<?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>The Hines57 Blog &#187; Technology</title>
	<atom:link href="http://blog.hines57.com/category/technology/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.hines57.com</link>
	<description>The Hines Family Web Log</description>
	<lastBuildDate>Fri, 23 Sep 2011 17:08:09 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.2.1</generator>
		<item>
		<title>NOTES: Porting IIPImage Server to VS2010</title>
		<link>http://blog.hines57.com/2011/04/01/notes-porting-iipimage-server-to-vs2010/</link>
		<comments>http://blog.hines57.com/2011/04/01/notes-porting-iipimage-server-to-vs2010/#comments</comments>
		<pubDate>Fri, 01 Apr 2011 17:35:22 +0000</pubDate>
		<dc:creator>Bubba</dc:creator>
				<category><![CDATA[Bubba's Update]]></category>
		<category><![CDATA[C\C++]]></category>
		<category><![CDATA[Image Processing]]></category>
		<category><![CDATA[Technology]]></category>
		<category><![CDATA[C C++ IIPImage Visual Studio VS2010 portability]]></category>

		<guid isPermaLink="false">http://blog.hines57.com/?p=533</guid>
		<description><![CDATA[If you aren’t interesting in porting C\C++ code to VS2010, nor are you interested in Image Processing Servers; you probably want to stop reading right about ….. here. For the ...]]></description>
			<content:encoded><![CDATA[<p>If you aren’t interesting in porting C\C++ code to VS2010, nor are you interested in Image Processing Servers; you probably want to stop reading right about ….. here.</p>
<p>For the rest of you, this is a rough documentation of what I have done to get IIP to compile under Windows 7 Ultimate (x64) using Visual Studio 2010 (version 10.0.30319.1). There are my notes for getting it to compile, there are still a few issues, but it compiles and it runs under Apache on Windows. Even though this is a x64 OS, we are relentlessly targeting an x32 architecture in the build.</p>
<p><strong>Created an IIP_Port directory structure</strong></p>
<p><a href="http://photos.hines57.com/images/Porting-IIPImage-Server-to-VS2010_BD90/image.png"><img style="background-image: none; border-bottom: 0px; border-left: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top: 0px; border-right: 0px; padding-top: 0px" title="image" border="0" alt="image" src="http://photos.hines57.com/images/Porting-IIPImage-Server-to-VS2010_BD90/image_thumb.png" width="180" height="163"></a></p>
<h3>Using Visual Studio 10</h3>
<h4>LIBFCGI</h4>
<ol>
<li>Acquired from: <a href="http://www.fastcgi.com/dist/fcgi.tar.gz">http://www.fastcgi.com/dist/fcgi.tar.gz</a></li>
<li>Open C:\iip_port\fcgi-2.4.0\Win32\libfcgi.dsp in Visual Studio.</li>
<li>Copy fcgi_config_x86.h to fcgi_config.h </li>
<li>Convert and Open Projects (Yes)</li>
<li>Build Debug version (Save Solution Name)</li>
<li>Verify C:\iip_port\fcgi-2.4.0\libfcgi\Debug\libfcgi.dll exists</li>
<li>Build Release version</li>
<li>Verify C:\iip_port\fcgi-2.4.0\libfcgi\Release\libfcgi.dll exists</li>
<li>Verify C:\iip_port\fcgi-2.4.0\libfcgi\Release\libfcgi.lib exists</li>
</ol>
<h4>LIBJPEG</h4>
<ol>
<li>Acquired from: <a href="http://www.ijg.org/files/jpegsr8c.zip">http://www.ijg.org/files/jpegsr8c.zip</a></li>
<li>Run C:\iip_port\jpeg-8c&gt;NMAKE /f makefile.vc&nbsp; setup-v10<br />&nbsp;&nbsp; This will move jconfig.vc to jconfig.h and makefiles to project files.<br />&nbsp;&nbsp; (Note that the renaming is critical!)</li>
<li>Open the solution file C:\iip_port\jpeg-8c\jpeg.sln</li>
<li>Build the Release Version of the library project.</li>
<li>Verify C:\iip_port\jpeg-8c\Release\jpeg.lib exists</li>
<li>Open the solution file C:\iip_port\jpeg-8c\apps.sln</li>
<li>Build the Release Version application projects.</li>
<li>Run C:\iip_port\jpeg-8c&gt;NMAKE /f makefile.vc&nbsp; test-build</li>
<li>Verify &#8216;no differences encountered&#8217;</li>
<li>Return to the jpeg.sln</li>
<li>Right click on the project, and go to properties</li>
<li>Modify Configuration Type and change to Dynamic Library (.dll), Click OK</li>
<li>Re-Build the Release Version of the library project.</li>
<li>Verify C:\iip_port\jpeg-8c\Release\jpeg.dll exists</li>
<li>Verify C:\iip_port\jpeg-8c\Release\jpeg.lib exists</li>
<ol>
<li>I had some issues with this, don’t remember precisely what, but had to recompile a couple of different ways to get both the lib and the dll.</li>
</ol>
</ol>
<h4>LIBTIFF</h4>
<ol>
<li>Acquired from: <a href="ftp://ftp.remotesensing.org/pub/libtiff/tiff-3.9.4.zip">ftp://ftp.remotesensing.org/pub/libtiff/tiff-3.9.4.zip</a></li>
<li>C:\iip_port\tiff-3.9.4\libtiff&gt;NMAKE /f makefile.vc</li>
<li>Verify C:\iip_port\tiff-3.9.4\libtiff\libtiff.dll exists</li>
<li>Verify C:\iip_port\tiff-3.9.4\libtiff\libtiff.lib exists</li>
<ol>
<li>I had some issues with this, don’t remember precisely what, but had to recompile a couple of different ways to get both the lib and the dll.</li>
</ol>
</ol>
<h4>ZLIB</h4>
<ol>
<li>Acquired from: <a href="http://zlib.net/zlib125.zip">http://zlib.net/zlib125.zip</a></li>
<li>Also get <a href="http://www.winimage.com/zLibDll/zlib125dll.zip">http://www.winimage.com/zLibDll/zlib125dll.zip</a></li>
<li>unzipped both to C:\iip_port\zlib-1.2.5\</li>
<li>Verify C:\iip_port\zlib-1.2.5\dll32\zlibwapi.dll exists</li>
<li>Verify C:\iip_port\zlib-1.2.5\dll32\zlibwapi.lib exists</li>
<li>Verify C:\iip_port\zlib-1.2.5\zlib.h exists</li>
</ol>
<h3>IIPSRV</h3>
<ol>
<li>Open Visual Studio 10</li>
<li>File -&gt; New –&gt; Project</li>
<li>Select Visual C++ -&gt; Win32 Console Application</li>
<li>Name it IIPSRV</li>
<li>Modify Location to: C:\iip_port\iipsrv</li>
<li>OK, then Next</li>
<li>Select Empty Project</li>
<li>Finish</li>
<li></li>
<li>Right click the project, ADD Existing, and select all files in C:\iip_port\iipsrv to add</li>
<li>Right click the project, ADD Existing, and select all files in C:\iip_port\iipsrv\src to add</li>
<li>Right click the project, Open Properties</li>
<ol>
<li><strong>Under C/C++ -&gt;<em> General</em></strong> We need to add additional <em>Include Directories</em></li>
<ol>
<li>C:\iip_port\fcgi-2.4.0\include</li>
<li>C:\iip_port\jpeg-8c</li>
<li>C:\iip_port\tiff-3.9.4\libtiff</li>
<li>C:\iip_port\zlib-1.2.5</li>
<li>After you click apply, wait a second for it to find/recompile the new headers from the path</li>
</ol>
<li><strong>Under Linker</strong> -&gt; <strong><em>General</em></strong> We need to add additional <em>Library Directories</em></li>
<ol>
<li>C:\iip_port\fcgi-2.4.0\libfcgi\Release</li>
<li>C:\iip_port\jpeg-8c\Release</li>
<li>C:\iip_port\tiff-3.9.4\libtiff</li>
<li>C:\iip_port\zlib-1.2.5\dll32</li>
<li>After you click apply, wait a second for it to find/recompile the new headers from the path</li>
</ol>
<li><strong>Under Linker</strong> –&gt; <strong><em>Input</em></strong> We need to add additional<em> Dependencies</em></li>
<ol>
<li>libfcgi.lib</li>
<li>libtiff.lib</li>
<li>zlibwapi.lib</li>
<li>jpeg.lib<!--EndFragment--></li>
</ol>
</ol>
<li>Build Solution (Debug Version)</li>
<li>Should Have 50 Build errors (right click the error list and turn off Show Intellisense Errors)</li>
<li>Right Click KakaduImage.cc and remove from project</li>
</ol>
<p><em>The MS Compiler doesn&#8217;t support snprintf, we need to alias that to _snprintf so it will work. </em></p>
<p>We will make the following modifications to source files:</p>
<h4>IIPResponse.h&nbsp;
<pre style="border-bottom: #cecece 1px solid; border-left: #cecece 1px solid; padding-bottom: 5px; background-color: #fbfbfb; min-height: 40px; padding-left: 5px; width: 650px; padding-right: 5px; overflow: auto; border-top: #cecece 1px solid; border-right: #cecece 1px solid; padding-top: 5px">
<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 10px">  1: #<span style="color: #0000ff">if</span> _MSC_VER
</pre>
<pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 10px">  2:  #define snprintf _snprintf
</pre>
<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 10px">  3: #endif</pre>
</pre>
<p>Cache.h</h4>
<pre style="border-bottom: #cecece 1px solid; border-left: #cecece 1px solid; padding-bottom: 5px; background-color: #fbfbfb; min-height: 40px; padding-left: 5px; width: 650px; padding-right: 5px; overflow: auto; border-top: #cecece 1px solid; border-right: #cecece 1px solid; padding-top: 5px">
<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 10px">  1: #<span style="color: #0000ff">if</span> _MSC_VER
</pre>
<pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 10px">  2:  #define snprintf _snprintf
</pre>
<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 10px">  3: #endif</pre>
</pre>
<h4>IIPImage.h
<pre style="border-bottom: #cecece 1px solid; border-left: #cecece 1px solid; padding-bottom: 5px; background-color: #fbfbfb; min-height: 40px; padding-left: 5px; width: 650px; padding-right: 5px; overflow: auto; border-top: #cecece 1px solid; border-right: #cecece 1px solid; padding-top: 5px">
<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 10px">  1:     #<span style="color: #0000ff">if</span> _MSC_VER
</pre>
<pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 10px">  2:         #define snprintf _snprintf
</pre>
<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 10px">  3:         #include &lt;<span style="color: #0000ff">time</span>.h&gt;
</pre>
<pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 10px">  4:         #define S_ISREG(mode)  (((mode) &amp; S_IFMT) == S_IFREG)
</pre>
<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 10px">  5:     #endif</pre>
</pre>
</h4>
<h4>fif.cc</h4>
<p>
<pre style="border-bottom: #cecece 1px solid; border-left: #cecece 1px solid; padding-bottom: 5px; background-color: #fbfbfb; min-height: 40px; padding-left: 5px; width: 686px; padding-right: 5px; height: 4297px; overflow: auto; border-top: #cecece 1px solid; border-right: #cecece 1px solid; padding-top: 5px">
<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 8px">  1:   #include &lt;algorithm&gt;
</pre>
<pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 8px">  2:   #include &lt;locale&gt;
</pre>
<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 8px">  3:     #<span style="color: #0000ff">if</span> _MSC_VER
</pre>
<pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 8px">  4: <span style="color: #008000">// Implement strptime under windows</span>
</pre>
<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 8px">  5: <span style="color: #0000ff">static</span> <span style="color: #0000ff">const</span> <span style="color: #0000ff">char</span>* kWeekFull[] = {
</pre>
<pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 8px">  6:   "<span style="color: #8b0000">Sunday</span>", "<span style="color: #8b0000">Monday</span>", "<span style="color: #8b0000">Tuesday</span>", "<span style="color: #8b0000">Wednesday</span>",
</pre>
<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 8px">  7:   "<span style="color: #8b0000">Thursday</span>", "<span style="color: #8b0000">Friday</span>", "<span style="color: #8b0000">Saturday</span>"
</pre>
<pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 8px">  8: };
</pre>
<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 8px">  9:
</pre>
<pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 8px"> 10: <span style="color: #0000ff">static</span> <span style="color: #0000ff">const</span> <span style="color: #0000ff">char</span>* kWeekAbbr[] = {
</pre>
<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 8px"> 11:   "<span style="color: #8b0000">Sun</span>", "<span style="color: #8b0000">Mon</span>", "<span style="color: #8b0000">Tue</span>", "<span style="color: #8b0000">Wed</span>",
</pre>
<pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 8px"> 12:   "<span style="color: #8b0000">Thu</span>", "<span style="color: #8b0000">Fri</span>", "<span style="color: #8b0000">Sat</span>"
</pre>
<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 8px"> 13: };
</pre>
<pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 8px"> 14:
</pre>
<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 8px"> 15: <span style="color: #0000ff">static</span> <span style="color: #0000ff">const</span> <span style="color: #0000ff">char</span>* kMonthFull[] = {
</pre>
<pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 8px"> 16:   "<span style="color: #8b0000">January</span>", "<span style="color: #8b0000">February</span>", "<span style="color: #8b0000">March</span>", "<span style="color: #8b0000">April</span>", "<span style="color: #8b0000">May</span>", "<span style="color: #8b0000">June</span>",
</pre>
<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 8px"> 17:   "<span style="color: #8b0000">July</span>", "<span style="color: #8b0000">August</span>", "<span style="color: #8b0000">September</span>", "<span style="color: #8b0000">October</span>", "<span style="color: #8b0000">November</span>", "<span style="color: #8b0000">December</span>"
</pre>
<pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 8px"> 18: };
</pre>
<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 8px"> 19:
</pre>
<pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 8px"> 20: <span style="color: #0000ff">static</span> <span style="color: #0000ff">const</span> <span style="color: #0000ff">char</span>* kMonthAbbr[] = {
</pre>
<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 8px"> 21:   "<span style="color: #8b0000">Jan</span>", "<span style="color: #8b0000">Feb</span>", "<span style="color: #8b0000">Mar</span>", "<span style="color: #8b0000">Apr</span>", "<span style="color: #8b0000">May</span>", "<span style="color: #8b0000">Jun</span>",
</pre>
<pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 8px"> 22:   "<span style="color: #8b0000">Jul</span>", "<span style="color: #8b0000">Aug</span>", "<span style="color: #8b0000">Sep</span>", "<span style="color: #8b0000">Oct</span>", "<span style="color: #8b0000">Nov</span>", "<span style="color: #8b0000">Dec</span>"
</pre>
<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 8px"> 23: };
</pre>
<pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 8px"> 24:
</pre>
<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 8px"> 25: <span style="color: #0000ff">static</span> <span style="color: #0000ff">const</span> <span style="color: #0000ff">char</span>* _parse_num(<span style="color: #0000ff">const</span> <span style="color: #0000ff">char</span>* s, <span style="color: #0000ff">int</span> low, <span style="color: #0000ff">int</span> high, <span style="color: #0000ff">int</span>* value) {
</pre>
<pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 8px"> 26:   <span style="color: #0000ff">const</span> <span style="color: #0000ff">char</span>* p = s;
</pre>
<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 8px"> 27:   <span style="color: #0000ff">for</span> (*value = 0; *p != NULL &amp;&amp; isdigit(*p); ++p) {
</pre>
<pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 8px"> 28:     *value = (*value) * 10 + static_cast&lt;<span style="color: #0000ff">int</span>&gt;(*p) - static_cast&lt;<span style="color: #0000ff">int</span>&gt;('0');
</pre>
<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 8px"> 29:   }
</pre>
<pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 8px"> 30:
</pre>
<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 8px"> 31:   <span style="color: #0000ff">if</span> (p == s || *value &lt; low || *value &gt; high) <span style="color: #0000ff">return</span> NULL;
</pre>
<pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 8px"> 32:   <span style="color: #0000ff">return</span> p;
</pre>
<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 8px"> 33: }
</pre>
<pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 8px"> 34:
</pre>
<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 8px"> 35: <span style="color: #0000ff">static</span> <span style="color: #0000ff">char</span>* _strptime(<span style="color: #0000ff">const</span> <span style="color: #0000ff">char</span> *s, <span style="color: #0000ff">const</span> <span style="color: #0000ff">char</span> *format, <span style="color: #0000ff">struct</span> tm *tm) {
</pre>
<pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 8px"> 36:   <span style="color: #0000ff">while</span> (*format != NULL &amp;&amp; *s != NULL) {
</pre>
<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 8px"> 37:     <span style="color: #0000ff">if</span> (*format != '%') {
</pre>
<pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 8px"> 38:       <span style="color: #0000ff">if</span> (*s != *format) <span style="color: #0000ff">return</span> NULL;
</pre>
<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 8px"> 39:
</pre>
<pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 8px"> 40:       ++format;
</pre>
<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 8px"> 41:       ++s;
</pre>
<pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 8px"> 42:       <span style="color: #0000ff">continue</span>;
</pre>
<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 8px"> 43:     }
</pre>
<pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 8px"> 44:
</pre>
<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 8px"> 45:     ++format;
</pre>
<pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 8px"> 46:     <span style="color: #0000ff">int</span> len = 0;
</pre>
<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 8px"> 47:     <span style="color: #0000ff">switch</span> (*format) {
</pre>
<pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 8px"> 48:       <span style="color: #008000">// weekday name.</span>
</pre>
<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 8px"> 49:       <span style="color: #0000ff">case</span> 'a':
</pre>
<pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 8px"> 50:       <span style="color: #0000ff">case</span> 'A':
</pre>
<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 8px"> 51:         tm-&gt;tm_wday = -1;
</pre>
<pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 8px"> 52:         <span style="color: #0000ff">for</span> (<span style="color: #0000ff">int</span> i = 0; i &lt; 7; ++i) {
</pre>
<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 8px"> 53:           len = static_cast&lt;<span style="color: #0000ff">int</span>&gt;(strlen(kWeekAbbr[i]));
</pre>
<pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 8px"> 54:           <span style="color: #0000ff">if</span> (strnicmp(kWeekAbbr[i], s, len) == 0) {
</pre>
<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 8px"> 55:             tm-&gt;tm_wday = i;
</pre>
<pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 8px"> 56:             <span style="color: #0000ff">break</span>;
</pre>
<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 8px"> 57:           }
</pre>
<pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 8px"> 58:
</pre>
<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 8px"> 59:           len = static_cast&lt;<span style="color: #0000ff">int</span>&gt;(strlen(kWeekFull[i]));
</pre>
<pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 8px"> 60:           <span style="color: #0000ff">if</span> (strnicmp(kWeekFull[i], s, len) == 0) {
</pre>
<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 8px"> 61:             tm-&gt;tm_wday = i;
</pre>
<pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 8px"> 62:             <span style="color: #0000ff">break</span>;
</pre>
<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 8px"> 63:           }
</pre>
<pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 8px"> 64:         }
</pre>
<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 8px"> 65:         <span style="color: #0000ff">if</span> (tm-&gt;tm_wday == -1) <span style="color: #0000ff">return</span> NULL;
</pre>
<pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 8px"> 66:         s += len;
</pre>
<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 8px"> 67:         <span style="color: #0000ff">break</span>;
</pre>
<pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 8px"> 68:
</pre>
<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 8px"> 69:       <span style="color: #008000">// month name.</span>
</pre>
<pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 8px"> 70:       <span style="color: #0000ff">case</span> 'b':
</pre>
<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 8px"> 71:       <span style="color: #0000ff">case</span> 'B':
</pre>
<pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 8px"> 72:       <span style="color: #0000ff">case</span> 'h':
</pre>
<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 8px"> 73:         tm-&gt;tm_mon = -1;
</pre>
<pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 8px"> 74:         <span style="color: #0000ff">for</span> (<span style="color: #0000ff">int</span> i = 0; i &lt; 12; ++i) {
</pre>
<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 8px"> 75:           len = static_cast&lt;<span style="color: #0000ff">int</span>&gt;(strlen(kMonthAbbr[i]));
</pre>
<pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 8px"> 76:           <span style="color: #0000ff">if</span> (strnicmp(kMonthAbbr[i], s, len) == 0) {
</pre>
<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 8px"> 77:             tm-&gt;tm_mon = i;
</pre>
<pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 8px"> 78:             <span style="color: #0000ff">break</span>;
</pre>
<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 8px"> 79:           }
</pre>
<pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 8px"> 80:
</pre>
<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 8px"> 81:           len = static_cast&lt;<span style="color: #0000ff">int</span>&gt;(strlen(kMonthFull[i]));
</pre>
<pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 8px"> 82:           <span style="color: #0000ff">if</span> (strnicmp(kMonthFull[i], s, len) == 0) {
</pre>
<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 8px"> 83:             tm-&gt;tm_mon = i;
</pre>
<pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 8px"> 84:             <span style="color: #0000ff">break</span>;
</pre>
<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 8px"> 85:           }
</pre>
<pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 8px"> 86:         }
</pre>
<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 8px"> 87:         <span style="color: #0000ff">if</span> (tm-&gt;tm_mon == -1) <span style="color: #0000ff">return</span> NULL;
</pre>
<pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 8px"> 88:         s += len;
</pre>
<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 8px"> 89:         <span style="color: #0000ff">break</span>;
</pre>
<pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 8px"> 90:
</pre>
<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 8px"> 91:       <span style="color: #008000">// month [1, 12].</span>
</pre>
<pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 8px"> 92:       <span style="color: #0000ff">case</span> 'm':
</pre>
<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 8px"> 93:         s = _parse_num(s, 1, 12, &amp;tm-&gt;tm_mon);
</pre>
<pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 8px"> 94:         <span style="color: #0000ff">if</span> (s == NULL) <span style="color: #0000ff">return</span> NULL;
</pre>
<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 8px"> 95:         --tm-&gt;tm_mon;
</pre>
<pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 8px"> 96:         <span style="color: #0000ff">break</span>;
</pre>
<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 8px"> 97:
</pre>
<pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 8px"> 98:       <span style="color: #008000">// day [1, 31].</span>
</pre>
<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 8px"> 99:       <span style="color: #0000ff">case</span> 'd':
</pre>
<pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 8px">100:       <span style="color: #0000ff">case</span> 'e':
</pre>
<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 8px">101:         s = _parse_num(s, 1, 31, &amp;tm-&gt;tm_mday);
</pre>
<pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 8px">102:         <span style="color: #0000ff">if</span> (s == NULL) <span style="color: #0000ff">return</span> NULL;
</pre>
<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 8px">103:         <span style="color: #0000ff">break</span>;
</pre>
<pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 8px">104:
</pre>
<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 8px">105:       <span style="color: #008000">// hour [0, 23].</span>
</pre>
<pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 8px">106:       <span style="color: #0000ff">case</span> 'H':
</pre>
<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 8px">107:         s = _parse_num(s, 0, 23, &amp;tm-&gt;tm_hour);
</pre>
<pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 8px">108:         <span style="color: #0000ff">if</span> (s == NULL) <span style="color: #0000ff">return</span> NULL;
</pre>
<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 8px">109:         <span style="color: #0000ff">break</span>;
</pre>
<pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 8px">110:
</pre>
<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 8px">111:       <span style="color: #008000">// minute [0, 59]</span>
</pre>
<pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 8px">112:       <span style="color: #0000ff">case</span> 'M':
</pre>
<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 8px">113:         s = _parse_num(s, 0, 59, &amp;tm-&gt;tm_min);
</pre>
<pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 8px">114:         <span style="color: #0000ff">if</span> (s == NULL) <span style="color: #0000ff">return</span> NULL;
</pre>
<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 8px">115:         <span style="color: #0000ff">break</span>;
</pre>
<pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 8px">116:
</pre>
<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 8px">117:       <span style="color: #008000">// seconds [0, 60]. 60 is for leap year.</span>
</pre>
<pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 8px">118:       <span style="color: #0000ff">case</span> 'S':
</pre>
<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 8px">119:         s = _parse_num(s, 0, 60, &amp;tm-&gt;tm_sec);
</pre>
<pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 8px">120:         <span style="color: #0000ff">if</span> (s == NULL) <span style="color: #0000ff">return</span> NULL;
</pre>
<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 8px">121:         <span style="color: #0000ff">break</span>;
</pre>
<pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 8px">122:
</pre>
<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 8px">123:       <span style="color: #008000">// year [1900, 9999].</span>
</pre>
<pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 8px">124:       <span style="color: #0000ff">case</span> 'Y':
</pre>
<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 8px">125:         s = _parse_num(s, 1900, 9999, &amp;tm-&gt;tm_year);
</pre>
<pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 8px">126:         <span style="color: #0000ff">if</span> (s == NULL) <span style="color: #0000ff">return</span> NULL;
</pre>
<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 8px">127:         tm-&gt;tm_year -= 1900;
</pre>
<pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 8px">128:         <span style="color: #0000ff">break</span>;
</pre>
<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 8px">129:
</pre>
<pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 8px">130:       <span style="color: #008000">// year [0, 99].</span>
</pre>
<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 8px">131:       <span style="color: #0000ff">case</span> 'y':
</pre>
<pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 8px">132:         s = _parse_num(s, 0, 99, &amp;tm-&gt;tm_year);
</pre>
<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 8px">133:         <span style="color: #0000ff">if</span> (s == NULL) <span style="color: #0000ff">return</span> NULL;
</pre>
<pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 8px">134:         <span style="color: #0000ff">if</span> (tm-&gt;tm_year &lt;= 68) {
</pre>
<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 8px">135:           tm-&gt;tm_year += 100;
</pre>
<pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 8px">136:         }
</pre>
<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 8px">137:         <span style="color: #0000ff">break</span>;
</pre>
<pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 8px">138:
</pre>
<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 8px">139:       <span style="color: #008000">// arbitray whitespace.</span>
</pre>
<pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 8px">140:       <span style="color: #0000ff">case</span> 't':
</pre>
<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 8px">141:       <span style="color: #0000ff">case</span> 'n':
</pre>
<pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 8px">142:         <span style="color: #0000ff">while</span> (isspace(*s)) ++s;
</pre>
<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 8px">143:         <span style="color: #0000ff">break</span>;
</pre>
<pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 8px">144:
</pre>
<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 8px">145:       <span style="color: #008000">// '%'.</span>
</pre>
<pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 8px">146:       <span style="color: #0000ff">case</span> '%':
</pre>
<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 8px">147:         <span style="color: #0000ff">if</span> (*s != '%') <span style="color: #0000ff">return</span> NULL;
</pre>
<pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 8px">148:         ++s;
</pre>
<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 8px">149:         <span style="color: #0000ff">break</span>;
</pre>
<pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 8px">150:
</pre>
<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 8px">151:       <span style="color: #008000">// All the other format are not supported.</span>
</pre>
<pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 8px">152:       <span style="color: #0000ff">default</span>:
</pre>
<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 8px">153:         <span style="color: #0000ff">return</span> NULL;
</pre>
<pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 8px">154:     }
</pre>
<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 8px">155:     ++format;
</pre>
<pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 8px">156:   }
</pre>
<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 8px">157:
</pre>
<pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 8px">158:   <span style="color: #0000ff">if</span> (*format != NULL) {
</pre>
<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 8px">159:     <span style="color: #0000ff">return</span> NULL;
</pre>
<pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 8px">160:   } <span style="color: #0000ff">else</span> {
</pre>
<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 8px">161:     <span style="color: #0000ff">return</span> const_cast&lt;<span style="color: #0000ff">char</span>*&gt;(s);
</pre>
<pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 8px">162:   }
</pre>
<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 8px">163: }
</pre>
<pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 8px">164:
</pre>
<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 8px">165: <span style="color: #0000ff">char</span>* strptime(<span style="color: #0000ff">const</span> <span style="color: #0000ff">char</span> *buf, <span style="color: #0000ff">const</span> <span style="color: #0000ff">char</span> *fmt, <span style="color: #0000ff">struct</span> tm *tm) {
</pre>
<pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 8px">166:   <span style="color: #0000ff">return</span> _strptime(buf, fmt, tm);
</pre>
<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 8px">167: }
</pre>
<pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 8px">168:
</pre>
<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 8px">169:
</pre>
<pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 8px">170:
</pre>
<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 8px">171: <span style="color: #0000ff">static</span> time_t timegm(<span style="color: #0000ff">struct</span> tm *tm){
</pre>
<pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 8px">172:   time_t answer;
</pre>
<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 8px">173:   <span style="color: #0000ff">char</span> *zone;
</pre>
<pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 8px">174:
</pre>
<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 8px">175:   zone=<span style="color: #0000ff">getenv</span>("<span style="color: #8b0000">TZ</span>");
</pre>
<pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 8px">176:   putenv("<span style="color: #8b0000">TZ=UTC</span>");
</pre>
<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 8px">177:   tzset();
</pre>
<pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 8px">178:   answer=mktime(tm);
</pre>
<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 8px">179:   <span style="color: #0000ff">if</span>(zone)
</pre>
<pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 8px">180:     {
</pre>
<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 8px">181:       <span style="color: #0000ff">char</span> *old_zone;
</pre>
<pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 8px">182:
</pre>
<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 8px">183:       old_zone=(<span style="color: #0000ff">char</span> *)<span style="color: #0000ff">malloc</span>(3+strlen(zone)+1);
</pre>
<pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 8px">184:       <span style="color: #0000ff">if</span>(old_zone)
</pre>
<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 8px">185:     {
</pre>
<pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 8px">186:       <span style="color: #0000ff">strcpy</span>(old_zone,"<span style="color: #8b0000">TZ=</span>");
</pre>
<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 8px">187:       strcat(old_zone,zone);
</pre>
<pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 8px">188:       putenv(old_zone);
</pre>
<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 8px">189:     }
</pre>
<pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 8px">190:     }
</pre>
<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 8px">191:   <span style="color: #0000ff">else</span>
</pre>
<pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 8px">192: #ifdef HAVE_UNSETENV
</pre>
<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 8px">193:     unsetenv("<span style="color: #8b0000">TZ</span>");
</pre>
<pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 8px">194: #<span style="color: #0000ff">else</span>
</pre>
<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 8px">195:     putenv("<span style="color: #8b0000">TZ</span>");
</pre>
<pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 8px">196: #endif
</pre>
<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 8px">197:
</pre>
<pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 8px">198:   tzset();
</pre>
<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 8px">199:   <span style="color: #0000ff">return</span> answer;
</pre>
<pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 8px">200: }
</pre>
<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 8px">201: #endif
</pre>
<pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 8px">202:
</pre>
<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 8px">203: </pre>
</pre>
<p>near line 75 replace<br />&nbsp; <br />&nbsp; <font face="Courier New">std::isxdigit(*(iter + 1)) &amp;&amp; std::isxdigit(*(iter + 2)) ){</font><br />&nbsp; <br />with
<pre style="border-bottom: #cecece 1px solid; border-left: #cecece 1px solid; padding-bottom: 5px; background-color: #fbfbfb; min-height: 40px; padding-left: 5px; width: 650px; padding-right: 5px; overflow: auto; border-top: #cecece 1px solid; border-right: #cecece 1px solid; padding-top: 5px">
<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 8px">  1:   #<span style="color: #0000ff">if</span> _MSC_VER
</pre>
<pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 8px">  2:     isxdigit(*(iter + 1)) &amp;&amp; isxdigit(*(iter + 2)) ){
</pre>
<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 8px">  3:   #<span style="color: #0000ff">else</span>
</pre>
<pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 8px">  4:     std::isxdigit(*(iter + 1)) &amp;&amp; std::isxdigit(*(iter + 2)) ){
</pre>
<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 8px">  5:   #endif</pre>
</pre>
<h4>CVT.cc</h4>
<p>
<pre style="border-bottom: #cecece 1px solid; border-left: #cecece 1px solid; padding-bottom: 5px; background-color: #fbfbfb; min-height: 40px; padding-left: 5px; width: 650px; padding-right: 5px; overflow: auto; border-top: #cecece 1px solid; border-right: #cecece 1px solid; padding-top: 5px">
<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 8px">  1:   #<span style="color: #0000ff">if</span> _MSC_VER
</pre>
<pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 8px">  2:   #include &lt;algorithm&gt;
</pre>
<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 8px">  3:   #include &lt;locale&gt;
</pre>
<pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 8px">  4:   #endif</pre>
</pre>
<h4>DeepZoom.cc</h4>
<p>Near the top add (because microsoft doesn&#8217;t provide the log2 function for us)
<pre style="border-bottom: #cecece 1px solid; border-left: #cecece 1px solid; padding-bottom: 5px; background-color: #fbfbfb; min-height: 40px; padding-left: 5px; width: 650px; padding-right: 5px; overflow: auto; border-top: #cecece 1px solid; border-right: #cecece 1px solid; padding-top: 5px">
<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 8px">  1: #<span style="color: #0000ff">if</span> _MSC_VER
</pre>
<pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 8px">  2: <span style="color: #0000ff">double</span> <span style="color: #0000ff">log</span>2(<span style="color: #0000ff">double</span> max){
</pre>
<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 8px">  3:     <span style="color: #0000ff">return</span> <span style="color: #0000ff">log</span>((<span style="color: #0000ff">double</span>)max)/<span style="color: #0000ff">log</span>((<span style="color: #0000ff">double</span>)2);
</pre>
<pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 8px">  4: }
</pre>
<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 8px">  5: #endif</pre>
</pre>
<h4>IIPImage.cc</h4>
<p>
<pre style="border-bottom: #cecece 1px solid; border-left: #cecece 1px solid; padding-bottom: 5px; background-color: #fbfbfb; min-height: 40px; padding-left: 5px; width: 650px; padding-right: 5px; overflow: auto; border-top: #cecece 1px solid; border-right: #cecece 1px solid; padding-top: 5px">
<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 8px">  1:     #<span style="color: #0000ff">if</span> _MSC_VER
</pre>
<pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 8px">  2:         #define snprintf _snprintf
</pre>
<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 8px">  3:         #include &lt;<span style="color: #0000ff">time</span>.h&gt;
</pre>
<pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 8px">  4:         #define S_ISREG(mode)  (((mode) &amp; S_IFMT) == S_IFREG)
</pre>
<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 8px">  5:     #endif</pre>
</pre>
<h4>FIF.cc
<pre style="border-bottom: #cecece 1px solid; border-left: #cecece 1px solid; padding-bottom: 5px; background-color: #fbfbfb; min-height: 40px; padding-left: 5px; width: 650px; padding-right: 5px; overflow: auto; border-top: #cecece 1px solid; border-right: #cecece 1px solid; padding-top: 5px">
<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 8px">  1: #include &lt;<span style="color: #0000ff">time</span>.h&gt;</pre>
</pre>
</h4>
<h4>JPEGCompressor.cc</h4>
<p>around line 388 Replace:<br />&nbsp; <font face="Courier New">unsigned char t[width*height*channels+1024]; // Add an extra 1k for extra buffering</font><br />with
<pre style="border-bottom: #cecece 1px solid; border-left: #cecece 1px solid; padding-bottom: 5px; background-color: #fbfbfb; min-height: 40px; padding-left: 5px; width: 650px; padding-right: 5px; overflow: auto; border-top: #cecece 1px solid; border-right: #cecece 1px solid; padding-top: 5px">
<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 8px">  1:   <span style="color: #0000ff">unsigned</span> <span style="color: #0000ff">char</span> * t;
</pre>
<pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 8px">  2:   t = new <span style="color: #0000ff">unsigned</span> <span style="color: #0000ff">char</span>[width*height*channels+1024]; <span style="color: #008000">// Add an extra 1k for extra buffering</span></pre>
</pre>
<h4>Watermark.cc</h4>
<p>around line 47 Replace:<br />&nbsp; <font face="Courier New">uint32 buffer[_width*_height];</font><br />with
<pre style="border-bottom: #cecece 1px solid; border-left: #cecece 1px solid; padding-bottom: 5px; background-color: #fbfbfb; min-height: 40px; padding-left: 5px; width: 650px; padding-right: 5px; overflow: auto; border-top: #cecece 1px solid; border-right: #cecece 1px solid; padding-top: 5px">
<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 8px">  1:   uint32 * buffer;
</pre>
<pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 8px">  2:   buffer = new uint32[_width*_height];</pre>
</pre>
<ol>
<li>Build the solution.</li>
<li>Stop Apache</li>
<li>Copy </li>
<ol>
<li>jpeg.dll</li>
<li>libfcgi.dll</li>
<li>libtiff.dll</li>
<li>zlibwapi.dll </li>
<li>IIPSRV.exe</li>
</ol>
<li>Into your fcgi-bin directory</li>
<li>Restart Apache</li>
<li>Test</li>
</ol>
]]></content:encoded>
			<wfw:commentRss>http://blog.hines57.com/2011/04/01/notes-porting-iipimage-server-to-vs2010/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Zendframework + Minify</title>
		<link>http://blog.hines57.com/2011/03/13/zendframework-minify/</link>
		<comments>http://blog.hines57.com/2011/03/13/zendframework-minify/#comments</comments>
		<pubDate>Mon, 14 Mar 2011 02:11:51 +0000</pubDate>
		<dc:creator>Bubba</dc:creator>
				<category><![CDATA[Javascript]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[Technology]]></category>
		<category><![CDATA[Zend Framework]]></category>
		<category><![CDATA[Zend Zendframework minify doctrine php github git performance jquery]]></category>

		<guid isPermaLink="false">http://blog.hines57.com/2011/03/13/zendframework-minify/</guid>
		<description><![CDATA[I have had the opportunity over the past year to do some extensive work with Zend Framework as we have been porting our legacy code to said framework, and it ...]]></description>
			<content:encoded><![CDATA[<p><a href="http://photos.hines57.com/images/Zendframework--Minify_12601/image.png"><img style="background-image: none; border-bottom: 0px; border-left: 0px; margin: 0px 10px 10px 0px; padding-left: 0px; padding-right: 0px; display: inline; float: left; border-top: 0px; border-right: 0px; padding-top: 0px" title="image" border="0" alt="image" align="left" src="http://photos.hines57.com/images/Zendframework--Minify_12601/image_thumb.png" width="176" height="180"></a></p>
<p>I have had the opportunity over the past year to do some extensive work with <a href="http://framework.zend.com/">Zend Framework</a> as we have been porting our legacy code to said framework, and it has been a lot of fun. It turns out that I very much enjoy the MVC framework, and have had great fun in the implementation. Our primary goal has been supportability and maintainability in moving to the framework, but we aren’t opposed to performance and scalability gains as well.<a href="http://photos.hines57.com/images/Zendframework--Minify_12601/image_3.png"><img style="background-image: none; border-bottom: 0px; border-left: 0px; margin: 10px; padding-left: 0px; padding-right: 0px; display: inline; float: right; border-top: 0px; border-right: 0px; padding-top: 0px" title="image" border="0" alt="image" align="right" src="http://photos.hines57.com/images/Zendframework--Minify_12601/image_thumb_3.png" width="154" height="128"></a></p>
<p>A key factor in the migration to the framework has been, and will continue to be, ensuring that we do not lose any of the scalability and performance that we currently enjoy in the legacy code. There have been a few instances, where porting functionality over to the <a href="http://framework.zend.com/">Zend Framework</a> resulted in immediate performance gains; however, the initial port over tends to perform a little slower, and at that point I roll out my handy performance toolbox and get to measuring and diagnosing to find the needed gains. </p>
<p>I typically discover that I have not fully leveraged the framework, took a shortcut someplace, or (re) wrote the code in an inefficient manner. But every single time I would look, the first thing that jumped out at me was the fact that I was breaking the <a href="http://developer.yahoo.com/performance/index.html#rules">Rules for High Performance Web Sites</a>. If you aren’t familiar, these are a series of best practice statements that have repeatedly shown to improve web page performance. From the time I began this effort last spring, I repeatedly told myself, “I’m going to fix that.”</p>
<p>Particularly because the framework allows for some mighty decent control over CSS and JavaScript additions to the page, it seemed to be a no brainer that we should be able to concatenate and minify the includes, then get the JavaScript to the bottom of the page and the css in the header. It even seemed to me that such functionality would be built right into the framework, I mean, we already have the <a href="http://framework.zend.com/manual/en/zend.view.helpers.html#zend.view.helpers.initial.headlink">HeadLink</a> and <a href="http://framework.zend.com/manual/en/zend.view.helpers.html#zend.view.helpers.initial.headscript">HeadScript</a> helpers managing them for us, just a wee bit more effort to get the rest of the way. <a href="http://twitter.com/#!/robhines">I tweeted a few requests</a> for a solution, and then spent a moment <a href="http://lmgtfy.com/?q=zend+framework+javascript+css+minification">researching it via Google</a>. No good. Turns out <a href="http://framework.zend.com/issues/browse/ZF-6031?page=com.atlassian.jira.plugin.system.issuetabpanels%3Aall-tabpanel">Zend Framework doesn’t support this</a>, and there does not appear to be a time set for when they will.</p>
<p>My buddy <a href="http://twitter.com/#!/willathome">WillAtHome</a> happened to mention there was a cool PHP5 project over at <a href="http://code.google.com/">Google Code</a> called <a href="http://code.google.com/p/minify/">minify</a>, that appeared to mostly do what I desired.</p>
<p>&nbsp;<a href="http://photos.hines57.com/images/Zendframework--Minify_12601/image_4.png"><img style="background-image: none; border-bottom: 0px; border-left: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top: 0px; border-right: 0px; padding-top: 0px" title="image" border="0" alt="image" src="http://photos.hines57.com/images/Zendframework--Minify_12601/image_thumb_4.png" width="433" height="54"></a></p>
<p>So I set about downloading, <a href="http://www.mrclay.org/2008/09/19/minify-21-on-mrclayorg/">following the instructions</a>, and implementing it within the public directory of my framework. It was simple enough to get working, and quite impressive. However, I continued to lack the ability to actually integrate it with Zend Framework. I really wanted <a href="http://framework.zend.com/manual/en/zend.view.helpers.html#zend.view.helpers.initial.headlink">HeadLink</a> and <a href="http://framework.zend.com/manual/en/zend.view.helpers.html#zend.view.helpers.initial.headscript">HeadScript</a> to get to know minify up close and personal. It turned out <a href="http://code.google.com/p/minify/issues/detail?id=105">I wasn’t the only one</a>! As I read through <strong>Issue </strong><a href="http://code.google.com/p/minify/issues/detail?id=105"><strong>105</strong></a><strong>: Integration with the Zend Framework</strong> I discovered some excellent progress had been made on introducing the three. However, I didn’t find anything that really met my own needs, and the scripts provided all seemed to require some editing in order to get them working as advertised. I really wanted a drop in solution for <strong><em>any</em></strong> <a href="http://framework.zend.com/">Zend Framework</a> project I might ever work on.</p>
<p>My first thought was to refactor the Minify interface into a ZF Controller, throw the minify libraries in my projects library folder, and then extend <a href="http://framework.zend.com/manual/en/zend.view.helpers.html#zend.view.helpers.initial.headlink">HeadLink</a> and <a href="http://framework.zend.com/manual/en/zend.view.helpers.html#zend.view.helpers.initial.headscript">HeadScript</a>. However, the boys contributing to <a href="http://code.google.com/p/minify/issues/detail?id=105">Issue 105</a> were mostly done with the helpers, so I figured that I would just apply my hand to the lowest hanging fruit; I already had minify unzipped (installed) and working. The end result can be found on <a href="https://github.com/">GitHub</a> under <a href="https://github.com/bubba-h57/zf-helpers">my zf-helpers repository</a>.</p>
<ul>
<li><a href="https://github.com/bubba-h57/zf-helpers/blob/master/MinifyHeadLink.php">MinifyHeadLink.php</a></li>
<li><a href="https://github.com/bubba-h57/zf-helpers/blob/master/MinifyHeadScript.php">MinifyHeadScript.php</a></li>
</ul>
<p>The instructions for installing and leveraging the scripts can be found in the Header Comments of each one. Here’s what MinifyHeadScript’s instructions look like:</p>
<blockquote><pre>

<font color="#777777" face="Verdana">/**</font>

<font color="#777777" face="Verdana"> * </font>

<font color="#777777" face="Verdana"> * Helper for setting and retrieving script elements for HTML head section</font>

<font color="#777777" face="Verdana"> * with the added twist of minifying the javascript files. </font>

<font color="#777777" face="Verdana"> * </font>

<font color="#777777" face="Verdana"> * ** PREREQUISITES **</font>

<font color="#777777" face="Verdana"> * This file expects that you have installed minify in ../ZendFramworkProject/Public/min </font>

<font color="#777777" face="Verdana"> * and that it is working. If your location has changed, modify </font>

<font color="#777777" face="Verdana"> * $this-&gt;$_minifyLocation to your current location.</font>

<font color="#777777" face="Verdana"> * </font>

<font color="#777777" face="Verdana"> * ** INSTALLATION **</font>

<font color="#777777" face="Verdana"> * Simply drop this file into your ../ZendFramworkProject/application/views/helpers</font>

<font color="#777777" face="Verdana"> * directory.</font>

<font color="#777777" face="Verdana"> * </font>

<font color="#777777" face="Verdana"> * ** USAGE **</font>

<font color="#777777" face="Verdana"> * In your Layout or View scripts, you can simply call minifyHeadScript</font>

<font color="#777777" face="Verdana"> * in the same way that you used to call headScript. Here is an example:</font>

<font color="#777777" face="Verdana"> * </font>

<font color="#777777" face="Verdana">  echo $this-&gt;minifyHeadScript()</font>

<font color="#777777" face="Verdana">  -&gt;prependFile('http://ajax.googleapis.com/ajax/libs/someObject/2.2/object.js') // 12th	   </font>

<font color="#777777" face="Verdana">	-&gt;prependFile('/js/jquery.delaytrigger.js') // 11th</font>

<font color="#777777" face="Verdana">	-&gt;prependFile('/js/sorttable.js')           // 10th</font>

<font color="#777777" face="Verdana">	-&gt;prependFile('/js/jquery.alerts.js')       // 9th</font>

<font color="#777777" face="Verdana">	-&gt;prependFile('/js/jqModal.js')             // 8th</font>

<font color="#777777" face="Verdana">	-&gt;prependFile('/js/jquery.maskedinput.js')  // 7th</font>

<font color="#777777" face="Verdana">	-&gt;prependFile('/js/jquery.checkbox.js')     // 6th</font>

<font color="#777777" face="Verdana">	-&gt;prependFile('/js/jquery.tablesorter.min.js') // 5th</font>

<font color="#777777" face="Verdana">	-&gt;prependFile('/js/jquery.autocomplete.js') // 4th</font>

<font color="#777777" face="Verdana">	-&gt;prependFile('/js/jquery.color.js')        // 3rd</font>

<font color="#777777" face="Verdana">	-&gt;prependFile('/js/jquery-1.3.2.min.js')    // 2nd</font>

<font color="#777777" face="Verdana">	-&gt;prependFile('/js/main.js')                // 1st</font>

<font color="#777777" face="Verdana">	-&gt;appendScript('</font>

<font color="#777777" face="Verdana">		$(document).ready(function() {</font>

<font color="#777777" face="Verdana">		      $(\'#ajaxWait\').ajaxStart(function() {</font>

<font color="#777777" face="Verdana">		      $(this).show();</font>

<font color="#777777" face="Verdana">		    }).ajaxStop(function() {</font>

<font color="#777777" face="Verdana">		      $(this).hide();</font>

<font color="#777777" face="Verdana">                                    })</font><font color="#777777" face="Verdana">	</font>

<font color="#777777" face="Verdana">	                    try { init(); } catch(e) {}</font>

<font color="#777777" face="Verdana">		});                                       // Last</font>

<font color="#777777" face="Verdana">	');</font>

<font color="#777777" face="Verdana"> * Because minify can't do anything with a javascript from some other server, nor</font>

<font color="#777777" face="Verdana"> * does it do anything with inline scripts, and order is important, it will minify</font>

<font color="#777777" face="Verdana"> * up to the point that it meets something that can't be minified, and then output</font>

<font color="#777777" face="Verdana"> * the minified version, then the item(s) that couldn't be minified, and then attempt</font>

<font color="#777777" face="Verdana"> * to minify items again, repeating the process till it is completed. Here is an</font>

<font color="#777777" face="Verdana"> * example of output from the example above.</font>

<font color="#777777" face="Verdana"> * </font>

<font color="#777777" face="Verdana">&lt;script type="text/javascript" src="/min/?f=/js/main.js,/js/jquery-1.3.2.min.js,/js/jquery.color.js,</font>

<font color="#777777" face="Verdana">                    /js/jquery.autocomplete.js,/js/jquery.tablesorter.min.js,/js/jquery.checkbox.js,</font>

<font color="#777777" face="Verdana">                    /js/jquery.maskedinput.js,/js/jqModal.js,/js/jquery.alerts.js,/js/sorttable.js,</font>

<font color="#777777" face="Verdana">                    /js/jquery.delaytrigger.js"&gt;&lt;/script&gt;</font>

<font color="#777777" face="Verdana">&lt;script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/someObject/2.2/object.js"&gt;&lt;/script&gt;</font>

<font color="#777777" face="Verdana">&lt;script type="text/javascript"&gt;</font>

<font color="#777777" face="Verdana">    //&lt;![CDATA[</font>

<font color="#777777" face="Verdana"></font>&nbsp;

<font color="#777777" face="Verdana">		$(document).ready(function() {</font>

<font color="#777777" face="Verdana">			$('#ajaxWait').ajaxStart(function() {</font>

<font color="#777777" face="Verdana">		      $(this).show();</font>

<font color="#777777" face="Verdana">		    }).ajaxStop(function() {</font>

<font color="#777777" face="Verdana">		      $(this).hide();</font>

<font color="#777777" face="Verdana">			      });</font>

<font color="#777777" face="Verdana">			</font>

<font color="#777777" face="Verdana">			try { init(); } catch(e) {}</font>

<font color="#777777" face="Verdana">		});</font>

<font color="#777777" face="Verdana">	    //]]&gt;</font>

<font color="#777777" face="Verdana"></font>&nbsp;

<font color="#777777" face="Verdana">&lt;/script&gt;</font>

<font color="#777777" face="Verdana"></font>&nbsp;

<font color="#777777" face="Verdana"> * </font>

<font color="#777777" face="Verdana"> * </font>

<font color="#777777" face="Verdana"> *</font>

<font color="#777777" face="Verdana"> * @see        http://code.google.com/p/minify/</font>

<font color="#777777" face="Verdana"> * @package    Zend_View</font>

<font color="#777777" face="Verdana"> * @subpackage Helper</font>

<font color="#777777" face="Verdana"> * @copyright  Copyright (c) 2010-2011 Signature Tech Studios (http://www.stechstudio.com)</font>

<font color="#777777" face="Verdana"> * @license    http://framework.zend.com/license/new-bsd     New BSD License</font>

<font color="#777777" face="Verdana"> * @author     Rob "Bubba" Hines</font>

<font color="#777777" face="Verdana"> *</font>

<font color="#777777" face="Verdana"> */</font>
</pre>
</blockquote>
<p>One of the questions I most regularly get is “why do you use prepend in your examples as opposed to append?” There is absolutely nothing preventing you from doing just that, assuming you are certain you have not made a call in the controller to assign scripts to the queue. If you are certain of that, and you are only modifying the script queue in the layout file, do whatever tickles you pink. I, however, tend to make some decisions on which JS and CSS will be included in the final results while I’m still in the controller, and order tends to get important, so prepending makes the most sense to me. Given that prepending assumes the most complex usage, it also seemed a good idea for the examples.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.hines57.com/2011/03/13/zendframework-minify/feed/</wfw:commentRss>
		<slash:comments>12</slash:comments>
		</item>
		<item>
		<title>What is the Big Deal?</title>
		<link>http://blog.hines57.com/2011/03/08/what-is-the-big-deal/</link>
		<comments>http://blog.hines57.com/2011/03/08/what-is-the-big-deal/#comments</comments>
		<pubDate>Tue, 08 Mar 2011 16:27:47 +0000</pubDate>
		<dc:creator>Bubba</dc:creator>
				<category><![CDATA[Technology]]></category>

		<guid isPermaLink="false">http://blog.hines57.com/2011/03/08/what-is-the-big-deal/</guid>
		<description><![CDATA[I recently had a conversation with the fellows I work with that went something like the one on the left. Perhaps, it looked almost, exactly, precisely like that. The simple ...]]></description>
			<content:encoded><![CDATA[<p><a href="http://photos.hines57.com/images/What-is-the-Big-Deal_92A6/image.png"><img style="background-image: none; border-right-width: 0px; margin: 0px 10px 10px 0px; padding-left: 0px; padding-right: 0px; display: inline; float: left; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="image" border="0" alt="image" align="left" src="http://photos.hines57.com/images/What-is-the-Big-Deal_92A6/image_thumb.png" width="342" height="172"></a>I recently had a conversation with the fellows I work with that went something like the one on the left. Perhaps, it looked almost, exactly, precisely like that. <img style="border-bottom-style: none; border-left-style: none; border-top-style: none; border-right-style: none" class="wlEmoticon wlEmoticon-winkingsmile" alt="Winking smile" src="http://photos.hines57.com/images/What-is-the-Big-Deal_92A6/wlEmoticon-winkingsmile.png"></p>
<p>The simple fact is that I really do pray that I not have to support IE6. I woke up this morning, and as is typical, I had a number of questions posed to me by a number of different individuals, many of whom do not even know each other. Here’s a a quick sample of the questions asked this morning:</p>
<p>- What is the difference between dirt and cement raised pigs, why do I care, and where do I buy them?<br />- Since I&#8217;m not a MS guy, can u explain the big deal about shutting down IE6? <br />- How do you handle self esteem issues w/your daughters?<br />- How does the reformed man deal with 1 John 2:2?<br />- What can you tell me about Islamic eschatology?<br />- How do you propose to evangelize over social networks?</p>
<p>As you might have already guessed, this post is going to be a quick answer to the IE6 question. The answer is very simple, none of us <em>should</em> be using a ten year old browser, particularly when three later versions of the same browser are available. I’ll refrain from a rant on why none of us should be using Internet Explorer at all. If you find yerself here, and wondering what browser you should be using, here’s Bubba’s Opinion:<img style="display: inline; float: right" align="right" src="http://upload.wikimedia.org/wikipedia/commons/thumb/b/b5/Operating_system_usage_share.svg/600px-Operating_system_usage_share.svg.png" width="342" height="342"></p>
<ol>
<li><a href="http://www.google.com/chrome/intl/en/landing_chrome.html?hl=en&amp;brand=CHMB&amp;utm_campaign=en&amp;utm_source=en-ha-na-us-sk&amp;utm_medium=ha">Google Chrome Browser</a></li>
<li><a href="http://www.mozilla.com/en-US/firefox/">Mozilla Firefox</a></li>
</ol>
<p>If neither of those is available for your operating system, you either already know enough about the technology to choose a suitable alternate yourself, or someone has done you wrong and you need to throw away the machine you currently use and go buy a new one. So, back to the question at hand. What is the Big Deal? It begins the issue of scale. Most people simply don’t grasp scale very well, and graphs give a visual of the data we are peaking at, so to that end, lets look at <a href="http://en.wikipedia.org/wiki/Usage_share_of_operating_systems">the breakdown of Operating Systems from which Browsers were used on the internet in February 2011</a>.</p>
<p>As you can see, Windows Variants continue to dominate the field in 2011, and of those, Windows XP stands head and shoulders above them all. Windows XP has a unique relationship with IE6, in that it was (is) the default browser installed when the operating system was installed. It is a sad fact that while everyone in America knows about cars, and most have likely driven one, very few know anything about servicing their vehicle, much less how to change the brakes themselves. This means that until said brakes either stop working, or begin to make unpalatable sounds, the breaks aren’t likely to get serviced.</p>
<p>In the same way, the vast majority of Internet Users are not Technologically Savvy. I know this because I have family and friends who own pieces of technology. This means that they will never go upgrade their own browser, and even if they are told “Hey, you need to go upgrade your browser.” they haven’t a clue what that means. If I don’t happen to be at their house (probably removing spyware, a virus, or installing some other piece of software for them) and notice that they have an old version, then subsequently go update it for them, they will simply never get the update.</p>
<p>Given how much I enjoy working on other peoples computers for free, even if they are family and friends, I can easily extrapolate that only a minimum of systems are getting updated in this way. That leaves us with an unfortunately large number of Windows XP with IE6 installs continuing in existence today. </p>
<p>Then we have the corporate conundrum. There are many pieces of corporate software that IE6 has been certified to work with, but that later versions have yet to be certified for. <a href="http://www.crunchgear.com/2010/01/19/use-internet-explorer-says-microsoft-but-stop-using-ie6/">Scott Merrill sums it up</a>:</p>
<blockquote><p>E8 is a case in point: it works with Peoplesoft, but since Oracle (owners of Peoplesoft) haven’t certified IE8 on various Peoplesoft products and versions, it remains “use at your own risk”. If an organization wants to continue to enjoy receiving technical support, they need to use the application vendor’s supported browser versions, and the application vendor may be in no particular rush to certify a new browser version.</p>
</blockquote>
<p>The end result is that an absurd number of private and corporate entities continue to use IE6. <a href="http://ma.tt/2008/07/ie6-independence/">WordPress continues to feel pressure to support IE6</a>, while other <a href="http://37signals.blogs.com/products/2008/07/basecamp-phasin.html">(37Signals</a>) have dropped it; and we continue to speculate on <a href="http://css-tricks.com/why-people-still-use-ie-6/">Why People Still Use IE6</a>. But what ultimately makes this a Big Deal is the combustion that occurs when 1) We desperately pray we can cease supporting it from the Technology side. 2) There continue to be far too many End Users actively using it to ignore them. So then, do we simply drop support, and effectively break the internet for such a large population in an effort to force them to move? Can we afford to do that? Everyone has an opinion, what’s yours? </p>
]]></content:encoded>
			<wfw:commentRss>http://blog.hines57.com/2011/03/08/what-is-the-big-deal/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>LiveWriter For The Win!!</title>
		<link>http://blog.hines57.com/2008/12/10/livewriter-for-the-win/</link>
		<comments>http://blog.hines57.com/2008/12/10/livewriter-for-the-win/#comments</comments>
		<pubDate>Wed, 10 Dec 2008 13:52:09 +0000</pubDate>
		<dc:creator>Bubba</dc:creator>
				<category><![CDATA[Bubba's Update]]></category>
		<category><![CDATA[Technology]]></category>

		<guid isPermaLink="false">http://blog.hines57.com/?p=154</guid>
		<description><![CDATA[If you write for a blog and aren’t using an Offline Editor – you need to. If you are using an Offline Editor other than Windows Live Writer – you need to take a peak at Windows Live Writer.]]></description>
			<content:encoded><![CDATA[<p><a href="http://windowslivewriter.spaces.live.com/"><img style="display: inline; margin: 0px 10px 0px 0px" title="image" src="http://byfiles.storage.msn.com/y1peCKPS7FIays7AhpYJ4h_LYhT7j8dm9_yL3npPBmzScYjY3O7-vTbSVvzn6bO8f-Y?PARTNER=WRITER" border="0" alt="image" width="258" height="299" align="left" /></a> This tool is awesome! Well, for me anyway!</p>
<p>As anyone who is familiar with the Hines57 sites will realize, we recently made a massive change to not only the look and feel, but also the underlying engine(s) and hosting. Part of this change was moving to WordPress for this blog.</p>
<p>I enjoy writing, and blogging comes somewhat natural to me, but the niceties of MS Office have <strong>ruined</strong> me. That is, I like cut and paste, I want images in my content and I want them in a certain place, the whitespace needs to make me happy.</p>
<p>Typically, this is somewhat difficult to do given a web interface, a text box, the need to upload images separately – yada, yada, yada. Enter <a href="http://windowslivewriter.spaces.live.com/">Windows Live Writer</a>.</p>
<p>First, I Googled “<a href="http://www.google.com/search?q=offline+blog+editor&amp;rls=com.microsoft:*&amp;ie=UTF-8&amp;oe=UTF-8&amp;startIndex=&amp;startPage=1">offline blog editor</a>” and quickly realized that there were two major players, BlogDesk and Windows LiveWriter. Then I thought, “Hey, I need this to work with WordPress!” I went back and threw <a href="http://wordpress.org/">WordPress</a> into the search, and was surprised to see that <a href="http://windowslivewriter.spaces.live.com/">Windows Live Writer</a> continued to come up! Having read about <a href="http://windowslivewriter.spaces.live.com/">Windows Live Writer</a> earlier this summer, I decided I’d go check it out.<br />
<span id="more-154"></span><br />
Lo and Behold, it supports <a href="http://wordpress.org/">WordPress</a> – and it supports it pretty dang good from my perspective. Seriously, I simply downloaded and installed it. Upon running, I provided the URL for my site, along with login credentials. Then I wrote a post, with an image in it, and hit submit.I cried that the Blog didn’t support images, but if I would provide an FTP directory along with credentials and subsequent URL, it would manage that for me. Which I promptly did – and POW! Things just worked! I know, the tool has the word Microsoft in front of it – you didn’t expect it to just work, did you. Frankly, neither did I – but it does.</p>
<p>After mentioning the tool to <a href="http://jinksto.com/blog?p=140">Tommy</a> he decided to give it a whirl. He hit a few more bumps in the road than I did, but then he also appears to have attempted to click on more of the bells and whistles than I did. Ultimately, I must say, if you write for a blog and aren’t using an Offline Editor – you need to. If you are using an Offline Editor other than <a href="http://windowslivewriter.spaces.live.com/">Windows Live Writer</a> – you need to take a peak at <a href="http://windowslivewriter.spaces.live.com/">Windows Live Writer</a>, it’s just that nice.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.hines57.com/2008/12/10/livewriter-for-the-win/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Learning JQuery</title>
		<link>http://blog.hines57.com/2008/02/29/learning-jquery/</link>
		<comments>http://blog.hines57.com/2008/02/29/learning-jquery/#comments</comments>
		<pubDate>Fri, 29 Feb 2008 14:39:39 +0000</pubDate>
		<dc:creator>Bubba</dc:creator>
				<category><![CDATA[Javascript]]></category>

		<guid isPermaLink="false">http://blog.hines57.com/?p=62</guid>
		<description><![CDATA[JQuery is a relatively powerful Javascript library that can be incorporated into webpages and used to extend them in some exciting and creative ways. Not only does it provide AJAX ...]]></description>
			<content:encoded><![CDATA[<p>JQuery is a relatively powerful Javascript library that can be incorporated into webpages and used to extend them in some exciting and creative ways. Not only does it provide AJAX functionality out of the box, there are literally hundreds of ways to manipulate your page in the browser. A friend of mine (Joseph Szobody &#8211; Signature Tech Studio) has been encouraging me to learn to leverage this library and suggested this book as a method of diving in.</p>
<p>I found the book itself to be quite well written. It begins by making no assumptions regarding your knowledge of JQuery (although it does assume you grok JScript) and starts with the most basic steps all the time pushing toward more powerful usages of the library.</p>
<p>With numerous real-world client-side issues addressed, you are bound to find a solution to 90% of your questions in the first few chapters. JQuery is also extensible, and many people out there are continually writing libraries on top of it.</p>
<p>This book dedicates the last few chapters to a review of some of the more common\popular libraries and assists you in understanding where you might leverage it in your projects.</p>
<p>All together, if you have never touched JQuery and are interested in learning something about it, this is a great book for you. If you already know a bit about the language, you are probably looking for something else though.</p>
<h2><a name="LearningJQuery-ISBN13#:9781847192509"></a>ISBN-13 #: 978-1-847192-50-9</h2>
<h2><a name="LearningJQuery-Recommended?:Yes"></a>Recommended?: Yes</h2>
]]></content:encoded>
			<wfw:commentRss>http://blog.hines57.com/2008/02/29/learning-jquery/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

