Tool Time | KeyContent.org.... Unlocking Communication

Tool Time

I develop tools to transform, publish, and track documentation. As I develop tools, or encounter new ones, I'll journal the trials and tribulations of my work.
Well, before I could even discuss the types of tools I use, I encountered something that demands blogging.

I use Ant to build docs; I use a MySQL database to track the docs. Someone recently suggested that I allow writers to control whether a document gets built by setting a bit in the database (via the PHP/Web interface). Seemed easy enough.

...except that there's no direct way to load a property from the results of a SQL SELECT query. Searching the web,I found a handful of posts that suggest how one might do it, but no one explains how. Here's how I did it:

<target name="main" depends="test-it,success,fail"/>
<target name="test-it">
<sql driver="${mysql.driver}"
url="${mysql.url}"
userid="${mysql.user}"
password="${mysql.password}"
print="yes"
showheaders="false"
output="sqltest.txt"
><![CDATA
SELECT autobuild FROM docs WHERE id = '${book-id}';
]></sql>

<loadfile srcfile="sqltest.txt" property="sql-autobuild">
<filterchain>
<headfilter lines="1"/>
<striplinebreaks/>
</filterchain>
</loadfile>
<echo>sql-autobuild is: *${sql-autobuild}*</echo>

<condition property="autobuild" >
<equals arg1="1" arg2="${sql-autobuild}" />
</condition>
<echo>autobuild is: *${autobuild}*</echo>
</target>

<target name="success" if="autobuild">
<echo>Yes, autobuild the job.</echo>
</target>
<target name="fail" unless="autobuild">
<echo>No, do not autobuild the job.</echo>
</target>

If I needed anything more than a single bit from the database, I'd start to create a custom Ant class. If I ever need to do that, I'll document my trials and tribulations here.


A few words of introduction.

My name is Simon Bate. I currently work at Symantec in Durham, NC. My primary job is to generate print and online docs from our sources.

One of my main principles has always been: let the computer do the work.

Thus, to do my job efficiently, consistently, and accurately, software tools development is a big part of my job. Sometimes I find that the best solution is to use tools to develop tools.

I've worked in the field of technical publications for about 30 years. I put in my time as a writer (writing mainly API and other programmer's documents) and a manager. Through that time I always spent some portion of my time doing tools development. I've been developing tools as a full-time gig for the past eight years.

In this BLOG, I intend to write about the tools I'm currently using or evaluating, the challenges I face, the solutions to those challenges, any my current thoughts on what works (and what doesn't work) in the world of tools development.

Next up: Which tools?

Key Pick New

Bill Albing has some suggestions to improve STC competitions. Read and let us know, what do you think?

Other Key Picks... Read more

About KeyContent

About KeyContent
KeyContent.org is an idea space where you can express your insights about your profession. Think of this site as a white board with a brain. You create and edit articles or portals to other sites and share your insights... Read More


Key Ads

Key Connections

Join KeyContent on these networks:



Key Promotions



Key Products