<?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/"
	>

<channel>
	<title>Code LOL</title>
	<atom:link href="http://codelol.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://codelol.com</link>
	<description>A reference to Java, WordPress, Perl, SQL, Scala, and more</description>
	<pubDate>Sun, 03 Jan 2010 04:53:27 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.7.1</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>ANT: Copy a directory recursively</title>
		<link>http://codelol.com/2010/01/ant-copy-a-directory-recursively/</link>
		<comments>http://codelol.com/2010/01/ant-copy-a-directory-recursively/#comments</comments>
		<pubDate>Sun, 03 Jan 2010 04:50:51 +0000</pubDate>
		<dc:creator>Cody</dc:creator>
		
		<category><![CDATA[ANT]]></category>

		<guid isPermaLink="false">http://codelol.com/?p=161</guid>
		<description><![CDATA[To mimic the xcopy command in windows, use the following:
&#60;copy todir="destinationDir"&#62;&#60;fileset="sourceDir"&#62;&#60;/fileset&#62;&#60;/copy&#62;
You only need to use the &#60;include&#62; tag if you want to specify which files you want included
]]></description>
			<content:encoded><![CDATA[<p>To mimic the xcopy command in windows, use the following:</p>
<pre>&lt;copy todir="destinationDir"&gt;&lt;fileset="sourceDir"&gt;&lt;/fileset&gt;&lt;/copy&gt;</pre>
<p>You only need to use the &lt;include&gt; tag if you want to specify which files you want included</p>
]]></content:encoded>
			<wfw:commentRss>http://codelol.com/2010/01/ant-copy-a-directory-recursively/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Log4j, SMTPAppender, and Authentication</title>
		<link>http://codelol.com/2009/09/log4j-smtpappender-and-authentication/</link>
		<comments>http://codelol.com/2009/09/log4j-smtpappender-and-authentication/#comments</comments>
		<pubDate>Wed, 30 Sep 2009 00:17:57 +0000</pubDate>
		<dc:creator>Earl</dc:creator>
		
		<category><![CDATA[CSS]]></category>

		<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://codelol.com/?p=152</guid>
		<description><![CDATA[I was trying to hook up my log4j configuration to my gmail account so that I could be immediately alert for errors.  Pretty simple use case&#8230; But I started getting errors like: 
com.sun.mail.smtp.SMTPSendFailedException: 530 5.7.0 Must issue a STARTTLS command first.
and 
com.sun.mail.smtp.SMTPSendFailedException: 530 5.7.0 Authentication required
I have reason to believe SMTPAppender is borked on [...]]]></description>
			<content:encoded><![CDATA[<p>I was trying to hook up my log4j configuration to my gmail account so that I could be immediately alert for errors.  Pretty simple use case&#8230; But I started getting errors like: </p>
<p><b>com.sun.mail.smtp.SMTPSendFailedException: 530 5.7.0 Must issue a STARTTLS command first.</b></p>
<p>and </p>
<p><b>com.sun.mail.smtp.SMTPSendFailedException: 530 5.7.0 Authentication required</b></p>
<p>I have reason to believe SMTPAppender is borked on anything authentication related because your authentication properties are read after the javax.mail.Session is created.  The following is code for an overridden SMTPAppender that takes over the session creation.  </p>
<pre class="brush:java">
import java.security.Security;
import java.util.Properties;
import javax.mail.PasswordAuthentication;
import javax.mail.Session;
import org.apache.log4j.net.SMTPAppender;

public class SMTPSSLAppender extends SMTPAppender {

	public SMTPSSLAppender() {
		Security.addProvider(new com.sun.net.ssl.internal.ssl.Provider());
	}

	@Override
	protected Session createSession() {
		Properties properties = new Properties();
		properties.setProperty("mail.transport.protocol", "smtp");
		properties.setProperty("mail.host", getSMTPHost());
		properties.put("mail.smtp.auth", "true");
		properties.put("mail.smtp.port", "465");
		properties.put("mail.smtp.socketFactory.port", "465");
		properties.put("mail.smtp.socketFactory.class","javax.net.ssl.SSLSocketFactory");
		properties.put("mail.smtp.socketFactory.fallback", "false");
		properties.setProperty("mail.smtp.quitwait", "false");

		Session session = Session.getDefaultInstance(properties, new javax.mail.Authenticator() {
			protected PasswordAuthentication getPasswordAuthentication()
			{ return new PasswordAuthentication(getSMTPUsername(),getSMTPPassword());	}
		});		

		return session;
	}
}
</pre>
<p>And the log4j.properties would have something like:</p>
<pre class="brush:java">
log4j.appender.mail=SMTPSSLAppender
log4j.appender.mail.SMTPHost=smtp.gmail.com
log4j.appender.mail.SMTPUsername=myusername
log4j.appender.mail.SMTPPassword=mypassword
log4j.appender.mail.BufferSize=1
log4j.appender.mail.Subject=ZOMG some error occured!
log4j.appender.mail.To=my@email.com
log4j.appender.mail.threshold=error
log4j.appender.mail.layout=org.apache.log4j.PatternLayout
log4j.appender.mail.layout.ConversionPattern=%d{ABSOLUTE} %5p %c{1}:%L - %m%n
</pre>
<p>Of course, overriding session creation breaks a lot of things, but it still has the 20% of functionality that 80% of folks will use.  </p>
]]></content:encoded>
			<wfw:commentRss>http://codelol.com/2009/09/log4j-smtpappender-and-authentication/feed/</wfw:commentRss>
		</item>
		<item>
		<title>File Containing Eclipse Application Debug VM Arguments</title>
		<link>http://codelol.com/2009/08/file-containing-eclipse-application-debug-vm-arguments/</link>
		<comments>http://codelol.com/2009/08/file-containing-eclipse-application-debug-vm-arguments/#comments</comments>
		<pubDate>Sun, 30 Aug 2009 03:16:43 +0000</pubDate>
		<dc:creator>Cody</dc:creator>
		
		<category><![CDATA[Eclipse]]></category>

		<guid isPermaLink="false">http://codelol.com/?p=144</guid>
		<description><![CDATA[Normally, you can edit the VM Arguments by going to Run > Debug Configurations&#8230; > Eclipse Application > [selecting the new configuration] > Arguments.  If you want to edit this file externally, the XML file containing this data is located in: [Your workspace directory]i\.metadata\.plugins\org.eclipse.debug.core\.launches\[Plugin name].launch
]]></description>
			<content:encoded><![CDATA[<p>Normally, you can edit the VM Arguments by going to Run > Debug Configurations&#8230; > Eclipse Application > [selecting the new configuration] > Arguments.  If you want to edit this file externally, the XML file containing this data is located in: [Your workspace directory]i\.metadata\.plugins\org.eclipse.debug.core\.launches\[Plugin name].launch</p>
]]></content:encoded>
			<wfw:commentRss>http://codelol.com/2009/08/file-containing-eclipse-application-debug-vm-arguments/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Prevent Directory Listings Using .htaccess</title>
		<link>http://codelol.com/2009/08/prevent-directory-listings-using-htaccess/</link>
		<comments>http://codelol.com/2009/08/prevent-directory-listings-using-htaccess/#comments</comments>
		<pubDate>Thu, 20 Aug 2009 02:56:06 +0000</pubDate>
		<dc:creator>Cody</dc:creator>
		
		<category><![CDATA[Uncategorized]]></category>

		<category><![CDATA[Web]]></category>

		<guid isPermaLink="false">http://codelol.com/?p=141</guid>
		<description><![CDATA[A simple fix, just add the following line of code to your .htaccess :
# Prevents directory listing
Options -Indexes
]]></description>
			<content:encoded><![CDATA[<p>A simple fix, just add the following line of code to your .htaccess :</p>
<pre># Prevents directory listing
Options -Indexes</pre>
]]></content:encoded>
			<wfw:commentRss>http://codelol.com/2009/08/prevent-directory-listings-using-htaccess/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Converting WordPress Collation to UTF8</title>
		<link>http://codelol.com/2009/07/converting-wordpress-collation-to-utf8/</link>
		<comments>http://codelol.com/2009/07/converting-wordpress-collation-to-utf8/#comments</comments>
		<pubDate>Mon, 13 Jul 2009 16:24:27 +0000</pubDate>
		<dc:creator>Cody</dc:creator>
		
		<category><![CDATA[WordPress]]></category>

		<category><![CDATA[Collation]]></category>

		<guid isPermaLink="false">http://codelol.com/?p=125</guid>
		<description><![CDATA[For some foolish reason, the recent upgrades to WordPress 2.8 and 2.7 changes the collation of the database tables.  This results in the removal of special characters like Japanese, Chinese, or Korean.  All your characters would be lost if you upgraded because the collation is  latin1_swedish_ci instead of utf8_general_ci.  You&#8217;re lucky if you hadn&#8217;t used [...]]]></description>
			<content:encoded><![CDATA[<p>For some foolish reason, the recent upgrades to WordPress 2.8 and 2.7 changes the collation of the database tables.  This results in the removal of special characters like Japanese, Chinese, or Korean.  All your characters would be lost if you upgraded because the collation is  latin1_swedish_ci instead of utf8_general_ci.  You&#8217;re lucky if you hadn&#8217;t used those characters before, but if you are planning to in the future, you can update your collation to UTF8 by running the following SQL queries in PHPMyAdmin:</p>
<pre class="brush:sql">
ALTER TABLE wp_comments DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci;
ALTER TABLE wp_links DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci;
ALTER TABLE wp_options DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci;
ALTER TABLE wp_postmeta DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci;
ALTER TABLE wp_posts DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci;
ALTER TABLE wp_terms DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci;
ALTER TABLE wp_term_relationships DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci;
ALTER TABLE wp_term_taxonomy DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci;
ALTER TABLE wp_usermeta DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci;
ALTER TABLE wp_users DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci;
</pre>
]]></content:encoded>
			<wfw:commentRss>http://codelol.com/2009/07/converting-wordpress-collation-to-utf8/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Downloading and Installing wsimport</title>
		<link>http://codelol.com/2009/07/downloading-and-installing-wsimport/</link>
		<comments>http://codelol.com/2009/07/downloading-and-installing-wsimport/#comments</comments>
		<pubDate>Mon, 13 Jul 2009 16:10:29 +0000</pubDate>
		<dc:creator>Cody</dc:creator>
		
		<category><![CDATA[Java]]></category>

		<category><![CDATA[Web Services]]></category>

		<guid isPermaLink="false">http://codelol.com/?p=126</guid>
		<description><![CDATA[The Java Web services book I&#8217;m reading right now uses wsimport to show how this tool can generate a client with ease.

Download wsimport at JAX-WS from java.net.  There should be a download link in the menu.  At the time of this article, the latest version 2.1.7 can be downloaded here.
Download the file and put it [...]]]></description>
			<content:encoded><![CDATA[<p>The Java Web services book I&#8217;m reading right now uses wsimport to show how this tool can generate a client with ease.</p>
<ol>
<li>Download wsimport at <a href="https://jax-ws.dev.java.net/">JAX-WS</a> from java.net.  There should be a download link in the menu.  At the time of this article, the latest version 2.1.7 can be downloaded <a href="https://jax-ws.dev.java.net/2.1.7/">here</a>.</li>
<li>Download the file and put it to a directory like C:/Java and execute by double clicking on the JAR file if you are on Windows</li>
<li>From the extracted files, set the CLASSPATH environmental variable in Windows to point to the bin folder</li>
</ol>
<p>Now you can run wsimport from the command prompt and have all sorts of fun.</p>
]]></content:encoded>
			<wfw:commentRss>http://codelol.com/2009/07/downloading-and-installing-wsimport/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Deleting All Posts and Comments from a WordPress Blog</title>
		<link>http://codelol.com/2009/07/deleting-all-posts-and-comments-from-a-wordpress-blog/</link>
		<comments>http://codelol.com/2009/07/deleting-all-posts-and-comments-from-a-wordpress-blog/#comments</comments>
		<pubDate>Sat, 11 Jul 2009 22:51:56 +0000</pubDate>
		<dc:creator>Cody</dc:creator>
		
		<category><![CDATA[WordPress]]></category>

		<guid isPermaLink="false">http://codelol.com/?p=121</guid>
		<description><![CDATA[The best way to understand the tables is to look at the WordPress Databae Design page, so you are aware of the dependencies.  I wanted a nearly clean copy of WordPress, so I executed the following SQL statements:

delete from wp_comments;
delete from wp_links;
delete from wp_posts;
delete from wp_postmeta;
update wp_term_taxonomy set count = 0 where 1 = 1;
delete [...]]]></description>
			<content:encoded><![CDATA[<p>The best way to understand the tables is to look at the <a href="http://codex.wordpress.org/Database_Description">WordPress Databae Design page</a>, so you are aware of the dependencies.  I wanted a nearly clean copy of WordPress, so I executed the following SQL statements:</p>
<pre class="brush:sql">
delete from wp_comments;
delete from wp_links;
delete from wp_posts;
delete from wp_postmeta;
update wp_term_taxonomy set count = 0 where 1 = 1;
delete from wp_term_relationships;
</pre>
<p>This deletes all comments, links, posts, post metadata, resets the count for the tags/categories/links to 0, and deletes the relationships.  I had to delete more than comments and posts, otherwise the tables would be in an inconsistent state.  For example, it may end up showing more than 1 post under a certain tag when all posts have been removed.   Thus, that explains why I had to set count to 0 for wp_term_taxonomy and remove all the links.</p>
]]></content:encoded>
			<wfw:commentRss>http://codelol.com/2009/07/deleting-all-posts-and-comments-from-a-wordpress-blog/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Updating All Internal Links in a WordPress Blog</title>
		<link>http://codelol.com/2009/07/updating-all-internal-links-in-a-wordpress-blog/</link>
		<comments>http://codelol.com/2009/07/updating-all-internal-links-in-a-wordpress-blog/#comments</comments>
		<pubDate>Sat, 11 Jul 2009 22:45:45 +0000</pubDate>
		<dc:creator>Cody</dc:creator>
		
		<category><![CDATA[WordPress]]></category>

		<guid isPermaLink="false">http://codelol.com/?p=119</guid>
		<description><![CDATA[Suppose you are switching domains and you want all links to point to your new blog.  There are 3 places where you need modifications: the author comment URL, the comment content, and the post content.  Comments are important as people may refer to your blog in the comments section, so it needs to be updated.
Perform [...]]]></description>
			<content:encoded><![CDATA[<p>Suppose you are switching domains and you want all links to point to your new blog.  There are 3 places where you need modifications: the author comment URL, the comment content, and the post content.  Comments are important as people may refer to your blog in the comments section, so it needs to be updated.</p>
<p>Perform the following queries:</p>
<pre class="brush:sql">
UPDATE wp_comments SET comment_author_url = replace(comment_author_url, 'old URL','new URL')
UPDATE wp_comments SET comment_content = replace(comment_content, 'old URL','new URL');
UPDATE wp_posts SET post_content = replace(post_content, 'old URL', 'new URL');
</pre>
<p>Reference: <a href="http://www.mydigitallife.info/2007/10/01/how-to-move-wordpress-blog-to-new-domain-or-location/">How to Move WordPress Blog to New Domain or Location</a></p>
]]></content:encoded>
			<wfw:commentRss>http://codelol.com/2009/07/updating-all-internal-links-in-a-wordpress-blog/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Importing Large WordPress WXR Files</title>
		<link>http://codelol.com/2009/07/importing-large-wordpress-wxr-files/</link>
		<comments>http://codelol.com/2009/07/importing-large-wordpress-wxr-files/#comments</comments>
		<pubDate>Sat, 11 Jul 2009 20:42:18 +0000</pubDate>
		<dc:creator>Cody</dc:creator>
		
		<category><![CDATA[WordPress]]></category>

		<guid isPermaLink="false">http://codelol.com/?p=115</guid>
		<description><![CDATA[I had to help someone import a 15MB WordPress WXR file today which failed because it was much too big (getting Fatal Errors).  I ended up splitting the WRX as described by the article Import Large WordPress WXR File.
Each WRX needs 3 parts t o comply with the schema:
Header:
&#60;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:wp=”http://wordpress.org/export/1.0/”&#62;
&#60;channel&#62;
including all info like category, [...]]]></description>
			<content:encoded><![CDATA[<p>I had to help someone import a 15MB WordPress WXR file today which failed because it was much too big (getting Fatal Errors).  I ended up splitting the WRX as described by the article <a href="http://ahtim.com/import-large-wordpress-wxr-file/">Import Large WordPress WXR File</a>.</p>
<p>Each WRX needs 3 parts t o comply with the schema:</p>
<p><strong>Header:<br />
</strong>&lt;rss version=”2.0?<br />
xmlns:content=”http://purl.org/rss/1.0/modules/content/”<br />
xmlns:wfw=”http://wellformedweb.org/CommentAPI/”<br />
xmlns:dc=”http://purl.org/dc/elements/1.1/”<br />
xmlns:wp=”http://wordpress.org/export/1.0/”&gt;<br />
&lt;channel&gt;<br />
including all info like category, tags, etc to just before the first &lt;item&gt;<br />
<strong><br />
Body:<br />
</strong>Your &lt;item&gt; tags<strong></strong></p>
<p><strong>Footer:<br />
</strong>&lt;/channel&gt;<br />
&lt;/rss&gt;<strong></strong></p>
<p>I had accidentally saved the file without UTF8 encoding and that messed up the import badly.  You need to make sure it is UTF8 if you have special characters.</p>
]]></content:encoded>
			<wfw:commentRss>http://codelol.com/2009/07/importing-large-wordpress-wxr-files/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Modifying the WordPress Comments Template</title>
		<link>http://codelol.com/2009/07/modifying-the-wordpress-comments-template/</link>
		<comments>http://codelol.com/2009/07/modifying-the-wordpress-comments-template/#comments</comments>
		<pubDate>Sat, 11 Jul 2009 20:13:41 +0000</pubDate>
		<dc:creator>Cody</dc:creator>
		
		<category><![CDATA[WordPress]]></category>

		<guid isPermaLink="false">http://codelol.com/?p=113</guid>
		<description><![CDATA[Reference: WordPress Codex
&#8220;This tag includes the file comments.php from your current theme&#8217;s directory. If that file is not found, it will instead include wp-content/themes/default/comments.php.&#8221;
You can copy the default comments.php and add modifications and place it in your theme&#8217;s directory.  It is a good template to start with.
]]></description>
			<content:encoded><![CDATA[<p>Reference: <a href="http://codex.wordpress.org/Include_Tags#The_Comments_Template">WordPress Codex</a></p>
<p>&#8220;This tag includes the file comments.php from your current theme&#8217;s directory. If that file is not found, it will instead include wp-content/themes/default/comments.php.&#8221;</p>
<p>You can copy the default comments.php and add modifications and place it in your theme&#8217;s directory.  It is a good template to start with.</p>
]]></content:encoded>
			<wfw:commentRss>http://codelol.com/2009/07/modifying-the-wordpress-comments-template/feed/</wfw:commentRss>
		</item>
	</channel>
</rss>
