<?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>Johnathan Kong</title>
	<atom:link href="http://www.johnathankong.ca/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.johnathankong.ca</link>
	<description></description>
	<lastBuildDate>Sun, 18 Mar 2012 03:47:00 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.1</generator>
		<item>
		<title>Recursive Query Using CTE</title>
		<link>http://www.johnathankong.ca/2012/03/17/recursive-query-using-cte/</link>
		<comments>http://www.johnathankong.ca/2012/03/17/recursive-query-using-cte/#comments</comments>
		<pubDate>Sat, 17 Mar 2012 20:56:31 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[MSSQL]]></category>

		<guid isPermaLink="false">http://www.johnathankong.ca/?p=217</guid>
		<description><![CDATA[For one of my projects I had to write a crawler that would crawl up a table that referenced itself, it was a table that stored directory structure. My initial logic was to just loop through and spit out folder &#8230;<p class="read-more"><a href="http://www.johnathankong.ca/2012/03/17/recursive-query-using-cte/">Read more &#187;</a></p>]]></description>
			<content:encoded><![CDATA[<p>For one of my projects I had to write a crawler that would crawl up a table that referenced itself, it was a table that stored directory structure. My initial logic was to just loop through and spit out folder sizes. Unfortunately this was AWFUL. Fortunately one of my managers gave me a recursive query using CTE to create a view that we could query and get files sizes on.</p>

<div class="wp_syntax"><div class="code"><pre class="sql" style="font-family:monospace;"><span style="color: #993333; font-weight: bold;">WITH</span> MyFolder<span style="color: #66cc66;">&#40;</span>FolderID<span style="color: #66cc66;">,</span> ParentFolderID<span style="color: #66cc66;">,</span> FolderName<span style="color: #66cc66;">,</span> Sku<span style="color: #66cc66;">,</span> Level<span style="color: #66cc66;">,</span> Path<span style="color: #66cc66;">&#41;</span>
<span style="color: #993333; font-weight: bold;">AS</span>
<span style="color: #66cc66;">&#40;</span>
	<span style="color: #993333; font-weight: bold;">SELECT</span> FolderID<span style="color: #66cc66;">,</span> ParentFolderID<span style="color: #66cc66;">,</span> FolderName<span style="color: #66cc66;">,</span> Sku<span style="color: #66cc66;">,</span> <span style="color: #cc66cc;">0</span> <span style="color: #993333; font-weight: bold;">AS</span> Level<span style="color: #66cc66;">,</span> cast<span style="color: #66cc66;">&#40;</span>FolderID <span style="color: #993333; font-weight: bold;">AS</span> varchar<span style="color: #66cc66;">&#40;</span><span style="color: #cc66cc;">100</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span> <span style="color: #993333; font-weight: bold;">AS</span> Path
	<span style="color: #993333; font-weight: bold;">FROM</span> Folder f
	<span style="color: #993333; font-weight: bold;">WHERE</span> ParentFolderID <span style="color: #993333; font-weight: bold;">IS</span> <span style="color: #993333; font-weight: bold;">NULL</span>
	<span style="color: #993333; font-weight: bold;">UNION</span> <span style="color: #993333; font-weight: bold;">ALL</span>
	<span style="color: #993333; font-weight: bold;">SELECT</span> f<span style="color: #66cc66;">.</span>FolderID<span style="color: #66cc66;">,</span> f<span style="color: #66cc66;">.</span>ParentFolderID<span style="color: #66cc66;">,</span> f<span style="color: #66cc66;">.</span>FolderName<span style="color: #66cc66;">,</span> f<span style="color: #66cc66;">.</span>Sku<span style="color: #66cc66;">,</span> <span style="color: #66cc66;">&#40;</span>p<span style="color: #66cc66;">.</span>level <span style="color: #66cc66;">+</span> <span style="color: #cc66cc;">1</span><span style="color: #66cc66;">&#41;</span> <span style="color: #993333; font-weight: bold;">AS</span> Level<span style="color: #66cc66;">,</span> cast<span style="color: #66cc66;">&#40;</span>p<span style="color: #66cc66;">.</span>Path <span style="color: #66cc66;">+</span> <span style="color: #ff0000;">'/'</span> <span style="color: #66cc66;">+</span> cast<span style="color: #66cc66;">&#40;</span>f<span style="color: #66cc66;">.</span>FolderID <span style="color: #993333; font-weight: bold;">AS</span> varchar<span style="color: #66cc66;">&#41;</span> <span style="color: #993333; font-weight: bold;">AS</span> varchar<span style="color: #66cc66;">&#40;</span><span style="color: #cc66cc;">100</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span> <span style="color: #993333; font-weight: bold;">AS</span> Path
	<span style="color: #993333; font-weight: bold;">FROM</span> Folder f
	<span style="color: #993333; font-weight: bold;">INNER</span> <span style="color: #993333; font-weight: bold;">JOIN</span> MyFolder p <span style="color: #993333; font-weight: bold;">ON</span> f<span style="color: #66cc66;">.</span>ParentFolderID <span style="color: #66cc66;">=</span> p<span style="color: #66cc66;">.</span>FolderID
<span style="color: #66cc66;">&#41;</span>
<span style="color: #993333; font-weight: bold;">SELECT</span> f<span style="color: #66cc66;">.</span>FolderID<span style="color: #66cc66;">,</span> f<span style="color: #66cc66;">.</span>ParentFolderID<span style="color: #66cc66;">,</span> f<span style="color: #66cc66;">.</span>FolderName<span style="color: #66cc66;">,</span> f<span style="color: #66cc66;">.</span>sku<span style="color: #66cc66;">,</span> f<span style="color: #66cc66;">.</span>Path<span style="color: #66cc66;">,</span> f<span style="color: #66cc66;">.</span>Level<span style="color: #66cc66;">,</span> count<span style="color: #66cc66;">&#40;</span>d<span style="color: #66cc66;">.</span>documentID<span style="color: #66cc66;">&#41;</span> <span style="color: #993333; font-weight: bold;">AS</span> FileCount<span style="color: #66cc66;">,</span> isnull<span style="color: #66cc66;">&#40;</span>sum<span style="color: #66cc66;">&#40;</span>d<span style="color: #66cc66;">.</span>size<span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">,</span> <span style="color: #cc66cc;">0</span><span style="color: #66cc66;">&#41;</span> <span style="color: #993333; font-weight: bold;">AS</span> FileSize
<span style="color: #993333; font-weight: bold;">FROM</span> myFolder f
	<span style="color: #993333; font-weight: bold;">LEFT</span> <span style="color: #993333; font-weight: bold;">OUTER</span> <span style="color: #993333; font-weight: bold;">JOIN</span> FolderFile ff <span style="color: #993333; font-weight: bold;">ON</span> f<span style="color: #66cc66;">.</span>FolderID <span style="color: #66cc66;">=</span> ff<span style="color: #66cc66;">.</span>FolderID
	<span style="color: #993333; font-weight: bold;">LEFT</span> <span style="color: #993333; font-weight: bold;">OUTER</span> <span style="color: #993333; font-weight: bold;">JOIN</span> Document d <span style="color: #993333; font-weight: bold;">ON</span> ff<span style="color: #66cc66;">.</span>DocumentID <span style="color: #66cc66;">=</span> d<span style="color: #66cc66;">.</span>DocumentID
<span style="color: #993333; font-weight: bold;">GROUP</span> <span style="color: #993333; font-weight: bold;">BY</span> f<span style="color: #66cc66;">.</span>FolderID<span style="color: #66cc66;">,</span> f<span style="color: #66cc66;">.</span>ParentFolderID<span style="color: #66cc66;">,</span> f<span style="color: #66cc66;">.</span>FolderName<span style="color: #66cc66;">,</span> f<span style="color: #66cc66;">.</span>Sku<span style="color: #66cc66;">,</span> f<span style="color: #66cc66;">.</span>Path<span style="color: #66cc66;">,</span> f<span style="color: #66cc66;">.</span>Level</pre></div></div>

]]></content:encoded>
			<wfw:commentRss>http://www.johnathankong.ca/2012/03/17/recursive-query-using-cte/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>unable to qualify my own domain name (production)</title>
		<link>http://www.johnathankong.ca/2012/03/17/unable-to-qualify-my-own-domain-name-production/</link>
		<comments>http://www.johnathankong.ca/2012/03/17/unable-to-qualify-my-own-domain-name-production/#comments</comments>
		<pubDate>Sat, 17 Mar 2012 20:49:13 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Linux]]></category>

		<guid isPermaLink="false">http://www.johnathankong.ca/?p=214</guid>
		<description><![CDATA[While trying to solve an issue with my sendmail, I stumbled upon an error that was filling up my mail.err logs. The error is as follows: Mar 7 06:26:37 production sendmail[11539]: My unqualified host name (production) unknown; sleeping for retry &#8230;<p class="read-more"><a href="http://www.johnathankong.ca/2012/03/17/unable-to-qualify-my-own-domain-name-production/">Read more &#187;</a></p>]]></description>
			<content:encoded><![CDATA[<p>While trying to solve an issue with my sendmail, I stumbled upon an error that was filling up my mail.err logs. The error is as follows:</p>
<p>Mar  7 06:26:37 production sendmail[11539]: My unqualified host name (production) unknown; sleeping for retry<br />
Mar  7 06:27:37 production sendmail[11539]: unable to qualify my own domain name (production) &#8212; using short name</p>
<p>What apparently happened was that while setting up a second ip address I set my ip address to point to &#8220;production&#8221; in the host file, /etc/hosts. My line looked like this:</p>
<p>127.0.0.1 production localhost</p>
<p>Apparently this was causing the error because send mail seems to like it as a valid domain name format, like mydomain.com. The fix was simple; I just had to add mydomain.com in front of production. Please note that it has to be in front of production. After that I restarted networking and sendmail:</p>
<p>/etc/init.d/networking restart<br />
/etc/init.d/sendmail restart</p>
]]></content:encoded>
			<wfw:commentRss>http://www.johnathankong.ca/2012/03/17/unable-to-qualify-my-own-domain-name-production/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Send out email with sendmail from command line</title>
		<link>http://www.johnathankong.ca/2012/03/17/send-out-email-with-sendmail-from-command-line/</link>
		<comments>http://www.johnathankong.ca/2012/03/17/send-out-email-with-sendmail-from-command-line/#comments</comments>
		<pubDate>Sat, 17 Mar 2012 20:40:44 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://www.johnathankong.ca/?p=212</guid>
		<description><![CDATA[/usr/sbin/sendmail -t < testing.txt contents of testing.txt: Date: Thu Nov 11 08:41:54 2007 To: johnathankong@gmail.com Subject: The subject of the message From: jared@razoredgelabs.com Body of message goes herev]]></description>
			<content:encoded><![CDATA[<p>/usr/sbin/sendmail -t < testing.txt</p>
<p>contents of testing.txt:<br />
Date: Thu Nov 11 08:41:54 2007<br />
To: johnathankong@gmail.com<br />
Subject: The subject of the message<br />
From: jared@razoredgelabs.com<br />
Body of message goes herev</p>
]]></content:encoded>
			<wfw:commentRss>http://www.johnathankong.ca/2012/03/17/send-out-email-with-sendmail-from-command-line/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>your host may have disabled the mail() function…</title>
		<link>http://www.johnathankong.ca/2012/03/17/your-host-may-have-disabled-the-mail-function%e2%80%a6/</link>
		<comments>http://www.johnathankong.ca/2012/03/17/your-host-may-have-disabled-the-mail-function%e2%80%a6/#comments</comments>
		<pubDate>Sat, 17 Mar 2012 20:39:44 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[Wordpress]]></category>

		<guid isPermaLink="false">http://www.johnathankong.ca/?p=210</guid>
		<description><![CDATA[Recently after trying to get our server off of the blacklisting, we had an issue with WordPress giving us your host may have disabled the mail() function… This turned out to not be centralized to WP, but to sendmail. It &#8230;<p class="read-more"><a href="http://www.johnathankong.ca/2012/03/17/your-host-may-have-disabled-the-mail-function%e2%80%a6/">Read more &#187;</a></p>]]></description>
			<content:encoded><![CDATA[<p>Recently after trying to get our server off of the blacklisting, we had an issue with WordPress giving us your host may have disabled the mail() function… This turned out to not be centralized to WP, but to sendmail. It wasn&#8217;t the fact that sendmail wasn&#8217;t able to send emails out properly, because the fact was that we were able to send mails anywhere EXCEPT to our main domain; so we were able to send emails out to gmail, yeahoo, etc., but unable to send to johnathankong.ca only. In looking at the logs for the sendmail (/var/log/mail.stats) I noticed that we were getting a lot of &#8220;DSN: User unknown&#8221; errors. after stumbling through multiple sites, I realized that the change I made to the sendmail.cf file was causing the issue. Apparently when I set the Dj to point to my main domain, it disabled all emails to that domain through sendmail. My solution, workaround, was that I created a production.mydomain.com and put it in place there. Now all my emails are up and running perfectly.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.johnathankong.ca/2012/03/17/your-host-may-have-disabled-the-mail-function%e2%80%a6/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>HELO Error</title>
		<link>http://www.johnathankong.ca/2012/03/17/helo-error/</link>
		<comments>http://www.johnathankong.ca/2012/03/17/helo-error/#comments</comments>
		<pubDate>Sat, 17 Mar 2012 20:32:50 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Linux]]></category>

		<guid isPermaLink="false">http://www.johnathankong.ca/?p=208</guid>
		<description><![CDATA[Recently after setting up my linode servers we realized that we were getting blacklisted. The error that we were getting when blacklisted was: This IP address is HELO&#8217;ing as &#8220;localhost.localdomain&#8221; which violates the relevant standards (specifically: RFC5321). After searching around &#8230;<p class="read-more"><a href="http://www.johnathankong.ca/2012/03/17/helo-error/">Read more &#187;</a></p>]]></description>
			<content:encoded><![CDATA[<p>Recently after setting up my linode servers we realized that we were getting blacklisted. The error that we were getting when blacklisted was:</p>
<p>This IP address is HELO&#8217;ing as &#8220;localhost.localdomain&#8221; which violates the relevant standards (specifically: RFC5321). </p>
<p>After searching around for a solution, we came upon this page, <b>http://cbl.abuseat.org/sendmailhelp.html</b>. Apparently we didn&#8217;t setup our sendmail.cf file properly. To sum up the solution, we needed to do the following steps:</p>
<p>1. open /etc/mail/sendmail.cf<br />
2. search for #Djlocalhost.localdomain<br />
3. uncomment #Djlocalhost.localdomain and replace localhost.localdomain with your domain. For example, in my case it would be Djjohnathankong.ca<br />
4. restart sendmail /etc/init.d/sendmail restart</p>
<p>After doing those steps, we automatically removed from the blacklist</p>
]]></content:encoded>
			<wfw:commentRss>http://www.johnathankong.ca/2012/03/17/helo-error/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Unmap Network Drive</title>
		<link>http://www.johnathankong.ca/2012/03/06/unmap-network-drive/</link>
		<comments>http://www.johnathankong.ca/2012/03/06/unmap-network-drive/#comments</comments>
		<pubDate>Tue, 06 Mar 2012 02:41:04 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Windows]]></category>

		<guid isPermaLink="false">http://www.johnathankong.ca/?p=202</guid>
		<description><![CDATA[This will remove the login information from a mapped drive net use \\&#60;computer&#62; /delete]]></description>
			<content:encoded><![CDATA[<p>This will remove the login information from a mapped drive</p>
<pre>
net use \\&lt;computer&gt; /delete
</pre>
]]></content:encoded>
			<wfw:commentRss>http://www.johnathankong.ca/2012/03/06/unmap-network-drive/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Could not reliably determine the server’s fully qualified domain name</title>
		<link>http://www.johnathankong.ca/2012/03/06/could-not-reliably-determine-the-server%e2%80%99s-fully-qualified-domain-name/</link>
		<comments>http://www.johnathankong.ca/2012/03/06/could-not-reliably-determine-the-server%e2%80%99s-fully-qualified-domain-name/#comments</comments>
		<pubDate>Tue, 06 Mar 2012 02:37:34 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Apache]]></category>

		<guid isPermaLink="false">http://www.johnathankong.ca/?p=194</guid>
		<description><![CDATA[A while back I was getting the error message Could not reliably determine the server’s fully qualified domain name, using 127.0.1.1 for ServerName … waiting apache2: Could not reliably determine the server’s fully qualified domain name, using 127.0.1.1 for ServerName &#8230;<p class="read-more"><a href="http://www.johnathankong.ca/2012/03/06/could-not-reliably-determine-the-server%e2%80%99s-fully-qualified-domain-name/">Read more &#187;</a></p>]]></description>
			<content:encoded><![CDATA[<p>A while back I was getting the error message </p>
<div style="color: red;margin: 10px;">
<i>Could not reliably determine the server’s fully qualified domain name, using 127.0.1.1 for ServerName<br />
… waiting apache2: Could not reliably determine the server’s fully qualified domain name, using 127.0.1.1 for ServerName</i>
</div>
<p>
every time I restarted Apache. Apparently to fix this issue you have to edit the /etc/apache2/httpd.conf. To resolve this issue, open up the httpd.conf (this will be empty by default) and add <b>ServerName localhost</b>. After you&#8217;ve added that entry, restart the Apache server and everything should work.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.johnathankong.ca/2012/03/06/could-not-reliably-determine-the-server%e2%80%99s-fully-qualified-domain-name/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Setup Curl</title>
		<link>http://www.johnathankong.ca/2012/03/06/setup-curl/</link>
		<comments>http://www.johnathankong.ca/2012/03/06/setup-curl/#comments</comments>
		<pubDate>Tue, 06 Mar 2012 02:26:17 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Apache]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[PHP]]></category>

		<guid isPermaLink="false">http://www.johnathankong.ca/?p=186</guid>
		<description><![CDATA[apt-get install curl libcurl3 libcurl3-dev php5-curl]]></description>
			<content:encoded><![CDATA[<p>apt-get install curl libcurl3 libcurl3-dev php5-curl</p>
]]></content:encoded>
			<wfw:commentRss>http://www.johnathankong.ca/2012/03/06/setup-curl/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Setup Send Mail</title>
		<link>http://www.johnathankong.ca/2012/03/06/setup-send-mail/</link>
		<comments>http://www.johnathankong.ca/2012/03/06/setup-send-mail/#comments</comments>
		<pubDate>Tue, 06 Mar 2012 02:25:44 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Apache]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[PHP]]></category>

		<guid isPermaLink="false">http://www.johnathankong.ca/?p=184</guid>
		<description><![CDATA[apt-get install sendmail]]></description>
			<content:encoded><![CDATA[<p>apt-get install sendmail</p>
]]></content:encoded>
			<wfw:commentRss>http://www.johnathankong.ca/2012/03/06/setup-send-mail/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Change Ubuntu Hostname</title>
		<link>http://www.johnathankong.ca/2012/03/06/change-ubuntu-hostname/</link>
		<comments>http://www.johnathankong.ca/2012/03/06/change-ubuntu-hostname/#comments</comments>
		<pubDate>Tue, 06 Mar 2012 02:21:10 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Linux]]></category>

		<guid isPermaLink="false">http://www.johnathankong.ca/?p=179</guid>
		<description><![CDATA[Change the host name of the ubuntu server: echo > /etc/hostname hostname -F /etc/hostname vi /etc/hosts add the host name to the 127.0.0.1 entry Note: if you are using Linode, you have to comment out SET_HOSTNAME=&#8217;yes&#8217; in /etc/default/dhcpcd]]></description>
			<content:encoded><![CDATA[<p>Change the host name of the ubuntu server:</p>
<ol>
<li>echo <hostname> > /etc/hostname</li>
<li>hostname -F /etc/hostname</li>
<li>vi /etc/hosts</li>
<li>add the host name to the 127.0.0.1 entry</li>
<ol>
<p>Note: if you are using Linode, you have to comment out SET_HOSTNAME=&#8217;yes&#8217; in /etc/default/dhcpcd</p>
]]></content:encoded>
			<wfw:commentRss>http://www.johnathankong.ca/2012/03/06/change-ubuntu-hostname/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

