<?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>blogs.teztech.com &#187; C++</title>
	<atom:link href="http://blogs.teztech.com/category/c/feed" rel="self" type="application/rss+xml" />
	<link>http://blogs.teztech.com</link>
	<description>Programming, Rock Climbing and Running</description>
	<lastBuildDate>Mon, 27 May 2013 23:47:36 +0000</lastBuildDate>
	<language>en-US</language>
		<sy:updatePeriod>hourly</sy:updatePeriod>
		<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.9.1</generator>
	<item>
		<title>PHP IDEs</title>
		<link>http://blogs.teztech.com/2009/03/26/php-ides</link>
		<comments>http://blogs.teztech.com/2009/03/26/php-ides#comments</comments>
		<pubDate>Fri, 27 Mar 2009 03:06:21 +0000</pubDate>
		<dc:creator><![CDATA[pj]]></dc:creator>
				<category><![CDATA[.Net]]></category>
		<category><![CDATA[C++]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[Programming]]></category>

		<guid isPermaLink="false">http://teztech.com/?p=21</guid>
		<description><![CDATA[What is an Integrated Development Environment (IDE)? For sure &#8220;IDE&#8221; means different things to different programmers. Some probably think an integrated GUI form editor or WYSIWYG HTML editor is critical. Others may think that the most important parts of an IDE are the text editor and code browser. Others still judge IDEs by their code [&#8230;]]]></description>
				<content:encoded><![CDATA[<p>What is an Integrated Development Environment (IDE)? For sure &#8220;IDE&#8221; means different things to different programmers. Some probably think an integrated GUI form editor or WYSIWYG HTML editor is critical. Others may think that the most important parts of an IDE are the text editor and code browser. Others still judge IDEs by their code &#8220;refactoring&#8221; tools.</p>
<p>For me, the IDE goes back to the days of Borland&#8217;s Turbo Pascal and Turbo C. They didn&#8217;t have GUIs much less GUI form editors, HTML wasn&#8217;t yet invented and I don&#8217;t remember the text editor being anything special. What turned them into IDEs was the super efficient work flow&#8230; A typical &#8220;Hello World&#8221; program was mostly a matter of typing in some code and pressing the Run key. If you wanted to debug, you would set your breakpoints right in the editor, then press the Debug key to start your program under the integrated debugger. <span id="more-21"></span>When your program expanded to more than one file, IDEs had simple project facilities that did a good job of bridging the gap between &#8220;Hello World&#8221; and tools for large projects like &#8220;make&#8221; and &#8220;nmake&#8221;. Later, when the GUI APIs got so big that nobody could keep them all their head, integrated documentation became critical to a smooth workflow. For better or worse, I&#8217;ve become addicted to code completion. It doesn&#8217;t work as well for dynamic languages like PHP, but some code completion is better than none.</p>
<p>So, when I think IDE, I think of an all purpose application that makes a programmer&#8217;s day-to-day workflow smooth and efficient&#8230; I find that anything I can do that cuts down my &#8220;cycle&#8221; time improves my productivity (and my mood).</p>
<p>Every since the days of Microsoft C 6, Microsoft has always had the best IDEs for C/C++ and Windows development. Their documentation is better and better integrated, their compilers are way, way faster and the general work flow is always the smoothest. Visual Studio continues this trend for C/C++ and now C# development &#8211; it sure is easy to crank up a new C# web application and start debugging.</p>
<p>As as web host, I end up working on a lot of different sites. These days, there is a lot of PHP code out there and I end up spending a fair amount of time working on PHP projects. For most my really big projects, I typically use C# and Asp.Net, so I have Visual Studio handy. With a few registry tweaks to syntax highly PHP code, Visual Studio works OK as a text editor for PHP, but I wouldn&#8217;t call it a true PHP IDE. For one thing, there is no integrated debugging support. You can kind of get project file support (PHP files can be listed), but the only integrated documentation is for HTML and JavaScript (and sadly, the Microsoft documentation on these frequently referenced topics is IE centric).</p>
<p>So, several times, I&#8217;ve set out on a mission to find a IDE for PHP programming. Last time around, I gave up and stuck it out using Visual Studio as a text editor. After this last round of reviews, I ended up buying NuSphere&#8217;s PhpED.</p>
<p>When you are in the world of &#8220;free&#8221; software, it is tempting to stick only to &#8220;free&#8221; tools. However, in the case of IDEs, I just couldn&#8217;t find a free one that worked well enough to be better than Visual Studio.</p>
<p>One area where PHP needs a lot of work is support for debugging. The basics are there, but having to fiddle with various debugging DLLs is a hassle &#8211; debugging information has been standard for binary programs for years &#8211; how hard could it be to figure out a standard debugging API for IDEs to use?  Having to use query strings to initiate a debugging session is a serious design mistake. With all the rewriting and other things going on, fiddling with URLs just doesn&#8217;t make sense. Visual Studio is able to attach a debugger to server code in just about any situation &#8211; PHP and its IDEs should make this as easy.</p>
<p>The ability to automatically reformatting HTML in both blocks and full pages is very handy&#8230; plenty of tools (like content management systems) make a real mess of HTML. And, for better or worse, you end up using some of these tools over and over so it&#8217;s not like you can fix the code just once and be done with it.</p>
<p>Below are some notes I made as I tried out various PHP IDEs:</p>
<h2>Eclipse PHP</h2>
<p>No cost and open source</p>
<p>Cross-platform (Java)</p>
<p>Attractive</p>
<p>Amazingly slow and memory hungry &#8211; based on Java and requires a Java Runtime to be installed.</p>
<p>Integrated PHP reference uses the php.net web site so, it requires Internet access and is slow.</p>
<p>No integrated CSS, HTML, JavaScript or DOM reference</p>
<p>No WYSIWYG HTML editor, no integrated page preview, either</p>
<p>HTML reformat is weak and not customizable</p>
<p>Go to definition doesn&#8217;t work reliably</p>
<p>Code completion doesn&#8217;t work reliably</p>
<p>Code completion doesn&#8217;t work in CSS files.</p>
<p>HTML code completion uses upper case for tags and attributes.</p>
<p>Subversion integration is slow and shows incorrect status</p>
<p>Crashes frequently</p>
<p>Debugger worked for a simple page, but did not work in a real project</p>
<h2>Komodo IDE</h2>
<p>Attractive </p>
<p>Cross-platform &#8211; interesting choice of Firefox engine</p>
<p>Reasonable performance and memory usage</p>
<p>Subversion integration is quick and accurate</p>
<p>Once configured, PHP syntax checking is very handy</p>
<p>No WYSIWYG HTML editor, but the integrated page preview is well done</p>
<p>Go to definition doesn&#8217;t work reliably</p>
<p>Code completion doesn&#8217;t work reliable (does not seem to follow include paths).</p>
<p>No integrated PHP, CSS, HTML, JavaScript, DOM or MySQL reference</p>
<p>Copy and paste of files in Projects tree fails with no error message</p>
<p>Deluxe syntax PHP + HTML syntax highlighting.</p>
<p>View unsaved changes off File menus is a great idea! The integration of this feature with the recovery of unsaved changes after a crash is nice, too.</p>
<p>Extremely annoying rendering bugs in the text editor</p>
<p>Code completion for CSS and HTML</p>
<p>CSS code completion is not very good. For example, once you type &#8220;margin:&#8221;, you get a drop list of choices instead of a description of the arguments for the margin style.</p>
<p>HTML code completion is annoying because it defaults to upper-case tags (is anyone still NOT using xhtml for new code?)  and does a poor job of suggesting closing tag (typing &#8220;&lt;/&#8221; does not give a drop list of closing tags).</p>
<h2>PHPEdit</h2>
<p>Attractive</p>
<p>Reasonable performance and memory usage</p>
<p>Subversion integration does not work out of the box.</p>
<p>Integrated PHP and MySQL reference is nice, no integrated CSS, HTML, JavaScript or DOM reference.</p>
<p>The ultra-deluxe syntax highlighting changes the highlighting rules depending on where the caret is placed &#8211; very handy for files with integrated HTML, PHP, CSS and JavaScript!.</p>
<p>No code reformat for any language other than PHP.</p>
<p>No code completion for any language other than PHP (CSS and HTML would be nice).</p>
<p>Go to definition (&#8220;Jump to declaration&#8221;) doesn&#8217;t work across files.</p>
<p>Cannot right click to open a file via a simple require() declaration.</p>
<p>No heroics to resolve PHP include paths for code completion.</p>
<p>DB Explorer is an interesting idea, but I think the most important thing about a database to a programmer is the column definitions (names, types, lengths) and, other than seeing the column names in the DB Explorer tree, there is no way see the column definitions for a table. Manually inputing a &#8220;show columns from&#8221; query into the SQL tab didn&#8217;t work &#8211; you end up with an &#8220;Invalid SELECT statement&#8221; error message in a message box.</p>
<p>Non-standard Alt+Tab behavior is not very useful.</p>
<h2>PhpED</h2>
<p>The debugger actually works! But, it&#8217;s a lot more hassle than it should be.</p>
<p>CSS code completion is OK, but Visual Studio is still the best.</p>
<p>PHP code completion is reasonable and follows include paths in some cases.</p>
<p>Integrated documentation for CVS, CSS, HTML, JavaScript, MySQL, PHP, PostgreSQL  and Smarty &#8211; very nice!</p>
<p>The project system works OK for PHP projects, but it is cumbersome and has odd limitations (you can&#8217;t copy and paste files and folders, for example). </p>
<p>Non-standard Alt+Tab behavior is not very useful.</p>
<p>No Subversion integration</p>
<p>No integrated code reformatting (help provides a good explanation of how to integrate 3rd party tools, but these don&#8217;t seem to work well, either).</p>
<p>One of the real selling</p>
<p>The ability to edit files via FTP or SSH file transfer is nice.</p>
<p>Integrated support for SSH terminals is nice (but why, oh why is copy and paste so difficult?)</p>
<h2>Other Suggestions</h2>
<p>A lot of people use Dreamweaver to edit PHP code. I guess if you come from the design world, this makes sense. Syntax highlighting for PHP is pretty poor, but I will say that Dreamweaver has the best support for code reformatting.</p>
<p>Notepad++ has a good syntax highlighting of many languages and there are add-ons to support FTP and integrated spell check.</p>
]]></content:encoded>
			<wfw:commentRss>http://blogs.teztech.com/2009/03/26/php-ides/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Simple Tracing and Logging for Asp.Net and .Net Command Line Applications</title>
		<link>http://blogs.teztech.com/2007/08/18/simple-tracing-and-logging-for-aspnet-and-net-command-line-applications</link>
		<comments>http://blogs.teztech.com/2007/08/18/simple-tracing-and-logging-for-aspnet-and-net-command-line-applications#comments</comments>
		<pubDate>Sat, 18 Aug 2007 04:51:38 +0000</pubDate>
		<dc:creator><![CDATA[pj]]></dc:creator>
				<category><![CDATA[.Net]]></category>
		<category><![CDATA[C++]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[Programming]]></category>

		<guid isPermaLink="false">http://teztech.com/2007/08/18/simple-tracing-and-logging-for-aspnet-and-net-command-line-applications</guid>
		<description><![CDATA[From time to time, I need some quick and dirty logging in my .Net applications.  I don&#8217;t always have time or energy to worry about the ideal logging API. The MSDN documentation and all the examples I found for the built-in .Net logging facilities were confusing and, it turns out, overkill. Logging in Asp.Net Logging [&#8230;]]]></description>
				<content:encoded><![CDATA[<p>From time to time, I need some quick and dirty logging in my .Net applications.  I don&#8217;t always have time or energy to worry about the <a href="http://teztech.com/2007/08/18/logging-for-services-gui-and-command-line-applications">ideal logging API</a>. The MSDN documentation and all the examples I found for the built-in .Net logging facilities were confusing and, it turns out, overkill.</p>
<h2>Logging in Asp.Net</h2>
<p>Logging in Asp.Net is confusing because Microsoft uses the word &#8220;trace&#8221; in two different contexts:<span id="more-23"></span></p>
<p>When a page is rendered and HTML generated, you can have the Asp.Net engine add a bunch of additional page state information to the generated HTML. In your application&#8217;s web.config file, this is the tracing that is controlled by<br />
&lt;trace&gt;&lt;/trace&gt; under &lt;web.config&gt;&lt;/web.config&gt;. In practice, I don&#8217;t often find this kind of tracing helpful, but when I do,  I put the following tags in web.config to make it easy to turn on or off:<br />
<code><br />
&lt;system.web&gt;<br />
  &lt;customErrors mode="Off"/&gt;<br />
  &lt;trace enabled="false" requestLimit="10" pageOutput="true" traceMode="SortByTime" localOnly="true" /&gt;<br />
  &lt;!-- ... --&gt;<br />
&lt;/system.web&gt;</code></p>
<p>With these tag in place, you can enable and disable page state tracing (more like a dump if you ask me) by changing enabled=&#8221;false&#8221; to enabled=&#8221;true&#8221;.</p>
<p>The other use of the word &#8220;trace&#8221; is related to the more traditional form of logging via .Net Debug.Write and Trace.Write. Essentially, under Asp.Net, you use Debug.Write and Trace.Write as usual. Contrary to the MSDN documentation, the default compiler options for Asp.Net web applications allow Debug.Write output in Debug builds and allow Trace.Write output in both Debug and Release builds. If you run your Asp.Net application under the Visual Studio debugger, you will see that Debug and Trace output is redirected to the debug output window without any additional configuration.  As with any use of .Net logging, you can setup tracing to various outputs either in code or via your application&#8217;s configuration file. To configure your Asp.Net web application to log trace output to a file (for use with <a href="http://unxutils.sourceforge.net/">other tools</a>), place the following into your web.config:<br />
<code><br />
&lt;system.diagnostics&gt;  <br />
  &lt;trace autoflush="true"&gt;    <br />
  &lt;listeners&gt;    <br />
  &lt;add name="MyApplicationTracer" type="System.Diagnostics.TextWriterTraceListener, System, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" initializeData="MyApplicationTrace.log" /&gt;<br />
  &lt;/listeners&gt;<br />
  &lt;/trace&gt;<br />
&lt;/system.diagnostics&gt;</code></p>
<p>This will result in debug (in debug builds) and trace output going into a file named MyApplicaitonTrace.log in your web site&#8217;s root folder.</p>
<h2>Logging in .Net Command Line Applications</h2>
<p>Since .Net applications are easy to create and fairly expressive, I often write small command line utilities that, on other platforms, I might create as shell scripts.  Here are some handy code snips that I use to handle simple logging for these applications:<br />
<code><br />
namespace Program1<br />
{<br />
 ///<br />
<summary></summary>
<p> /// Prepends each output line with the time<br />
 ///<br />
 public class TextWriterTraceListenerWithTime : TextWriterTraceListener<br />
 {<br />
  public TextWriterTraceListenerWithTime()<br />
  : base()<br />
  {<br />
  }</code><code>public TextWriterTraceListenerWithTime(Stream stream)<br />
  : base(stream)<br />
  {<br />
  }</code><code>public TextWriterTraceListenerWithTime(string path)<br />
  : base(path)<br />
  {<br />
  }</code><code>public TextWriterTraceListenerWithTime(TextWriter writer)<br />
  : base(writer)<br />
  {<br />
  }</code><code>public TextWriterTraceListenerWithTime(Stream stream, string name)<br />
  : base(stream, name)<br />
  {<br />
  }</p>
<p>public TextWriterTraceListenerWithTime(string path, string name)<br />
  : base(path, name)<br />
  {<br />
  }</p>
<p>public TextWriterTraceListenerWithTime(TextWriter writer, string name)<br />
  : base(writer, name)<br />
  {<br />
  }</p>
<p>public override void WriteLine(string message)<br />
  {<br />
  base.Write(DateTime.Now.ToString());<br />
  base.Write(" ");<br />
  base.WriteLine(message);<br />
  }<br />
 }</p>
<p>class Program<br />
 {</p>
<p>static void Main(string[] commandLineArgs)<br />
  {<br />
  MemoryStream messageStream = null;<br />
  TextWriterTraceListenerWithTime messageWriter = null;</p>
<p>try<br />
  {<br />
  messageStream = new MemoryStream();<br />
  messageWriter = new TextWriterTraceListenerWithTime(messageStream);<br />
  Trace.Listeners.Add(messageWriter);<br />
  Trace.Listeners.Add(new ConsoleTraceListener());</p>
<p>Trace.WriteLine("This is an example message");<br />
  messageWriter.Flush();</p>
<p>// ...</p>
<p>messageWriter.Flush();<br />
  messageWriter = null;<br />
  }<br />
  catch (Exception e)<br />
  {<br />
  Trace.Write(string.Format("ERROR: A fatal exception occured: {0}: {1}", e.GetType().Name, e.Message));<br />
  if (e.InnerException != null)<br />
  Trace.Write(string.Format(" ({0}: {1})", e.InnerException.GetType().Name, e.InnerException.Message));<br />
  Trace.WriteLine("");</p>
<p>if (messageWriter != null)<br />
  {<br />
  messageWriter.Flush();<br />
  messageStream.Seek(0, SeekOrigin.Begin);<br />
  StreamReader messageReader = new StreamReader(messageStream);<br />
  DbRequest.Singleton.Alert(messageReader.ReadToEnd()); // Send alert message via email<br />
  }<br />
  }<br />
  }<br />
 }<br />
}</p>
<p>Hopefully, you get the idea from the example code above.</p>
<p></code></p>
]]></content:encoded>
			<wfw:commentRss>http://blogs.teztech.com/2007/08/18/simple-tracing-and-logging-for-aspnet-and-net-command-line-applications/feed</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Logging for Services, GUI and Command Line Applications</title>
		<link>http://blogs.teztech.com/2007/08/18/logging-for-services-gui-and-command-line-applications</link>
		<comments>http://blogs.teztech.com/2007/08/18/logging-for-services-gui-and-command-line-applications#comments</comments>
		<pubDate>Sat, 18 Aug 2007 04:50:29 +0000</pubDate>
		<dc:creator><![CDATA[pj]]></dc:creator>
				<category><![CDATA[.Net]]></category>
		<category><![CDATA[C++]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[Programming]]></category>

		<guid isPermaLink="false">http://teztech.com/2007/08/18/logging-for-services-gui-and-command-line-applications</guid>
		<description><![CDATA[This is the first is a series of articles about logging. In this first article, I will describe what I believe is a simple, yet useful logging API. In later articles, I&#8217;ll give some hands on practical advise. As I continue the series, I&#8217;ll add links to the new articles here: Simple Tracing and Logging for Asp.Net and .Net [&#8230;]]]></description>
				<content:encoded><![CDATA[<p>This is the first is a series of articles about logging. In this first article, I will describe what I believe is a simple, yet useful logging API. In later articles, I&#8217;ll give some hands on practical advise. As I continue the series, I&#8217;ll add links to the new articles here:</p>
<ul>
<li><a href="http://teztech.com/2007/08/18/simple-tracing-and-logging-for-aspnet-and-net-command-line-applications">Simple Tracing and Logging for Asp.Net and .Net Command Line Applications</a></li>
</ul>
<p>Wow, some programmers go crazy about logging.  Do a <a href="http://www.google.com/search?hl=en&amp;q=.net+logging">Google search for &#8220;.net logging&#8221;</a> and you&#8217;ll see what I mean. Some of these libraries are huge.  While some applications may really need all the complexity these libraries offer, I have seen it severely abused on more than one occasion. Crank up a copy of <a href="http://teztech.com/2007/02/09/enterprise-overly-complex-and-slow">Blackberry Enterprise Server</a> (BES) and let it run for a week or two. You&#8217;ll find your Windows Event Viewer overflowing with all types of mysterious, confusing and generally useless messages.  In addition to the constant Event Viewer spew, if you let BES run unattended, you&#8217;ll eventually find that your BES hard drive is literally overflowing with many different log files all with obscure names and even more obscure contents.  Exchange Server has a similar problem where some logging is done in Event Viewer, other logging is done to text files. And none of the Exchange Server logging options ever seems to enable the simple email flow messages you need for common day to day administration tasks that I take for granted on our Linux email servers.</p>
<p>Is all this really necessary? <span id="more-22"></span>After 20 years of programming, I&#8217;ve found that the following simple API is more than enough for all my needs:</p>
<p>LogMessage(<em>componentName</em>, <em>severity</em>, <em>format</em>[, <em>formatArg1</em>, <em>formatArg2</em>, ...])</p>
<p>Depending on your programming language and coding standards,  this simple function may need to be wrapped in a class. You might also wrap the function call in a macro to allow for conditional compilation and to keep from having to pass the same <em>componentName</em> over and over.</p>
<p>With this API in mind, you also need a fairly simple configuration system to automatically prefix the messages with time, date, and thread ID and direct messages to some combination of syslog, Windows Event Log, a text file (just 1, please!), console, system debugger, email (for Alerts &#8211; see below)  and user defined functions.</p>
<p>The <em>componentName</em> argument is best handled as a single string determined by the programmer. This keeps things simple, yet gives the programmer a lot of flexibility in both the presentation of messages and the ability to filter messages.</p>
<p>There is no sense in going overboard with adding lots of flexibility for the <em>severity</em> argument. It&#8217;s best to spell things out and keep them simple. You&#8217;re never going to get a group of programmers and system administrators to agree on the difference between &#8220;error&#8221;, &#8220;critical&#8221; and &#8220;alert&#8221;. I use an enumerated type with the following values:</p>
<ul>
<li><strong>Debug</strong> &#8211; Low level messages of interest only to programmers. It should be easy to enable and disable output of debug messages. The only reason a user would enable debug messages is to create a log file to be sent to a programmer. Information messages may be sent to log files and/or UI elements, but they should never be sent to system facilities (such as syslog or the Windows Event Log).</li>
<li><strong>Information</strong> &#8211; Messages that let users know the program is doing what it supposed to do. Information messages are of most value for services where there is no interactive UI to demonstrate that the program is working properly. However, interactive programs can trap Information messages to display status messages during length operations. Information messages may be sent to log files and/or UI elements, but they should never be sent to system facilities.</li>
<li><strong>Warning</strong> &#8211; Messages to let the user know the program encountered a problem, but the problem is not completely unexpected. The program should be able to work around problems that result in warnings (possibly by retrying at a later time).  Warnings should be sent to all log files and system facilities.</li>
<li><strong>Error</strong> &#8211; Messages that need the user&#8217;s attention.  Errors should be sent to all log files and system facilities.</li>
<li><strong>Alert</strong> &#8211; Messages that need the user&#8217;s immediate attention.  The user should be woken from bed. Alerts should be sent to all log files and system facilities.</li>
</ul>
<p>I&#8217;ve found that the most difficult choice is between Error and Alert. For example, at an ISP, email server problems are almost always Alert messages, while for home users or small businesses, email problem can wait until morning. If it&#8217;s not obvious, make everything an Error and assume the administrator will have some way to filter the messages to decide for himself which Errors are really Alerts.</p>
<p>The data type for the <em>format</em> argument depends on your programming language and I8N requirements and tools. For ease of programming, I much prefer to use String.Format style format strings (printf strings in C++ and PHP code).  </p>
<p>I could write an entire article about choosing the best method for formatting strings for output, but quickly:</p>
<p>For production applications, use formatting rather than composition:</p>
<ul>
<li><strong>Do use</strong>: string output = string.Format(&#8220;A = &#8216;{0}&#8217;&#8221;, a)</li>
<li><strong>Do not use</strong>: string output = &#8220;A = &#8216;&#8221; +  a + &#8220;&#8216;&#8221;;</li>
</ul>
<p>As much as I love C++ and <a href="http://www.research.att.com/~bs/C++.html">Bjarne Stroustrup</a> (and understand the arguments for the ability to format user defined types in a safe and type safe manner), favoring formatting over composition leads to programs that are easier to write, easier to read and easier to translate.</p>
<p>If you need to translate your program into other languages, there are two schools of thought for handling literal strings that need to be translated:  </p>
<ul>
<li><strong>In the Windows/Mac style system</strong>, each string is manually assigned a unique integer identifier and all strings are stored in a database of some kind (typically application resources). When the you need a string, you program a call to the database API, passing it the unique integer ID of the string to be retrieved as a lookup key. </li>
<li><strong>In the gettext style system</strong> (UNIX like platforms),  translated versions of the strings are still stored in an external database (though typically in simple text files). However, the original strings created by the programmer (often English) remain in the code. The original strings are used as the lookup key to retrieve the translated string.</li>
</ul>
<p>Kind of like the difference between using raw char* vs. a string class for low level string operations, the Windows style system is the most resource efficient. The gettext system is less tedious to program with and, for better or worse, more tolerant of errors. You can find tools to retrofit your old code for either style. Also, there are various kinds of tools for both systems that allow translators to translate application strings without access to program source code.</p>
<p>Since my API is a lowest common denominator, mapping my simple API to syslog and the Windows Event Log is fairly straightforward.</p>
]]></content:encoded>
			<wfw:commentRss>http://blogs.teztech.com/2007/08/18/logging-for-services-gui-and-command-line-applications/feed</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>
