<?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>Chris JeanChris Jean &#187; Development</title>
	<atom:link href="http://chrisjean.com/category/development/feed/" rel="self" type="application/rss+xml" />
	<link>http://chrisjean.com</link>
	<description>Linux, WordPress, programming, anime, and other stuff</description>
	<lastBuildDate>Mon, 16 Jan 2012 15:22:13 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>Creating a PHP ICO Creator for Favicons</title>
		<link>http://chrisjean.com/2011/07/21/creating-a-php-ico-creator-for-favicons/</link>
		<comments>http://chrisjean.com/2011/07/21/creating-a-php-ico-creator-for-favicons/#comments</comments>
		<pubDate>Thu, 21 Jul 2011 15:15:58 +0000</pubDate>
		<dc:creator>Chris Jean</dc:creator>
				<category><![CDATA[Development]]></category>
		<category><![CDATA[favicon]]></category>
		<category><![CDATA[ICO]]></category>
		<category><![CDATA[PHP]]></category>

		<guid isPermaLink="false">http://chrisjean.com/?p=1965</guid>
		<description><![CDATA[For the past couple of weeks, I have worked on creating a PHP library to create ICO files. This has been difficult as all the documentation for the ICO format is either sparse or not completely documented. I&#8217;m doing this since I have yet to find a way of creating a valid favicon file using [...]]]></description>
			<content:encoded><![CDATA[<!-- filtered -->
<p>For the past couple of weeks, I have worked on creating a PHP library to create ICO files. This has been difficult as all the documentation for the ICO format is either sparse or not completely documented.</p>
<p>I&#8217;m doing this since I have yet to find a way of creating a valid favicon file using just PHP and PHP&#8217;s GD library. Sure, I can create a PNG file and change the extension to &#8220;.ico&#8221;, but that doesn&#8217;t work in all browsers, on all operating systems (such as Windows XP), and is more of a hack than a valid method for creating favicon files.</p>
<p>So, it is time to make one. I have a placeholder github repository named <a title="GitHub Repository - PHP ICO" href="https://github.com/chrisbliss18/php-ico">php-ico</a>.</p>
<p>The primary goal is to make a robust, reliable library that creates valid ICO files that can be properly rendered on Windows XP+ and all the major browsers. Thus, my initial goal is not to support every format that exists nor is it to support parsing the ICO files. If the project gets enough attention, I&#8217;ll look at expanding the scope.</p>
<p>Here are the resources that I&#8217;ve found helpful as I&#8217;ve worked on this project:</p>
<ul>
<li><a title="Wikipedia - ICO (File Format)" href="http://en.wikipedia.org/wiki/ICO_%28file_format%29">ICO (file format)</a> &#8211; Wikipedia article about the ICO file format. This has a very comprehensive description of the ICO header. It is sparse on details about the format of the image data.</li>
<li><a title="Wikipedia - BMP file format" href="http://en.wikipedia.org/wiki/BMP_file_format">BMP file format</a> &#8211; Wikipedia article about the BMP file format. This helped me understand the headers and pixel data format for the BMP image data.</li>
<li><a title="Wikipedia - Portable Network Graphics" href="http://en.wikipedia.org/wiki/Portable_Network_Graphics">Portable Network Graphics</a> &#8211; Wikipedia article about the PNG file format. This gave me what I needed to know to identify PNG image data.</li>
<li><a title="Article - Windows Bitmap File Format" href="http://www.mediatel.lu/workshop/graphic/2D_fileformat/h_bmp.html">Windows Bitmap File Format</a> &#8211; Very good article that delves into more details about the BMP file format. The extra details about the different types of headers, compression methods, compression encoding, and examples were very helpful.</li>
<li><a title="Microsoft Developer Network Article - Icons" href="http://msdn.microsoft.com/en-us/library/ms997538.aspx">Icons</a> &#8211; A Microsoft Developer Network article from 1995 that provides the original ICO file format spec. While this is the most authoritative, I really didn&#8217;t find this to be as much help as other sources.</li>
<li><a title="The Code Project Article - Replacing ICON resources in EXE and DLL files" href="http://www.codeproject.com/KB/DLL/ICON_Resources.aspx?display=Mobile">Replacing ICON resources in EXE and DLL files</a> &#8211; Article from The Code Project that has a breakdown of the format similar to what is found in the MSDN article. Example C code is provided.</li>
<li><a title="Bugzilla@Mozilla - Bug 600556 - Support Vista-style ICO files" href="https://bugzilla.mozilla.org/show_bug.cgi?id=600556">Support Vista-style ICO files</a> &#8211; Mozilla Bugzilla filed bug. The discussion has some great information about methods used to reliably parse varying ICO formats and structures. It also has some good test ICO files to try.</li>
<li><a title="Chironex Software Post - Convert HBITMAP to .ICO file" href="http://chironexsoftware.com/blog/?p=13">Convert HBITMAP to .ICO file</a> &#8211; This Chironex Software blog post provided the last piece I needed: how to structure the opacity mask data. Where he found this information (since I didn&#8217;t find it in any of the above articles) I haven&#8217;t a clue.</li>
</ul>
<p>If this post gets some traction and interest, I&#8217;ll consider putting together a post detailing all the different pieces I&#8217;ve found here. I&#8217;m not a spec writer, but I&#8217;d try my best. Let me know if you&#8217;d like to have me work on this.</p>
]]></content:encoded>
			<wfw:commentRss>http://chrisjean.com/2011/07/21/creating-a-php-ico-creator-for-favicons/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Links to Named Anchors or Element IDs Fail in Internet Explorer 8</title>
		<link>http://chrisjean.com/2010/10/20/links-to-named-anchors-or-element-ids-fail-in-ie8/</link>
		<comments>http://chrisjean.com/2010/10/20/links-to-named-anchors-or-element-ids-fail-in-ie8/#comments</comments>
		<pubDate>Wed, 20 Oct 2010 16:07:28 +0000</pubDate>
		<dc:creator>Chris Jean</dc:creator>
				<category><![CDATA[Development]]></category>
		<category><![CDATA[Bug]]></category>
		<category><![CDATA[Internet Explorer]]></category>

		<guid isPermaLink="false">http://chrisjean.com/?p=1860</guid>
		<description><![CDATA[I recently ran into an interesting situation where clicking a link to a named anchor (a link such as &#8220;#top&#8221; linking to &#8220;&#60;a name="top"&#62;&#8221; or &#8220;&#60;div id="top"&#62;&#8220;) failed in Internet Explorer 8. Strangely, it worked properly in every other browser I tested (Firefox, Chrome, Opera, and Safari) and it worked properly on other tested versions [...]]]></description>
			<content:encoded><![CDATA[<!-- filtered -->
<p>I recently ran into an interesting situation where clicking a link to a named anchor (a link such as &#8220;#top&#8221; linking to &#8220;<code>&lt;a name="top"&gt;</code>&#8221; or &#8220;<code>&lt;div id="top"&gt;</code>&#8220;) failed in Internet Explorer 8. Strangely, it worked properly in every other browser I tested (Firefox, Chrome, Opera, and Safari) and it worked properly on other tested versions of IE (6,7, and 9). It was just Internet Explorer 8 that was broken.</p>
<p>I created a very simple <a href="http://chrisjean.com/examples/ie8-broken-named-anchor.html">example page</a> that shows this bug. The important elements are the empty named A tag and the container with the &#8220;overflow:hidden&#8221; rule. The rest of the content and the width is simply to allow enough height to show the functionality or lack thereof of the link.</p>
<p>So the key elements of this bug are:</p>
<ol>
<li>An empty named A tag or any empty element with an ID. Adding text inside the element allows for the link to work properly.</li>
<li>A container with &#8220;overflow:hidden&#8221; around the link, element that is linked to, or both. I tested removing either the link or the element linked to from the div in the example, and IE 8 still failed to allow the link to function in both cases.</li>
</ol>
<p>Given that the &#8220;overflow: hidden&#8221; rule could be very important or useful for the design, the solution to this issue is very simple. Either you add text to the empty element or remove the empty element and add the removed name/id to an element that does have content. Since adding text is probably not what you want, simply moving the anchor point to another element will probably do what you want and have very little impact on the functionality.</p>
<p>For example, if you have the following:</p>
<pre>&lt;a name="purchase"&gt;&lt;/a&gt;
&lt;h3&gt;Purchase&lt;/h3&gt;</pre>
<p>Change it to:</p>
<pre>&lt;h3 id="purchase"&gt;Purchase&lt;/h3&gt;</pre>
<p>It will do the same thing and avoid this annoying IE 8 issue.</p>
<p>For those interested, the filler content was generated with the great <a href="http://www.lorizzle.nl/">Gangsta Lorem Ipsum</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://chrisjean.com/2010/10/20/links-to-named-anchors-or-element-ids-fail-in-ie8/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>MySQL ERROR 1018: Unable to Follow Symlink in Ubuntu</title>
		<link>http://chrisjean.com/2010/05/21/mysql-error-1018-unable-to-follow-symlink-in-ubuntu/</link>
		<comments>http://chrisjean.com/2010/05/21/mysql-error-1018-unable-to-follow-symlink-in-ubuntu/#comments</comments>
		<pubDate>Fri, 21 May 2010 17:40:31 +0000</pubDate>
		<dc:creator>Chris Jean</dc:creator>
				<category><![CDATA[Development]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[Tips 'n Tricks]]></category>
		<category><![CDATA[MySQL]]></category>
		<category><![CDATA[symlink]]></category>
		<category><![CDATA[Ubuntu]]></category>

		<guid isPermaLink="false">http://gaarai.com/?p=1764</guid>
		<description><![CDATA[I recently had a issue getting MySQL to read a specific database. Each time I tried to manually query a table in the database, I received the following error message: ERROR 1018 (HY000): Can't read dir of './default/' (errno: 13) I&#8217;ve seen this message before as it means that there is a permissions issue. I [...]]]></description>
			<content:encoded><![CDATA[<!-- filtered -->
<p>I recently had a issue getting MySQL to read a specific database. Each time I tried to manually query a table in the database, I received the following error message:</p>
<pre>ERROR 1018 (HY000): Can't read dir of './default/' (errno: 13)</pre>
<p>I&#8217;ve seen this message before as it means that there is a permissions issue. I checked the ownerships and permissions, and everything seemed to be in order.</p>
<p>The only thing special about this database is that I have it symlinked to another partition. This has always worked in the past, so I was stumped.</p>
<p>The problem turned out to be that Ubuntu has <a href="http://en.wikipedia.org/wiki/AppArmor">AppArmor</a>. This software sets up rules that prevent software from gaining access to different areas of the file system. In my case, AppArmor was preventing read and write access to the actual location of my database files.</p>
<p>The solution was quite easy: First, I added the path that I wanted MySQL to have access to in the AppArmor configuration file for MySQL. Second, I restarted the apparmor service. Here&#8217;s the technical details:</p>
<ol>
<li>On my system, the configuration file that controls MySQL permissions through AppArmor are located at /etc/apparmor.d/usr.sbin.mysqld. The following shows the contents of the file as it now exists:
<pre># vim:syntax=apparmor
# Last Modified: Tue Jun 19 17:37:30 2007
#include 

/usr/sbin/mysqld {
  #include
  #include
  #include
  #include
  #include 

  capability dac_override,
  capability sys_resource,
  capability setgid,
  capability setuid,

  network tcp,

  /etc/hosts.allow r,
  /etc/hosts.deny r,

  /etc/mysql/*.pem r,
  /etc/mysql/conf.d/ r,
  /etc/mysql/conf.d/* r,
  /etc/mysql/my.cnf r,
  /usr/sbin/mysqld mr,
  /usr/share/mysql/** r,
  /var/log/mysql.log rw,
  /var/log/mysql.err rw,
  /var/lib/mysql/ r,
  /var/lib/mysql/** rwk,
  /var/log/mysql/ r,
  /var/log/mysql/* rw,
  /var/run/mysqld/mysqld.pid w,
  /var/run/mysqld/mysqld.sock w,
  <strong>/home/sites/default/mysql/ rw,
  /home/sites/default/mysql/* rw,</strong>

  /sys/devices/system/cpu/ r,
}</pre>
<p>The two lines in bold show what I added to the configuation. The first line gives read and write access to the directory itself while the second gives read and write access to the files contained in the directory.</li>
<li>After saving the configuration changes, I simply needed to restart the AppArmor daemon. I did this with the following command:
<pre class="terminal"><span style="color:#8FED99;">[<span style="color:#BBFF33;">chris@rommie</span> <span style="color:#729FCF;">~</span>]$</span> <span style="color:#FFF;">sudo service apparmor restart</span>
 * Reloading AppArmor profiles
Skipping profile in /etc/apparmor.d/disable: usr.bin.firefox</pre>
</li>
</ol>
]]></content:encoded>
			<wfw:commentRss>http://chrisjean.com/2010/05/21/mysql-error-1018-unable-to-follow-symlink-in-ubuntu/feed/</wfw:commentRss>
		<slash:comments>6</slash:comments>
		</item>
		<item>
		<title>Fix width:auto Floated Elements in IE 6</title>
		<link>http://chrisjean.com/2009/09/30/fix-width-auto-floated-elements-in-ie-6/</link>
		<comments>http://chrisjean.com/2009/09/30/fix-width-auto-floated-elements-in-ie-6/#comments</comments>
		<pubDate>Wed, 30 Sep 2009 05:37:53 +0000</pubDate>
		<dc:creator>Chris Jean</dc:creator>
				<category><![CDATA[Development]]></category>
		<category><![CDATA[Tips 'n Tricks]]></category>
		<category><![CDATA[Browser Wars]]></category>
		<category><![CDATA[CSS]]></category>
		<category><![CDATA[HTML]]></category>
		<category><![CDATA[Internet Explorer 6]]></category>

		<guid isPermaLink="false">http://gaarai.com/?p=1604</guid>
		<description><![CDATA[It is popular to use ul and li elements float them and set them to width:auto in CSS in order to create a horizontal list of self-sizing boxes. These can easily be used to create horizontal navigation or a listing of tabs, and it works very well. However, there is one caveat; given the right [...]]]></description>
			<content:encoded><![CDATA[<!-- filtered -->
<p>It is popular to use <code>ul</code> and <code>li</code> elements float them and set them to <code>width:auto</code> in CSS in order to create a horizontal list of self-sizing boxes. These can easily be used to create horizontal navigation or a listing of tabs, and it works very well. However, there is one caveat; given the right mix of CSS this solution doesn&#8217;t work properly in IE 6.</p>
<p>To create this scenario, we can simply use something like the following:</p>
<pre>&lt;style type="text/css"&gt;
    ul {
        height: 30px;
        overflow: hidden;
    }
    ul li {
        float: left;
        width: auto;
    }
    ul li a {
        display: block;
        height: 30px;
    }
&lt;/style&gt;
&lt;ul&gt;
    &lt;li&gt;&lt;a href="#"&gt;Link 1&lt;/a&gt;&lt;/li&gt;
    &lt;li&gt;&lt;a href="#"&gt;Link 2&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;</pre>
<p>This will show the problem in IE 6 nicely. The problem is that IE 6 interprets this mix of CSS and decides that each <code>li</code> element should actually expand out to 100% width.</p>
<p>I&#8217;ll explain how to fix this issue and provide and example page so you can easily play around with the HTML and CSS yourself.</p>
<p><span id="more-1604"></span></p>
<h3>Fix #1</h3>
<p>A quick way to tame the IE 6 beast is to give the offending element a width of 0. Counter to intuition, this won&#8217;t force the element to an infinitely-small width; rather, it will force IE 6 to automatically-size the width of the element. However, this has an immediate problem, all other browsers will see this width of 0 for what it really is and render nothing for that element since, well, it has a width of 0.</p>
<p>There are a few different ways to correct this:</p>
<ol>
<li>We can use a hack to introduce the width 0 command to IE 6 without having the other browsers take notice. This works and can be implemented by using <code>_width:0</code> to specifically target IE 6. For example:
<pre>#nav ul li {
    width: auto;
    _width: 0;
    float: left;
}</pre>
</li>
<li>Since using a hack isn&#8217;t always preferable, another option is to selectively-load a CSS document that adds the IE 6-only behavior. In the HTML document, you first load the standard stylesheet followed by the IE 6-specific stylesheet:
<pre>&lt;link rel="stylesheet" href="/css/style.css" type="text/css" media="screen" /&gt;
&lt;!--[if lt IE 7]&gt;
    &lt;link rel="stylesheet" href="/css/lt-ie7.css" type="text/css" media="screen" /&gt;
&lt;![endif]--&gt;</pre>
<p>In the IE 6 stylesheet, add the <code>width:0</code> style:</p>
<pre>#nav ul li {
    width: 0;
}</pre>
</li>
<li>We can use CSS selectors that are ignored by IE 6. This doesn&#8217;t use a hack and also avoids using a separate stylesheet.
<pre>#nav ul li {
    width: 0;
    float: left;
}
#nav ul &gt; li {
    width: auto;
}</pre>
</li>
</ol>
<p>Each of these methods work nicely, however, after some additional testing, a new limitation becomes clear. For some reason, IE 6 now decides that only one word should be permitted in each box. Basically, it seems to word-wrap all additional words, effectively cutting them off. Thus the need for another fix.</p>
<h3>Fix #2</h3>
<p>The solution to preventing IE 6 from truncating each element is simple: prevent word wrapping. This is easily done using the <code>white-space:nowrap</code> CSS instruction.</p>
<p>Using the third example above, we can change it to the following to apply this next fix:</p>
<pre>#nav ul li {
    width: 0;
    float: left;
    white-space: nowrap;
}
#nav ul &gt; li {
    width: auto;
}</pre>
<h3>Example Page</h3>
<p>I built an <a href="http://www.gaarai.com/ie6-auto-width-float-fix.html" target="_blank">example page</a> that shows what is actually occurring during each step of this process and shows how each fix improves the rendering in IE 6. The final example renders as it should.</p>
<p>Here is a screenshot that shows how it renders in IE 6:</p>
<div id="attachment_1611" class='wp-caption alignnone' style='width:515px;'><a href="http://www.gaarai.com/ie6-auto-width-float-fix.html" target="_blank"><img class="size-full wp-image-1611 " title="ie-6-nav-issue" src="http://chrisjean.com/wp-content/uploads/2009/09/ie-6-nav-issue.png" alt="ie-6-nav-issue" width="515" height="541" /></a><p class='wp-caption-text'>Example Rendering in IE 6</p></div>
]]></content:encoded>
			<wfw:commentRss>http://chrisjean.com/2009/09/30/fix-width-auto-floated-elements-in-ie-6/feed/</wfw:commentRss>
		<slash:comments>6</slash:comments>
		</item>
		<item>
		<title>Vertically Centering HTML Content via CSS</title>
		<link>http://chrisjean.com/2009/09/27/vertically-centering-html-content-via-css/</link>
		<comments>http://chrisjean.com/2009/09/27/vertically-centering-html-content-via-css/#comments</comments>
		<pubDate>Sun, 27 Sep 2009 05:00:13 +0000</pubDate>
		<dc:creator>Chris Jean</dc:creator>
				<category><![CDATA[Development]]></category>
		<category><![CDATA[Tips 'n Tricks]]></category>
		<category><![CDATA[Browser Wars]]></category>
		<category><![CDATA[CSS]]></category>
		<category><![CDATA[HTML]]></category>

		<guid isPermaLink="false">http://gaarai.com/?p=1586</guid>
		<description><![CDATA[Today I  have yet another entry on HTML and CSS. Today it is how to vertically center content in HTML using CSS. You&#8217;d think that there would be a standard definition of how to vertically center any content by now, but there isn&#8217;t. There are a variety of methods out there that do this. I [...]]]></description>
			<content:encoded><![CDATA[<!-- filtered -->
<p>Today I  have yet another entry on HTML and CSS. Today it is how to vertically center content in HTML using CSS.</p>
<p>You&#8217;d think that there would be a standard definition of how to vertically center any content by now, but there isn&#8217;t. There are a variety of methods out there that do this. I frequently see people using the line-height CSS property to vertically center content. While this appears to work, it isn&#8217;t very flexible, only works properly if there is only one line of text, and doesn&#8217;t work in all situations.</p>
<p>I found <a href="http://www.jakpsatweb.cz/css/css-vertical-center-solution.html" target="_blank">Yuhu&#8217;s Definitive Solution with Unknown Height</a> which looks great, works properly with all major browsers, doesn&#8217;t have the limitations I&#8217;ve seen in other solutions, and is quite simple to implement. Basically all you have to do is have three divs wrapped around the content you wish to vertically center and use specific styling for those divs.</p>
<p>The following code is what does the magic. Replace the comment with the content to be vertically centered, change the height to match the vertical height of the container, and you&#8217;re set.</p>
<pre>&lt;div style="display:table; height:400px; #position:relative;"&gt;
    &lt;div style="#position:absolute; #top:50%; display:table-cell;
vertical-align:middle;"&gt;
        &lt;div style="#position:relative; #top:-50%"&gt;
            &lt;!-- content to be centered --&gt;
        &lt;/div&gt;
    &lt;/div&gt;
&lt;/div&gt;</pre>
<p>I built a quick <a href="http://chrisjean.com/center_vertically.html" target="_blank">example document</a> that shows how I applied the rules via a style block in the head to keep the HTML clean.</p>
<p>As with my <a href="http://chrisjean.com/2009/09/24/taming-html-lists-across-all-browsers/" target="_blank">taming HTML lists fix</a>, I tested this successfully on the following browsers:</p>
<ul>
<li> OS X
<ul>
<li>Firefox 3.5</li>
<li>Safari 4</li>
</ul>
</li>
<li> Ubuntu (Linux)
<ul>
<li>Firefox 3.5</li>
<li>Google Chrome 4</li>
<li>Konqueror 4.2</li>
<li>Midori 0.1.2</li>
<li>Opera 10</li>
</ul>
</li>
<li> Windows
<ul>
<li>Firefox 3.5</li>
<li>Google Chrome 4</li>
<li>Internet Explorer 6, 7, and 8</li>
<li>Safari 4</li>
</ul>
</li>
</ul>
<p>Thank you Yuhu for the great solution.</p>
]]></content:encoded>
			<wfw:commentRss>http://chrisjean.com/2009/09/27/vertically-centering-html-content-via-css/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>man Pages for C Development in Ubuntu</title>
		<link>http://chrisjean.com/2009/09/26/man-pages-for-c-development-in-ubuntu/</link>
		<comments>http://chrisjean.com/2009/09/26/man-pages-for-c-development-in-ubuntu/#comments</comments>
		<pubDate>Sat, 26 Sep 2009 05:00:23 +0000</pubDate>
		<dc:creator>Chris Jean</dc:creator>
				<category><![CDATA[Development]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[Tips 'n Tricks]]></category>
		<category><![CDATA[C]]></category>
		<category><![CDATA[Mastering The Command Line]]></category>
		<category><![CDATA[Ubuntu]]></category>

		<guid isPermaLink="false">http://gaarai.com/?p=1493</guid>
		<description><![CDATA[I recently tutored a friend in C coding. Since I hadn&#8217;t worked with C in at least 8 years, I really needed to have some references to rely on for syntax and other specifics. Fortunately, there are some easy man pages that can be installed in Ubuntu that offer helpful information that I was able [...]]]></description>
			<content:encoded><![CDATA[<!-- filtered -->
<p>I recently tutored a friend in C coding. Since I hadn&#8217;t worked with C in at least 8 years, I really needed to have some references to rely on for syntax and other specifics. Fortunately, there are some easy man pages that can be installed in Ubuntu that offer helpful information that I was able to use to help refresh my memory.</p>
<p>These man pages are easily installed by installing the <code>manpages-dev</code> package. You can install this package via Synaptic or directly on the command line. I like the command line method personally, so I ran <code>sudo apt-get install manpages-dev</code> from the command line to quickly install the package.</p>
<p>After installing the package, I&#8217;m able to access man pages for functions such as <code>printf</code>, <code>opendir</code>, and <code>putc</code>. For each function, it shows the valid syntax as well as what library is required to make use of the function.</p>
<p>The information isn&#8217;t limited to functions as you can also access information on the libraries, such as <code>stdio</code> or <code>string</code>.</p>
<p>To access any of this information, simply run <code>man [function or library name]</code> such as <code>man stdio</code>.</p>
<p>This package isn&#8217;t limited to C functions/libraries. It is a general use Linux development suite of man pages. For a full list of what is installed, check out the <a href="http://packages.ubuntu.com/hardy/all/manpages-dev/filelist" target="_blank">file list</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://chrisjean.com/2009/09/26/man-pages-for-c-development-in-ubuntu/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Pushing a Webpage Footer to the Bottom of an HTML Page with CSS</title>
		<link>http://chrisjean.com/2009/09/25/pushing-a-webpage-footer-to-the-bottom-of-an-page-with-css/</link>
		<comments>http://chrisjean.com/2009/09/25/pushing-a-webpage-footer-to-the-bottom-of-an-page-with-css/#comments</comments>
		<pubDate>Fri, 25 Sep 2009 05:00:51 +0000</pubDate>
		<dc:creator>Chris Jean</dc:creator>
				<category><![CDATA[Development]]></category>
		<category><![CDATA[Tips 'n Tricks]]></category>
		<category><![CDATA[Browser Wars]]></category>
		<category><![CDATA[CSS]]></category>
		<category><![CDATA[HTML]]></category>

		<guid isPermaLink="false">http://gaarai.com/?p=1565</guid>
		<description><![CDATA[Anyone that works with HTML and CSS will tell you that positioning things exactly where you want them to be is often times difficult. If you want to position something somewhere vertically, it becomes even worse. I just finished working on a theme where I needed to force the footer of the layout to the [...]]]></description>
			<content:encoded><![CDATA[<!-- filtered -->
<p>Anyone that works with HTML and CSS will tell you that positioning things exactly where you want them to be is often times difficult. If you want to position something somewhere vertically, it becomes even worse.</p>
<p>I just finished working on a theme where I needed to force the footer of the layout to the very bottom of the page. While logically putting the footer after all the other content is easy, making it sit at the very bottom of the page even when the content doesn&#8217;t take up enough space to push it down there is quite difficult.</p>
<p>After struggling with getting this right for a couple of hours, I finally found a site that has done all the hard work for me. <a href="http://www.cssstickyfooter.com/" target="_blank">CSS Sticky Footer</a> is the site that saved my sanity.</p>
<p>CSS Sticky Footer provides a solution that sticks the footer to the bottom of the page in a cross-browser compliant manner. The site reports, and I can confirm, that it works with Internet Explorer 6 through Internet Explorer 8,  Firefox, Google Chrome, Safari, Opera, and Konqueror.</p>
<p>Since the implementation could change, I recommend that you visit the site to get details; however, just in case something happens to the site, I&#8217;m going to add the solution here as well.</p>
<p><span id="more-1565"></span></p>
<h3>HTML</h3>
<pre>&lt;div id="wrap"&gt;
    &lt;div id="main" class="clearfix"&gt;
        &lt;!-- non-footer content --&gt;
    &lt;/div&gt;
&lt;/div&gt;

&lt;div id="footer"&gt;
    &lt;!-- footer content --&gt;
&lt;/div&gt;</pre>
<h3>CSS</h3>
<pre>/*
Sticky Footer Solution
by Steve Hatcher

http://stever.ca

http://www.cssstickyfooter.com

*/

* {
    margin: 0;
    padding: 0;
}

/* must declare 0 margins on everything, also for main layout components
use padding, not vertical margins (top and bottom) to add spacing, else
those margins get added to total height and your footer gets pushed down
a bit more, creating vertical scroll bars in the browser */

html, body, #wrap {
    height: 100%;
}

body &gt; #wrap {
    height: auto;
    min-height: 100%;
}

#main {
    padding-bottom: 150px;  /* must be same height as the footer */
}

#footer {
    position: relative;
    margin-top: -150px;  /* negative value of footer height */
    height: 150px;
    clear: both;
} 

/* CLEAR FIX */
.clearfix:after {
    content: ".";
    display: block;
    height: 0;
    clear: both;
    visibility: hidden;
}
.clearfix {
    display: inline-block;
}
/* Hides from IE-mac \*/
* html .clearfix {
    height: 1%;
}
.clearfix {
    display: block;
}
/* End hide from IE-mac */</pre>
<h3>Sample</h3>
<p>I have a <a href="http://chrisjean.com/css_sticky_footer.html" target="_blank">sample page</a> available to see this in action.</p>
<p>Many thanks to Steve Hatcher who made my job a lot easier.</p>
<h3>Update</h3>
<p>Someone reported that they have a roughly 45 pixel white gap at the bottom of footer of the sample and that they saw this on Firefox 3.5.3 on Vista. I&#8217;ve tested this on the exact same OS and browser, and I don&#8217;t see it. I&#8217;ve tested this on a huge variety of platforms, browsers, and browser versions, and I can&#8217;t see the gap. Does anyone else see any odd rendering?</p>
]]></content:encoded>
			<wfw:commentRss>http://chrisjean.com/2009/09/25/pushing-a-webpage-footer-to-the-bottom-of-an-page-with-css/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Taming HTML Lists Across All Browsers</title>
		<link>http://chrisjean.com/2009/09/24/taming-html-lists-across-all-browsers/</link>
		<comments>http://chrisjean.com/2009/09/24/taming-html-lists-across-all-browsers/#comments</comments>
		<pubDate>Thu, 24 Sep 2009 15:31:39 +0000</pubDate>
		<dc:creator>Chris Jean</dc:creator>
				<category><![CDATA[Development]]></category>
		<category><![CDATA[Tips 'n Tricks]]></category>
		<category><![CDATA[Browser Wars]]></category>
		<category><![CDATA[CSS]]></category>
		<category><![CDATA[HTML]]></category>

		<guid isPermaLink="false">http://gaarai.com/?p=1552</guid>
		<description><![CDATA[It seems that every browser rendering engine has a completely different way of rendering lists. I recently had the frustrating job of getting them all to play nicely together. The CSS I ended up using is quite simple and works across all the browsers I tested (list at the bottom). This is the magic bit [...]]]></description>
			<content:encoded><![CDATA[<!-- filtered -->
<p>It seems that every browser rendering engine has a completely different way of rendering lists. I recently had the frustrating job of getting them all to play nicely together.</p>
<p>The CSS I ended up using is quite simple and works across all the browsers I tested (list at the bottom).</p>
<p>This is the magic bit of CSS:</p>
<pre>ul, ol {
    list-style-position: outside;
    margin: 0 0 0 15px;
    padding: 0;
}
ol {
    margin-left: 20px;
    *margin-left: 24px; /* targeted IE 6, 7 fix */
}
li {
    margin: 0;
    padding: 0;
}</pre>
<p>This CSS forces all the browsers to play by the same rules. The end results are nice and clean.</p>
<p>The left margins are necessary to get all the browsers to not clip part of the bullet/number; however, you can change this left margin on ul/ol elements contained within the primary ul/ol if you need to adjust the indentation of each sub-list.</p>
<p>Each browser that I tested rendered the same thing, albeit with slightly different bullets or padding in front of the number.</p>
<p>The following are the browsers I tested:</p>
<ul>
<li>
OS X</p>
<ul>
<li>Firefox 3.5</li>
<li>Safari 4</li>
</ul>
</li>
<li>
Ubuntu (Linux)</p>
<ul>
<li>Firefox 3.5</li>
<li>Google Chrome 4</li>
<li>Konqueror 4.2</li>
<li>Midori 0.1.2</li>
<li>Opera 10</li>
</ul>
</li>
<li>
Windows</p>
<ul>
<li>Firefox 3.5</li>
<li>Google Chrome 4</li>
<li>Internet Explorer 6, 7, and 8</li>
<li>Safari 4</li>
</ul>
</li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://chrisjean.com/2009/09/24/taming-html-lists-across-all-browsers/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Recursively Updating Git Submodules</title>
		<link>http://chrisjean.com/2009/09/16/recursively-updating-git-submodules/</link>
		<comments>http://chrisjean.com/2009/09/16/recursively-updating-git-submodules/#comments</comments>
		<pubDate>Wed, 16 Sep 2009 18:30:20 +0000</pubDate>
		<dc:creator>Chris Jean</dc:creator>
				<category><![CDATA[Development]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[Tips 'n Tricks]]></category>
		<category><![CDATA[git]]></category>
		<category><![CDATA[Perl]]></category>
		<category><![CDATA[script]]></category>
		<category><![CDATA[submodules]]></category>

		<guid isPermaLink="false">http://gaarai.com/?p=1528</guid>
		<description><![CDATA[I had fun writing about how I work with Git yesterday. I thought I&#8217;d continue on that thread. I have a solid set of code libraries that I&#8217;ve written that latch into the WordPress themes we produce at iThemes. Each time code is duplicated across different repositories, I break that code out and make it [...]]]></description>
			<content:encoded><![CDATA[<!-- filtered -->
<p>I had fun writing about how I work with Git yesterday. I thought I&#8217;d continue on that thread.</p>
<p>I have a solid set of code libraries that I&#8217;ve written that latch into the WordPress themes we produce at <a href="http://ithemes.com/" target="_blank">iThemes</a>. Each time code is duplicated across different repositories, I break that code out and make it into a separate repository. I then link it back into the project as a submodule. This makes it extremely-easy to keep duplicated code across numerous repositories updated with little or no fuss.</p>
<p>After cloning a repository, simply run <code>git submodule init</code> followed by <code>git submodule update</code> in order to initialize all the submodules and update their container folder with the content of the submodule&#8217;s repository. For a long time, this is exactly what I did when I would clone a theme repository to start working on it. However, this quickly wasn&#8217;t enough.</p>
<p>The problem happened as soon as I added a submodule to a repository that was also a submodule of other repositories. Doing the submodule init and update process wouldn&#8217;t do everything I needed in this case as there would be submodules in some subfolder that haven&#8217;t been set up.</p>
<p>I didn&#8217;t want to get into a habit of always switching to other directories and doing the submodule processes there as well since I 1) knew that I would forget all-too-often, thus wasting my time, and 2) knew that this would not be the last time that a submodule had submodules. Heck, there is even the possibility that I&#8217;ll have a submodule that has a submodule that has a submodule. It was immediately clear that I needed a script to do all this dirty work for me. The rest of this post will be about the script I created.</p>
<p><span id="more-1528"></span></p>
<h3>The Script</h3>
<p>First, I&#8217;ll share the script itself. If you are interested in how it works, continue reading.</p>
<p><a href="/git-submodule-recursive-update" target="_blank">git-submodule-recursive-update</a> (right-click &gt; &#8220;Save Link As&#8230;&#8221; to download)</p>
<p>The script is written in Perl and should work on most systems. I&#8217;ve only tested it on Linux and OS X, so please let me know your results if you try out on Windows.</p>
<pre class="code">#!/usr/bin/perl

use strict;
use Cwd;

init_and_update();

exit;

sub init_and_update
{
    my $start_path = cwd();

    my %paths;
    my $updated;

    do
    {
        my $data = `find . -name '.gitmodules'`;
        chomp($data);

        $data =~ s/\/\.gitmodules//g;

        foreach my $path (split(/\n/, $data))
        {
            $paths{$path} = '' if($paths{$path} eq '');
        }

        $updated = 0;

        foreach my $path (sort keys %paths)
        {
            if($paths{$path} eq '')
            {
                chdir($path);
                `git submodule init 2&gt;&amp;1`;
                `git submodule update 2&gt;&amp;1`;
                `git submodule foreach 'git checkout master' 2&gt;&amp;1`
                chdir($start_path);

                if($ARGV[0] eq '--remove-gitmodules')
                {
                    unlink("$path/.gitmodules");
                }

                $paths{$path} = 1;

                $updated++;
            }
        }
    } while($updated);
}</pre>
<h3>The Description</h3>
<p>The functionality should look very straight-forward to anyone that knows Perl.</p>
<ol>
<li>I store the current directory in the <code>$start_path</code> variable in order to always know where home is.</li>
<li>I start a wrapper loop that keeps running until all the possible submodules are initialized and updated.</li>
<li>Using the find command, I look for all the instances of <code>.gitmodules</code> and store the results in <code>$data</code>. The <code>.gitmodules</code> file exists if a repo has submodules.</li>
<li>I remove all the <code>.gitmodules</code> file references from the <code>$data</code> to leave just the paths.</li>
<li>I split the paths into an array and initialize the <code>%paths</code> hash to have a blank value for new paths (stored in the key). Setting this value to blank will flag the following loop that the submodules in that path have not been set up yet.</li>
<li>I create a tracker variable, <code>$updated</code>, to check if anything happened in the loop.</li>
<li>I then loop through the <code>%paths</code> hash to work on each path. If the path&#8217;s hash value is blank, I process that path.</li>
<li>I <code>cd</code> into the repo path, init and update the submodules, and switch back to the starting folder.</li>
<li>If the script is called with the optional <code>--remove-gitmodules</code> argument, I remove the <code>.gitmodules</code> folder while I&#8217;m focused on that folder. I use this for other automation scripts, so it may or may not be of value to you.</li>
<li>I then set the path&#8217;s hash value to <code>1</code> to flag it as done.</li>
<li>Closing out the loop, I update the <code>$updated</code> variable to show that something was updated in this pass.</li>
<li>Finishing up the <code>do</code> loop towards the top, I have <code>while($updated)</code>. Basically, as long as something was updated in the core update loop, I&#8217;ll run everything again. This means that the loop will keep running until it didn&#8217;t find anything else that needed to be updated. When that point is reached, the main loop ends, and the script is finished.</li>
</ol>
<p>I know that there are a number of things I could have done to make for a much more brief, compact script, but I was going to quick production with solid functionality, not brevity. In addition, there are unnecessary elements such as incrementing the <code>$updated</code> variable rather than just setting it to some value. I thought might want to know how many things were updated at some point, so I left it as a counter.</p>
<p>If you found this script helpful, please leave a comment. The more interest these Git-related posts receive, the more motivated I&#8217;ll be to share other processes, developments I&#8217;ve made to make working Git easier.</p>
]]></content:encoded>
			<wfw:commentRss>http://chrisjean.com/2009/09/16/recursively-updating-git-submodules/feed/</wfw:commentRss>
		<slash:comments>14</slash:comments>
		</item>
		<item>
		<title>Updating Multiple Git Repositories Easily Using Bash for Loop</title>
		<link>http://chrisjean.com/2009/09/15/updating-multiple-git-repositories-easily-using-bash-for-loop/</link>
		<comments>http://chrisjean.com/2009/09/15/updating-multiple-git-repositories-easily-using-bash-for-loop/#comments</comments>
		<pubDate>Tue, 15 Sep 2009 16:42:14 +0000</pubDate>
		<dc:creator>Chris Jean</dc:creator>
				<category><![CDATA[Development]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[Tips 'n Tricks]]></category>
		<category><![CDATA[command line]]></category>
		<category><![CDATA[git]]></category>
		<category><![CDATA[Mastering The Command Line]]></category>

		<guid isPermaLink="false">http://gaarai.com/?p=1508</guid>
		<description><![CDATA[All of the WordPress themes that I work on for iThemes are managed as Git repositories. Recently, we moved past the 100 repositories mark. That&#8217;s a lot of repositories to manage, and unfortunately, too many of those repositories contain duplicated information. Later on, I might delve into how we use Git to manage our theme [...]]]></description>
			<content:encoded><![CDATA[<!-- filtered -->
<p>All of the <a href="http://wordpress.org/" target="_blank">WordPress</a> themes that I work on for <a href="http://ithemes.com/" target="_blank">iThemes</a> are managed as Git repositories. Recently, we moved past the 100 repositories mark. That&#8217;s a lot of repositories to manage, and unfortunately, too many of those repositories contain duplicated information.</p>
<p>Later on, I might delve into how we use Git to manage our theme repos. For today, however, I&#8217;d like to focus on how I quickly and easily pushed up changes to more than a dozen repos in a single, albeit long, Bash command.</p>
<p>I had finished making updates to 16 <a href="http://ithemes.com/purchase/flexx-theme-wordpress-blog-themes/" target="_blank">Flexx</a> repos, and I needed to push all of those changes up. Since I had multiple working repos in that folder, I was lucky that each of these repos began with the text &#8220;Flexx&#8221;. Also, since they are all part of the same series and need to keep the same version number, that simplified the tagging as all could be tagged as 2.5.0.</p>
<p>Given this information, I simply ran the following command from the directory that contained all the repository directories:</p>
<div class="code">for i in `ls|grep Flexx`; do echo &#8220;&#8212; Pushing $i&#8221;; cd $i; git commit -am &#8217;2.5.0&#8242; &amp;&amp; git push &amp;&amp; git tag 2.5.0 &amp;&amp; git push &#8211;tags; cd ..; echo &#8220;&#8212; Finished $i&#8221;; done</div>
<p>There&#8217;s a lot going on here, so I&#8217;ll break it up and explain what I&#8217;m doing.</p>
<p><span id="more-1508"></span></p>
<div class="code">for i in `ls|grep Flexx`</div>
<p>This is basically a compound command. Bash&#8217;s <code>for</code> command is being used to step through the results of <code>ls|grep Flexx</code>. Each result will be stored to the variable <code>i</code> which can be referred to with <code>$i</code>.</p>
<p>In other words, I&#8217;m going to loop through each directory that contains the text &#8220;Flexx&#8221; (technically, it isn&#8217;t limited to just directories, but I don&#8217;t have any files containing &#8220;Flexx&#8221;, so I&#8217;m safe). For each iteration of the loop, the variable <code>$i</code> will contain the name of the folder I&#8217;m interested in.</p>
<div class="code">do echo &#8220;&#8212; Pushing $i&#8221;</div>
<p>The most important bit here is <code>do</code>. <code>do</code> simply begins the functional part of the loop and could be followed by any command that I wanted to start the loop with.</p>
<p>The <code>echo</code> command isn&#8217;t technically necessary. I simply have it there so that I can better determine what output belongs to which repository.</p>
<div class="code">cd $i</div>
<p>This is a very important command. It changes the directory to the repository I wish to run commands on.</p>
<div class="code">git commit -am &#8217;2.5.0&#8242; &amp;&amp; git push &amp;&amp; git tag 2.5.0 &amp;&amp; git push &#8211;tags</div>
<p>This is the command that actually does what I want to do in each repo directory. This adds all the modified files, commits them with a message of &#8220;2.5.0&#8243;, pushes the changes to the remote repository, creates a new tag of 2.5.0, and pushes up the new tag.</p>
<p>I have all of these commands chained together with <code>&amp;&amp;</code> so that if one command fails, the other ones won&#8217;t run. This prevents tagging in the event that the repository couldn&#8217;t be committed or pushed.</p>
<div class="code">cd ..</div>
<p>It&#8217;s a small command but necessary. This switches back to the main directory that holds all the repos, thus returning us back to a state that the next loop iteration can work with.</p>
<div class="code">echo &#8220;&#8212; Finished $i&#8221;</div>
<p>As with the other <code>echo</code> command, this simply allows me to keep track of what is going on more easily.</p>
<div class="code">done</div>
<p>The <code>done</code> command finishes out the loop iteration.</p>
<p>I hope that by sharing this you can gain a bit of insight into how I work with repositories while also learning more about how you can do things with Bash.</p>
]]></content:encoded>
			<wfw:commentRss>http://chrisjean.com/2009/09/15/updating-multiple-git-repositories-easily-using-bash-for-loop/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

