<?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; Tips</title>
	<atom:link href="http://chrisjean.com/tag/tips/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>Change Default Application When Opening Files in Ubuntu</title>
		<link>http://chrisjean.com/2009/04/21/change-default-application-when-opening-files-in-ubuntu/</link>
		<comments>http://chrisjean.com/2009/04/21/change-default-application-when-opening-files-in-ubuntu/#comments</comments>
		<pubDate>Tue, 21 Apr 2009 05:00:29 +0000</pubDate>
		<dc:creator>Chris Jean</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[Tips 'n Tricks]]></category>
		<category><![CDATA[Videos]]></category>
		<category><![CDATA[WordPress]]></category>
		<category><![CDATA[Tips]]></category>
		<category><![CDATA[Ubuntu]]></category>

		<guid isPermaLink="false">http://gaarai.com/?p=1399</guid>
		<description><![CDATA[Now that I know how to do this, it seems so easy and straight-forward. To change the default application files of a specific type are opened with, do the following: Right-click a file that you wish to change the default application for and select Properties. Click the &#8220;Open With&#8221; tab. Select the desired application&#8217;s radio [...]]]></description>
			<content:encoded><![CDATA[<!-- filtered -->
<p>Now that I know how to do this, it seems so easy and straight-forward. To change the default application files of a specific type are opened with, do the following:</p>
<ol>
<li>Right-click a file that you wish to change the default application for and select Properties.</li>
<li>Click the &#8220;Open With&#8221; tab.</li>
<li>Select the desired application&#8217;s radio button.
<ul>
<li>Additional applications can be added if the one you want is not listed. Use the Add button to find the desired application.</li>
<li>You can also remove applications from the list by highlighting the application and clicking the Remove button.</li>
<li>Adding applications to or removing applications from this list changes which applications are available in the &#8220;Open With&#8221; option when you right-click a file.</li>
</ul>
</li>
<li>Click the Close button.</li>
</ol>
<p>Again, it seems so easy and straight-forward now. Go figure. <img src='http://chrisjean.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
]]></content:encoded>
			<wfw:commentRss>http://chrisjean.com/2009/04/21/change-default-application-when-opening-files-in-ubuntu/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Git Submodules: Adding, Using, Removing, Updating</title>
		<link>http://chrisjean.com/2009/04/20/git-submodules-adding-using-removing-and-updating/</link>
		<comments>http://chrisjean.com/2009/04/20/git-submodules-adding-using-removing-and-updating/#comments</comments>
		<pubDate>Mon, 20 Apr 2009 05:00:48 +0000</pubDate>
		<dc:creator>Chris Jean</dc:creator>
				<category><![CDATA[Development]]></category>
		<category><![CDATA[Tips 'n Tricks]]></category>
		<category><![CDATA[git]]></category>
		<category><![CDATA[submodules]]></category>
		<category><![CDATA[Tips]]></category>

		<guid isPermaLink="false">http://gaarai.com/?p=1423</guid>
		<description><![CDATA[I&#8217;ve spent a little more than a month working with Git now. I can honestly say that while there are many things that I like about Git, there are just as many things that I personally find to be a pain in the butt. Submodules specifically have managed to be a thorn in my side [...]]]></description>
			<content:encoded><![CDATA[<!-- filtered -->
<p>I&#8217;ve spent a little more than a month working with <a href="http://git-scm.com/" target="_blank">Git</a> now. I can honestly say that while there are many things that I like about Git, there are just as many things that I personally find to be a pain in the butt.</p>
<p>Submodules specifically have managed to be a thorn in my side on many occasions. While the concept of submodules is simple, figuring out how to actually work with them can be a chore. I say &#8220;figuring out&#8221; because not everything about working with submodules is well documented. I&#8217;ll cover two of the more difficult things to figure out: removing and updating submodules from your repository.</p>
<p><span id="more-1423"></span></p>
<h3>What are Submodules?</h3>
<p>The concept of submodules is brilliant. It essentially allows you to attach an external repository inside another repository at a specific path. In order to illustrate the value of submodules, it will probably be helpful for me to explain how I am using them.</p>
<p>My profession is working with <a href="http://wordpress.org/" target="_blank">WordPress</a> themes. Basically, I develop feature enhancements to the themes. I develop the code for these enhancements in modules that are completely contained in their own folder. This allows for the code to be easily added to other themes and also simplifies code updates/improvements as the code for specific features is consistent across all the themes that use that specific module.</p>
<p>Each theme that we produce is kept in its own Git repository. In addition, I&#8217;ve created a separate repository for each one of these feature modules. Rather than actually putting the feature module code directly into the theme repositories, I simply add the needed feature module repositories as submodules.</p>
<p>For example, we have a theme called FlexxBold. FlexxBold currently includes a total of seven submodules: billboard, contact-page-plugin, featured-images, feedburner-widget, file-utility, flexx-layout-editor, and tutorials. Since I&#8217;m using submodules, the code can be pulled directly from the relevant submodule repositories rather than requiring me to manually update each individual theme repository.</p>
<p>As I mentioned before, not everything in Git is easy to work with. There are four main functions you will need to understand in order to work with Git submodules. In order, you will need to know how to add, make use of, remove, and update submodules. I&#8217;ll cover each of those uses below.</p>
<h3>Adding Submodules to a Git Repository</h3>
<p>Fortunately, adding a submodule to a git repository is actually quite simple. For example, if I&#8217;m in the repository working directory of a new theme called SampleTheme and need to add the billboard repository to the path lib/billboard, I can do so with the following command:</p>
<pre class="terminal"><span style="color:#8FED99;">[<span style="color:#BBFF33;">user@office</span> <span style="color:#729FCF;">SampleTheme</span>]$</span> <span style="color:#FFF;">git submodule add git@mygithost:billboard lib/billboard</span>
Initialized empty Git repository in ~/git_dev/SampleTheme/lib/billboard/.git/
remote: Counting objects: 1006, done.
remote: Compressing objects: 100% (978/978), done.
remote: Total 1006 (delta 631), reused 0 (delta 0)
Receiving objects: 100% (1006/1006), 408.22 KiB, done.
Resolving deltas: 100% (631/631), done.</pre>
<p>There are three main parts to this command:</p>
<ul>
<li>git submodule add &#8211; This simply tells Git that we are adding a submodule. This syntax will always remain the same.</li>
<li>git@mygithost:billboard &#8211; This is the external repository that is to be added as a submodule. The exact syntax will vary depending on the setup of the Git repository you are connecting to. You need to ensure that you have the ability to clone the given repository.</li>
<li>lib/billboard &#8211; This is the path where the submodule repository will be added to the main repository.</li>
</ul>
<p>Let&#8217;s check to see how the repository is doing.</p>
<pre class="terminal"><span style="color:#8FED99;">[<span style="color:#BBFF33;">user@office</span> <span style="color:#729FCF;">SampleTheme</span>]$</span> <span style="color:#FFF;">git status</span>
# On branch master
# Changes to be committed:
#   (use "git reset HEAD &lt;file&gt;..." to unstage)
#
#       new file:   .gitmodules
#       new file:   lib/billboard
#</pre>
<p>Notice how the supplied path was created and added to the changes to be committed. In addition, a new file called .gitmodules was created. This new file contains the details we supplied about the new submodule. Out of curiosity, let&#8217;s check out the contents of that new file:</p>
<pre class="terminal"><span style="color:#8FED99;">[<span style="color:#BBFF33;">user@office</span> <span style="color:#729FCF;">SampleTheme</span>]$</span> <span style="color:#FFF;">cat .gitmodules</span>
[submodule "lib/billboard"]
path = lib/billboard
url = git@mygithost:billboard</pre>
<p>Being able to modify this file later will come in handy later.</p>
<p>All that is left to do now is to commit the changes and then push the commit to a remote system if necessary.</p>
<h3>Using Submodules</h3>
<p>Having submodules in a repository is great and all, but if I look in my repository, all I have is an empty folder rather than the actual contents of the submodule&#8217;s repository. In order to fill in the submodule&#8217;s path with the files from the external repository, you must first initialize the submodules and then update them.</p>
<div class="post-notice">
<p>Note: This has changed in newer versions of  Git. Now the submodule&#8217;s repository will be cloned with master checked out. If that repository also has submodules, then your submodule&#8217;s submodules will have to be populated by following the steps below from within your project&#8217;s submodule directory (confusing yet?).</p>
<p>For instance, if you are working in project called <code>phone-app</code>, add a submodule called <code>graphics-lib</code>, and <code>graphics-lib</code> has a submodule called <code>renderer</code>, when you add <code>graphics-lib</code> to <code>phone-app</code>, the <code>phone-app/graphics-lib</code> directory will be populated as a cloned repo but the <code>phone-app/graphics-lib/renderer</code> directory will be empty. To populate <code>phone-app/graphics-lib/renderer</code>, first change directories to <code>phone-app/graphics-lib</code> and follow the instructions below.</p>
</div>
<p>First, we need to initialize the submodule(s). We can do that with the following command:</p>
<pre class="terminal"><span style="color:#8FED99;">[<span style="color:#BBFF33;">user@office</span> <span style="color:#729FCF;">SampleTheme</span>]$</span> <span style="color:#FFF;">git submodule init</span>
Submodule 'lib/billboard' (git@mygithost:billboard) registered for path 'lib/billboard'</pre>
<p>Then we need to run the update in order to pull down the files.</p>
<pre class="terminal"><span style="color:#8FED99;">[<span style="color:#BBFF33;">user@office</span> <span style="color:#729FCF;">SampleTheme</span>]$</span> <span style="color:#FFF;">git submodule update</span>
Initialized empty Git repository in ~/git_dev/SampleTheme/lib/billboard/.git/
remote: Counting objects: 26, done.
remote: Compressing objects: 100% (22/22), done.
remote: Total 26 (delta 5), reused 0 (delta 0)
Receiving objects: 100% (26/26), 17.37 KiB, done.
Resolving deltas: 100% (5/5), done.
Submodule path 'lib/billboard': checked out '1c407cb2315z0847facb57d79d680f88ca004332'</pre>
<p>Looking in the lib/billboard directory now shows a nice listing of the needed files.</p>
<h3>Removing Submodules</h3>
<p>What happens if we need to remove a submodule? Maybe I made a mistake. It could also be that the design of the project has changed, and the submodules need to change with it. No problem, I&#8217;ll simply run &#8220;<strong>git submodule rm [submodule path]</strong>&#8221; and everything will be great, right?</p>
<pre class="terminal"><span style="color:#8FED99;">[<span style="color:#BBFF33;">user@office</span> <span style="color:#729FCF;">SampleTheme</span>]$</span> <span style="color:#FFF;">git submodule rm lib/billboard</span>
error: pathspec 'rm' did not match any file(s) known to git.
Did you forget to 'git add'?
 b8ff8f68eb56938b9b4bf993619218fa848c5848 lib/billboard (1.2.25)</pre>
<p>Unfortunately, this is wrong. Git does not have a built in way to remove submodules. Hopefully this will be resolved in the future, because we now have to do submodule removal manually.</p>
<p>Sticking with the example, we&#8217;ll remove the lib/billboard module from SampleTheme. All the instructions will be run from the working directory of the SampleTheme repository. In order, we need to do the following:</p>
<ol>
<li>Remove the submodule&#8217;s entry in the .gitmodules file.Since lib/billboard is the only submodule in the SampleTheme repository, we can simply remove the file entirely by running &#8220;git rm lib/billboard&#8221;.If lib/billboard isn&#8217;t the only submodule, the .gitmodules file will have to be modified by hand. Open it up in vi, or your favorite text editory, and remove the three lines relevant to the submodule being removed. In this case, these lines will be removed:
<div class="code">[submodule "lib/billboard"]<br />
path = lib/billboard<br />
url = git@mygithost:billboard</div>
</li>
<li>Remove the submodule&#8217;s entry in the .git/config. This step isn&#8217;t strictly necessary, but it does keep your config file tidy and will help prevent problems in the future.The submodule&#8217;s entry in .git/config will only be present if you&#8217;ve run &#8220;git submodule init&#8221; on the repository. If you haven&#8217;t, you can skip this step.In this example, the following lines will be removed:
<div class="code">[submodule "billboard"]<br />
url = git@mygithost:billboard</div>
</li>
<li>Remove the path created for the submodule. This one is easy. Simply run &#8220;<strong>git rm &#8211;cached [plugin path]</strong>&#8220;. In this example, I will run &#8220;<strong>git rm &#8211;cached lib/billboard</strong>&#8220;.As I&#8217;ve seen noted elsewhere, do not put a trailing slash as the command will fail. For example, if I run &#8220;<strong>git rm &#8211;cached lib/billboard/</strong>&#8220;, I get an error: &#8220;<strong>fatal: pathspec &#8216;lib/billboard/&#8217; did not match any files</strong>&#8220;.
<pre class="terminal"><span style="color:#8FED99;">[<span style="color:#BBFF33;">user@office</span> <span style="color:#729FCF;">SampleTheme</span>]$</span> <span style="color:#FFF;">git rm --cached lib/billboard</span>
rm 'lib/billboard'</pre>
</li>
</ol>
<h3>Updating Submodules</h3>
<p>There is an aspect about submodules that some may not realize when first working with Git submodules. When you add the submodule, the most recent commit of the submodule is stored in the main repository&#8217;s index. That means that as the code in the submodule&#8217;s repository updates, the same code will still be pulled on the repositories relying on the submodule.</p>
<p>This makes a lot of sense when you consider how your code will have been tested and verified (or at least should be) against a specific version of the submodule code, but the main repository&#8217;s code may not work well with new submodule updates before the changes are tested.</p>
<p>Unfortunately, like removing submodules, Git does not make it clear how to update a submodule to a later commit. Fortunately though, it&#8217;s not that tough.</p>
<ol>
<li>Initialize the repository&#8217;s submodules by running &#8220;<strong>git submodule init</strong>&#8221; followed by &#8220;<strong>git submodule update</strong>&#8220;.
<pre class="terminal"><span style="color:#8FED99;">[<span style="color:#BBFF33;">user@office</span> <span style="color:#729FCF;">SampleTheme</span>]$</span> <span style="color:#FFF;">git submodule init</span>
Submodule 'lib/billboard' (git@mygithost:billboard) registered for path 'lib/billboard'
<span style="color:#8FED99;">[<span style="color:#BBFF33;">user@office</span> <span style="color:#729FCF;">SampleTheme</span>]$</span> <span style="color:#FFF;">git submodule update</span>
Initialized empty Git repository in ~/git_dev/SampleTheme/lib/billboard/.git/
remote: Counting objects: 26, done.
remote: Compressing objects: 100% (22/22), done.
remote: Total 26 (delta 5), reused 0 (delta 0)
Receiving objects: 100% (26/26), 17.37 KiB, done.
Resolving deltas: 100% (5/5), done.
Submodule path 'lib/billboard': checked out '1c407cb2315z0847facb57d79d680f88ca004332'</pre>
</li>
<li>Change into the submodule&#8217;s directory. In this example, &#8220;<strong>cd lib/billboard</strong>&#8220;.
<pre class="terminal"><span style="color:#8FED99;">[<span style="color:#BBFF33;">user@office</span> <span style="color:#729FCF;">SampleTheme</span>]$</span> <span style="color:#FFF;">cd lib/billboard</span>
<span style="color:#8FED99;">[<span style="color:#BBFF33;">user@office</span> <span style="color:#729FCF;">SampleTheme/lib/billboard</span>]$</span> <span style="color:#FFF;"></span></pre>
</li>
<li>The submodule repositories added by &#8220;<strong>git submodule update</strong>&#8221; are &#8220;headless&#8221;. This means that they aren&#8217;t on a current branch.To fix this, we simply need to switch to a branch. In this example, that would be the master branch. We switch with the following command: &#8220;<strong>git checkout master</strong>&#8220;.
<pre class="terminal"><span style="color:#8FED99;">[<span style="color:#BBFF33;">user@office</span> <span style="color:#729FCF;">SampleTheme/lib/billboard</span>]$</span> <span style="color:#FFF;">git status</span>
# Not currently on any branch.
nothing to commit (working directory clean)
<span style="color:#8FED99;">[<span style="color:#BBFF33;">user@office</span> <span style="color:#729FCF;">SampleTheme/lib/billboard</span>]$</span> <span style="color:#FFF;">git checkout master</span>
Previous HEAD position was b8ff8f6... re-ordering
Switched to branch 'master'
Your branch is behind 'origin/master' by 8 commits, and can be fast-forwarded.
<span style="color:#8FED99;">[<span style="color:#BBFF33;">user@office</span> <span style="color:#729FCF;">SampleTheme/lib/billboard</span>]$</span> <span style="color:#FFF;">git status</span>
# On branch master
# Your branch is behind 'origin/master' by 8 commits, and can be fast-forwarded.
#
nothing to commit (working directory clean)</pre>
</li>
<li>Next, we simply need to update the repository to ensure that we have the latest updates. We can do that with a pull: &#8220;<strong>git pull</strong>&#8220;.
<pre class="terminal"><span style="color:#8FED99;">[<span style="color:#BBFF33;">user@office</span> <span style="color:#729FCF;">SampleTheme/lib/billboard</span>]$</span> <span style="color:#FFF;">git pull</span>
remote: Counting objects: 31, done.
remote: Compressing objects: 100% (24/24), done.
remote: Total 24 (delta 15), reused 0 (delta 0)
Unpacking objects: 100% (24/24), done.
From mygithost:billboard
   b8ff8f6..5cab93f  master     -&gt; origin/master
 * [new tag]         1.2.28     -&gt; 1.2.28
From mygithost:billboard
 * [new tag]         1.2.26     -&gt; 1.2.26
 * [new tag]         1.2.27     -&gt; 1.2.27
Updating c547e0d..5cab93f
Fast-forward
 billboard.php                           |  109 ++++++++++++++-
 classes/view_gettingstarted.php         |  107 ++++++++++++++
 classes/view_gettingstarted_content.php |   38 +++++
 css/admin.css                           |   26 ++++
 history.txt                             |   22 +++-
 js/admin.js                             |   17 +++
 lib/updater/get.php                     |   94 +++++++-----
 lib/updater/history.txt                 |    9 ++
 lib/updater/updater.php                 |  241 ++++++++++++++++++-------------
 9 files changed, 519 insertions(+), 144 deletions(-)
 create mode 100644 classes/view_gettingstarted.php
 create mode 100644 classes/view_gettingstarted_content.php
 create mode 100644 css/admin.css
 create mode 100644 js/admin.js
 create mode 100644 lib/updater/history.txt</pre>
</li>
<li>Now switch back to the root working directory of the repository. In our example, we are two directories in, so we run &#8220;<strong>cd ../..</strong>&#8220;.
<pre class="terminal"><span style="color:#8FED99;">[<span style="color:#BBFF33;">user@office</span> <span style="color:#729FCF;">SampleTheme/lib/billboard</span>]$</span> <span style="color:#FFF;">cd ../..</span>
<span style="color:#8FED99;">[<span style="color:#BBFF33;">user@office</span> <span style="color:#729FCF;">SampleTheme</span>]$</span> <span style="color:#FFF;"></span></pre>
</li>
<li>Everything is now ready to be commit and pushed back in (if there is a remote repository to push to that is). If you run &#8220;<strong>git status</strong>&#8220;, you&#8217;ll notice that the path to the submodule is listed as modified. This is what you should expect to see. Simply add the path to be commit and do a commit. When you do the commit, the index will update the commit string for the submodule.
<pre class="terminal"><span style="color:#8FED99;">[<span style="color:#BBFF33;">user@office</span> <span style="color:#729FCF;">SampleTheme</span>]$</span> <span style="color:#FFF;">git status</span>
# On branch master
# Changed but not updated:
#   (use "git add ..." to update what will be committed)
#   (use "git checkout -- ..." to discard changes in working directory)
#
#	modified:   lib/billboard (new commits)
#
no changes added to commit (use "git add" and/or "git commit -a")
<span style="color:#8FED99;">[<span style="color:#BBFF33;">user@office</span> <span style="color:#729FCF;">SampleTheme</span>]$</span> <span style="color:#FFF;">git add lib/billboard</span>
<span style="color:#8FED99;">[<span style="color:#BBFF33;">user@office</span> <span style="color:#729FCF;">SampleTheme</span>]$</span> <span style="color:#FFF;">git status</span>
# On branch master
# Changes to be committed:
#   (use "git reset HEAD ..." to unstage)
#
#	modified:   lib/billboard
#</pre>
</li>
</ol>
<h3>Closing Thoughts</h3>
<p>I&#8217;ve learned a lot in my short time with Git. Expect to see more details about working with Git in the future. I have a series of pitfalls I&#8217;ve discovered that I should organize together and post about. I&#8217;ve also created some really slick scripts to help me automate numerous things when working with the repositories that I&#8217;d like to share.</p>
<p>If there is anything specfic you&#8217;d like to know about Git, please add a comment or <a href="http://chrisjean.com/contact/" target="_blank">contact me</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://chrisjean.com/2009/04/20/git-submodules-adding-using-removing-and-updating/feed/</wfw:commentRss>
		<slash:comments>44</slash:comments>
		</item>
		<item>
		<title>MySQL Natural Sort Order By on Non-Numeric Field Type</title>
		<link>http://chrisjean.com/2009/04/19/mysql-natural-sort-order-by-on-non-numeric-field-type/</link>
		<comments>http://chrisjean.com/2009/04/19/mysql-natural-sort-order-by-on-non-numeric-field-type/#comments</comments>
		<pubDate>Sun, 19 Apr 2009 05:00:45 +0000</pubDate>
		<dc:creator>Chris Jean</dc:creator>
				<category><![CDATA[Development]]></category>
		<category><![CDATA[Tips 'n Tricks]]></category>
		<category><![CDATA[MySQL]]></category>
		<category><![CDATA[Tips]]></category>

		<guid isPermaLink="false">http://gaarai.com/?p=1408</guid>
		<description><![CDATA[I recently worked on a project where I had to sort a set of rows returned from a MySQL query. The problem is that most of the data in the field being sorted is numeric yet the field type is varchar since some of the entries contained characters. The reason that this is a problem [...]]]></description>
			<content:encoded><![CDATA[<!-- filtered -->
<p>I recently worked on a project where I had to sort a set of rows returned from a MySQL query. The problem is that most of the data in the field being sorted is numeric yet the field type is varchar since some of the entries contained characters.</p>
<p>The reason that this is a problem is that MySQL sorts character fields using a method that will produce undesirable results with numeric data. For example, sorting 4, 10, and 50 as character data produces 10, 4, and 50. In most applications, this is highly undesirable.</p>
<p>The solution to this is to force a sorting order that is commonly referred to as a natural sort. Natural sort is just a term that refers to how humans would commonly sort a set of information (numbers as numbers and non-numeric characters alphabetically). Fortunately, this isn&#8217;t difficult to achieve in MySQL.</p>
<p><span id="more-1408"></span>To further illustrate the problem, here is a simple table description:</p>
<pre>&gt; DESC SampleData;
<table border="0">
<tbody>
<tr>
<th><b>Field</b></th>
<th><b>Type</b></th>
</tr>
<tr>
<td>data_char&nbsp;</td>
<td>varchar(5)</td>
</tr>
</tbody>
</table>
</pre>
<p>I filled up the table with sample data. The following example query and resulting data shows the problem clearly:</p>
<pre>&gt; SELECT * FROM SampleData ORDER BY data_char;
<table border="0">
<tbody>
<tr>
<th><b>data_char</b></th>
</tr>
<tr>
<td>10</td>
</tr>
<tr>
<td>11</td>
</tr>
<tr>
<td>120</td>
</tr>
<tr>
<td>21</td>
</tr>
<tr>
<td>3</td>
</tr>
<tr>
<td>a1</td>
</tr>
</tbody>
</table>
</pre>
<p>As you can see, the results aren&#8217;t exactly usable. If we simply modify the order by declaration slightly (add &#8220;+0&#8243; to the order by field), you can force MySQL to sort the field naturally.</p>
<pre>&gt; SELECT * FROM SampleData ORDER BY data_char+0;
<table border="0">
<tbody>
<tr>
<th><b>data_char</b></th>
</tr>
<tr>
<td>3</td>
</tr>
<tr>
<td>10</td>
</tr>
<tr>
<td>11</td>
</tr>
<tr>
<td>21</td>
</tr>
<tr>
<td>120</td>
</tr>
<tr>
<td>a1</td>
</tr>
</tbody>
</table>
</pre>
<p>There you have it. To force a natural sort, just add a 0 onto the field you wish to be naturally sorted.</p>
]]></content:encoded>
			<wfw:commentRss>http://chrisjean.com/2009/04/19/mysql-natural-sort-order-by-on-non-numeric-field-type/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>Tool to Optimize MySQL Configuration and Performance</title>
		<link>http://chrisjean.com/2008/10/23/optimize-mysql-configuration-and-performance/</link>
		<comments>http://chrisjean.com/2008/10/23/optimize-mysql-configuration-and-performance/#comments</comments>
		<pubDate>Thu, 23 Oct 2008 16:21:03 +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[Tips]]></category>
		<category><![CDATA[Tools]]></category>

		<guid isPermaLink="false">http://gaarai.com/?p=367</guid>
		<description><![CDATA[Web applications developers such as myself often have a hard time keeping up with everything that&#8217;s going on. There&#8217;s always some new programming or scripting language, new standards, new browsers, new technologies, new paradigms, new social networks, and on and on. Every day, something new happens. The end result of all of this always ends [...]]]></description>
			<content:encoded><![CDATA[<!-- filtered -->
<p>Web applications developers such as myself often have a hard time keeping up with everything that&#8217;s going on. There&#8217;s always some new programming or scripting language, new standards, new browsers, new technologies, new paradigms, new social networks, and on and on. Every day, something new happens. The end result of all of this always ends up being very similar: people demand faster applications that deal with ever-increasing amounts of data which end up putting massive stress on the server architecture.</p>
<p>As we toil to improve the performance of the applications and their snappy response times, it becomes easy to forget about how we can tweak settings on a low level to provide massive speed improvements on the front-end. For example, most people don&#8217;t know that you can configure MySQL to take better advantage of the resources that the server has available.</p>
<p>By default, MySQL is configured to consume a relatively limited amount of memory resources. Start giving MySQL more memory to work with, and your application&#8217;s performance can improve greatly.</p>
<p><span id="more-367"></span></p>
<p>Unfortunately, I&#8217;m not a MySQL configuration guru. I&#8217;ve never read through the source code or any low-level technical documents about how it functions. So most of the configurations options are a complete mystery to me, and I don&#8217;t know if changing a specific option could benefit me at all.</p>
<p>Fortunately, I don&#8217;t have to be a MySQL configuration guru to get better performance. There is an amazing tool created by Matthew Montgomery called the <a href="http://day32.com/MySQL/" target="_blank">MySQL performance tuning primer script</a>.</p>
<p>Matthew Montgomery&#8217;s script does an amazing job of giving me information about how my MySQL configuration may be inappropriate for the queries being executed and provides information about what variables to modify in order to better optimize my configuration. For example, the &#8220;TEMP TABLES&#8221; section of the output tells me the following:</p>
<pre style="padding-left: 30px;">TEMP TABLES
Current max_heap_table_size = 512 M
Current tmp_table_size = 512 M
Of 1684 temp tables, 10% were created on disk
Effective in-memory tmp_table_size is limited to max_heap_table_size.
Created disk tmp tables ratio seems fine</pre>
<p>Previously, I had my <code>max_heap_table_size</code> and <code>tmp_table_size</code> variables set to default settings and had up to 60% of my temp tables created on disk. As much as possible, temp tables should be created in memory to reduce the performance penalty of using the disk for random access to such data rather than memory which is much faster.</p>
<p>Now this doesn&#8217;t mean that you should set your variables to the same settings as I have. The server that this is running on is dedicated to running a dispatching system that has many tables containing hundreds of thousands of rows each. The value of the script is that it will help you tailor your settings to best use your hardware without having MySQL consume too many resources that other processes (such as you web server) could use.</p>
<p>The script is provided as a standard Linux shell script. <a href="http://day32.com/MySQL/tuning-primer.sh" target="_blank">Download the script</a> into a folder of your choosing and run &#8220;<code>sh tuning-primer.sh</code>&#8220;.</p>
<p>Good luck with your MySQL optimization. I hope that you get as great of results as I have. Keep in mind that if your table structures and queries are inefficient to begin with, that configuration optimization can only do so much to improve the performance.</p>
<h2>Further Reading</h2>
<ul>
<li><a href="http://www.ibm.com/developerworks/library/l-tune-lamp-3.html" target="_blank">Tuning LAMP systems, Part 3: Tuning your MySQL server</a><br />
This is a great read that should help most novice database administrators understand some of the basics about tuning their database&#8217;s performance.</li>
<li><a href="http://www.mysqlperformanceblog.com/" target="_blank">MySQL Performance Blog</a><br />
A blog by the authors of <a href="http://oreilly.com/catalog/9780596101718/" target="_blank">High Performance MySQL</a> (also highly recommended). This blog is updated frequently with great tips that will help you develop higher-performance apps.</li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://chrisjean.com/2008/10/23/optimize-mysql-configuration-and-performance/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Can pinging get your WordPress site blocked?</title>
		<link>http://chrisjean.com/2008/05/03/can-pinging-get-your-wordpress-site-blocked/</link>
		<comments>http://chrisjean.com/2008/05/03/can-pinging-get-your-wordpress-site-blocked/#comments</comments>
		<pubDate>Sat, 03 May 2008 07:00:18 +0000</pubDate>
		<dc:creator>Chris Jean</dc:creator>
				<category><![CDATA[Tips 'n Tricks]]></category>
		<category><![CDATA[WordPress]]></category>
		<category><![CDATA[Pings]]></category>
		<category><![CDATA[Plugins]]></category>
		<category><![CDATA[Tips]]></category>

		<guid isPermaLink="false">http://blog.realthemes.com/?p=16</guid>
		<description><![CDATA[Many clients have shared concerns with me about using the built-in Update Services feature of WordPress to automatically ping services like Ping-O-Matic. Why are they concerned? They have heard horror stories from fellow bloggers or read random stories you can find on the web about WordPress sites being blocked from these sites due to a [...]]]></description>
			<content:encoded><![CDATA[<!-- filtered -->
<p>Many clients have shared concerns with me about using the built-in Update Services feature of WordPress to automatically ping services like <a href="http://pingomatic.com/" target="_blank">Ping-O-Matic</a>. Why are they concerned? They have heard horror stories from fellow bloggers or read random stories you can find on the web about WordPress sites being blocked from these sites due to a variety of different reasons. Unfortunately, there is much more information out there about the problems and very little information about solutions. In this post, I aim to address the major concerns and provide solutions where solutions are needed.<span id="more-154"></span></p>
<p>Some WordPress users will be tempted to not use the Update Services feature in order to avoid this situation. Other WordPress users will just dismiss the problems as something that doesn&#8217;t affect them. Both of these reactions are poor solutions to the problem since pinging can bring in quality traffic to your blog with little to no effort. That said, you do have to do a little bit of work to make sure that you aren&#8217;t going to get blocked by the pinging services.</p>
<h3>Future Posting</h3>
<p>The biggest concern that people have and the one that is widely reported as the major issue is scheduling posts for a future date. Scheduling posts ahead of time has many great benefits: posts can always come out at a specific time, you can batch many days&#8217; worth of posts so that you don&#8217;t have to write every day, etc. However, it has been reported that the combination of scheduling posts for a future date and using Update Services have horrible consequences.</p>
<p><strong>What&#8217;s the problem?</strong> The idea behind this fear is that scheduling a future post causes the ping to go through the moment you hit the Publish button. This would cause the pinging service to look poorly upon your blog since you are telling them about non-existent material (since the post hasn&#8217;t been visibly published yet).</p>
<p><strong>What&#8217;s really happening?</strong> This problem was very real not too long ago. Versions of WordPress prior to 2.1 would ping the moment you published the post, irregardless of whether or not the post was visible yet. However, as of WordPress version 2.1 on, this has not been a problem. In these newer versions, a ping will not be sent until the post is visible.</p>
<p><strong>What&#8217;s the solution?</strong> If you are still running a version of WordPress prior to 2.1, I highly recommend that you upgrade. Not only do the latest versions have great features that will make your life as a blogger easier, but they also include numerous security fixes and bug fixes such as this one.</p>
<h3>Editing and Updating</h3>
<p>Have you ever published a post just to make a quick change minutes or hours later? Have you ever had so many little mistakes in a post that you&#8217;ve found yourself going back time and time again to make &#8220;just one last fix?&#8221; How about clicking the Publish button and then seeing a mistake before the article even finishes publishing? Yeah&#8230; Neither have I. According to some people out there, all these little edits and updates can get your blog banned from pinging services.</p>
<p><strong>What&#8217;s the problem?</strong> WordPress&#8217;s Update Services feature wants to tell the world that your blog is out there and active; however, sometimes this feature gets overzealous and pings these services when you really don&#8217;t want it to. Basically, the Update Services feature will ping every site in your list each and every time you save a published post (after the posting date) no matter how big or small the edit to the content was. So, that time that you made ten changes to the content within a matter of minutes after publishing the post, you sent out an additional ten pings to your Update Services list.</p>
<p><strong>What&#8217;s really happening?</strong> In this case, WordPress is behaving exactly as reported. When you make those numerous tiny tweaks to your content right after publishing, you are sending more and more duplicate pings to your pinging services. Depending on the service, this can get your temporarily or permanently banned from their service very quickly.</p>
<p><strong>What&#8217;s the solution?</strong> Fortunately, many great solutions for the problems with WordPress&#8217; auto-ping feature exist. My personal favorite is <a href="http://ultimateplugins.com/" target="_blank">Ultimate Plugins&#8217;</a> <a href="http://ultimateplugins.com/smart-update-pinger/" target="_blank">Smart Update Pinger</a> plugin. This plugin not only prevents ping services from getting hit each time you edit your post, but it also allows you to manually ping the services in case you make a large edit, such as an update on the post topic, later on that you would like to notify the ping services about.</p>
<h3>Conclusion</h3>
<p>As you can see, WordPress has offered a great tool to help your blog get noticed, but it is not without its problems. Adding a plugin such as the <a href="http://ultimateplugins.com/smart-update-pinger/" target="_blank">Smart Update Pinger</a> can really help you take advantage of pinging services without running the risk of getting banned by those services for abusing their system.</p>
<p>If everyone is interested enough, I&#8217;ll make another post in the future about the value of pinging and how to best take advantage of pinging to help maximize your blog&#8217;s potential.</p>
<h3>Recommended Reading</h3>
<ul>
<li><a href="http://codex.wordpress.org/Update_Services" target="_blank">Update Services on the WordPress Codex</a></li>
<li><a href="http://technorati.com/developers/ping/wordpress.html" target="_blank">Ping Technorati using WordPress</a></li>
<li><a href="http://www.instant-info-online.com/wordpress-compressed-all-inclusive-ping-list.html" target="_blank">WordPress Compressed All-Inclusive Ping List</a></li>
<li><a href="http://en.wikipedia.org/wiki/Ping_%28blogging%29" target="_blank">Ping (blogging) on Wikipedia</a> (technical)</li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://chrisjean.com/2008/05/03/can-pinging-get-your-wordpress-site-blocked/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

