<?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>jesse j collins &#187; code</title>
	<atom:link href="http://jessejcollins.com/blog/category/code/feed/" rel="self" type="application/rss+xml" />
	<link>http://jessejcollins.com/blog</link>
	<description>slash blog</description>
	<lastBuildDate>Tue, 20 Mar 2012 06:14:04 +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>Reset AUTO_INCREMENT in MySQL</title>
		<link>http://jessejcollins.com/blog/2009/05/16/reset-auto_increment-in-mysql/</link>
		<comments>http://jessejcollins.com/blog/2009/05/16/reset-auto_increment-in-mysql/#comments</comments>
		<pubDate>Sat, 16 May 2009 16:36:16 +0000</pubDate>
		<dc:creator>jesse</dc:creator>
				<category><![CDATA[code]]></category>
		<category><![CDATA[mysql]]></category>
		<category><![CDATA[sql]]></category>

		<guid isPermaLink="false">http://jessejcollins.com/blog/?p=49</guid>
		<description><![CDATA[Despite it being simple, I always forget the syntax to reset AUTO_INCREMENT in MySQL.  I&#8217;m posting this for my reference and hopefully others will find it useful.]]></description>
			<content:encoded><![CDATA[<p>Despite it being simple, I always forget the syntax to reset AUTO_INCREMENT in MySQL.  I&#8217;m posting this for my reference and hopefully others will find it useful.</p>
<pre class="brush: sql; title: ; notranslate">
ALTER TABLE table_name AUTO_INCREMENT = next_increment_number
</pre>
]]></content:encoded>
			<wfw:commentRss>http://jessejcollins.com/blog/2009/05/16/reset-auto_increment-in-mysql/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Automated Craigslist Search with Cron</title>
		<link>http://jessejcollins.com/blog/2009/02/21/automated-craigslist-search-with-cron/</link>
		<comments>http://jessejcollins.com/blog/2009/02/21/automated-craigslist-search-with-cron/#comments</comments>
		<pubDate>Sat, 21 Feb 2009 06:07:23 +0000</pubDate>
		<dc:creator>jesse</dc:creator>
				<category><![CDATA[code]]></category>
		<category><![CDATA[craigslist]]></category>
		<category><![CDATA[cron]]></category>
		<category><![CDATA[korn shell]]></category>
		<category><![CDATA[ksh]]></category>
		<category><![CDATA[sh]]></category>

		<guid isPermaLink="false">http://jessejcollins.com/blog/?p=13</guid>
		<description><![CDATA[I was looking for a way to have an automated search for some items I&#8217;m looking for on Craigslist, but nothing exists in Craigslist to email you daily/weekly for items matching a particular string.  I found a few websites that offered this functionality via an application, but I&#8217;m not down for that.  Instead I wrote [...]]]></description>
			<content:encoded><![CDATA[<p>I was looking for a way to have an automated search for some items I&#8217;m looking for on Craigslist, but nothing exists in Craigslist to email you daily/weekly for items matching a particular string.  I found a few websites that offered this functionality via an application, but I&#8217;m not down for that.  Instead I wrote this simple korn shell script.  Enjoy!</p>
<pre class="brush: bash; title: ; notranslate">
#!/bin/sh
echo &quot;--&gt; Setup...&quot;;
directory=/my/dir/for/results/;
filename=&quot;craigslist_dell_monitor.html&quot;;
path=&quot;${directory}${filename}&quot;;
website=&quot;http://mycity.craigslist.org/search/sss?query=dell+2005fpw&amp;amp;minAsk=min&amp;amp;maxAsk=max&quot;
echo &quot;--&gt; Searching for Dell Monitor...&quot;;
wget -O ${path} ${website}
ls -la ${directory}
echo &quot;--&gt; Checking for results...&quot;;
cat ${path} | grep &quot;Found:&quot;
if [ $? == 0 ]
then
echo &quot;--&gt; Sending results email...&quot;;
echo ${website} | mail -s &quot;craigslist search - Dell Monitor&quot; myemail@gmail.com
else
echo &quot;--&gt; No results.&quot;;
fi
exit;
</pre>
<p>Any guesses on what I was searching for?  <img src='http://jessejcollins.com/blog/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
]]></content:encoded>
			<wfw:commentRss>http://jessejcollins.com/blog/2009/02/21/automated-craigslist-search-with-cron/feed/</wfw:commentRss>
		<slash:comments>7</slash:comments>
		</item>
		<item>
		<title>XSL Cross-Browser Transformations w/ JavaScript</title>
		<link>http://jessejcollins.com/blog/2007/03/07/xsl-cross-browser-transformations-w-javascript/</link>
		<comments>http://jessejcollins.com/blog/2007/03/07/xsl-cross-browser-transformations-w-javascript/#comments</comments>
		<pubDate>Wed, 07 Mar 2007 19:28:41 +0000</pubDate>
		<dc:creator>jesse</dc:creator>
				<category><![CDATA[code]]></category>
		<category><![CDATA[xml]]></category>
		<category><![CDATA[xsl]]></category>

		<guid isPermaLink="false">http://jessejcollins.com/blog2/?p=3</guid>
		<description><![CDATA[Here is an example of how to display an XML (extensible markup language) document using an XSL (extensible stylesheet language) document in your browser. First, we will need an XML document containing the information we would like to display. Below is the XML document we will be using. Next, we will need an XSL document [...]]]></description>
			<content:encoded><![CDATA[<p>Here is an example of how to display an XML (extensible markup language) document using an XSL (extensible stylesheet language) document in your browser.</p>
<p>First, we will need an XML document containing the information we would like to display. Below is the XML document we will be using.</p>
<pre class="brush: xml; title: ; notranslate">
&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot;?&gt;
&lt;schedule&gt;
	&lt;day value=&quot;2007-3-7&quot;&gt;
		&lt;hour value=&quot;8:00&quot; suffix=&quot;AM&quot;&gt;
			&lt;length&gt;1 hour(s)&lt;/length&gt;
			&lt;attending&gt;yes&lt;/attending&gt;
		&lt;/hour&gt;
		&lt;hour value=&quot;9:00&quot; suffix=&quot;AM&quot;&gt;
			&lt;length&gt;1 hour(s)&lt;/length&gt;
			&lt;attending&gt;yes&lt;/attending&gt;
		&lt;/hour&gt;
		&lt;hour value=&quot;1:30&quot; suffix=&quot;PM&quot;&gt;
			&lt;length&gt;2 hour(s)&lt;/length&gt;
			&lt;attending&gt;yes&lt;/attending&gt;
		&lt;/hour&gt;
	&lt;/day&gt;
	&lt;day value=&quot;2007-3-8&quot;&gt;
		&lt;hour value=&quot;10:00&quot; suffix=&quot;AM&quot;&gt;
			&lt;length&gt;1 hour(s)&lt;/length&gt;
			&lt;attending&gt;no&lt;/attending&gt;
		&lt;/hour&gt;
		&lt;hour value=&quot;1:00&quot; suffix=&quot;PM&quot;&gt;
			&lt;length&gt;3 hour(s)&lt;/length&gt;
			&lt;attending&gt;yes&lt;/attending&gt;
		&lt;/hour&gt;
	&lt;/day&gt;
&lt;/schedule&gt;
</pre>
<p>Next, we will need an XSL document containing how we would like the data to be displayed.</p>
<pre class="brush: xml; title: ; notranslate">
&lt;?xml version=&quot;1.0&quot; encoding=&quot;ISO-8859-1&quot;?&gt;
&lt;xsl:stylesheet version=&quot;1.0&quot; xmlns:xsl=&quot;http://www.w3.org/1999/XSL/Transform&quot;&gt;
&lt;xsl:output method='html' version='1.0' encoding='UTF-8' indent='yes'/&gt;

	&lt;xsl:template match=&quot;/&quot;&gt;
		&lt;html&gt;
			&lt;body&gt;
				&lt;table border=&quot;1&quot;&gt;
					&lt;tr bgcolor=&quot;#777777&quot;&gt;
						&lt;th align=&quot;left&quot;&gt;Day&lt;/th&gt;
						&lt;th align=&quot;left&quot;&gt;Hour&lt;/th&gt;
						&lt;th align=&quot;left&quot;&gt;AM/PM&lt;/th&gt;
						&lt;th align=&quot;left&quot;&gt;Length&lt;/th&gt;
						&lt;th align=&quot;left&quot;&gt;Attending?&lt;/th&gt;
					&lt;/tr&gt;
					&lt;xsl:for-each select=&quot;schedule/day/hour&quot;&gt;
						&lt;tr bgcolor=&quot;#EAF2FA&quot;&gt;
							&lt;td&gt;&lt;xsl:value-of select=&quot;../@value&quot;/&gt;&lt;/td&gt;
							&lt;td&gt;&lt;xsl:value-of select=&quot;@value&quot;/&gt;&lt;/td&gt;
							&lt;td&gt;&lt;xsl:value-of select=&quot;@suffix&quot;/&gt;&lt;/td&gt;
							&lt;td&gt;&lt;xsl:value-of select=&quot;length&quot;/&gt;&lt;/td&gt;
							&lt;td&gt;&lt;xsl:value-of select=&quot;attending&quot;/&gt;&lt;/td&gt;
						&lt;/tr&gt;
					&lt;/xsl:for-each&gt;
				&lt;/table&gt;
			&lt;/body&gt;
		&lt;/html&gt;
	&lt;/xsl:template&gt;

&lt;/xsl:stylesheet&gt;
</pre>
<p>Next, we will need a simple HTML document.</p>
<pre class="brush: xml; title: ; notranslate">
&lt;html&gt;
&lt;head&gt;
	&lt;script src=&quot;./js/loadXml.js&quot; type=&quot;text/javascript&quot;&gt;&lt;/script&gt;
&lt;/head&gt;
&lt;body&gt;
	&lt;button onclick=&quot;displayXml('schedule.xml','./xsl/schedule.xsl')&quot;&gt;Load&lt;/button&gt;
	&lt;button onclick=&quot;document.getElementById('output').innerHTML='';&quot;&gt;Clear&lt;/button&gt;
	&lt;div id=&quot;output&quot;&gt;&lt;/div&gt;
&lt;/body&gt;
&lt;/html&gt;
</pre>
<p>Finally, we will need a JavaScript file that will be in charge of loading and transforming the XML and XSL documents.</p>
<pre class="brush: jscript; title: ; notranslate">
function displayXml(sXmlLocation,sXslLocation) {
	if (window.ActiveXObject) { // microsoft ie
		// load xml
		var xml = new ActiveXObject(&quot;Microsoft.XMLDOM&quot;);
		xml.async = false;
		xml.load(sXmlLocation);

		// load xsl
		var xsl = new ActiveXObject(&quot;Microsoft.XMLDOM&quot;);
		xsl.async = false;
		xsl.load(sXslLocation);

		// transform doc and write to div
		var out = document.getElementById(&quot;output&quot;);
		out.innerHTML = xml.transformNode(xsl);

	} else if (document.implementation &amp;&amp; document.implementation.createDocument) { // firefox and netscape
		// create xslt processor object
		var processor = new XSLTProcessor(); 

		// load xml
		xml=document.implementation.createDocument(&quot;&quot;,&quot;&quot;,null);
		xml.async = false;
		xml.load(sXmlLocation);

		// load xsl
		xsl=document.implementation.createDocument(&quot;&quot;,&quot;&quot;,null);
		xsl.async = false;
		xsl.load(sXslLocation);
		processor.importStylesheet(xsl);

		// transform doc and serialize to string
		var result = processor.transformToDocument(xml);
		var xmls = new XMLSerializer();
		var output = xmls.serializeToString(result); 

		// write to div
		var out = document.getElementById(&quot;output&quot;);
		out.innerHTML = output;
	} else {
		alert('Browser not supported.');
	}
}
</pre>
<p><a title="see example" href="http://www.jessejcollins.com/files/jessejcollins-2007-03-07/" target="_blank">Here</a> is what the final product looks like. Click &#8220;Load&#8221; to execute the JavaScript method.</p>
<p><a title="download package" href="http://www.jessejcollins.com/files/jessejcollins-2007-03-07.zip" target="_blank">Click here</a> if you would like to download the complete package.</p>
<p>I hope this short tutorial/example can be of help to someone looking to display XML with XSL in a browser using JavaScript.</p>
]]></content:encoded>
			<wfw:commentRss>http://jessejcollins.com/blog/2007/03/07/xsl-cross-browser-transformations-w-javascript/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Script for Installing Subversion on Ubuntu</title>
		<link>http://jessejcollins.com/blog/2006/11/02/script-for-installing-subversion-on-ubuntu/</link>
		<comments>http://jessejcollins.com/blog/2006/11/02/script-for-installing-subversion-on-ubuntu/#comments</comments>
		<pubDate>Thu, 02 Nov 2006 15:35:24 +0000</pubDate>
		<dc:creator>jesse</dc:creator>
				<category><![CDATA[code]]></category>
		<category><![CDATA[subversion]]></category>
		<category><![CDATA[svn]]></category>

		<guid isPermaLink="false">http://jessejcollins.com/blog2/?p=10</guid>
		<description><![CDATA[I put together a script that will automate the installation and setup process of Subversion and Apache2 on Ubuntu. This script follows all the steps outlined in my Subversion tutorial which can be found here. A few things to point out: The subversion repository will be created at the root in a folder named &#8220;/svn&#8221;. [...]]]></description>
			<content:encoded><![CDATA[<p>I put together a script that will automate the installation and setup process of Subversion and Apache2 on Ubuntu. This script follows all the steps outlined in my Subversion tutorial which can be found <a title="Subversion Tutorial" href="http://jessejcollins.com/blog/2006/10/17/setup-subversion-with-apache2-on-ubuntu">here</a>.</p>
<p>A few things to point out:</p>
<ol>
<li>The subversion repository will be created at the root in a folder named &#8220;/svn&#8221;.</li>
<li>The script will download a new dav_svn.conf file from my server that has been modified for the script.</li>
<li>SSL is not used.</li>
</ol>
<p>The script requires 4 arguments.</p>
<ol>
<li>The Username of the Subversion Authenticated user to create.</li>
<li>The Password of the Subversion Authenticated user to create.</li>
<li>The folder to add to the new Subversion repository.</li>
<li>The name of the new Subversion project.</li>
</ol>
<pre class="brush: bash; title: ; notranslate">sh setup_subversion.sh [username] [password] [folder_path] [project_name]</pre>
<p>Here is an example:</p>
<pre class="brush: bash; title: ; notranslate">sh setup_subversion.sh jesse mypassword /home/jesse/myproject myprojectname</pre>
<p>This script has only been tested on Ubuntu 6.10 Edgy Eft. If anyone runs the script successfully on another version of Ubuntu or another Linux distribution please let me know. Also, I am <span style="text-decoration: line-through;">99.999%</span> 100% positive that the script will work on Ubuntu 6.06 Dapper Drake.</p>
<p><strong>Update:</strong> I have been informed that the script is compatible with Ubuntu 6.06 Dapper Drake.</p>
<p><strong>Note:</strong> A script for Ubuntu 7.04 Feisty Fawn has been added.</p>
<p><strong>Pick your version of Ubuntu:</strong></p>
<p><a title="Download the 6.06/6.10 Script" href="http://www.jessejcollins.com/files/ubuntu/setup_subversion.sh">6.06/6.10 Script</a> or <a title="Download the 7.04 Script" href="http://www.jessejcollins.com/files/ubuntu/setup_subversion_7.04.sh">7.04 Script</a></p>
]]></content:encoded>
			<wfw:commentRss>http://jessejcollins.com/blog/2006/11/02/script-for-installing-subversion-on-ubuntu/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Setup Subversion with Apache2 on Ubuntu</title>
		<link>http://jessejcollins.com/blog/2006/10/17/setup-subversion-with-apache2-on-ubuntu/</link>
		<comments>http://jessejcollins.com/blog/2006/10/17/setup-subversion-with-apache2-on-ubuntu/#comments</comments>
		<pubDate>Tue, 17 Oct 2006 16:49:13 +0000</pubDate>
		<dc:creator>jesse</dc:creator>
				<category><![CDATA[code]]></category>
		<category><![CDATA[subversion]]></category>
		<category><![CDATA[svn]]></category>

		<guid isPermaLink="false">http://jessejcollins.com/blog2/?p=13</guid>
		<description><![CDATA[Note: I have created a script to automate this process. The post regarding the script can be found here. This guide is for setting up a Subversion (SVN) repository in Ubuntu. Subversion is a version control system which enables multiple users to modify the same document. Therefore, a tool such as Subversion comes in really [...]]]></description>
			<content:encoded><![CDATA[<p><strong>Note:</strong> I have created a script to automate this process.  The post regarding the script can be found <a href="http://jessejcollins.com/blog/2006/11/02/script-for-installing-subversion-on-ubuntu">here</a>.</p>
<p>This guide is for setting up a <a title="Official Subversion Site" href="http://subversion.tigris.org/">Subversion</a> (SVN) repository in Ubuntu. Subversion is a version control system which enables multiple users to modify the same document. Therefore, a tool such as Subversion comes in really handy when developing software on a team. Also, Subversion can be a life saver when you need to revert back to older versions of a document (e.g. you made some changes to your code and now everything is broken).</p>
<p>This guide is for creating a repository that requires authentication for all access. This is unlike open source SVN repositories which allow anonymous read access. If you desire, access permissions can be changed at the end of step 3.</p>
<p>Also, this guide does not use SSL and therefore is only recommended for secure local networks (e.g. behind a router at your house or corporate network) if you are working on something important. Maybe I will add SSL to this tutorial in the future.</p>
<p>When creating this guide I used Ubuntu 6.06, Apache2 2.0.55, and Subversion 1.3.1. Ok, on with the walkthrough.</p>
<p><strong>1)</strong> Install Apache2, Subversion, and the Apache modules for Subversion. You can install these packages via the Synaptic Package Manager or you can execute the following commands in the terminal.</p>
<pre class="brush: bash; title: ; notranslate">sudo apt-get install apache2
sudo apt-get install subversion
sudo apt-get install libapache2-svn</pre>
<p><strong>2)</strong> Now we need to edit the libapache2-svn configuration file. To open the file, execute the following command.</p>
<pre class="brush: bash; title: ; notranslate">sudo gedit /etc/apache2/mods-available/dav_svn.conf</pre>
<p><strong>3)</strong> Edit the file in the following locations:</p>
<p><strong>To enable the repository:</strong></p>
<p>Uncomment&#8230;</p>
<pre class="brush: plain; title: ; notranslate"># DAV svn</pre>
<p>To&#8230;</p>
<pre class="brush: plain; title: ; notranslate">DAV svn</pre>
<p><strong>To set the path of the repository:</strong></p>
<p><strong>Note: </strong>This guide uses /svn for the Subversion repository. You can create the repository in any directory you wish, just make sure to change the path throughout the rest of the guide to represent your chosen directory.</p>
<p>Uncomment &amp; Change&#8230;</p>
<pre class="brush: plain; title: ; notranslate"># SVNPath /var/lib/svn</pre>
<p>To&#8230;</p>
<pre class="brush: plain; title: ; notranslate">SVNPath /svn</pre>
<p><strong>To enable user authentication:</strong></p>
<p>Uncomment&#8230;</p>
<pre class="brush: plain; title: ; notranslate"># AuthType Basic
# AuthName &quot;Subversion Repository&quot;
# AuthUserFile /etc/apache2/dav_svn.passwd</pre>
<p>To&#8230;</p>
<pre class="brush: plain; title: ; notranslate">AuthType Basic
AuthName &quot;Subversion Repository&quot;
AuthUserFile /etc/apache2/dav_svn.passwd</pre>
<p><strong>To make readers &amp; committers authenticate themselves:</strong></p>
<p>Change&#8230;</p>
<pre class="brush: xml; title: ; notranslate">&lt;LimitExcept GET PROPFIND OPTIONS REPORT&gt;
Require valid-user
&lt;/LimitExcept&gt;</pre>
<p>To&#8230;</p>
<pre class="brush: xml; title: ; notranslate">&lt;LimitExcept&gt;
Require valid-user
&lt;/LimitExcept&gt;</pre>
<p><strong>4)</strong> Now we need to restart Apache.</p>
<pre class="brush: bash; title: ; notranslate">sudo /etc/init.d/apache2 restart</pre>
<p><strong>5)</strong> Next we need to create the Subversion repository. As said before, in this guide we are going to create the repository in the directory /svn of the root directory. This command will create several SVN files and directories in /svn.</p>
<pre class="brush: bash; title: ; notranslate">sudo mkdir /svn
sudo svnadmin create /svn</pre>
<p><strong>6)</strong> Then we have to change the ownership of the directory so that Apache can write to it.</p>
<pre class="brush: bash; title: ; notranslate">sudo chown -R www-data:www-data /svn</pre>
<p><strong>7)</strong> Ok, let&#8217;s create an authenticated user that will have access to the repository. The following command will create a user named &#8220;bigbamboo&#8221;.</p>
<p><strong>Note: </strong>You will be prompted for a password.</p>
<pre class="brush: bash; title: ; notranslate">sudo htpasswd2 -c /etc/apache2/dav_svn.passwd bigbamboo</pre>
<p><strong>8&#41;</strong> Now let&#8217;s create a project. Probably the easiest way to create a project is to import files that you would like to add to SVN. If you would like to learn more about the SVN import command please visit <a title="Subversion Book" href="http://svnbook.red-bean.com/nightly/en/svn.ref.svn.c.import.html">here</a>.</p>
<p><strong>Note: </strong></p>
<ul>
<li> &#8220;/home/bigbamboo/myproject&#8221; is the location of the files we want to add to the repository.</li>
<li>&#8220;projectname&#8221; is the name of the project we are adding to Subversion.</li>
<li>&#8220;-m&#8221; is used for adding a message to the commit.</li>
<li>&#8220;bigbamboo&#8221; is the username and &#8220;mypassword&#8221; is the password of the authenticated user.</li>
</ul>
<p><strong>Note: </strong>The following command is one line.</p>
<pre class="brush: bash; title: ; notranslate">svn import /home/bigbamboo/myproject http://localhost/svn/projectname -m &quot;creating repository&quot; --username bigbamboo --password mypassword</pre>
<p><strong>9)</strong> You have now created a SVN repository containing a project. To view the files in your Subversion repository you can go to <a title="Your SVN Project" href="http://localhost/svn/projectname">http://localhost/svn/projectname</a>.</p>
<p>From here you are on your own with adding, committing, updating, and reverting your documents. All of those commands can be done via the command line but there are several GUI applications that really help out. I highly recommend <a title="RapidSVN" href="http://rapidsvn.tigris.org/">RapidSVN</a> for Mac/Linux, and <a title="TortoiseSVN" href="http://tortoisesvn.tigris.org/">TortoiseSVN</a> for Windows.</p>
<p>If you notice any errors in the guide please let me know. Also, I am always open to any suggestions as I am still learning too.</p>
]]></content:encoded>
			<wfw:commentRss>http://jessejcollins.com/blog/2006/10/17/setup-subversion-with-apache2-on-ubuntu/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

