<?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>Peter Mac And Associates</title>
	<atom:link href="http://www.petermac.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.petermac.com</link>
	<description>Australian freelance programmer and website design</description>
	<lastBuildDate>Wed, 28 Jul 2010 10:38:14 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0</generator>
		<item>
		<title>Internationalized country/state/city database</title>
		<link>http://www.petermac.com/internationalized-countrystatecity-database/</link>
		<comments>http://www.petermac.com/internationalized-countrystatecity-database/#comments</comments>
		<pubDate>Wed, 28 Jul 2010 10:37:11 +0000</pubDate>
		<dc:creator>peter</dc:creator>
				<category><![CDATA[Databases]]></category>
		<category><![CDATA[Git]]></category>
		<category><![CDATA[Ruby on Rails]]></category>

		<guid isPermaLink="false">http://www.petermac.com/?p=292</guid>
		<description><![CDATA[I&#8217;ve just posted a little project up to the gitorious website for my and other&#8217;s pleasure. The last few freelance projects I&#8217;ve worked on have required the functionality to provide users with a way to enter their location using a prompt system by selecting country first, then entering their region/state and finally their town and [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve just posted a little project up to the gitorious website for my and other&#8217;s pleasure. The last few freelance projects I&#8217;ve worked on have required the functionality to provide users with a way to enter their location using a prompt system by selecting country first, then entering their region/state and finally their town and city. The database structure uses a standard Rails convention and is MySQL based. It can be very easily converted to any other SQL supported format.</p>
<p>
<a href="http://gitorious.org/internationalised-country-city-region-database" target="blank">Click here to browse to the project.</a></p>
<p><a class="a2a_dd addtoany_share_save" href="http://www.addtoany.com/share_save?linkurl=http%3A%2F%2Fwww.petermac.com%2Finternationalized-countrystatecity-database%2F&amp;linkname=Internationalized%20country%2Fstate%2Fcity%20database"><img src="http://www.petermac.com/wp-content/plugins/add-to-any/share_save_171_16.png" width="171" height="16" alt="Share/Bookmark"/></a> </p>]]></content:encoded>
			<wfw:commentRss>http://www.petermac.com/internationalized-countrystatecity-database/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Java/Hibernate ant build example</title>
		<link>http://www.petermac.com/javahibernate-ant-build-example/</link>
		<comments>http://www.petermac.com/javahibernate-ant-build-example/#comments</comments>
		<pubDate>Mon, 12 Jul 2010 07:30:02 +0000</pubDate>
		<dc:creator>peter</dc:creator>
				<category><![CDATA[Software Development]]></category>
		<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://www.petermac.com/?p=271</guid>
		<description><![CDATA[This is the contents of a typical ant build file I use for Java coding projects. It&#8217;s up here in case it can help anyone else, and so I can copy and paste it when working off-site. The process is fairly simple, I have my working area in a ~/projects/myapp folder (where myapp is name [...]]]></description>
			<content:encoded><![CDATA[<p>This is the contents of a typical ant build file I use for Java coding projects. It&#8217;s up here in case it can help anyone else, and so I can copy and paste it when working off-site.</p>
<p>The process is fairly simple, I have my working area in a ~/projects/myapp folder (where myapp is name of current project). I have lib files in ~/projects/java/lib/ </p>
<p>I run the build in the myapp file, the ant file reads the build.properties file for some config info and dumps the build outputs to the $targetdir folder (~/projects/bin)</p>
<p>Firstly, the build.properties file</p>
<div class="codecolorer-container xml blackboard" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="xml codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"># options: linux, windows, mac &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<br />
gwt.os = linux<br />
<br />
#Directories &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<br />
gwt.installation.dir = ~/google/gwt-windows-1.5.3<br />
#note env is defined in build.xml file &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<br />
gwt.dir=${env.GWT_HOME}<br />
tomcat.dir=${env.TOMCAT_HOME}<br />
hibernate.dir=${env.HIBERNATE_HOME}<br />
postgresql.dir=${env.POSTGRES_HOME}<br />
asm.dir=${env.ASM_HOME}<br />
spring.dir=${env.SPRING_HOME}<br />
loglib.dir=${env.LOGLIB_HOME}<br />
junit.dir=${env.JUNIT_HOME}<br />
<br />
#JAR files &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<br />
servlet.api.jar=${tomcat.dir}/lib/servlet-api.jar<br />
gwt.servlet.jar=${gwt.dir}/gwt-servlet.jar<br />
hibernate3.jar=${hibernate.dir}/hibernate3.jar<br />
postgresql.driver.jar=${postgresql.dir}/postgresql-8.3-604.jdbc4.jar<br />
asm.jar=${asm.dir}/asm-3.1.jar<br />
loglib.jar=${loglib.dir}/commons-logging-1.1.1.jar<br />
junit.jar=${junit.dir}/junit-4.5.jar<br />
#google web toolkit jars<br />
gwt.user.jar = ${gwt.installation.dir}/gwt-user.jar<br />
gwt.servlet.jar = ${gwt.installation.dir}/gwt-servlet.jar<br />
gwt.dev.jar = ${gwt.installation.dir}/gwt-dev-${gwt.os}.jar<br />
build.dir = ../build<br />
classes.dir = ${build.dir}/classes<br />
jar.dir = ${build.dir}/jar<br />
gwt.output = ${build.dir}/www<br />
<br />
sourcedir = ${basedir}/src<br />
targetdir = ${basedir}/bin<br />
includedir = c:/projects/java/lib<br />
testdir = ${basedir}/test<br />
resdir = ${basedir}/res<br />
reportsdir = ${basedir}/reports<br />
appdir = ${basedir}<br />
wwwdir = ${appdir}/www/com.petermac.${app}<br />
spring.conf.dir = ${basedir}/src/META-INF/spring<br />
hibernate.conf.dir = ${basedir}/src/META-INF/hibernate</div></div>
<p>Now for the actual ant file. This is specific to a GWT application, but you can easily knock out the google bits and use the rest without any changes.</p>
<div class="codecolorer-container xml blackboard" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="xml codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;?xml</span> <span style="color: #000066;">version</span>=<span style="color: #ff0000;">&quot;1.0&quot;</span> <span style="color: #000066;">encoding</span>=<span style="color: #ff0000;">&quot;utf-8&quot;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span></span><br />
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;project</span> <span style="color: #000066;">name</span>=<span style="color: #ff0000;">&quot;ClaimsManager&quot;</span> <span style="color: #000066;">default</span>=<span style="color: #ff0000;">&quot;compile&quot;</span> <span style="color: #000066;">basedir</span>=<span style="color: #ff0000;">&quot;.&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span><br />
&nbsp; &nbsp; <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;property</span> <span style="color: #000066;">name</span>=<span style="color: #ff0000;">&quot;TALK&quot;</span> <span style="color: #000066;">value</span>=<span style="color: #ff0000;">&quot;false&quot;</span> <span style="color: #000000; font-weight: bold;">/&gt;</span></span><br />
&nbsp; &nbsp; <span style="color: #808080; font-style: italic;">&lt;!-- Define the environment property variable --&gt;</span><br />
&nbsp; &nbsp; <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;property</span> <span style="color: #000066;">environment</span>=<span style="color: #ff0000;">&quot;env&quot;</span> <span style="color: #000000; font-weight: bold;">/&gt;</span></span><br />
&nbsp; &nbsp; <span style="color: #808080; font-style: italic;">&lt;!-- Define where our properties are located --&gt;</span><br />
&nbsp; &nbsp; <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;property</span> <span style="color: #000066;">file</span>=<span style="color: #ff0000;">&quot;build.properties&quot;</span> <span style="color: #000000; font-weight: bold;">/&gt;</span></span><br />
&nbsp; &nbsp; <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;description<span style="color: #000000; font-weight: bold;">&gt;</span></span></span><br />
&nbsp; &nbsp; &nbsp; &nbsp; ClaimsManager build file. &nbsp;This is used to package up your project as a jar,<br />
&nbsp; &nbsp; &nbsp; &nbsp; if you want to distribute it. &nbsp;This isn't needed for normal operation.<br />
&nbsp; &nbsp; <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/description<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>&nbsp; <br />
<br />
&nbsp; &nbsp; <span style="color: #808080; font-style: italic;">&lt;!-- set classpath --&gt;</span><br />
&nbsp; &nbsp; <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;path</span> <span style="color: #000066;">id</span>=<span style="color: #ff0000;">&quot;classpath&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;pathelement</span> <span style="color: #000066;">location</span>=<span style="color: #ff0000;">&quot;${sourcedir}&quot;</span><span style="color: #000000; font-weight: bold;">/&gt;</span></span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;pathelement</span> <span style="color: #000066;">location</span>=<span style="color: #ff0000;">&quot;${servlet.api.jar}&quot;</span> <span style="color: #000000; font-weight: bold;">/&gt;</span></span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;pathelement</span> <span style="color: #000066;">location</span>=<span style="color: #ff0000;">&quot;${gwt.servlet.jar}&quot;</span> <span style="color: #000000; font-weight: bold;">/&gt;</span></span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;pathelement</span> <span style="color: #000066;">location</span>=<span style="color: #ff0000;">&quot;${asm.jar}&quot;</span> <span style="color: #000000; font-weight: bold;">/&gt;</span></span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;pathelement</span> <span style="color: #000066;">location</span>=<span style="color: #ff0000;">&quot;${postgresql.driver.jar}&quot;</span> <span style="color: #000000; font-weight: bold;">/&gt;</span></span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;pathelement</span> <span style="color: #000066;">location</span>=<span style="color: #ff0000;">&quot;${loglib.jar}&quot;</span> <span style="color: #000000; font-weight: bold;">/&gt;</span></span><br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;fileset</span> <span style="color: #000066;">dir</span>=<span style="color: #ff0000;">&quot;${includedir}&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;include</span> <span style="color: #000066;">name</span>=<span style="color: #ff0000;">&quot;*.jar&quot;</span> <span style="color: #000000; font-weight: bold;">/&gt;</span></span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/fileset<span style="color: #000000; font-weight: bold;">&gt;</span></span></span><br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;fileset</span> <span style="color: #000066;">dir</span>=<span style="color: #ff0000;">&quot;${spring.dir}&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;include</span> <span style="color: #000066;">name</span>=<span style="color: #ff0000;">&quot;*.jar&quot;</span> <span style="color: #000000; font-weight: bold;">/&gt;</span></span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/fileset<span style="color: #000000; font-weight: bold;">&gt;</span></span></span><br />
&nbsp; &nbsp; <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/path<span style="color: #000000; font-weight: bold;">&gt;</span></span></span><br />
&nbsp; &nbsp; <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;path</span> <span style="color: #000066;">id</span>=<span style="color: #ff0000;">&quot;gwt.compile.class.path&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;pathelement</span> <span style="color: #000066;">location</span>=<span style="color: #ff0000;">&quot;${sourcedir}&quot;</span><span style="color: #000000; font-weight: bold;">/&gt;</span></span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;pathelement</span> <span style="color: #000066;">location</span>=<span style="color: #ff0000;">&quot;${testdir}&quot;</span><span style="color: #000000; font-weight: bold;">/&gt;</span></span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;pathelement</span> <span style="color: #000066;">path</span>=<span style="color: #ff0000;">&quot;${gwt.user.jar}&quot;</span><span style="color: #000000; font-weight: bold;">/&gt;</span></span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;pathelement</span> <span style="color: #000066;">path</span>=<span style="color: #ff0000;">&quot;${gwt.dev.jar}&quot;</span><span style="color: #000000; font-weight: bold;">/&gt;</span></span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;pathelement</span> <span style="color: #000066;">path</span>=<span style="color: #ff0000;">&quot;${wwwdir}/WEB-INF/classes/com/petermac/claimsmanager/server/service&quot;</span><span style="color: #000000; font-weight: bold;">/&gt;</span></span><br />
&nbsp; &nbsp; &nbsp; &nbsp;<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/path<span style="color: #000000; font-weight: bold;">&gt;</span></span></span><br />
&nbsp; &nbsp; &nbsp; &nbsp;<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;path</span> <span style="color: #000066;">id</span>=<span style="color: #ff0000;">&quot;test.classpath&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;pathelement</span> <span style="color: #000066;">location</span>=<span style="color: #ff0000;">&quot;${junit.jar}&quot;</span> <span style="color: #000000; font-weight: bold;">/&gt;</span></span><br />
&nbsp; &nbsp; &nbsp; <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;pathelement</span> <span style="color: #000066;">location</span>=<span style="color: #ff0000;">&quot;${gwt.user.jar}&quot;</span><span style="color: #000000; font-weight: bold;">/&gt;</span></span><br />
&nbsp; &nbsp; &nbsp; <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;pathelement</span> <span style="color: #000066;">path</span>=<span style="color: #ff0000;">&quot;${targetdir}&quot;</span><span style="color: #000000; font-weight: bold;">/&gt;</span></span><br />
&nbsp; &nbsp; &nbsp; <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;fileset</span> <span style="color: #000066;">dir</span>=<span style="color: #ff0000;">&quot;${includedir}&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;include</span> <span style="color: #000066;">name</span>=<span style="color: #ff0000;">&quot;*.jar&quot;</span> <span style="color: #000000; font-weight: bold;">/&gt;</span></span><br />
&nbsp; &nbsp; &nbsp; <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/fileset<span style="color: #000000; font-weight: bold;">&gt;</span></span></span><br />
&nbsp; &nbsp; &nbsp; <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;fileset</span> <span style="color: #000066;">dir</span>=<span style="color: #ff0000;">&quot;${spring.dir}&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;include</span> <span style="color: #000066;">name</span>=<span style="color: #ff0000;">&quot;*.jar&quot;</span> <span style="color: #000000; font-weight: bold;">/&gt;</span></span><br />
&nbsp; &nbsp; &nbsp; <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/fileset<span style="color: #000000; font-weight: bold;">&gt;</span></span></span><br />
&nbsp; &nbsp; <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/path<span style="color: #000000; font-weight: bold;">&gt;</span></span></span><br />
&nbsp; &nbsp; <br />
&nbsp; &nbsp; <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;target</span> <span style="color: #000066;">name</span>=<span style="color: #ff0000;">&quot;init&quot;</span> <span style="color: #000066;">description</span>=<span style="color: #ff0000;">&quot;Initialize the build environment&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;fail</span> <span style="color: #000066;">unless</span>=<span style="color: #ff0000;">&quot;app&quot;</span> <span style="color: #000066;">message</span>=<span style="color: #ff0000;">&quot;Run ant -Dapp=[applicationName]&quot;</span><span style="color: #000000; font-weight: bold;">/&gt;</span></span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #808080; font-style: italic;">&lt;!-- Create the time stamp --&gt;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;tstamp</span><span style="color: #000000; font-weight: bold;">/&gt;</span></span><br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;echo</span> <span style="color: #000066;">message</span>=<span style="color: #ff0000;">&quot;Building on ${TODAY} at ${TSTAMP}&quot;</span> <span style="color: #000000; font-weight: bold;">/&gt;</span></span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #808080; font-style: italic;">&lt;!-- Create directory structures --&gt;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;mkdir</span> <span style="color: #000066;">dir</span>=<span style="color: #ff0000;">&quot;${targetdir}&quot;</span><span style="color: #000000; font-weight: bold;">/&gt;</span></span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;mkdir</span> <span style="color: #000066;">dir</span>=<span style="color: #ff0000;">&quot;${reportsdir}&quot;</span><span style="color: #000000; font-weight: bold;">/&gt;</span></span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;mkdir</span> <span style="color: #000066;">dir</span>=<span style="color: #ff0000;">&quot;${reportsdir}/raw/&quot;</span><span style="color: #000000; font-weight: bold;">/&gt;</span></span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;mkdir</span> <span style="color: #000066;">dir</span>=<span style="color: #ff0000;">&quot;${reportsdir}/html/&quot;</span><span style="color: #000000; font-weight: bold;">/&gt;</span></span><br />
&nbsp; &nbsp; <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/target<span style="color: #000000; font-weight: bold;">&gt;</span></span></span><br />
<br />
&nbsp; &nbsp; <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;target</span> <span style="color: #000066;">name</span>=<span style="color: #ff0000;">&quot;compile&quot;</span> <span style="color: #000066;">depends</span>=<span style="color: #ff0000;">&quot;clean, init, copy-support&quot;</span> <span style="color: #000066;">description</span>=<span style="color: #ff0000;">&quot;Compile server side java code&quot;</span> <span style="color: #000000; font-weight: bold;">&gt;</span></span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;javac</span> <span style="color: #000066;">srcdir</span>=<span style="color: #ff0000;">&quot;${sourcedir}&quot;</span></span><br />
<span style="color: #009900;"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span style="color: #000066;">destdir</span>=<span style="color: #ff0000;">&quot;${wwwdir}/WEB-INF/classes&quot;</span></span><br />
<span style="color: #009900;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000066;">debug</span>=<span style="color: #ff0000;">&quot;true&quot;</span> </span><br />
<span style="color: #009900;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000066;">debuglevel</span>=<span style="color: #ff0000;">&quot;lines,vars,source&quot;</span> </span><br />
<span style="color: #009900;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000066;">source</span>=<span style="color: #ff0000;">&quot;1.6&quot;</span></span><br />
<span style="color: #009900;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000066;">excludes</span>=<span style="color: #ff0000;">&quot;**/client/*.java,**/*.xml&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;classpath</span> <span style="color: #000066;">refid</span>=<span style="color: #ff0000;">&quot;classpath&quot;</span> <span style="color: #000000; font-weight: bold;">/&gt;</span></span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;compilerarg</span> <span style="color: #000066;">value</span>=<span style="color: #ff0000;">&quot;-Xlint&quot;</span><span style="color: #000000; font-weight: bold;">/&gt;</span></span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/javac<span style="color: #000000; font-weight: bold;">&gt;</span></span></span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #808080; font-style: italic;">&lt;!-- copy www class files to bin folder --&gt;</span><br />
&nbsp; &nbsp; <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;copy</span> <span style="color: #000066;">todir</span>=<span style="color: #ff0000;">&quot;${targetdir}&quot;</span> <span style="color: #000000; font-weight: bold;">&gt;</span></span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;fileset</span> <span style="color: #000066;">dir</span>=<span style="color: #ff0000;">&quot;${wwwdir}/WEB-INF/classes/com/petermac/claimsmanager/client&quot;</span> <span style="color: #000066;">includes</span>=<span style="color: #ff0000;">&quot;*.class&quot;</span> <span style="color: #000000; font-weight: bold;">/&gt;</span></span><br />
&nbsp; &nbsp; <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/copy<span style="color: #000000; font-weight: bold;">&gt;</span></span></span><br />
<br />
&nbsp; &nbsp; <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;copy</span> <span style="color: #000066;">todir</span>=<span style="color: #ff0000;">&quot;${targetdir}&quot;</span> <span style="color: #000000; font-weight: bold;">&gt;</span></span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;fileset</span> <span style="color: #000066;">dir</span>=<span style="color: #ff0000;">&quot;${wwwdir}/WEB-INF/classes/com/petermac/claimsmanager/server/service&quot;</span> <span style="color: #000066;">includes</span>=<span style="color: #ff0000;">&quot;*.class&quot;</span> <span style="color: #000000; font-weight: bold;">/&gt;</span></span><br />
&nbsp; &nbsp; <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/copy<span style="color: #000000; font-weight: bold;">&gt;</span></span></span><br />
&nbsp; &nbsp; <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/target<span style="color: #000000; font-weight: bold;">&gt;</span></span></span><br />
<br />
&nbsp; &nbsp; <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;target</span> <span style="color: #000066;">name</span>=<span style="color: #ff0000;">&quot;gwt-compile&quot;</span> <span style="color: #000066;">depends</span>=<span style="color: #ff0000;">&quot;init&quot;</span> <span style="color: #000066;">description</span>=<span style="color: #ff0000;">&quot;Execute the GWT compiler on client-side code&quot;</span> <span style="color: #000000; font-weight: bold;">&gt;</span></span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #808080; font-style: italic;">&lt;!-- Invoke the GWT compiler --&gt;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;java</span> <span style="color: #000066;">classpathref</span>=<span style="color: #ff0000;">&quot;gwt.compile.class.path&quot;</span> <span style="color: #000066;">classname</span>=<span style="color: #ff0000;">&quot;com.google.gwt.dev.GWTCompiler&quot;</span> <span style="color: #000066;">fork</span>=<span style="color: #ff0000;">&quot;true&quot;</span> <span style="color: #000000; font-weight: bold;">&gt;</span></span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;arg</span> <span style="color: #000066;">value</span>=<span style="color: #ff0000;">&quot;-out&quot;</span><span style="color: #000000; font-weight: bold;">/&gt;</span></span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;arg</span> <span style="color: #000066;">value</span>=<span style="color: #ff0000;">&quot;${gwt.output}&quot;</span><span style="color: #000000; font-weight: bold;">/&gt;</span></span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;arg</span> <span style="color: #000066;">value</span>=<span style="color: #ff0000;">&quot;com.petermac.claimsmanager.${app}&quot;</span><span style="color: #000000; font-weight: bold;">/&gt;</span></span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/java<span style="color: #000000; font-weight: bold;">&gt;</span></span></span><br />
&nbsp; &nbsp; <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/target<span style="color: #000000; font-weight: bold;">&gt;</span></span></span><br />
&nbsp; &nbsp; <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;target</span> <span style="color: #000066;">name</span>=<span style="color: #ff0000;">&quot;clean&quot;</span> <span style="color: #000066;">depends</span>=<span style="color: #ff0000;">&quot;clean-compile-test&quot;</span> <span style="color: #000066;">description</span>=<span style="color: #ff0000;">&quot;Cleans build system by removing directories created during build&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;delete</span> <span style="color: #000066;">dir</span>=<span style="color: #ff0000;">&quot;${targetdir}&quot;</span><span style="color: #000000; font-weight: bold;">/&gt;</span></span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;mkdir</span> <span style="color: #000066;">dir</span>=<span style="color: #ff0000;">&quot;${targetdir}&quot;</span><span style="color: #000000; font-weight: bold;">/&gt;</span></span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;delete</span> <span style="color: #000066;">dir</span>=<span style="color: #ff0000;">&quot;${reportsdir}&quot;</span><span style="color: #000000; font-weight: bold;">/&gt;</span></span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;delete</span> <span style="color: #000066;">dir</span>=<span style="color: #ff0000;">&quot;${wwwdir}&quot;</span><span style="color: #000000; font-weight: bold;">/&gt;</span></span><br />
&nbsp; &nbsp; <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/target<span style="color: #000000; font-weight: bold;">&gt;</span></span></span><br />
<br />
&nbsp; &nbsp; <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;target</span> <span style="color: #000066;">name</span>=<span style="color: #ff0000;">&quot;prepare-www-dir&quot;</span> <span style="color: #000066;">depends</span>=<span style="color: #ff0000;">&quot;init&quot;</span> <span style="color: #000066;">description</span>=<span style="color: #ff0000;">&quot;Copy files to ${wwwdir} directory&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>&nbsp; &nbsp; &nbsp; <br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;mkdir</span> <span style="color: #000066;">dir</span>=<span style="color: #ff0000;">&quot;${wwwdir}/WEB-INF/classes&quot;</span> <span style="color: #000000; font-weight: bold;">/&gt;</span></span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;mkdir</span> <span style="color: #000066;">dir</span>=<span style="color: #ff0000;">&quot;${wwwdir}/WEB-INF/lib&quot;</span> <span style="color: #000000; font-weight: bold;">/&gt;</span></span><br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #808080; font-style: italic;">&lt;!-- copy all public files to $wwwdir --&gt;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;copy</span> <span style="color: #000066;">todir</span>=<span style="color: #ff0000;">&quot;${wwwdir}&quot;</span> <span style="color: #000000; font-weight: bold;">&gt;</span></span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;fileset</span> <span style="color: #000066;">dir</span>=<span style="color: #ff0000;">&quot;${sourcedir}/com/petermac/${app}/public&quot;</span> <span style="color: #000000; font-weight: bold;">/&gt;</span></span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/copy<span style="color: #000000; font-weight: bold;">&gt;</span></span></span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #808080; font-style: italic;">&lt;!-- copy the gwt servlet JAR to /WEB-INF/lib --&gt;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;copy</span> <span style="color: #000066;">todir</span>=<span style="color: #ff0000;">&quot;${wwwdir}/WEB-INF/lib&quot;</span> <span style="color: #000066;">file</span>=<span style="color: #ff0000;">&quot;${gwt.servlet.jar}&quot;</span> <span style="color: #000000; font-weight: bold;">/&gt;</span></span><br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #808080; font-style: italic;">&lt;!-- copy web.xml to /WEB-INF --&gt;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;copy</span> <span style="color: #000066;">todir</span>=<span style="color: #ff0000;">&quot;${wwwdir}/WEB-INF/lib&quot;</span> <span style="color: #000066;">file</span>=<span style="color: #ff0000;">&quot;${gwt.servlet.jar}&quot;</span> <span style="color: #000000; font-weight: bold;">/&gt;</span></span><br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #808080; font-style: italic;">&lt;!-- copy the web.xml deployment descritpor --&gt;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;copy</span> <span style="color: #000066;">todir</span>=<span style="color: #ff0000;">&quot;${wwwdir}/WEB-INF/&quot;</span> <span style="color: #000066;">file</span>=<span style="color: #ff0000;">&quot;${sourcedir}/web.xml&quot;</span> <span style="color: #000000; font-weight: bold;">/&gt;</span></span> <br />
&nbsp; &nbsp; <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/target<span style="color: #000000; font-weight: bold;">&gt;</span></span></span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; <span style="color: #808080; font-style: italic;">&lt;!-- Copy relevant hibernate and spring files --&gt;</span><br />
&nbsp; &nbsp; <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;target</span> <span style="color: #000066;">name</span>=<span style="color: #ff0000;">&quot;copy-support&quot;</span> <span style="color: #000066;">depends</span>=<span style="color: #ff0000;">&quot;prepare-www-dir&quot;</span> <span style="color: #000066;">description</span>=<span style="color: #ff0000;">&quot;Copy hibernate/spring support files&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;copy</span> <span style="color: #000066;">todir</span>=<span style="color: #ff0000;">&quot;${wwwdir}/WEB-INF/lib&quot;</span> <span style="color: #000066;">file</span>=<span style="color: #ff0000;">&quot;${postgresql.driver.jar}&quot;</span> <span style="color: #000000; font-weight: bold;">/&gt;</span></span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;copy</span> <span style="color: #000066;">todir</span>=<span style="color: #ff0000;">&quot;${wwwdir}/WEB-INF/lib&quot;</span> <span style="color: #000066;">file</span>=<span style="color: #ff0000;">&quot;${hibernate3.jar}&quot;</span> <span style="color: #000000; font-weight: bold;">/&gt;</span></span><br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #808080; font-style: italic;">&lt;!-- copy over the bulk of support jars --&gt;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;copy</span> <span style="color: #000066;">todir</span>=<span style="color: #ff0000;">&quot;${wwwdir}/WEB-INF/lib&quot;</span> <span style="color: #000000; font-weight: bold;">&gt;</span></span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;fileset</span> <span style="color: #000066;">dir</span>=<span style="color: #ff0000;">&quot;${hibernate.dir}/&quot;</span> <span style="color: #000066;">includes</span>=<span style="color: #ff0000;">&quot;*.jar&quot;</span> <span style="color: #000000; font-weight: bold;">/&gt;</span></span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/copy<span style="color: #000000; font-weight: bold;">&gt;</span></span></span><br />
&nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;copy</span> <span style="color: #000066;">todir</span>=<span style="color: #ff0000;">&quot;${wwwdir}/WEB-INF/lib&quot;</span> <span style="color: #000000; font-weight: bold;">&gt;</span></span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;fileset</span> <span style="color: #000066;">dir</span>=<span style="color: #ff0000;">&quot;${spring.dir}/&quot;</span> <span style="color: #000066;">includes</span>=<span style="color: #ff0000;">&quot;*.jar&quot;</span> <span style="color: #000000; font-weight: bold;">/&gt;</span></span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/copy<span style="color: #000000; font-weight: bold;">&gt;</span></span></span><br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #808080; font-style: italic;">&lt;!-- copy the hibernate and spring config files --&gt;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;copy</span> <span style="color: #000066;">todir</span>=<span style="color: #ff0000;">&quot;${wwwdir}/WEB-INF/classes&quot;</span> <span style="color: #000000; font-weight: bold;">&gt;</span></span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;fileset</span> <span style="color: #000066;">dir</span>=<span style="color: #ff0000;">&quot;${spring.conf.dir}/&quot;</span> <span style="color: #000066;">includes</span>=<span style="color: #ff0000;">&quot;*.xml&quot;</span> <span style="color: #000000; font-weight: bold;">/&gt;</span></span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/copy<span style="color: #000000; font-weight: bold;">&gt;</span></span></span><br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;copy</span> <span style="color: #000066;">todir</span>=<span style="color: #ff0000;">&quot;${wwwdir}/WEB-INF/classes&quot;</span> <span style="color: #000000; font-weight: bold;">&gt;</span></span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;fileset</span> <span style="color: #000066;">dir</span>=<span style="color: #ff0000;">&quot;${hibernate.conf.dir}/&quot;</span> <span style="color: #000066;">includes</span>=<span style="color: #ff0000;">&quot;*.xml&quot;</span> <span style="color: #000000; font-weight: bold;">/&gt;</span></span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/copy<span style="color: #000000; font-weight: bold;">&gt;</span></span></span><br />
<br />
&nbsp; &nbsp; <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/target<span style="color: #000000; font-weight: bold;">&gt;</span></span></span><br />
&nbsp; &nbsp; <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;target</span> <span style="color: #000066;">name</span>=<span style="color: #ff0000;">&quot;deploy&quot;</span> <span style="color: #000066;">depends</span>=<span style="color: #ff0000;">&quot;compile,gwt-compile&quot;</span> <span style="color: #000066;">description</span>=<span style="color: #ff0000;">&quot;Deploy the application&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;war</span> <span style="color: #000066;">destfile</span>=<span style="color: #ff0000;">&quot;${app}.war&quot;</span> <span style="color: #000066;">webxml</span>=<span style="color: #ff0000;">&quot;${wwwdir}/WEB-INF/web.xml&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;fileset</span> <span style="color: #000066;">dir</span>=<span style="color: #ff0000;">&quot;${wwwdir}&quot;</span><span style="color: #000000; font-weight: bold;">/&gt;</span></span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;classes</span> <span style="color: #000066;">dir</span>=<span style="color: #ff0000;">&quot;${wwwdir}/WEB-INF/classes&quot;</span><span style="color: #000000; font-weight: bold;">/&gt;</span></span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;lib</span> <span style="color: #000066;">dir</span>=<span style="color: #ff0000;">&quot;${wwwdir}/WEB-INF/lib&quot;</span> <span style="color: #000000; font-weight: bold;">/&gt;</span></span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/war<span style="color: #000000; font-weight: bold;">&gt;</span></span></span><br />
&nbsp; &nbsp; <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/target<span style="color: #000000; font-weight: bold;">&gt;</span></span></span><br />
&nbsp; &nbsp; <span style="color: #808080; font-style: italic;">&lt;!-- ////////////////////////// Test related targets /////////////////////////////////--&gt;</span><br />
&nbsp; &nbsp; <br />
&nbsp; &nbsp; <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;target</span> <span style="color: #000066;">name</span>=<span style="color: #ff0000;">&quot;clean-compile-test&quot;</span> <span style="color: #000066;">description</span>=<span style="color: #ff0000;">&quot;Cleans the classes deployed used during unit tests&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;delete</span> <span style="color: #000066;">verbose</span>=<span style="color: #ff0000;">&quot;${TALK}&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;fileset</span> <span style="color: #000066;">dir</span>=<span style="color: #ff0000;">&quot;${testdir}&quot;</span> <span style="color: #000066;">includes</span>=<span style="color: #ff0000;">&quot;**/*.class&quot;</span> <span style="color: #000000; font-weight: bold;">/&gt;</span></span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/delete<span style="color: #000000; font-weight: bold;">&gt;</span></span></span><br />
&nbsp; &nbsp; <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/target<span style="color: #000000; font-weight: bold;">&gt;</span></span></span><br />
<br />
&nbsp; &nbsp; <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;target</span> <span style="color: #000066;">name</span>=<span style="color: #ff0000;">&quot;compile-tests&quot;</span> <span style="color: #000066;">description</span>=<span style="color: #ff0000;">&quot;Compile unit tests&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;javac</span> <span style="color: #000066;">srcdir</span>=<span style="color: #ff0000;">&quot;${testdir}&quot;</span></span><br />
<span style="color: #009900;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span style="color: #000066;">destdir</span>=<span style="color: #ff0000;">&quot;${targetdir}&quot;</span></span><br />
<span style="color: #009900;"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000066;">verbose</span>=<span style="color: #ff0000;">&quot;${TALK}&quot;</span></span><br />
<span style="color: #009900;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span style="color: #000066;">classpathref</span>=<span style="color: #ff0000;">&quot;test.classpath&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/javac<span style="color: #000000; font-weight: bold;">&gt;</span></span></span><br />
&nbsp; &nbsp; <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/target<span style="color: #000000; font-weight: bold;">&gt;</span></span></span><br />
&nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;target</span> <span style="color: #000066;">name</span>=<span style="color: #ff0000;">&quot;run-tests&quot;</span> <span style="color: #000066;">depends</span>=<span style="color: #ff0000;">&quot;compile-tests&quot;</span> <span style="color: #000066;">description</span>=<span style="color: #ff0000;">&quot;Compiles and runs unit tests&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;junit</span> <span style="color: #000066;">printsummary</span>=<span style="color: #ff0000;">&quot;yes&quot;</span> <span style="color: #000066;">haltonfailure</span>=<span style="color: #ff0000;">&quot;true&quot;</span> <span style="color: #000066;">showoutput</span>=<span style="color: #ff0000;">&quot;yes&quot;</span> <span style="color: #000000; font-weight: bold;">&gt;</span></span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;classpath</span> <span style="color: #000066;">refid</span>=<span style="color: #ff0000;">&quot;classpath&quot;</span> <span style="color: #000000; font-weight: bold;">/&gt;</span></span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;classpath</span> <span style="color: #000066;">refid</span>=<span style="color: #ff0000;">&quot;test.classpath&quot;</span> <span style="color: #000000; font-weight: bold;">/&gt;</span></span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;batchtest</span> <span style="color: #000066;">fork</span>=<span style="color: #ff0000;">&quot;yes&quot;</span> <span style="color: #000066;">todir</span>=<span style="color: #ff0000;">&quot;${reportsdir}/raw/&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;formatter</span> <span style="color: #000066;">type</span>=<span style="color: #ff0000;">&quot;xml&quot;</span> <span style="color: #000000; font-weight: bold;">/&gt;</span></span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;fileset</span> <span style="color: #000066;">dir</span>=<span style="color: #ff0000;">&quot;${testdir}&quot;</span> <span style="color: #000066;">includes</span>=<span style="color: #ff0000;">&quot;**/AllTests.java&quot;</span> <span style="color: #000000; font-weight: bold;">/&gt;</span></span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/batchtest<span style="color: #000000; font-weight: bold;">&gt;</span></span></span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/junit<span style="color: #000000; font-weight: bold;">&gt;</span></span></span><br />
&nbsp; &nbsp; &nbsp; <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/target<span style="color: #000000; font-weight: bold;">&gt;</span></span></span> &nbsp; &nbsp; <br />
<br />
&nbsp; &nbsp; &nbsp; <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;target</span> <span style="color: #000066;">name</span>=<span style="color: #ff0000;">&quot;test&quot;</span> <span style="color: #000066;">depends</span>=<span style="color: #ff0000;">&quot;run-tests&quot;</span> <span style="color: #000066;">description</span>=<span style="color: #ff0000;">&quot;Comiles tests, runs them and generates test results in report format&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;junitreport</span> <span style="color: #000066;">todir</span>=<span style="color: #ff0000;">&quot;${reportsdir}&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;fileset</span> <span style="color: #000066;">dir</span>=<span style="color: #ff0000;">&quot;${reportsdir}/raw/&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;include</span> <span style="color: #000066;">name</span>=<span style="color: #ff0000;">&quot;TEST-*.xml&quot;</span><span style="color: #000000; font-weight: bold;">/&gt;</span></span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/fileset<span style="color: #000000; font-weight: bold;">&gt;</span></span></span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;report</span> <span style="color: #000066;">format</span>=<span style="color: #ff0000;">&quot;frames&quot;</span> <span style="color: #000066;">todir</span>=<span style="color: #ff0000;">&quot;${reportsdir}\html\&quot;</span><span style="color: #000000; font-weight: bold;">/&gt;</span></span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/junitreport<span style="color: #000000; font-weight: bold;">&gt;</span></span></span><br />
&nbsp; &nbsp; &nbsp; <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/target<span style="color: #000000; font-weight: bold;">&gt;</span></span></span><br />
<br />
&nbsp; &nbsp; &nbsp; <span style="color: #808080; font-style: italic;">&lt;!-- end test related --&gt;</span><br />
&nbsp; &nbsp; <span style="color: #808080; font-style: italic;">&lt;!--</span><br />
<span style="color: #808080; font-style: italic;">&nbsp; &nbsp; &lt;target name=&quot;package&quot; depends=&quot;compile&quot; description=&quot;Package up the project as a jar&quot;&gt;</span><br />
<span style="color: #808080; font-style: italic;">&nbsp; &nbsp; &nbsp; &nbsp; &lt;jar destfile=&quot;ClaimsManager.jar&quot;&gt;</span><br />
<span style="color: #808080; font-style: italic;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &lt;fileset dir=&quot;bin&quot;&gt;</span><br />
<span style="color: #808080; font-style: italic;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &lt;include name=&quot;**/*.class&quot;/&gt;</span><br />
<span style="color: #808080; font-style: italic;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &lt;/fileset&gt;</span><br />
<span style="color: #808080; font-style: italic;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &lt;fileset dir=&quot;src&quot;&gt;</span><br />
<span style="color: #808080; font-style: italic;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &lt;include name=&quot;**&quot;/&gt;</span><br />
<span style="color: #808080; font-style: italic;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &lt;/fileset&gt;</span><br />
<span style="color: #808080; font-style: italic;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &lt;fileset dir=&quot;test&quot;&gt;</span><br />
<span style="color: #808080; font-style: italic;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &lt;include name=&quot;**&quot;/&gt;</span><br />
<span style="color: #808080; font-style: italic;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &lt;/fileset&gt;</span><br />
<span style="color: #808080; font-style: italic;">&nbsp; &nbsp; &nbsp; &nbsp; &lt;/jar&gt;</span><br />
<span style="color: #808080; font-style: italic;">&nbsp; &nbsp; &lt;/target&gt;</span><br />
<span style="color: #808080; font-style: italic;">&nbsp; &nbsp; --&gt;</span><br />
<br />
&nbsp; &nbsp; <span style="color: #808080; font-style: italic;">&lt;!--</span><br />
<span style="color: #808080; font-style: italic;">&nbsp; &nbsp; &lt;target name=&quot;all&quot; depends=&quot;package&quot;/&gt;</span><br />
<span style="color: #808080; font-style: italic;">&nbsp; &nbsp; --&gt;</span><br />
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/project<span style="color: #000000; font-weight: bold;">&gt;</span></span></span></div></div>
<p>Feel free to suggest any ways to make this simpler and more automated.</p>
<p><a class="a2a_dd addtoany_share_save" href="http://www.addtoany.com/share_save?linkurl=http%3A%2F%2Fwww.petermac.com%2Fjavahibernate-ant-build-example%2F&amp;linkname=Java%2FHibernate%20ant%20build%20example"><img src="http://www.petermac.com/wp-content/plugins/add-to-any/share_save_171_16.png" width="171" height="16" alt="Share/Bookmark"/></a> </p>]]></content:encoded>
			<wfw:commentRss>http://www.petermac.com/javahibernate-ant-build-example/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Moving from Subversion to Git</title>
		<link>http://www.petermac.com/moving-from-subversion-to-git/</link>
		<comments>http://www.petermac.com/moving-from-subversion-to-git/#comments</comments>
		<pubDate>Sat, 10 Jul 2010 03:47:22 +0000</pubDate>
		<dc:creator>peter</dc:creator>
				<category><![CDATA[Git]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[Software Development]]></category>

		<guid isPermaLink="false">http://www.petermac.com/?p=239</guid>
		<description><![CDATA[I have been using subversion for a number of years and it wasn&#8217;t until I had seen and sampled the simplicity and power of git that I decided once and for all to bite the bullet and migrate all my subversion repositories to git. I&#8217;d done the same from cvs to subversion in the early [...]]]></description>
			<content:encoded><![CDATA[<p>I have been using subversion for a number of years and it wasn&#8217;t until I had seen and sampled the simplicity and power of git that I decided once and for all to bite the bullet and migrate all my subversion repositories to git.</p>
<p>I&#8217;d done the same from cvs to subversion in the early 2000&#8242;s and still think the move worked out well with a bit of preparation.</p>
<p>An unfortunate side effect of subversion is that it takes a good bit of effort to set up and manage a new repository so I ended up with two somewhat monolithic repositories&#8230;</p>
<p>1. archives<br />
2. projects</p>
<p>The &#8216;archives &#8216; repository contained all old project work and the &#8216;projects&#8217; one contained relevant or current project work.</p>
<p>The result of this was that each archive had a bundle of sub-folders, each containing a project in its&#8217; own right. Although git can handle the concept of sub-modules it&#8217;s not the best way to structure your project. In fact, it was a pretty lazy to structure my subversion projects in the first place but convenience overcame system administrative chores at the time.</p>
<p>This article explains the following:</p>
<p>1. Converting a monolithic subversion repository to a git repository<br />
2. Breaking out the new git repository into a set of discrete repositories.<br />
3. General backup process and scripts to copy the new repositories across to a backup system.</p>
<p>First off, a couple of conventions I keep are&#8230;</p>
<p>My server stores a central set of repositories with the name of myproject.git<br />
My workstations work with their local version of repositories called myproject (no .git)<br />
My server exports it&#8217;s .git repositories to a backup server using the same .git naming convention.<br />
I have created a git.git user.group on my server to run all git processes. File ownership is given to this user so other users can&#8217;t fowl things up at least without thinking about it first.</p>
<p><strong>Step 1 &#8211; Migrating to subversion</strong></p>
<p>I store all my git repositories on a server in the directory</p>
<p>/usr/local/share/gitrepos</p>
<p>All of my subversion repositories are stored in</p>
<p>/usr/local/share/svn</p>
<p>Even though each folder is accessible using standard paths and commands, I have to go through the subversion door using the same mechanism I would access it from a remote box, namely http://.  Other people may use svn:// if that&#8217;s their way of working.</p>
<p>Migration is taken care of with a single command.</p>
<div class="codecolorer-container bash blackboard" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="bash codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #c20cb9; font-weight: bold;">sudo</span> <span style="color: #c20cb9; font-weight: bold;">git</span> <span style="color: #c20cb9; font-weight: bold;">svn</span> clone https:<span style="color: #000000; font-weight: bold;">//</span>localhost<span style="color: #000000; font-weight: bold;">/</span>repository<span style="color: #000000; font-weight: bold;">/</span>projects <span style="color: #660033;">--stdlayout</span> <span style="color: #660033;">--authors-file</span>=<span style="color: #000000; font-weight: bold;">/</span>home<span style="color: #000000; font-weight: bold;">/</span>peter<span style="color: #000000; font-weight: bold;">/</span>authors.txt <span style="color: #660033;">-t</span> tags <span style="color: #660033;">-b</span> branches <span style="color: #660033;">-T</span> trunk <span style="color: #000000; font-weight: bold;">/</span>usr<span style="color: #000000; font-weight: bold;">/</span>local<span style="color: #000000; font-weight: bold;">/</span>share<span style="color: #000000; font-weight: bold;">/</span>gitrepos<span style="color: #000000; font-weight: bold;">/</span>projects.git<span style="color: #000000; font-weight: bold;">/</span></div></div>
<p>An explanation of all the bits follow:</p>
<p><strong>sudo</strong> &#8211; because I run everything as unprivileged user, sudo gives me the rights i need to create new files and folders.</p>
<p><strong>git svn</strong> &#8211; this is the git subcommand that manages conversion of subversion repositories.</p>
<p><strong>clone</strong> &#8211; make a copy of the repositories that I&#8217;m pointing at.</p>
<p><strong>https://localhost/repository/projects</strong> &#8211; I access all my subversion repositories using secure http. This allows me to securely browse the content across the Internet and track things easily using Trac.</p>
<p>Depending on your setup, this parameter will contain the path to your svn repository,however you access it.</p>
<p><strong>&#8211;stdlayout</strong> option tells git svn that my subversion repository is in the standard layout of trunk/branch/tags directories.</p>
<p><strong>&#8211;authors file</strong> &#8211; this is a file I created by hand containing a list of all the people who committed project material in the past. It&#8217;d format is as follows:</p>
<div class="codecolorer-container bash blackboard" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="bash codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #007800;">peter</span>= Peter Mac Giollafhearga <span style="color: #000000; font-weight: bold;">&lt;</span>my email at mydomain.com<span style="color: #000000; font-weight: bold;">&gt;</span><br />
<span style="color: #007800;">simon</span>= Simon Shagwell <span style="color: #000000; font-weight: bold;">&lt;</span>simon<span style="color: #000000; font-weight: bold;">\'</span>s email at his domain.com<span style="color: #000000; font-weight: bold;">&gt;</span></div></div>
<p><strong>-t tags -b branches -T trunk</strong> &#8211; these values are for completeness and I&#8217;m not sure they are necessary given the &#8211;stdlayout option, but if you&#8217;ve called your branches, tags and trunks anything different, this is how you find it.</p>
<p>Once the command has completed you should find a projects.git folder has been created and navigating into it you will see all your nasty subversion sub-folders which you should have set up as individual repositories in the first place&#8230;tut tut!</p>
<p><strong>Step 2 &#8211; Breaking out Git into baby gits</strong></p>
<p>The structure of the new git repository is something like this.</p>
<div class="codecolorer-container bash blackboard" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="bash codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">gitrepository<span style="color: #000000; font-weight: bold;">/</span><br />
&nbsp; projects.git<span style="color: #000000; font-weight: bold;">/</span><br />
&nbsp; &nbsp; project1<span style="color: #000000; font-weight: bold;">/</span><br />
&nbsp; &nbsp; WorldDomination<span style="color: #000000; font-weight: bold;">/</span><br />
&nbsp; &nbsp; SomeStuff<span style="color: #000000; font-weight: bold;">/</span><br />
&nbsp; &nbsp; SomeotherStuff_V2<span style="color: #000000; font-weight: bold;">/</span><br />
&nbsp; &nbsp; Demos<span style="color: #000000; font-weight: bold;">/</span><br />
&nbsp; &nbsp; Downloads<span style="color: #000000; font-weight: bold;">/</span><br />
&nbsp; &nbsp; .git<span style="color: #000000; font-weight: bold;">/</span></div></div>
<p>The .git folder (you cans see it using ls -a) contains a list of all the git related material such as project history, revisions and tags.<br />
Check you can see your history by typing</p>
<div class="codecolorer-container bash blackboard" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="bash codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #c20cb9; font-weight: bold;">git</span> log</div></div>
<p>The next task is to break the contents of the rather large &#8216;project&#8217; folder into a git repository per project.<br />
The tool for the job is a combination of the very useful git subtree command and a bit of custom shell scripting specific to this job.</p>
<p>The subtree functionality was written by Avery Pennarun and is hosted by the github site. You can download the git subtree command from the URL <a href="http://github.com/apenwarr/git-subtree" target="blank">http://github.com/apenwarr/git-subtree</a>. Installation instructions are on the same site so I won&#8217;t bore you with it here.</p>
<p>Once you have it installed you&#8217;re almost ready to roll. The following shell script has comments at the top to explain what it does. Save this to your favourite scripts folder and chmod it so it&#8217;s executable (chmod +x git_breakout.sh).</p>
<p>Then cd into the folder you created earlier (in my case /usr/local/share/gitrepository/projects). Run the script and watch the output. Depending on the size of your projects it will take a bit of time to complete; mine took about 20 minutes.</p>
<div class="codecolorer-container bash blackboard" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="bash codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #666666; font-style: italic;">#!/bin/sh</span><br />
<br />
<span style="color: #666666; font-style: italic;">#git_breakout.sh</span><br />
<span style="color: #666666; font-style: italic;">#This script should be run from within a git repository folder that</span><br />
<span style="color: #666666; font-style: italic;">#contains many child folders.</span><br />
<span style="color: #666666; font-style: italic;">#It will create a branch for every subfolder it finds and a new</span><br />
<span style="color: #666666; font-style: italic;">#top level folder for each.</span><br />
<span style="color: #666666; font-style: italic;">#It then initialises a git respoitory, copying into the relevant branch</span><br />
<br />
<span style="color: #666666; font-style: italic;"># Make sure only root can run our script</span><br />
<span style="color: #000000; font-weight: bold;">if</span> <span style="color: #7a0874; font-weight: bold;">&#91;</span> <span style="color: #ff0000;">&quot;<span style="color: #007800;">$(id -u)</span>&quot;</span> <span style="color: #000000; font-weight: bold;">!</span>= <span style="color: #ff0000;">&quot;0&quot;</span> <span style="color: #7a0874; font-weight: bold;">&#93;</span>; <span style="color: #000000; font-weight: bold;">then</span><br />
&nbsp; <span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">&quot;This script must be run as root&quot;</span> <span style="color: #000000;">1</span><span style="color: #000000; font-weight: bold;">&gt;&amp;</span><span style="color: #000000;">2</span><br />
&nbsp; <span style="color: #7a0874; font-weight: bold;">exit</span> <span style="color: #000000;">1</span><br />
<span style="color: #000000; font-weight: bold;">fi</span><br />
<br />
<span style="color: #007800;">current_dir</span>=<span style="color: #000000; font-weight: bold;">`</span><span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #800000;">${PWD##*/}</span><span style="color: #000000; font-weight: bold;">`</span><br />
<span style="color: #007800;">git_user</span>=<span style="color: #c20cb9; font-weight: bold;">git</span><br />
<span style="color: #007800;">git_group</span>=<span style="color: #c20cb9; font-weight: bold;">git</span><br />
<br />
<span style="color: #000000; font-weight: bold;">for</span> project <span style="color: #000000; font-weight: bold;">in</span> $<span style="color: #7a0874; font-weight: bold;">&#40;</span> <span style="color: #c20cb9; font-weight: bold;">ls</span> . <span style="color: #7a0874; font-weight: bold;">&#41;</span><br />
<span style="color: #000000; font-weight: bold;">do</span><br />
&nbsp; <span style="color: #000000; font-weight: bold;">if</span> <span style="color: #7a0874; font-weight: bold;">&#91;</span> <span style="color: #660033;">-d</span> <span style="color: #007800;">$project</span> <span style="color: #7a0874; font-weight: bold;">&#93;</span>; <span style="color: #000000; font-weight: bold;">then</span><br />
&nbsp; &nbsp; <span style="color: #007800;">project_lower</span>=<span style="color: #000000; font-weight: bold;">`</span><span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #007800;">$project</span>.git <span style="color: #000000; font-weight: bold;">|</span> <span style="color: #c20cb9; font-weight: bold;">tr</span> <span style="color: #7a0874; font-weight: bold;">&#91;</span>A-Z<span style="color: #7a0874; font-weight: bold;">&#93;</span> <span style="color: #7a0874; font-weight: bold;">&#91;</span>a-z<span style="color: #7a0874; font-weight: bold;">&#93;</span><span style="color: #000000; font-weight: bold;">`</span><br />
&nbsp; &nbsp; <span style="color: #007800;">branchname</span>=<span style="color: #007800;">$project_lower</span>.<span style="color: #ff0000;">&quot;export&quot;</span><br />
&nbsp; &nbsp; <span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">&quot;performing subtree split...&quot;</span><br />
&nbsp; &nbsp; <span style="color: #c20cb9; font-weight: bold;">git</span> subtree <span style="color: #c20cb9; font-weight: bold;">split</span> <span style="color: #660033;">-P</span> <span style="color: #007800;">$project</span> <span style="color: #660033;">-b</span> <span style="color: #007800;">$branchname</span><br />
&nbsp; &nbsp; <span style="color: #c20cb9; font-weight: bold;">mkdir</span> ..<span style="color: #000000; font-weight: bold;">/</span><span style="color: #007800;">$project_lower</span><br />
&nbsp; &nbsp; <span style="color: #7a0874; font-weight: bold;">cd</span> ..<span style="color: #000000; font-weight: bold;">/</span><span style="color: #007800;">$project_lower</span><br />
&nbsp; &nbsp; <span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">&quot;initialising git&quot;</span><br />
&nbsp; &nbsp; <span style="color: #c20cb9; font-weight: bold;">git</span> init<br />
&nbsp; &nbsp; <span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">&quot;fetching branch&quot;</span><br />
&nbsp; &nbsp; <span style="color: #c20cb9; font-weight: bold;">git</span> fetch ..<span style="color: #000000; font-weight: bold;">/</span><span style="color: #007800;">$current_dir</span> <span style="color: #007800;">$branchname</span><br />
&nbsp; &nbsp; <span style="color: #c20cb9; font-weight: bold;">git</span> checkout <span style="color: #660033;">-b</span> master FETCH_HEAD <span style="color: #000000;">2</span><span style="color: #000000; font-weight: bold;">&gt;&amp;</span><span style="color: #000000;">1</span><br />
&nbsp; &nbsp; <span style="color: #7a0874; font-weight: bold;">cd</span> ..<br />
&nbsp; &nbsp; <span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">&quot;setting appropriate ownership&quot;</span><br />
&nbsp; &nbsp; <span style="color: #c20cb9; font-weight: bold;">chown</span> <span style="color: #007800;">$git_user</span>.<span style="color: #007800;">$git_group</span> <span style="color: #660033;">-R</span> <span style="color: #007800;">$project_lower</span><br />
&nbsp; &nbsp; <span style="color: #7a0874; font-weight: bold;">cd</span> <span style="color: #007800;">$current_dir</span><br />
&nbsp; <span style="color: #000000; font-weight: bold;">fi</span><br />
<span style="color: #000000; font-weight: bold;">done</span></div></div>
<p>Once the script has completed, you should be able to see a new directory structure, something along the following lines.</p>
<div class="codecolorer-container bash blackboard" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="bash codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">gitrepository<span style="color: #000000; font-weight: bold;">/</span><br />
&nbsp; projects.git<span style="color: #000000; font-weight: bold;">/</span><br />
&nbsp; project1.git<br />
&nbsp; worlddomination.git<span style="color: #000000; font-weight: bold;">/</span><br />
&nbsp; somestuff.git<span style="color: #000000; font-weight: bold;">/</span><br />
&nbsp; someotherstuff_v2.git<span style="color: #000000; font-weight: bold;">/</span><br />
&nbsp; demos.git<span style="color: #000000; font-weight: bold;">/</span><br />
&nbsp; downloads.git<span style="color: #000000; font-weight: bold;">/</span></div></div>
<p>Each folder is now its&#8217; own git repository with it&#8217;s own internal version history, tags, branches etc.<br />
cd into one of the folders and do a git log just to confirm you still have history.</p>
<p>The original projects.git can be removed (after backing it up for safety&#8217;s sake) if you&#8217;re satisfied everything is in place. We&#8217;re now ready to proceed with the next stage of the game, namely backing up our new git repositories to a remote share.</p>
<p><strong>Step 3 &#8211; Backing up Git</strong></p>
<p>I use a 2TB removable disk as a central data server for sharing files throughout my network. My thinking is that should the place ever burn down and I have the opportunity, there&#8217;s only one box I need to grab before rushing out the door. Of course, I burn frequent snapshots of this box to DVD.</p>
<p>I have created a &#8216;backups&#8217; share on the disk which I map to my physical server using NFS.</p>
<p>The entry in my /etc/fstab file is something like this.</p>
<div class="codecolorer-container bash blackboard" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="bash codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">192.168.0.20:<span style="color: #000000; font-weight: bold;">/</span>DataVolume<span style="color: #000000; font-weight: bold;">/</span>backups &nbsp;<span style="color: #000000; font-weight: bold;">/</span>usr<span style="color: #000000; font-weight: bold;">/</span>local<span style="color: #000000; font-weight: bold;">/</span>share<span style="color: #000000; font-weight: bold;">/</span>backups &nbsp;nfs defaults&nbsp; &nbsp; <span style="color: #000000;">0</span> <span style="color: #000000;">0</span></div></div>
<p>This means I can read/write to my backups folder as if it was a local folder on a local disk.</p>
<p>The job at hand is to be able to backup my git repositories using a cron task scheduled to run when everything is nice and quiet. Below is the script I use to run my git backups.</p>
<div class="codecolorer-container bash blackboard" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="bash codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #666666; font-style: italic;">#!/bin/bash</span><br />
<span style="color: #666666; font-style: italic;"># git_backup.sh</span><br />
<span style="color: #666666; font-style: italic;"># Backup git repositories to another folder</span><br />
&nbsp;<br />
<span style="color: #666666; font-style: italic;"># Make sure only root can run our script</span><br />
<span style="color: #000000; font-weight: bold;">if</span> <span style="color: #7a0874; font-weight: bold;">&#91;</span> <span style="color: #ff0000;">&quot;<span style="color: #007800;">$(id -u)</span>&quot;</span> <span style="color: #000000; font-weight: bold;">!</span>= <span style="color: #ff0000;">&quot;0&quot;</span> <span style="color: #7a0874; font-weight: bold;">&#93;</span>; <span style="color: #000000; font-weight: bold;">then</span><br />
&nbsp; &nbsp;<span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">&quot;This script must be run as root&quot;</span> <span style="color: #000000;">1</span><span style="color: #000000; font-weight: bold;">&gt;&amp;</span><span style="color: #000000;">2</span><br />
&nbsp; &nbsp;<span style="color: #7a0874; font-weight: bold;">exit</span> <span style="color: #000000;">1</span><br />
<span style="color: #000000; font-weight: bold;">fi</span><br />
<br />
<span style="color: #007800;">git_command</span>=<span style="color: #000000; font-weight: bold;">/</span>usr<span style="color: #000000; font-weight: bold;">/</span>bin<span style="color: #000000; font-weight: bold;">/</span><span style="color: #c20cb9; font-weight: bold;">git</span><br />
<span style="color: #666666; font-style: italic;">#Where they're going to be backed up</span><br />
<span style="color: #007800;">backup_dir</span>=<span style="color: #000000; font-weight: bold;">/</span>usr<span style="color: #000000; font-weight: bold;">/</span>local<span style="color: #000000; font-weight: bold;">/</span>share<span style="color: #000000; font-weight: bold;">/</span>backups<span style="color: #000000; font-weight: bold;">/</span><span style="color: #c20cb9; font-weight: bold;">git</span><br />
<span style="color: #666666; font-style: italic;">#Location of current live repositories</span><br />
<span style="color: #007800;">repository_dir</span>=<span style="color: #000000; font-weight: bold;">/</span>usr<span style="color: #000000; font-weight: bold;">/</span>local<span style="color: #000000; font-weight: bold;">/</span>share<span style="color: #000000; font-weight: bold;">/</span>gitrepos<br />
<br />
<span style="color: #7a0874; font-weight: bold;">cd</span> <span style="color: #007800;">$repository_dir</span><br />
<span style="color: #000000; font-weight: bold;">for</span> project <span style="color: #000000; font-weight: bold;">in</span> $<span style="color: #7a0874; font-weight: bold;">&#40;</span> <span style="color: #c20cb9; font-weight: bold;">ls</span> . <span style="color: #7a0874; font-weight: bold;">&#41;</span><br />
<span style="color: #000000; font-weight: bold;">do</span><br />
&nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">if</span> <span style="color: #7a0874; font-weight: bold;">&#91;</span> <span style="color: #660033;">-d</span> <span style="color: #007800;">$project</span> <span style="color: #7a0874; font-weight: bold;">&#93;</span>; <span style="color: #000000; font-weight: bold;">then</span><br />
&nbsp; &nbsp; <span style="color: #007800;">destination</span>=<span style="color: #ff0000;">&quot;<span style="color: #007800;">$backup_dir</span>/<span style="color: #007800;">$project</span>&quot;</span><br />
<br />
&nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">if</span> <span style="color: #7a0874; font-weight: bold;">&#91;</span> <span style="color: #660033;">-d</span> <span style="color: #007800;">$destination</span> <span style="color: #7a0874; font-weight: bold;">&#93;</span>; <span style="color: #000000; font-weight: bold;">then</span><br />
&nbsp; &nbsp; &nbsp; <span style="color: #7a0874; font-weight: bold;">cd</span> <span style="color: #007800;">$destination</span><br />
&nbsp; &nbsp; &nbsp; <span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">&quot;pulling <span style="color: #007800;">$project</span>...&quot;</span><br />
&nbsp; &nbsp; &nbsp; <span style="color: #007800;">$git_command</span> pull<br />
&nbsp; &nbsp; &nbsp; <span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">&quot;done.&quot;</span><br />
&nbsp; &nbsp; &nbsp; <span style="color: #7a0874; font-weight: bold;">cd</span> <span style="color: #007800;">$repository_dir</span><br />
&nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">else</span><br />
&nbsp; &nbsp; &nbsp; <span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">&quot;mkdir <span style="color: #007800;">$destination</span>&quot;</span><br />
&nbsp; &nbsp; &nbsp; <span style="color: #c20cb9; font-weight: bold;">mkdir</span> <span style="color: #007800;">$destination</span><br />
&nbsp; &nbsp; &nbsp; <span style="color: #7a0874; font-weight: bold;">cd</span> <span style="color: #ff0000;">&quot;<span style="color: #007800;">$repository_dir</span>/<span style="color: #007800;">$project</span>&quot;</span><br />
&nbsp; &nbsp; &nbsp; <span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">&quot;cloning <span style="color: #007800;">$project</span>...&quot;</span><br />
&nbsp; &nbsp; &nbsp; <span style="color: #007800;">$git_command</span> clone <span style="color: #660033;">-v</span> <span style="color: #660033;">-l</span> <span style="color: #660033;">--no-hardlinks</span> . <span style="color: #007800;">$destination</span><br />
&nbsp; &nbsp; &nbsp; <span style="color: #7a0874; font-weight: bold;">cd</span> ..<br />
&nbsp; &nbsp; &nbsp; <span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">&quot;done.&quot;</span><br />
&nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">fi</span><br />
&nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">fi</span><br />
<span style="color: #000000; font-weight: bold;">done</span></div></div>
<p>Once this script is run, you &#8216;ll have a copy of all your repositories in the backup folder. The next time it&#8217;s run should only take a fraction of the time as it won&#8217;t have to reestablish the git repository again. </p>
<p>So there you have it, migrating a subversion repository to git is really simple, the fun starts when you try to play with the results. I hope this has been helpful to others faced with the same job. Any improvements please let me know.</p>
<p><a class="a2a_dd addtoany_share_save" href="http://www.addtoany.com/share_save?linkurl=http%3A%2F%2Fwww.petermac.com%2Fmoving-from-subversion-to-git%2F&amp;linkname=Moving%20from%20Subversion%20to%20Git"><img src="http://www.petermac.com/wp-content/plugins/add-to-any/share_save_171_16.png" width="171" height="16" alt="Share/Bookmark"/></a> </p>]]></content:encoded>
			<wfw:commentRss>http://www.petermac.com/moving-from-subversion-to-git/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Ubuntu 10.04 setup for Ruby on Rails and general use</title>
		<link>http://www.petermac.com/ubuntu-1004-setup-for-ruby-on-rails-and-general-use/</link>
		<comments>http://www.petermac.com/ubuntu-1004-setup-for-ruby-on-rails-and-general-use/#comments</comments>
		<pubDate>Sat, 03 Jul 2010 09:13:55 +0000</pubDate>
		<dc:creator>peter</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[Ruby on Rails]]></category>

		<guid isPermaLink="false">http://www.petermac.com/?p=107</guid>
		<description><![CDATA[This extract is from notes I took during the process of setting up both a desktop and laptop for general use as a development environment for Ruby on Rails (RoR) and PHP development. There were lots of other steps (custom gems and environment stuff I like), but most of what follows is generic enough to [...]]]></description>
			<content:encoded><![CDATA[<p>This extract is from notes I took during the process of setting up both a desktop and laptop for general use as a development environment for Ruby on Rails (RoR) and PHP development.</p>
<p>There were lots of other steps (custom gems and environment stuff I like), but most of what follows is generic enough to get the basics in place.  Happy Hacking!!</p>
<p>#Install Skype<br />
sudo apt-get install libqt4-dbus libqt4-network libqt4-xml libasound2<br />
sudo dpkg -i skype-ubuntu-intrepid_2.1.0.81-1_amd64.deb</p>
<p>#Install Amarok<br />
sudo apt-get install xine-ui libxine1-ffmpeg</p>
<p>##<br />
#To get remote shares mapping in fstab<br />
##</p>
<p>#install the smb client package<br />
sudo aptitude install smbfs</p>
<p>sudo apt-get install portmap nfs-common</p>
<p>#Add the following line to /etc/hosts.deny:<br />
echo portmap : ALL&gt;&gt;/etc/hosts.deny</p>
<p>#By blocking all clients first, only clients in /etc/hosts.allow below<br />
#will be allowed to access the server.</p>
<p>#Now add the following line to /etc/hosts.allow:<br />
echo portmap : NFS server IP address&gt;&gt;hosts.allow</p>
<p>sudo mkdir /mnt/<foldername><br />
&#8230;etc<br />
sudo mkdir /mnt/music<br />
&#8230;etc<br />
sudo mkdir /mnt/backups</p>
<p>Create a file in home folder called .smbcredentials (note the leading dot)<br />
touch ~/.smbcredentials<br />
echo username=<br />
echo password=<br />
chmod 600 smbcredentials</p>
<p>Now an entry in /etc/fstab<br />
#Added a permanent share to shares on NAS box<br />
#Note: everything that follows (up to the 0  0 should appear on the one line)<br />
#and one line is required for each share you want to map</p>
<p>//192.168.0.20/<foldername> /mnt/<foldername> cifs<br />
uid=peter,credentials=/home/peter/.smbcredentials,domain=office,dir_mode=0777,file_mode=0777 0       0</p>
<p>#setup filezilla<br />
sudo aptitude install filezilla</p>
<p>#Limewire &#8211; download LimeWireLinux.deb from limewire site<br />
# reports missing dependencies<br />
peter@enspire:~/Downloads$ sudo dpkg -i LimeWireLinux.deb<br />
limewire-basic depends on sun-java6-jre | icedtea-java7-jre |<br />
sun-java6-jdk | icedtea-java7-jdk; however:<br />
Package sun-java6-jre is not installed.<br />
Package icedtea-java7-jre is not installed.<br />
Package sun-java6-jdk is not installed.<br />
Package icedtea-java7-jdk is not installed.<br />
dpkg: error processing limewire-basic (&#8211;install):<br />
dependency problems &#8211; leaving unconfigured</p>
<p>#Open synaptic package manager.<br />
#Go to the Settings/Repositories/Other sources tab.<br />
#Check the two default partner sites.</p>
<p>#Reload the package list and select the following<br />
#sun-java6-jre<br />
#sun-java6-plugin<br />
#sun-java6-fonts packages</p>
<p>##<br />
# Installing ruby and associated gems<br />
##</p>
<p>sudo apt-get install ruby</p>
<p>sudo apt-get install rubygems</p>
<p>sudo gem install rake<br />
sudo gem install rails</p>
<p>#tried to install capistrano using sudo but it wasn&#8217;t working on laptop<br />
#however it did work on desktop<br />
#sudo gem install capistrano<br />
# or without sudo&#8230;<br />
#gem install capistrano</p>
<p>#changed ~/.bashrc to include path to new gems<br />
#Added PMGF 2010-06-24<br />
export PATH=$PATH:~/.gem/ruby/1.8/bin:/var/lib/gems/1.8/bin</p>
<p>###<br />
# Now install and configure mysql before trying to install any of the ruby mysql gems<br />
###</p>
<p>#install mysql server<br />
sudo apt-get install mysql-server<br />
#setup prompts you for a password &#8211; enter it, remember it and enter it again.</p>
<p>#install the mysql admin tools<br />
sudo apt-get install mysql-admin</p>
<p>#NB &#8211; must install the libmysqlclient[nn]-dev package<br />
# this has mysql_config bundled with it which is needed by the ruby gems</p>
<p>#execute the following to find out what version of libmysqlclient yo&#8217;re running</p>
<p>dpkg &#8211;get-selections | grep mysqlclient</p>
<p>#in my case it&#8217;s version 16, so execute the following</p>
<p>sudo apt-get install libmysqlclient16-dev</p>
<p>#Next, you NEED TO INSTALL the ruby1.8 dev package<br />
#If you don&#8217;t you&#8217;ll get all sorts of mysql gem errors &#8212; frustrating!!!<br />
sudo apt-get install ruby1.8-dev</p>
<p>#now go for the mysql gem<br />
sudo gem install mysql</p>
<p>###<br />
# Installing and configuring git<br />
###</p>
<p>sudo apt-get install git-core<br />
git config &#8211;global user.email</p>
<p>###<br />
# Installing apache<br />
###<br />
sudo apt-get install apache2<br />
#the line above should do it, if you get any glitches, try the following<br />
#sudo apt-get install apache2.2-bin<br />
#sudo apt-get install apache2.2-common<br />
#sudo apt-get install apache2-threaded-dev</p>
<p>###<br />
# Installing php<br />
###<br />
sudo apt-get install php5<br />
sudo apt-get install php5-mysql</p>
<p><a class="a2a_dd addtoany_share_save" href="http://www.addtoany.com/share_save?linkurl=http%3A%2F%2Fwww.petermac.com%2Fubuntu-1004-setup-for-ruby-on-rails-and-general-use%2F&amp;linkname=Ubuntu%2010.04%20setup%20for%20Ruby%20on%20Rails%20and%20general%20use"><img src="http://www.petermac.com/wp-content/plugins/add-to-any/share_save_171_16.png" width="171" height="16" alt="Share/Bookmark"/></a> </p>]]></content:encoded>
			<wfw:commentRss>http://www.petermac.com/ubuntu-1004-setup-for-ruby-on-rails-and-general-use/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Linux Command Line Tips</title>
		<link>http://www.petermac.com/linux-command-line-tips/</link>
		<comments>http://www.petermac.com/linux-command-line-tips/#comments</comments>
		<pubDate>Sat, 03 Jul 2010 02:35:52 +0000</pubDate>
		<dc:creator>peter</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[command line]]></category>
		<category><![CDATA[commands]]></category>

		<guid isPermaLink="false">http://www.petermac.com/?p=79</guid>
		<description><![CDATA[.nw { white-space: nowrap; } table.listing { padding: 0px; border: 1px ridge rgb(255,255,192); /* entry */ border-collapse: collapse; background-color: rgb(255,255,255); } table.listing td { padding: 0px; padding-left: 2px; border: 1px ridge rgb(0,102,221); border-collapse: collapse; } tr.title, td.title { background-color: #005a98; color:#ffffff; margin-left:3px; } This list of commands is pretty much a copy found on P&#225;draig [...]]]></description>
			<content:encoded><![CDATA[<style text/css>
.nw {
white-space: nowrap;
}
table.listing {
padding: 0px;
border: 1px ridge rgb(255,255,192); /* entry */
border-collapse: collapse;
background-color: rgb(255,255,255);
}
table.listing td {
padding: 0px;
padding-left: 2px;
border: 1px ridge rgb(0,102,221);
border-collapse: collapse;
}
tr.title, td.title {
background-color: #005a98;
color:#ffffff;
margin-left:3px;
}</p>
</style>
<p>This list of commands is pretty much a copy found on P&aacute;draig Brady&#8217;s site <a href="http://www.pixelbeat.org/" target="blank">PixelBeat</a>. It&#8217;s reproduced here for personal convenience.</br><br />
Note:The commands with the • in the left hand column are safe to copy and paste as is.</p>
<table class="listing" border="0">
<tbody>
<tr id="misc" class="title">
<td colspan="2"><strong>Command</strong></td>
<td><strong>Description</strong></td>
</tr>
<tr>
<td>•</td>
<td class="nw">apropos whatis</td>
<td>Show commands pertinent to string.</td>
</tr>
<tr>
<td>•</td>
<td class="nw">man -t man | ps2pdf &#8211; &gt; man.pdf</td>
<td>make a pdf of a manual page</td>
</tr>
<tr>
<td></td>
<td class="nw">which command</td>
<td>Show full path name of command</td>
</tr>
<tr>
<td></td>
<td class="nw">time command</td>
<td>See how long a command takes</td>
</tr>
<tr>
<td>•</td>
<td class="nw">time cat</td>
<td>Start stopwatch. Ctrl-d to stop.</td>
</tr>
<tr id="dirs" class="title">
<td colspan="3"><strong>dir navigation</strong></td>
</tr>
<tr>
<td>•</td>
<td class="nw">cd -</td>
<td>Go to previous directory</td>
</tr>
<tr>
<td>•</td>
<td class="nw">cd</td>
<td>Go to $HOME directory</td>
</tr>
<tr>
<td></td>
<td class="nw">(cd dir &amp;&amp; command)</td>
<td>Go to dir, execute command and return to current dir</td>
</tr>
<tr>
<td>•</td>
<td class="nw">pushd <strong>.</strong></td>
<td>Put current dir on stack so you can <strong>popd</strong> back to it</td>
</tr>
<tr id="file_search" class="title">
<td colspan="3"><strong>file searching</strong></td>
</tr>
<tr>
<td>•</td>
<td class="nw">alias l=&#8217;ls -l &#8211;color=auto&#8217;</td>
<td>quick dir listing</td>
</tr>
<tr>
<td>•</td>
<td class="nw">ls -lrt</td>
<td>List files by date. </td>
</tr>
<tr>
<td>•</td>
<td class="nw">ls /usr/bin | pr -T9 -W$COLUMNS</td>
<td>Print in 9 columns to width of terminal</td>
</tr>
<tr>
<td></td>
<td class="nw">find -name &#8216;*.[ch]&#8216; | xargs grep -E &#8216;expr&#8217;</td>
<td>Search &#8216;expr&#8217; in this dir and below.</td>
</tr>
<tr>
<td></td>
<td class="nw">find -type f -print0 | xargs -r0 grep -F &#8216;example&#8217;</td>
<td>Search all regular files for &#8216;example&#8217; in this dir and below</td>
</tr>
<tr>
<td></td>
<td class="nw">find -maxdepth 1 -type f | xargs grep -F &#8216;example&#8217;</td>
<td>Search all regular files for &#8216;example&#8217; in this dir</td>
</tr>
<td>•</td>
<td class="nw">find -type f ! -perm -444</td>
<td>Find files not readable by all (useful for web site)</td>
</tr>
<tr>
<td>•</td>
<td class="nw">find -type d ! -perm -111</td>
<td>Find dirs not accessible by all (useful for web site)</td>
</tr>
<tr>
<td>•</td>
<td class="nw">locate -r &#8216;file[^/]*\.txt&#8217;</td>
<td>Search cached index for names. This re is like glob *file*.txt</td>
</tr>
<tr>
<td>•</td>
<td class="nw">look reference</td>
<td>Quickly search (sorted) dictionary for prefix</td>
</tr>
<tr>
<td>•</td>
<td class="nw">grep &#8211;color reference /usr/share/dict/words</td>
<td>Highlight occurances of regular expression in dictionary</td>
</tr>
<tr id="archives" class="title">
<td colspan="3"><strong>archives and compression</strong></td>
</tr>
<tr>
<td></td>
<td class="nw">gpg -c file</td>
<td>Encrypt file</td>
</tr>
<tr>
<td></td>
<td class="nw">gpg file.gpg</td>
<td>Decrypt file</td>
</tr>
<tr>
<td></td>
<td class="nw">tar -c dir/ | bzip2 &gt; dir.tar.bz2</td>
<td>Make compressed archive of dir/</td>
</tr>
<tr>
<td></td>
<td class="nw">bzip2 -dc dir.tar.bz2 | tar -x</td>
<td>Extract archive (use gzip instead of bzip2 for tar.gz files)</td>
</tr>
<tr>
<td></td>
<td class="nw">tar -c dir/ | gzip | gpg -c | ssh user@remote &#8216;dd of=dir.tar.gz.gpg&#8217;</td>
<td>Make encrypted archive of dir/ on remote machine</td>
</tr>
<tr>
<td></td>
<td class="nw">find dir/ -name &#8216;*.txt&#8217; | tar -c &#8211;files-from=- | bzip2 &gt; dir_txt.tar.bz2</td>
<td>Make archive of subset of dir/ and below</td>
</tr>
<tr>
<td></td>
<td class="nw">find dir/ -name &#8216;*.txt&#8217; | xargs cp -a &#8211;target-directory=dir_txt/ &#8211;parents</td>
<td>Make copy of subset of dir/ and below</td>
</tr>
<tr>
<td></td>
<td class="nw">( tar -c /dir/to/copy ) | ( cd /where/to/ &amp;&amp; tar -x -p )</td>
<td>Copy (with permissions) copy/ dir to /where/to/ dir</td>
</tr>
<tr>
<td></td>
<td class="nw">( cd /dir/to/copy &amp;&amp; tar -c <strong>.</strong> ) | ( cd /where/to/ &amp;&amp; tar -x -p )</td>
<td>Copy (with permissions) contents of copy/ dir to /where/to/</td>
</tr>
<tr>
<td></td>
<td class="nw">( tar -c /dir/to/copy ) | ssh -C user@remote &#8216;cd /where/to/ &amp;&amp; tar -x -p&#8217;</td>
<td>Copy (with permissions) copy/ dir to remote:/where/to/ dir</td>
</tr>
<tr>
<td></td>
<td class="nw">dd bs=1M if=/dev/sda | gzip | ssh user@remote &#8216;dd of=sda.gz&#8217;</td>
<td>Backup harddisk to remote machine</td>
</tr>
<tr id="rsync" class="title">
<td colspan="3"><strong>rsync</strong> (Network efficient file copier: Use the &#8211;dry-run option for testing)</td>
</tr>
<tr>
<td></td>
<td class="nw">rsync -P rsync://rsync.server.com/path/to/file file</td>
<td>Only get diffs. Do multiple times for troublesome downloads</td>
</tr>
<tr>
<td></td>
<td class="nw">rsync &#8211;bwlimit=1000 fromfile tofile</td>
<td>Locally copy with rate limit. It&#8217;s like nice for I/O</td>
</tr>
<tr>
<td></td>
<td class="nw">rsync -az -e ssh &#8211;delete ~/public_html/ remote.com:&#8217;~/public_html&#8217;</td>
<td>Mirror web site (using compression and encryption)</td>
</tr>
<tr>
<td></td>
<td class="nw">rsync -auz -e ssh remote:/dir/ <strong>.</strong> &amp;&amp; rsync -auz -e ssh <strong>.</strong> remote:/dir/</td>
<td>Synchronize current directory with remote one</td>
</tr>
<tr id="ssh" class="title">
<td colspan="3"><strong>ssh</strong> (Secure SHell)</td>
</tr>
<tr>
<td></td>
<td class="nw">ssh $USER@$HOST command</td>
<td>Run command on $HOST as $USER (default command=shell)</td>
</tr>
<tr>
<td>•</td>
<td class="nw">ssh -f -Y $USER@$HOSTNAME xeyes</td>
<td>Run GUI command on $HOSTNAME as $USER</td>
</tr>
<tr>
<td></td>
<td class="nw">scp -p -r $USER@$HOST: file dir/</td>
<td>Copy with permissions to $USER&#8217;s home directory on $HOST</td>
</tr>
<tr>
<td></td>
<td class="nw">ssh -g -L 8080:localhost:80 root@$HOST</td>
<td>Forward connections to $HOSTNAME:8080 out to $HOST:80</td>
</tr>
<tr>
<td></td>
<td class="nw">ssh -R 1434:imap:143 root@$HOST</td>
<td>Forward connections from $HOST:1434 in to imap:143</td>
</tr>
<tr>
<td></td>
<td class="nw">ssh-copy-id $USER@$HOST</td>
<td>Install $USER&#8217;s public key on $HOST for password-less log in</td>
</tr>
<tr id="wget" class="title">
<td colspan="3"><strong>wget</strong> (multi purpose download tool)</td>
</tr>
<tr>
<td>•</td>
<td class="nw">(cd dir/ &amp;&amp; wget -nd -pHEKk http://www.pixelbeat.org/cmdline.html)</td>
<td>Store local browsable version of a page to the current dir</td>
</tr>
<tr>
<td></td>
<td class="nw">wget -c http://www.example.com/large.file</td>
<td>Continue downloading a partially downloaded file</td>
</tr>
<tr>
<td></td>
<td class="nw">wget -r -nd -np -l1 -A &#8216;*.jpg&#8217; http://www.example.com/dir/</td>
<td>Download a set of files to the current directory</td>
</tr>
<tr>
<td></td>
<td class="nw">wget ftp://remote/file[1-9].iso/</td>
<td>FTP supports globbing directly</td>
</tr>
<tr>
<td>•</td>
<td class="nw">wget -q -O- http://www.pixelbeat.org/timeline.html | grep &#8216;a href&#8217; | head</td>
<td>Process output directly</td>
</tr>
<tr>
<td></td>
<td class="nw">echo &#8216;wget url&#8217; | at 01:00</td>
<td>Download url at 1AM to current dir</td>
</tr>
<tr>
<td></td>
<td class="nw">wget &#8211;limit-rate=20k url</td>
<td>Do a low priority download (limit to 20KB/s in this case)</td>
</tr>
<tr>
<td></td>
<td class="nw">wget -nv &#8211;spider &#8211;force-html -i bookmarks.html</td>
<td>Check links in a file</td>
</tr>
<tr>
<td></td>
<td class="nw">wget &#8211;mirror http://www.example.com/</td>
<td>Efficiently update a local copy of a site (handy from cron)</td>
</tr>
<tr id="net" class="title">
<td colspan="3"><strong>networking</strong> (Note ifconfig, route, mii-tool, nslookup commands are obsolete)</td>
</tr>
<tr>
<td></td>
<td class="nw"><acronym title="usually in /sbin/">ethtool</acronym> eth0</td>
<td>Show status of ethernet interface eth0</td>
</tr>
<tr>
<td></td>
<td class="nw">ethtool &#8211;change eth0 autoneg off speed 100 duplex full</td>
<td>Manually set ethernet interface speed</td>
</tr>
<tr>
<td></td>
<td class="nw"><acronym title="usually in /sbin/">iwconfig</acronym> eth1</td>
<td>Show status of wireless interface eth1</td>
</tr>
<tr>
<td></td>
<td class="nw">iwconfig eth1 rate 1Mb/s fixed</td>
<td>Manually set wireless interface speed</td>
</tr>
<tr>
<td>•</td>
<td class="nw"><acronym title="usually in /sbin/">iwlist</acronym> scan</td>
<td>List wireless networks in range</td>
</tr>
<tr>
<td>•</td>
<td class="nw"><acronym title="usually in /sbin/">ip</acronym> link show</td>
<td>List network interfaces</td>
</tr>
<tr>
<td></td>
<td class="nw">ip link set dev eth0 name wan</td>
<td>Rename interface eth0 to wan</td>
</tr>
<tr>
<td></td>
<td class="nw">ip link set dev eth0 up</td>
<td>Bring interface eth0 up (or down)</td>
</tr>
<tr>
<td>•</td>
<td class="nw">ip addr show</td>
<td>List addresses for interfaces</td>
</tr>
<tr>
<td></td>
<td class="nw">ip addr add 1.2.3.4/24 brd + dev eth0</td>
<td>Add (or del) ip and mask (255.255.255.0)</td>
</tr>
<tr>
<td>•</td>
<td class="nw">ip route show</td>
<td>List routing table</td>
</tr>
<tr>
<td></td>
<td class="nw">ip route add default via 1.2.3.254</td>
<td>Set default gateway to 1.2.3.254</td>
</tr>
<tr>
<td>•</td>
<td class="nw">host pixelbeat.org</td>
<td>Lookup DNS ip address for name or vice versa</td>
</tr>
<tr>
<td>•</td>
<td class="nw">hostname -i</td>
<td>Lookup local ip address (equivalent to host `hostname`)</td>
</tr>
<tr>
<td>•</td>
<td class="nw">whois pixelbeat.org</td>
<td>Lookup whois info for hostname or ip address</td>
</tr>
<tr>
<td>•</td>
<td class="nw">netstat -tupl</td>
<td>List internet services on a system</td>
</tr>
<tr>
<td>•</td>
<td class="nw">netstat -tup</td>
<td>List active connections to/from system</td>
</tr>
<tr id="windows" class="title">
<td colspan="3"><strong>windows networking</strong> (Note samba is the package that provides all this windows specific networking support)</td>
</tr>
<tr>
<td>•</td>
<td class="nw">smbtree</td>
<td>Find windows machines. See also findsmb</td>
</tr>
<tr>
<td></td>
<td class="nw">nmblookup -A 1.2.3.4</td>
<td>Find the windows (netbios) name associated with ip address</td>
</tr>
<tr>
<td></td>
<td class="nw">smbclient -L windows_box</td>
<td>List shares on windows machine or samba server</td>
</tr>
<tr>
<td></td>
<td class="nw">mount -t smbfs -o fmask=666,guest //windows_box/share /mnt/share</td>
<td>Mount a windows share</td>
</tr>
<tr>
<td></td>
<td class="nw">echo &#8216;message&#8217; | smbclient -M windows_box</td>
<td>Send popup to windows machine (off by default in XP sp2)</td>
</tr>
<tr id="text" class="title">
<td colspan="3"><strong>text manipulation</strong> (Note sed uses stdin and stdout. Newer versions support inplace editing with the -i option)</td>
</tr>
<tr>
<td></td>
<td class="nw">sed &#8216;s/string1/string2/g&#8217;</td>
<td>Replace string1 with string2</td>
</tr>
<tr>
<td></td>
<td class="nw">sed &#8216;s/\(.*\)1/\12/g&#8217;</td>
<td>Modify anystring1 to anystring2</td>
</tr>
<tr>
<td></td>
<td class="nw">sed &#8216;/ *#/d; /^ *$/d&#8217;</td>
<td>Remove comments and blank lines</td>
</tr>
<tr>
<td></td>
<td class="nw">sed &#8216;:a; /\\$/N; s/\\\n//; ta&#8217;</td>
<td>Concatenate lines with trailing \</td>
</tr>
<tr>
<td></td>
<td class="nw">sed &#8216;s/[ \t]*$//&#8217;</td>
<td>Remove trailing spaces from lines</td>
</tr>
<tr>
<td></td>
<td class="nw">sed &#8216;s/\([`"$\]\)/\\\1/g&#8217;</td>
<td>Escape shell metacharacters active within double quotes</td>
</tr>
<tr>
<td>•</td>
<td class="nw">seq 10 | sed &#8220;s/^/      /; s/ *\(.\{7,\}\)/\1/&#8221;</td>
<td>Right align numbers</td>
</tr>
<tr>
<td></td>
<td class="nw">sed -n &#8217;1000{p;<acronym title="quit ASAP">q</acronym>}&#8217;</td>
<td>Print 1000th line</td>
</tr>
<tr>
<td></td>
<td class="nw">sed -n &#8217;10,20p;<acronym title="quit ASAP">20q</acronym>&#8216;</td>
<td>Print lines 10 to 20</td>
</tr>
<tr>
<td></td>
<td class="nw">sed -n &#8216;s/.*&lt;title&gt;\(.*\)&lt;\/title&gt;.*/\1/ip;<acronym title="quit after match">T;q</acronym>&#8216;</td>
<td>Extract title from HTML web page</td>
</tr>
<tr>
<td></td>
<td class="nw">sed -i 42d ~/.ssh/known_hosts</td>
<td>Delete a particular line</td>
</tr>
<tr>
<td></td>
<td class="nw">sort -t. -k1,1n -k2,2n -k3,3n -k4,4n</td>
<td>Sort IPV4 ip addresses</td>
</tr>
<tr>
<td>•</td>
<td class="nw">echo &#8216;Test&#8217; | tr &#8216;[:lower:]&#8216; &#8216;[:upper:]&#8216;</td>
<td>Case conversion</td>
</tr>
<tr>
<td>•</td>
<td class="nw">tr -dc &#8216;[:print:]&#8216; &lt; /dev/urandom</td>
<td>Filter non printable characters</td>
</tr>
<tr>
<td>•</td>
<td class="nw">tr -s &#8216;[:blank:]&#8216; &#8216;\t&#8217; &lt;/proc/diskstats | cut -f4</td>
<td>cut fields separated by blanks</td>
</tr>
<tr>
<td>•</td>
<td class="nw">history | wc -l</td>
<td>Count lines</td>
</tr>
<tr id="sets" class="title">
<td colspan="3"><strong>set operations</strong> (Note you can export LANG=C for speed. Also these assume no duplicate lines within a file)</td>
</tr>
<tr>
<td></td>
<td class="nw">sort file1 file2 | uniq</td>
<td><acronym title="Items in either file1 or file2">Union</acronym> of unsorted files</td>
</tr>
<tr>
<td></td>
<td class="nw">sort file1 file2 | uniq -d</td>
<td><acronym title="Items both in file1 and file2">Intersection</acronym> of unsorted files</td>
</tr>
<tr>
<td></td>
<td class="nw">sort file1 file1 file2 | uniq -u</td>
<td><acronym title="Items in file2 not in file1">Difference</acronym> of unsorted files</td>
</tr>
<tr>
<td></td>
<td class="nw">sort file1 file2 | uniq -u</td>
<td><acronym title="Items in only one file">Symmetric Difference</acronym> of unsorted files</td>
</tr>
<tr>
<td></td>
<td class="nw">join <acronym title="process whole line (assuming no NUL characters present)">-t&#8217;\0&#8242;</acronym> -a1 -a2 file1 file2</td>
<td>Union of sorted files</td>
</tr>
<tr>
<td></td>
<td class="nw">join -t&#8217;\0&#8242; file1 file2</td>
<td>Intersection of sorted files</td>
</tr>
<tr>
<td></td>
<td class="nw">join -t&#8217;\0&#8242; -v2 file1 file2</td>
<td>Difference of sorted files</td>
</tr>
<tr>
<td></td>
<td class="nw">join -t&#8217;\0&#8242; -v1 -v2 file1 file2</td>
<td>Symmetric Difference of sorted files</td>
</tr>
<tr id="math" class="title">
<td colspan="3"><strong>math</strong></td>
</tr>
<tr>
<td>•</td>
<td class="nw">echo &#8216;(1 + sqrt(5))/2&#8242; | bc -l</td>
<td>Quick math (Calculate φ). </td>
</tr>
<tr>
<td>•</td>
<td class="nw">echo &#8216;pad=20; min=64; (100*10^6)/((pad+min)*8)&#8217; | bc</td>
<td>More complex (int) e.g. This shows max FastE packet rate</td>
</tr>
<tr>
<td>•</td>
<td class="nw">echo &#8216;pad=20; min=64; print (100E6)/((pad+min)*8)&#8217; | python</td>
<td>Python handles scientific notation</td>
</tr>
<tr>
<td>•</td>
<td class="nw">echo &#8216;pad=20; plot [64:1518] (100*10**6)/((pad+x)*8)&#8217; | gnuplot -persist</td>
<td>Plot FastE packet rate vs packet size</td>
</tr>
<tr>
<td>•</td>
<td class="nw">echo &#8216;obase=16; ibase=10; 64206&#8242; | bc</td>
<td>Base conversion (decimal to hexadecimal)</td>
</tr>
<tr>
<td>•</td>
<td class="nw">echo $((0x2dec))</td>
<td>Base conversion (hex to dec) ((shell arithmetic expansion))</td>
</tr>
<tr>
<td>•</td>
<td class="nw">units -t &#8217;100m/s&#8217; &#8216;miles/hour&#8217;</td>
<td>Unit conversion (metric to imperial)</td>
</tr>
<tr>
<td>•</td>
<td class="nw">units -t &#8217;500GB&#8217; &#8216;GiB&#8217;</td>
<td>Unit conversion (<acronym title="powers of 10">SI</acronym> to <acronym title="powers of 2">IEC</acronym> prefixes)</td>
</tr>
<tr>
<td>•</td>
<td class="nw">units -t &#8217;1 googol&#8217;</td>
<td>Definition lookup</td>
</tr>
<tr>
<td>•</td>
<td class="nw">seq 100 | (tr &#8216;\n&#8217; +; echo 0) | bc</td>
<td>Add a column of numbers.</td>
</tr>
<tr id="dates" class="title">
<td colspan="3"><strong>calendar</strong></td>
</tr>
<tr>
<td>•</td>
<td class="nw">cal -3</td>
<td>Display a calendar</td>
</tr>
<tr>
<td>•</td>
<td class="nw">cal 9 1752</td>
<td>Display a calendar for a particular month year</td>
</tr>
<tr>
<td>•</td>
<td class="nw">date -d fri</td>
<td>What date is it this friday.</td>
</tr>
<tr>
<td>•</td>
<td class="nw">[ $(date -d "tomorrow" +%d) = "01" ] || exit</td>
<td>exit a script unless it&#8217;s the last day of the month</td>
</tr>
<tr>
<td>•</td>
<td class="nw">date &#8211;date=&#8217;25 Dec&#8217; +%A</td>
<td>What day does xmas fall on, this year</td>
</tr>
<tr>
<td>•</td>
<td class="nw">date &#8211;date=&#8217;@2147483647&#8242;</td>
<td>Convert seconds since the epoch (1970-01-01 UTC) to date</td>
</tr>
<tr>
<td>•</td>
<td class="nw">TZ=&#8217;America/Los_Angeles&#8217; date</td>
<td>What time is it on west coast of US (use tzselect to find TZ)</td>
</tr>
<tr>
<td>•</td>
<td class="nw">date &#8211;date=&#8217;TZ=&#8221;America/Los_Angeles&#8221; 09:00 next Fri&#8217;</td>
<td>What&#8217;s the local time for 9AM next Friday on west coast US</td>
</tr>
<tr id="locale" class="title">
<td colspan="3"><strong>locales</strong></td>
</tr>
<tr>
<td>•</td>
<td class="nw">printf &#8220;%&#8217;d\n&#8221; 1234</td>
<td>Print number with thousands grouping appropriate to locale</td>
</tr>
<tr>
<td>•</td>
<td class="nw">BLOCK_SIZE=\&#8217;1 ls -l</td>
<td>Use locale thousands grouping in ls.</td>
</tr>
<tr>
<td>•</td>
<td class="nw">echo &#8220;I live in `locale territory`&#8221;</td>
<td>Extract info from locale database</td>
</tr>
<tr>
<td>•</td>
<td class="nw">LANG=en_IE.utf8 locale int_prefix</td>
<td>Lookup locale info for specific country.</td>
</tr>
<tr>
<td>•</td>
<td class="nw">locale | cut -d= -f1 | xargs locale -kc | less</td>
<td>List fields available in locale database</td>
</tr>
<tr id="recode" class="title">
<td colspan="3"><strong>recode</strong> (Obsoletes iconv, dos2unix, unix2dos)</td>
</tr>
<tr>
<td>•</td>
<td class="nw">recode -l | less</td>
<td>Show available conversions (aliases on each line)</td>
</tr>
<tr>
<td></td>
<td class="nw">recode windows-1252.. file_to_change.txt</td>
<td>Windows &#8220;ansi&#8221; to local charset (auto does CRLF conversion)</td>
</tr>
<tr>
<td></td>
<td class="nw">recode utf-8/CRLF.. file_to_change.txt</td>
<td>Windows utf8 to local charset</td>
</tr>
<tr>
<td></td>
<td class="nw">recode iso-8859-15..utf8 file_to_change.txt</td>
<td>Latin9 (western europe) to utf8</td>
</tr>
<tr>
<td></td>
<td class="nw">recode ../b64 &lt; file.txt &gt; file.b64</td>
<td>Base64 encode</td>
</tr>
<tr>
<td></td>
<td class="nw">recode /qp.. &lt; file.qp &gt; file.txt</td>
<td>Quoted printable decode</td>
</tr>
<tr>
<td></td>
<td class="nw">recode ..HTML &lt; file.txt &gt; file.html</td>
<td>Text to HTML</td>
</tr>
<tr>
<td>•</td>
<td class="nw">recode -lf windows-1252 | grep euro</td>
<td>Lookup table of characters</td>
</tr>
<tr>
<td>•</td>
<td class="nw">echo -n 0&#215;80 | recode latin-9/x1..dump</td>
<td>Show what a code represents in latin-9 charmap</td>
</tr>
<tr>
<td>•</td>
<td class="nw">echo -n 0x20AC | recode ucs-2/x2..latin-9/x</td>
<td>Show latin-9 encoding</td>
</tr>
<tr>
<td>•</td>
<td class="nw">echo -n 0x20AC | recode ucs-2/x2..utf-8/x</td>
<td>Show utf-8 encoding</td>
</tr>
<tr id="CDs" class="title">
<td colspan="3"><strong><acronym title="Compact Disks">CDs</acronym></strong></td>
</tr>
<tr>
<td></td>
<td class="nw">gzip &lt; /dev/cdrom &gt; cdrom.iso.gz</td>
<td>Save copy of data cdrom</td>
</tr>
<tr>
<td></td>
<td class="nw">mkisofs -V LABEL -r dir | gzip &gt; cdrom.iso.gz</td>
<td>Create cdrom image from contents of dir</td>
</tr>
<tr>
<td></td>
<td class="nw">mount -o loop cdrom.iso /mnt/dir</td>
<td>Mount the cdrom image at /mnt/dir (read only)</td>
</tr>
<tr>
<td></td>
<td class="nw">cdrecord -v dev=/dev/cdrom blank=fast</td>
<td>Clear a CDRW</td>
</tr>
<tr>
<td></td>
<td class="nw">gzip -dc cdrom.iso.gz | cdrecord -v dev=/dev/cdrom -</td>
<td>Burn cdrom image (use dev=ATAPI -scanbus to confirm dev)</td>
</tr>
<tr>
<td></td>
<td class="nw">cdparanoia -B</td>
<td>Rip audio tracks from CD to wav files in current dir</td>
</tr>
<tr>
<td></td>
<td class="nw">cdrecord -v dev=/dev/cdrom -audio -pad *.wav</td>
<td>Make audio CD from all wavs in current dir (see also cdrdao)</td>
</tr>
<tr>
<td></td>
<td class="nw">oggenc &#8211;tracknum=&#8217;track&#8217; track.cdda.wav -o &#8216;track.ogg&#8217;</td>
<td>Make ogg file from wav file</td>
</tr>
<tr id="disk_space" class="title">
<td colspan="3"><strong>disk space</strong></td>
</tr>
<tr>
<td>•</td>
<td class="nw">ls -lSr</td>
<td>Show files by size, biggest last</td>
</tr>
<tr>
<td>•</td>
<td class="nw">du -s * | sort -k1,1rn | head</td>
<td>Show top disk users in current dir.</td>
</tr>
<tr>
<td>•</td>
<td class="nw">du -hs /home/* | sort -k1,1<acronym title="available since coreutils 7.5">h</acronym></td>
<td>Sort paths by easy to interpret disk usage</td>
</tr>
<tr>
<td>•</td>
<td class="nw">df -h</td>
<td>Show free space on mounted filesystems</td>
</tr>
<tr>
<td>•</td>
<td class="nw">df -i</td>
<td>Show free inodes on mounted filesystems</td>
</tr>
<tr>
<td>•</td>
<td class="nw"><acronym title="usually in /sbin/">fdisk</acronym> -l</td>
<td>Show disks partitions sizes and types (run as root)</td>
</tr>
<tr>
<td>•</td>
<td class="nw">rpm -q -a &#8211;qf &#8216;%10{SIZE}\t%{NAME}\n&#8217; | sort -k1,1n</td>
<td>List all packages by installed size (Bytes) on rpm distros</td>
</tr>
<tr>
<td>•</td>
<td class="nw">dpkg -query -W -f=&#8217;${Installed-Size;10}\t${Package}\n&#8217; | sort -k1,1n</td>
<td>List all packages by installed size (KBytes) on deb distros</td>
</tr>
<tr>
<td>•</td>
<td class="nw">dd bs=1 seek=2TB if=/dev/null of=ext3.test</td>
<td>Create a large test file (taking no space).</td>
</tr>
<tr>
<td>•</td>
<td class="nw">&gt; file</td>
<td>truncate data of file or create an empty file</td>
</tr>
<tr id="monitor" class="title">
<td colspan="3"><strong>monitoring/debugging</strong></td>
</tr>
<tr>
<td>•</td>
<td class="nw">tail -f /var/log/messages</td>
<td>Monitor messages in a log file</td>
</tr>
<tr>
<td>•</td>
<td class="nw">strace -c ls &gt;/dev/null</td>
<td>Summarise/profile system calls made by command</td>
</tr>
<tr>
<td>•</td>
<td class="nw">strace -f -e open ls &gt;/dev/null</td>
<td>List system calls made by command</td>
</tr>
<tr>
<td>•</td>
<td class="nw">ltrace -f -e getenv ls &gt;/dev/null</td>
<td>List library calls made by command</td>
</tr>
<tr>
<td>•</td>
<td class="nw"><acronym title="usually in /usr/sbin/">lsof</acronym> -p <acronym title="process id of current shell">$$</acronym></td>
<td>List paths that process id has open</td>
</tr>
<tr>
<td>•</td>
<td class="nw">lsof ~</td>
<td>List processes that have specified path open</td>
</tr>
<tr>
<td>•</td>
<td class="nw">tcpdump not port 22</td>
<td>Show network traffic except ssh.</td>
</tr>
<tr>
<td>•</td>
<td class="nw">ps -e -o pid,args &#8211;forest</td>
<td>List processes in a hierarchy</td>
</tr>
<tr>
<td>•</td>
<td class="nw">ps -e -o pcpu,cpu,nice,state,cputime,args &#8211;sort pcpu | sed &#8216;/^ 0.0 /d&#8217;</td>
<td>List processes by % cpu usage</td>
</tr>
<tr>
<td>•</td>
<td class="nw">ps -e -orss=,args= | sort -b -k1,1n | pr -TW$COLUMNS</td>
<td>List processes by mem (KB) usage.</td>
</tr>
<tr>
<td>•</td>
<td class="nw">ps -C firefox-bin -L -o pid,tid,pcpu,state</td>
<td>List all threads for a particular process</td>
</tr>
<tr>
<td>•</td>
<td class="nw">ps -p 1,2</td>
<td>List info for particular process IDs</td>
</tr>
<tr>
<td>•</td>
<td class="nw">last reboot</td>
<td>Show system reboot history</td>
</tr>
<tr>
<td>•</td>
<td class="nw">free -m</td>
<td>Show amount of (remaining) RAM (-m displays in MB)</td>
</tr>
<tr>
<td>•</td>
<td class="nw">watch -n.1 &#8216;cat /proc/interrupts&#8217;</td>
<td>Watch changeable data continuously</td>
</tr>
<tr>
<td>•</td>
<td class="nw">udevadm monitor</td>
<td>Monitor udev events to help configure rules</td>
</tr>
<tr id="sysinfo" class="title">
<td colspan="3"><strong>system information</strong ('#' means root access is required)</td>
</tr>
<tr>
<td>•</td>
<td class="nw">uname -a</td>
<td>Show kernel version and system architecture</td>
</tr>
<tr>
<td>•</td>
<td class="nw">head -n1 /etc/issue</td>
<td>Show name and version of distribution</td>
</tr>
<tr>
<td>•</td>
<td class="nw">cat /proc/partitions</td>
<td>Show all partitions registered on the system</td>
</tr>
<tr>
<td>•</td>
<td class="nw">grep MemTotal /proc/meminfo</td>
<td>Show RAM total seen by the system</td>
</tr>
<tr>
<td>•</td>
<td class="nw">grep &#8220;model name&#8221; /proc/cpuinfo</td>
<td>Show CPU(s) info</td>
</tr>
<tr>
<td>•</td>
<td class="nw"><acronym title="usually in /sbin/">lspci</acronym> -tv</td>
<td>Show PCI info</td>
</tr>
<tr>
<td>•</td>
<td class="nw"><acronym title="usually in /sbin/">lsusb</acronym> -tv</td>
<td>Show USB info</td>
</tr>
<tr>
<td>•</td>
<td class="nw">mount | column -t</td>
<td>List mounted filesystems on the system (and align output)</td>
</tr>
<tr>
<td>•</td>
<td class="nw">grep -F capacity: /proc/acpi/battery/BAT0/info</td>
<td>Show state of cells in laptop battery</td>
</tr>
<tr>
<td>#</td>
<td class="nw">dmidecode -q | less</td>
<td>Display SMBIOS/DMI information</td>
</tr>
<tr>
<td>#</td>
<td class="nw">smartctl -A /dev/sda | grep Power_On_Hours</td>
<td>How long has this disk (system) been powered on in total</td>
</tr>
<tr>
<td>#</td>
<td class="nw">hdparm -i /dev/sda</td>
<td>Show info about disk sda</td>
</tr>
<tr>
<td>#</td>
<td class="nw">hdparm -tT /dev/sda</td>
<td>Do a read speed test on disk sda</td>
</tr>
<tr>
<td>#</td>
<td class="nw">badblocks -s /dev/sda</td>
<td>Test for unreadable blocks on disk sda</td>
</tr>
<tr id="interactive" class="title">
<td colspan="3"><strong>interactive</strong></td>
</tr>
<tr>
<td>•</td>
<td class="nw">readline</td>
<td>Line editor used by bash, python, bc, gnuplot, &#8230;</td>
</tr>
<tr>
<td>•</td>
<td class="nw">screen</td>
<td>Virtual terminals with detach capability, &#8230;</td>
</tr>
<tr>
<td>•</td>
<td class="nw">mc</td>
<td>Powerful file manager that can browse rpm, tar, ftp, ssh, &#8230;</td>
</tr>
<tr>
<td>•</td>
<td class="nw">gnuplot</td>
<td>Interactive/scriptable graphing</td>
</tr>
<tr>
<td>•</td>
<td class="nw">links</td>
<td>Web browser</td>
</tr>
<tr>
<td>•</td>
<td class="nw">xdg-open <strong>.</strong></td>
<td>open a file or url with the registered desktop application</td>
</tr>
</tbody>
</table>
<p><a class="a2a_dd addtoany_share_save" href="http://www.addtoany.com/share_save?linkurl=http%3A%2F%2Fwww.petermac.com%2Flinux-command-line-tips%2F&amp;linkname=Linux%20Command%20Line%20Tips"><img src="http://www.petermac.com/wp-content/plugins/add-to-any/share_save_171_16.png" width="171" height="16" alt="Share/Bookmark"/></a> </p>]]></content:encoded>
			<wfw:commentRss>http://www.petermac.com/linux-command-line-tips/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Creating Your Website &#8211; FAQ</title>
		<link>http://www.petermac.com/creating-your-website-faq/</link>
		<comments>http://www.petermac.com/creating-your-website-faq/#comments</comments>
		<pubDate>Mon, 02 Feb 2009 23:24:36 +0000</pubDate>
		<dc:creator>peter</dc:creator>
				<category><![CDATA[Web Development]]></category>

		<guid isPermaLink="false">http://www.petermac.com/2009/02/03/creating-your-website-faq/</guid>
		<description><![CDATA[Q. How much will my website cost me? A. Depends on the size and complexity of the site. Q. If all i want is a few web pages that tell the world about my buiness. A. We can design a look and feel, get a few web pages up and host them for about $4,000 Q. [...]]]></description>
			<content:encoded><![CDATA[<p>Q. How much will my website cost me?</p>
<p>A. Depends on the size and complexity of the site.</p>
<p>Q. If all i want is a few web pages that tell the world about my buiness.</p>
<p>A. We can design a look and feel, get a few web pages up and host them for about $4,000</p>
<p>Q. But what about getting the site listed in search engines? Will people find me using google?</p>
<p>A. We&#8217;ll put in the smarts behind your pages to give them a good chance of being listed. It&#8217;s called SEO. The rest is up to you.</p>
<p>Q. What do you mean &#8220;the rest is up to me&#8221;?</p>
<p>A. Once you have a working web-site, keeping its&#8217; content fresh and relevant and ensuring it gets high search engine rankings is an on-going job.</p>
<p>Q. Can I update my site with new content or do I have to pay you for any changes?</p>
<p>A. We will use a CMS to build your site, you can add new articles and pages if you need. You can call us if it all gets too much like hard work.</p>
<p>Q. How long will this take?</p>
<p>A. For a simple website where you can provide the textual content, it can take 2-3 weeks. For an online store with order forms and product cataloges considerably longer.</p>
<p><a class="a2a_dd addtoany_share_save" href="http://www.addtoany.com/share_save?linkurl=http%3A%2F%2Fwww.petermac.com%2Fcreating-your-website-faq%2F&amp;linkname=Creating%20Your%20Website%20%26%238211%3B%20FAQ"><img src="http://www.petermac.com/wp-content/plugins/add-to-any/share_save_171_16.png" width="171" height="16" alt="Share/Bookmark"/></a> </p>]]></content:encoded>
			<wfw:commentRss>http://www.petermac.com/creating-your-website-faq/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Upgrading from Microsoft Access &#8211; The options</title>
		<link>http://www.petermac.com/upgrading-from-ms-access/</link>
		<comments>http://www.petermac.com/upgrading-from-ms-access/#comments</comments>
		<pubDate>Sun, 26 Oct 2008 00:11:17 +0000</pubDate>
		<dc:creator>peter</dc:creator>
				<category><![CDATA[Databases]]></category>

		<guid isPermaLink="false">http://www.petermac.com/2008/10/26/upgrading-from-ms-access/</guid>
		<description><![CDATA[A few of my clients have had similar experiences with the Microsoft Access database system. As a light-weight non mission critical solution it offers ease of use and in the right hands can be extremely functional. The problems start usually after a few years of use when a database moves from the &#8216;useful&#8217; to the [...]]]></description>
			<content:encoded><![CDATA[<p>A few of my clients have had similar experiences with the Microsoft Access database system. As a light-weight non mission critical solution it offers ease of use and in the right hands can be extremely functional. The problems start usually after a few years of use when a database moves from the &#8216;useful&#8217; to the &#8211; &#8216;oh my God&#8230;we&#8217;re stuck &#8211; the database has fallen over!&#8217;</p>
<h2>The Database Hobbyist</h2>
<p>Microsoft Access in the right hands is a useful tool for data capture and reporting. One of my clients started to develop his own in-house client recording system around 2001. He&#8217;s in the criminal law business and has pretty specific requirements such as recording hearings and their results. He then started to move some workflow steps into his home-grown solution.  The problem is that six years later his Access database could take up to 20 seconds to perform an update.</p>
<p>The problem with MS Access is it&#8217;s not designed for large datasets especially if the data is text or image based. When you start experiencing insert and update delays and/or you&#8217;re left waiting ages for the database to start-up it&#8217;s probably time for an upgrade.</p>
<h2>Database Upgrade Options</h2>
<p>If you&#8217;re tied into the Microsoft camp (and I can&#8217;t see why you should be), you have a couple of options. You can pay the big dollars for a SQL Server installation and a relatively straight-forward data migration path using SQL Server&#8217;s data migration Wizard. You also have the lower cost option of using the Microsoft Desktop Engine (MSDE). This offers pretty much the same functionality as SQL Server but less in terms of development tools and scalability and backup options. MSDE is not for the Enterprise, it&#8217;s for the corner-shop.<br />
Alternatively if the concept of paying license fees does not sit well, you can go for the &#8216;open source&#8217; solutions of <a href="http://www.mysql.com" target="_blank">MySQL</a> (pronounced My seequel) and <a href="http://www.postgresql.org" target="_blank">PostgreSQL</a> (pronounced post gres Q L) These are database systems that have been developed by teams who provide them free of charge to the community at large. There are commercial options with each solution where you can get support agreements, training and the like, but if all you want is the database up and running on your site for free, these are the options for you.</p>
<p>Both MySQL and PostgreSQL offer migration options supplied by the database vendors (can you call someone a vendor if they give you stuff for free?). There&#8217;s also a couple of third-party solutions such as those provided by <a href="http://www.sqlmaestro.com" target="_blank">SQLMaestro</a> and <a href="http://dbconvert.com" target="_blank">DBConvert</a>.</p>
<h2>Don&#8217;t migrate bad data design</h2>
<p>Whatever solution you go for, you&#8217;ve got to be careful you don&#8217;t migrate bad database design. There&#8217;s a whole lot more to designing an efficient and workable database than using a point and click wizard to build a table to store your contacts in. Of course, at Peter Mac we&#8217;d love to help you in this regard, but if you already know what you&#8217;re doing there&#8217;s a whole lof of online support you can get from the open source communities.</p>
<p><a class="a2a_dd addtoany_share_save" href="http://www.addtoany.com/share_save?linkurl=http%3A%2F%2Fwww.petermac.com%2Fupgrading-from-ms-access%2F&amp;linkname=Upgrading%20from%20Microsoft%20Access%20%26%238211%3B%20The%20options"><img src="http://www.petermac.com/wp-content/plugins/add-to-any/share_save_171_16.png" width="171" height="16" alt="Share/Bookmark"/></a> </p>]]></content:encoded>
			<wfw:commentRss>http://www.petermac.com/upgrading-from-ms-access/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>ClamAV &#8211; Antivirus Scanner on Fedora8</title>
		<link>http://www.petermac.com/clamav-antivirus-scanner-on-fedora8/</link>
		<comments>http://www.petermac.com/clamav-antivirus-scanner-on-fedora8/#comments</comments>
		<pubDate>Wed, 15 Oct 2008 11:23:32 +0000</pubDate>
		<dc:creator>peter</dc:creator>
				<category><![CDATA[Linux]]></category>

		<guid isPermaLink="false">http://www.petermac.com/2008/10/15/clamav-antivirus-scanner-on-fedora8/</guid>
		<description><![CDATA[I&#8217;ve just spent the best part of two hours fighting with the set-up of clamav on a relatively new Fedora 8 Server.  The documentation wasn&#8217;t the greatest so I&#8217;ve decided to do my bit to patch some of the holes. Download clam # sudo yum clamav clamav-server clamav-update A number of instances of the clamd [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve just spent the best part of two hours fighting with the set-up of clamav on a relatively new Fedora 8 Server.  The documentation wasn&#8217;t the greatest so I&#8217;ve decided to do my bit to patch some of the holes.</p>
<p>Download clam</p>
<div class="codecolorer-container text blackboard" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"># sudo yum clamav clamav-server clamav-update</div></div>
<p>A number of instances of the clamd daemon can run concurrently. Each instance needs to be provided with a unique name. To keep things simple, we&#8217;re going to run one instance and call it &#8216;server&#8217;. This name has implications for what is to follow.<br />
Setting up the daemon up as running service involves the following steps:</p>
<p>Phase 1 &#8211; create a daemon user</p>
<p>When you install clamav using the yum utility, a new user is created automatically &#8211; The user is clamav. Most documentation uses this user as the daemon user &#8211; this isn&#8217;t a good idea. The clamav user has rights to update the database containig the list of known virii.   Create a new user clamd with no login rights.</p>
<div class="codecolorer-container text blackboard" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">#sudo useradd -s /sbin/nologin/ clamd</div></div>
<p>Phase 2 &#8211; Copying and renaming config files</p>
<p>Copy assorted files from /usr/share/doc/clamav-server-nn.nn.nn/ (where nn is the version number of your install) to assorted folders, renaming them and modifying their content.</p>
<div class="codecolorer-container text blackboard" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"># cp /usr/share/doc/clam-server-nn.nn.nn/clamd.conf /etc/clamd.d/</div></div>
<div class="codecolorer-container text blackboard" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"># cp /usr/share/doc/clam-server-nn.nn.nn/clamd.sysconfig /etc/sysconfig/clamd.server</div></div>
<div class="codecolorer-container text blackboard" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"># cp /usr/share/doc/clam-server-nn.nn.nn/clamd.logrotate /etc/logrotate.d/clamd</div></div>
<p>Phase 3 &#8211; Editing the configuration files</p>
<p>Start by editing the /etc/clamd.d/clamd.conf file.</p>
<p>Firstly, comment out the line saying Example in file clamd.conf</p>
<div class="codecolorer-container text blackboard" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">&nbsp;LogFile /var/log/clamd/clamd.log<br />
Edit the LogSysLog setting LogSysLog yes<br />
PidFile /var/run/clamd.server/clamd.pid<br />
LocalSocket /var/run/clamd.server/clamd.sock<br />
TcpAddr 127.0.0.1<br />
User clamd</div></div>
<p>Phase 3 &#8211; Create the folders</p>
<p>Create the /var/run/clamd.server folder</p>
<div class="codecolorer-container text blackboard" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">#mkdir /var/run/clamd.server<br />
#chown clamd.clamd /var/run/clamd.server</div></div>
<p>Create the clamd log folder</p>
<div class="codecolorer-container text blackboard" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">&nbsp;#mkdir /var/log/clamd<br />
#touch /var/log/clamd/clamd.log<br />
#chown clamd.clamd -R /var/log/clamd/<br />
#chmod 0620 /var/log/clamd/clamd.log</div></div>
<p>Copy the clamd-wrapper to clamd.server</p>
<p># cp /etc/init.d/clamd-wrapper /etc/init.d/clamd.server</p>
<p>Edit the CLAMD_SERVICE variable in the /etc/init.d/clamd.server file</p>
<p>CLAMD_SERVICE=server</p>
<p>Geez..this is getting complicated&#8230;one final step</p>
<p>Create a clamd.server file in /usr/sbin that links to the original clamd file</p>
<p># ln -s /usr/sbin/clamd.server /usr/sbin/clamd</p>
<p>OK..all systems go&#8230;</p>
<p>now start the daemon</p>
<p>#etc/init.d/clamd.server start</p>
<p>If you want the daemon to start on reboot add it to the startup list using chkconfig</p>
<div class="codecolorer-container text blackboard" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"># /sbin/chkconfig clamd.server start</div></div>
<p>Hopefully you get the green light and have a running clamd daemon. If you don&#8217;t (check using ps auxw | grep clamd) please post a comment and let me know what grief you&#8217;re having.</p>
<p><a class="a2a_dd addtoany_share_save" href="http://www.addtoany.com/share_save?linkurl=http%3A%2F%2Fwww.petermac.com%2Fclamav-antivirus-scanner-on-fedora8%2F&amp;linkname=ClamAV%20%26%238211%3B%20Antivirus%20Scanner%20on%20Fedora8"><img src="http://www.petermac.com/wp-content/plugins/add-to-any/share_save_171_16.png" width="171" height="16" alt="Share/Bookmark"/></a> </p>]]></content:encoded>
			<wfw:commentRss>http://www.petermac.com/clamav-antivirus-scanner-on-fedora8/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Public Key</title>
		<link>http://www.petermac.com/public-key/</link>
		<comments>http://www.petermac.com/public-key/#comments</comments>
		<pubDate>Wed, 15 Oct 2008 02:23:59 +0000</pubDate>
		<dc:creator>peter</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://www.petermac.com/2008/10/15/public-key/</guid>
		<description><![CDATA[&#8212;&#8211;BEGIN PGP PUBLIC KEY BLOCK&#8212;&#8211; Version: GnuPG v1.4.9 (MingW32) mQGiBEj1SQoRBACbRUMtyYFvFa81V7cnzbYJzSfk5MDuUdV0Wo+ckxKKRfW4Qf30 +ORIJeqzirJp9tOd8/uoPVnxNOK4LBKw47W+lHHLUYNMy2qByy7zVBXfg9EXuIrU edebiwM92yODj/VoAxTjI1p5Mmr5fhFSSEo8yh7GTqg8g0j4jWPR+eZxywCgi78d CZ6WmIS+tpNvEqrV/DwQUd0D/R9tyFMuwVKKOcyPxpekJ5RmKk8DDJ7cx6z0s6wM kpx5qpL2QKhVp/3s7t9M40FT3ZmT2ERjJwZzncM8JMxDOK/vS8CRGlTd/JJIzWNj 8SOo55HCq1gJP8U01P1wU1AK9/7n+RcENOGvHEPvKfWweY8HuE8OwHkPGxkqT4og 1TNgA/97226C/NTf7MmOmV5y3yo5k5VUzGRjPpyvZIxIxnQJR4viquNEJfnW9BQT kRw4J7qQePvcbYrvDWxHlJJzlIzQxbBUqVry4K79ByudQA8QaQAT+XJIMjjppgHz rKWB6YVTqsSlfjASM9RqjfDCMZpefpjlq2hvJ2WzyLnYGyEJ+rRuUGV0ZXIgTWFj IEdpb2xsYWZoZWFyZ2EgKEtleSBmb3IgbWFpbCBmcm9tIHBldGVyQHBldGVybWFj LmNvbSAtIFBldGVyIE1hYyBBbmQgQXNzb2NpYXRlcykgPHBldGVyQHBldGVybWFj LmNvbT6IZgQTEQIAJgUCSPVJCgIbIwUJCWYBgAYLCQgHAwIEFQIIAwQWAgMBAh4B AheAAAoJEJlpD3yHCMV4/qYAn0WbPZejFQGgFi3g5IT2Q0D8u++xAJsGmFMdEwPm zFi4mAEAbhfO+tuUr7kCDQRI9UkKEAgAhf491b6MaNOCp1qo9hjvX1NLQ1sORkI9 suP7PceRZfXuqc92GMXw8lYds9cPddtOBPpBZCaezxvRZHfERwiSWEVjEdwXyC5z y8ys8L4jxaPS8YS3SnEjkg+1DCLRb5fry+jiSaFeC2YklFFopSxWiSJQow9+jIPF hfvE4ZswP3EBx54SYC92sZgqfq/DcDcqlOp7gGAxHhxP+rdt4ow4aEzhdzyzNVpb C26BwRWH6T1JtsBSiy0PoaxV2eVl3Fb93aHPVldtdk5p6Pqm03KAbowurFfLshK9 jyPuOyaM8cUSN+RXSgi846mXT0EhY6J4Ofb0rClm8maXwtSHpk8wBwADBQf/b4i6 oDa5K69S2tyERpxAPhSBPdUnYT0oxlZvj75Wp1SfBkmUy8O+1jONIE1+OhLslxke WdFMmDrH8AiRU0q19bGEsKDqUWt58UV7GL26+QZbQWjhz7fWzI6ljftgshmXQozI 3725Y2AVQR3U4BaFNiFrJQECPYLB/yypf8OCsZjspERb+d4J7CXfk5mVkFFAOj7N 5UQv0u+dMVJAP3OCVdEibjXc/c4qPPxLUioAqN8MbixM1OzZDOH55K/oJdRoGyIG mfWU1lToNDCSi7BSqXjPGC+DMDjFc4QfnBFJfV0301GvLshuw+b/r8qJNfxkYkk4 zK/sgbPlXPL032aM4ohPBBgRAgAPBQJI9UkKAhsMBQkJZgGAAAoJEJlpD3yHCMV4 JQMAnA21n/10YG9hXHrUEel1HTFcU+opAJ9KlShcMzJoLI5VVIqfJTa8y/GE+Q== =L39p &#8212;&#8211;END PGP PUBLIC KEY BLOCK&#8212;&#8211; Click here to download this as key as a file]]></description>
			<content:encoded><![CDATA[<p>&#8212;&#8211;BEGIN PGP PUBLIC KEY BLOCK&#8212;&#8211;<br />
Version: GnuPG v1.4.9 (MingW32)</p>
<p>mQGiBEj1SQoRBACbRUMtyYFvFa81V7cnzbYJzSfk5MDuUdV0Wo+ckxKKRfW4Qf30<br />
+ORIJeqzirJp9tOd8/uoPVnxNOK4LBKw47W+lHHLUYNMy2qByy7zVBXfg9EXuIrU<br />
edebiwM92yODj/VoAxTjI1p5Mmr5fhFSSEo8yh7GTqg8g0j4jWPR+eZxywCgi78d<br />
CZ6WmIS+tpNvEqrV/DwQUd0D/R9tyFMuwVKKOcyPxpekJ5RmKk8DDJ7cx6z0s6wM<br />
kpx5qpL2QKhVp/3s7t9M40FT3ZmT2ERjJwZzncM8JMxDOK/vS8CRGlTd/JJIzWNj<br />
8SOo55HCq1gJP8U01P1wU1AK9/7n+RcENOGvHEPvKfWweY8HuE8OwHkPGxkqT4og<br />
1TNgA/97226C/NTf7MmOmV5y3yo5k5VUzGRjPpyvZIxIxnQJR4viquNEJfnW9BQT<br />
kRw4J7qQePvcbYrvDWxHlJJzlIzQxbBUqVry4K79ByudQA8QaQAT+XJIMjjppgHz<br />
rKWB6YVTqsSlfjASM9RqjfDCMZpefpjlq2hvJ2WzyLnYGyEJ+rRuUGV0ZXIgTWFj<br />
IEdpb2xsYWZoZWFyZ2EgKEtleSBmb3IgbWFpbCBmcm9tIHBldGVyQHBldGVybWFj<br />
LmNvbSAtIFBldGVyIE1hYyBBbmQgQXNzb2NpYXRlcykgPHBldGVyQHBldGVybWFj<br />
LmNvbT6IZgQTEQIAJgUCSPVJCgIbIwUJCWYBgAYLCQgHAwIEFQIIAwQWAgMBAh4B<br />
AheAAAoJEJlpD3yHCMV4/qYAn0WbPZejFQGgFi3g5IT2Q0D8u++xAJsGmFMdEwPm<br />
zFi4mAEAbhfO+tuUr7kCDQRI9UkKEAgAhf491b6MaNOCp1qo9hjvX1NLQ1sORkI9<br />
suP7PceRZfXuqc92GMXw8lYds9cPddtOBPpBZCaezxvRZHfERwiSWEVjEdwXyC5z<br />
y8ys8L4jxaPS8YS3SnEjkg+1DCLRb5fry+jiSaFeC2YklFFopSxWiSJQow9+jIPF<br />
hfvE4ZswP3EBx54SYC92sZgqfq/DcDcqlOp7gGAxHhxP+rdt4ow4aEzhdzyzNVpb<br />
C26BwRWH6T1JtsBSiy0PoaxV2eVl3Fb93aHPVldtdk5p6Pqm03KAbowurFfLshK9<br />
jyPuOyaM8cUSN+RXSgi846mXT0EhY6J4Ofb0rClm8maXwtSHpk8wBwADBQf/b4i6<br />
oDa5K69S2tyERpxAPhSBPdUnYT0oxlZvj75Wp1SfBkmUy8O+1jONIE1+OhLslxke<br />
WdFMmDrH8AiRU0q19bGEsKDqUWt58UV7GL26+QZbQWjhz7fWzI6ljftgshmXQozI<br />
3725Y2AVQR3U4BaFNiFrJQECPYLB/yypf8OCsZjspERb+d4J7CXfk5mVkFFAOj7N<br />
5UQv0u+dMVJAP3OCVdEibjXc/c4qPPxLUioAqN8MbixM1OzZDOH55K/oJdRoGyIG<br />
mfWU1lToNDCSi7BSqXjPGC+DMDjFc4QfnBFJfV0301GvLshuw+b/r8qJNfxkYkk4<br />
zK/sgbPlXPL032aM4ohPBBgRAgAPBQJI9UkKAhsMBQkJZgGAAAoJEJlpD3yHCMV4<br />
JQMAnA21n/10YG9hXHrUEel1HTFcU+opAJ9KlShcMzJoLI5VVIqfJTa8y/GE+Q==<br />
=L39p<br />
&#8212;&#8211;END PGP PUBLIC KEY BLOCK&#8212;&#8211;</p>
<p><a href="http://www.petermac.com/wp-content/uploads/2008/11/petermac.com.pub.asc">Click here to download this as key as a file</a></p>
<p><a class="a2a_dd addtoany_share_save" href="http://www.addtoany.com/share_save?linkurl=http%3A%2F%2Fwww.petermac.com%2Fpublic-key%2F&amp;linkname=Public%20Key"><img src="http://www.petermac.com/wp-content/plugins/add-to-any/share_save_171_16.png" width="171" height="16" alt="Share/Bookmark"/></a> </p>]]></content:encoded>
			<wfw:commentRss>http://www.petermac.com/public-key/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Purrfect Java Solutions</title>
		<link>http://www.petermac.com/purrfect-java-solutions/</link>
		<comments>http://www.petermac.com/purrfect-java-solutions/#comments</comments>
		<pubDate>Sun, 05 Aug 2007 04:17:32 +0000</pubDate>
		<dc:creator>peter</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://www.petermac.com/?p=24</guid>
		<description><![CDATA[Meet &#8220;Java&#8221;, a new addition to the PeterMac team. Although only 9 weeks old, she shows great focus in object oriented design (she chases any object that moves). She&#8217;s got an excellent grasp of string manipulation technniques and we have to agree that her display of experience in the J2SE (Sleeping and Eating) area is beyond [...]]]></description>
			<content:encoded><![CDATA[<p>Meet &#8220;Java&#8221;, a new addition to the PeterMac team.</p>
<p><img height="132" alt="java at 9 weeks" src="http://www.petermac.com/wp-content/uploads/2007/08/java_20070805_sm.png" width="214" /></p>
<p>Although only 9 weeks old, she shows great focus in object oriented design (she chases any object that moves). She&#8217;s got an excellent grasp of string manipulation technniques and we have to agree that her display of experience in the J2SE (Sleeping and Eating) area is beyond expectations for one so young.</p>
<p><a class="a2a_dd addtoany_share_save" href="http://www.addtoany.com/share_save?linkurl=http%3A%2F%2Fwww.petermac.com%2Fpurrfect-java-solutions%2F&amp;linkname=Purrfect%20Java%20Solutions"><img src="http://www.petermac.com/wp-content/plugins/add-to-any/share_save_171_16.png" width="171" height="16" alt="Share/Bookmark"/></a> </p>]]></content:encoded>
			<wfw:commentRss>http://www.petermac.com/purrfect-java-solutions/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
