<?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>Phillip Napieralski</title>
	<atom:link href="http://blog.pnapieralski.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.pnapieralski.com</link>
	<description>Programmer, Engineer, Researcher.</description>
	<lastBuildDate>Sat, 07 Aug 2010 16:24:18 +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>How to make a scrolling star field background with Flixel</title>
		<link>http://blog.pnapieralski.com/flixel/how-to-make-a-scrolling-star-field-background-with-flixel/</link>
		<comments>http://blog.pnapieralski.com/flixel/how-to-make-a-scrolling-star-field-background-with-flixel/#comments</comments>
		<pubDate>Sat, 24 Jul 2010 07:01:23 +0000</pubDate>
		<dc:creator>Phillip Napieralski</dc:creator>
				<category><![CDATA[Flixel]]></category>
		<category><![CDATA[flixel]]></category>
		<category><![CDATA[shooter]]></category>

		<guid isPermaLink="false">http://blog.pnapieralski.com/?p=58</guid>
		<description><![CDATA[I won't waste your time, here's the source code...]]></description>
			<content:encoded><![CDATA[<p>Here is what it does:</p>
<p><embed src='http://blog.pnapieralski.com/wp-content/uploads/2010/07/Starfielddriver.swf' width=640 height=480></embed></p>
<h2>The Code</h2>
<p>I won&#8217;t waste your time, here&#8217;s the source code.</p>
<pre class="brush: plain;">
package {
	import org.flixel.*;

	public class StarField extends FlxObject {
		public static const NUM_STARS:Number = 75;
		private var _stars:FlxGroup;

		/**
		 * @param	ang This is the angle that the starField will be rotating (in degrees)
		 * @param	speedMultiplier
		 */
		override public function StarField(ang:Number = 90, speedMultiplier:Number = 4):void {
			angle = ang;
			_stars = new FlxGroup();

			var radang:Number = angle * Math.PI / 180;
			var cosang:Number = Math.cos(radang);
			var sinang:Number = Math.sin(radang);

			for ( var i:int = 0; i &lt; StarField.NUM_STARS; i++ ) {
				var str:FlxSprite = new FlxSprite(Math.random() * FlxG.width, Math.random() * FlxG.height);
				var vel:Number = Math.random() * -16 * speedMultiplier;

				// change the transparency of the star based on it's velocity
				var transp:uint = (Math.round(16 * (-vel / speedMultiplier) - 1) &lt;&lt; 24);

				str.createGraphic(2, 2, 0x00ffffff | transp);
				str.velocity.x = cosang * vel;
				str.velocity.y = sinang * vel;
				_stars.add(str);
			}
		}

		/**
		 * Rotate the starField
		 * @param	howMuch Input the amount of rotation in degrees
		 */
		public function rotate(howMuch:Number = 1):void {
			angle += howMuch;

			var radang:Number = angle * Math.PI / 180;
			var cosang:Number = Math.cos(radang);
			var sinang:Number = Math.sin(radang);

			for ( var i:int = 0; i &lt; StarField.NUM_STARS; i++ ) {
				var str:FlxSprite = _stars.members[i] as FlxSprite;

				FlxU.rotatePoint(str.velocity.x, str.velocity.y, 0, 0, howMuch, str.velocity);
			}
		}

		override public function update():void {
			_stars.update();

			for (var i:int = 0; i &lt; _stars.members.length; i++) {
				var star:FlxSprite = _stars.members[i] as FlxSprite;
				if (star.x &gt; FlxG.width) {
					star.x = 0;
				} else if (star.x &lt; 0) {
					star.x = FlxG.width;
				}
				if (star.y &gt; FlxG.height) {
					star.y = 0;
				} else if (star.y &lt; 0) {
					star.y = FlxG.height;
				}

			}
		}

		override public function render():void {
			_stars.render();
		}
	}

}
</pre>
<p>Now to use it, simply add the following in one of your states:</p>
<pre class="brush: plain;">
private var sf:StarField = new StarField();

// state constructor
override public function StarState():void {
     this.add(sf);
}
</pre>
<p><a href='http://blog.pnapieralski.com/wp-content/uploads/2010/07/src.zip'>Get the star field demo source code</a></p>
<p>I also used this star field class in my FIRST ever flash game. <a href='http://www.kongregate.com/games/pnapieralski/face-defender'>Face Defender</a>.</p>


<div class="shr-bookmarks shr-bookmarks-expand shr-bookmarks-center">
<ul class="socials">
		<li class="shr-twitter">
			<a href="http://twitter.com/home?status=How+to+make+a+scrolling+star+field+background+with+Flixel+-+http://b2l.me/ab96cu&amp;source=shareaholic" rel="nofollow" class="external" title="Tweet This!">Tweet This!</a>
		</li>
		<li class="shr-digg">
			<a href="http://digg.com/submit?phase=2&amp;url=http://blog.pnapieralski.com/flixel/how-to-make-a-scrolling-star-field-background-with-flixel/&amp;title=How+to+make+a+scrolling+star+field+background+with+Flixel" rel="nofollow" class="external" title="Digg this!">Digg this!</a>
		</li>
		<li class="shr-reddit">
			<a href="http://reddit.com/submit?url=http://blog.pnapieralski.com/flixel/how-to-make-a-scrolling-star-field-background-with-flixel/&amp;title=How+to+make+a+scrolling+star+field+background+with+Flixel" rel="nofollow" class="external" title="Share this on Reddit">Share this on Reddit</a>
		</li>
		<li class="shr-technorati">
			<a href="http://technorati.com/faves?add=http://blog.pnapieralski.com/flixel/how-to-make-a-scrolling-star-field-background-with-flixel/" rel="nofollow" class="external" title="Share this on Technorati">Share this on Technorati</a>
		</li>
		<li class="shr-comfeed">
			<a href="http://blog.pnapieralski.com/flixel/how-to-make-a-scrolling-star-field-background-with-flixel/feed" rel="nofollow" class="external" title="Subscribe to the comments for this post?">Subscribe to the comments for this post?</a>
		</li>
		<li class="shr-delicious">
			<a href="http://delicious.com/post?url=http://blog.pnapieralski.com/flixel/how-to-make-a-scrolling-star-field-background-with-flixel/&amp;title=How+to+make+a+scrolling+star+field+background+with+Flixel" rel="nofollow" class="external" title="Share this on del.icio.us">Share this on del.icio.us</a>
		</li>
		<li class="shr-facebook">
			<a href="http://www.facebook.com/share.php?v=4&amp;src=bm&amp;u=http://blog.pnapieralski.com/flixel/how-to-make-a-scrolling-star-field-background-with-flixel/&amp;t=How+to+make+a+scrolling+star+field+background+with+Flixel" rel="nofollow" class="external" title="Share this on Facebook">Share this on Facebook</a>
		</li>
		<li class="shr-stumbleupon">
			<a href="http://www.stumbleupon.com/submit?url=http://blog.pnapieralski.com/flixel/how-to-make-a-scrolling-star-field-background-with-flixel/&amp;title=How+to+make+a+scrolling+star+field+background+with+Flixel" rel="nofollow" class="external" title="Stumble upon something good? Share it on StumbleUpon">Stumble upon something good? Share it on StumbleUpon</a>
		</li>
</ul>
<div style="clear:both;"></div>
</div>

]]></content:encoded>
			<wfw:commentRss>http://blog.pnapieralski.com/flixel/how-to-make-a-scrolling-star-field-background-with-flixel/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>How to Setup MongoDB PHP Extension on Shared Hosting</title>
		<link>http://blog.pnapieralski.com/mongodb/how-to-setup-mongodb-php-extension-on-shared-hosting/</link>
		<comments>http://blog.pnapieralski.com/mongodb/how-to-setup-mongodb-php-extension-on-shared-hosting/#comments</comments>
		<pubDate>Wed, 07 Jul 2010 21:38:04 +0000</pubDate>
		<dc:creator>Phillip Napieralski</dc:creator>
				<category><![CDATA[MongoDB]]></category>
		<category><![CDATA[Shared hosting]]></category>
		<category><![CDATA[Dreamhost]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[PHP Extensions]]></category>

		<guid isPermaLink="false">http://blog.pnapieralski.com/?p=57</guid>
		<description><![CDATA[Want to use MongoDB but don't want to switch to a more expensive hosting plan? This is a great alternative that I got working on Dreamhost in less than an hour!]]></description>
			<content:encoded><![CDATA[<p>Want to use MongoDB but don&#8217;t want to switch to a more expensive hosting plan? This is a great alternative that I got working on Dreamhost in less than an hour!</p>
<h2>Setup your external MongoDB</h2>
<p>I use <a href="https://mongohq.com/home">MongoHQ</a> to host my database (your first 16MB database is free). Make sure to take note of your connection string for later.</p>
<h2>Custom PHP.ini</h2>
<p>This part is somewhat tricky. Luckily, if you are using dreamhost, it is well documented on <a href="http://wiki.dreamhost.com/index.php/PHP.ini#Custom_php.ini_for_a_Single_domain">their wiki</a>. Thus, I won&#8217;t go into detail of that here. Follow the directions and proceed to the next step (or leave a comment asking for help if you have issues).</p>
<p>After setting up your custom ini file for your domain, add the following lines to the very end of your php.ini:</p>
<pre class="brush: php;">
extension_dir = &quot;/home/YOUR_USERNAME/bin&quot;
extension = mongo.so
</pre>
<p><strong>NOTE:</strong> This step loads the MongoDB extension but, we don&#8217;t have it yet! The next steps will fix that.</p>
<h2>Compile MongoDB: Part 1</h2>
<p>Using SSH, cd into your home folder (/home/YOUR_USERNAME) and type the following:</p>
<pre class="brush: bash;">
mkdir bin
cd bin/
wget http://download.github.com/mongodb-mongo-php-driver-1.0.6-0-gd261d7a.tar.gz
tar zxvf mongodb-mongo-php-driver-1.0.6-0-gd261d7a.tar.gz
cd mongodb-mongo-php-driver-gd261d7a/
phpize
</pre>
<p>If you receive the error <em>Cannot find autoconf</em> after running the command <em>phpize</em>, follow the next section. Otherwise, skip it!</p>
<h2>Compile/install autoconf</h2>
<pre class="brush: bash;">
wget http://ftp.gnu.org/gnu/autoconf/autoconf-2.66.tar.gz
tar -zvxf autoconf-2.66.tar.gz
cd autoconf-2.66/
./configure &quot;--prefix=$HOME&quot;
make
make install
</pre>
<p>The <em>configure</em> line will tell <em>make install</em> to put the library (.so) file into our home/bin directory (eg, /home/YOUR_USERNAME/bin). Quickly check that you have a few autoconf folders in your bin directory and continue on.</p>
<p><strong>IMPORTANT:</strong> You must now tell linux to look for libraries in your home/bin directory. To do this, you must change the PATH as follows:</p>
<pre class="brush: bash;">
EXPORT PATH=$HOME/bin:$PATH
</pre>
<h2>Compile MongoDB: Part 2</h2>
<p>Remember that <em>phpize</em> function? Yea, try it again:</p>
<pre class="brush: bash;">
cd $HOME/bin/mongodb-mongo-php-driver-gd261d7a/
phpize
</pre>
<p>This time, you should not receive an autoconf error. Now, we actually compile the extension.</p>
<pre class="brush: bash;">
./configure &quot;--prefix=$HOME&quot;
make
</pre>
<p>And, for some reason, the <em>make install</em> commands ignores our prefix&#8230; so we can just manually copy the needed (.so) file to our bin folder:</p>
<pre class="brush: bash;">
cp modules/mongo.so $HOME/bin/
</pre>
<p>Now double check that Mongo.so exists in your home/bin directory (eg, /home/YOUR_USERNAME/bin/mongo.so)</p>
<h2>Test it</h2>
<p>Now, here&#8217;s a simple script to test if you can insert something into your external Mongo database.</p>
<pre class="brush: php;">
&lt;?php
   $m = new Mongo(&quot;mongodb://YOUR_USERNAME:YOUR_PASSWORD@YOUR_SERVER:27046/YOUR_DATABASE&quot;);
   $m-&gt;connect();
   $db = $m-&gt;YOUR_DATABASE
   $collection = $db-&gt;YOUR_COLLECTION;

   $collection-&gt;insert(array('name' =&gt; 'super test 5000'));
</pre>
<p>There! You should have just inserted a new record into your database collection. Test by changing the insert line to the following:</p>
<pre class="brush: php;">
$cursor = $collection-&gt;find();

echo $cursor-&gt;count() . ' documents found. &lt;br/&gt;';
foreach ($cursor as $obj) {
   var_dump($obj);
   echo '&lt;br/&gt;';
}
</pre>
<p>Now when you run that last script, you should see at least the one record you JUST added! </p>
<h2>Conclusion</h2>
<p>This is the approach I am currently using for one of my smaller pet projects. I&#8217;m going to be doing a lot of testing on my local machine using XAMPP, then going live with it using Dreamhost. It is also unfortunate that I&#8217;m forced to use an external DB. But, considering the first 16MB of database from MongoHQ is free, I&#8217;m totally satisfied with this for now.</p>


<div class="shr-bookmarks shr-bookmarks-expand shr-bookmarks-center">
<ul class="socials">
		<li class="shr-twitter">
			<a href="http://twitter.com/home?status=How+to+Setup+MongoDB+PHP+Extension+on+Shared+Hosting+-+http://b2l.me/9jpdt&amp;source=shareaholic" rel="nofollow" class="external" title="Tweet This!">Tweet This!</a>
		</li>
		<li class="shr-digg">
			<a href="http://digg.com/submit?phase=2&amp;url=http://blog.pnapieralski.com/mongodb/how-to-setup-mongodb-php-extension-on-shared-hosting/&amp;title=How+to+Setup+MongoDB+PHP+Extension+on+Shared+Hosting" rel="nofollow" class="external" title="Digg this!">Digg this!</a>
		</li>
		<li class="shr-reddit">
			<a href="http://reddit.com/submit?url=http://blog.pnapieralski.com/mongodb/how-to-setup-mongodb-php-extension-on-shared-hosting/&amp;title=How+to+Setup+MongoDB+PHP+Extension+on+Shared+Hosting" rel="nofollow" class="external" title="Share this on Reddit">Share this on Reddit</a>
		</li>
		<li class="shr-technorati">
			<a href="http://technorati.com/faves?add=http://blog.pnapieralski.com/mongodb/how-to-setup-mongodb-php-extension-on-shared-hosting/" rel="nofollow" class="external" title="Share this on Technorati">Share this on Technorati</a>
		</li>
		<li class="shr-comfeed">
			<a href="http://blog.pnapieralski.com/mongodb/how-to-setup-mongodb-php-extension-on-shared-hosting/feed" rel="nofollow" class="external" title="Subscribe to the comments for this post?">Subscribe to the comments for this post?</a>
		</li>
		<li class="shr-delicious">
			<a href="http://delicious.com/post?url=http://blog.pnapieralski.com/mongodb/how-to-setup-mongodb-php-extension-on-shared-hosting/&amp;title=How+to+Setup+MongoDB+PHP+Extension+on+Shared+Hosting" rel="nofollow" class="external" title="Share this on del.icio.us">Share this on del.icio.us</a>
		</li>
		<li class="shr-facebook">
			<a href="http://www.facebook.com/share.php?v=4&amp;src=bm&amp;u=http://blog.pnapieralski.com/mongodb/how-to-setup-mongodb-php-extension-on-shared-hosting/&amp;t=How+to+Setup+MongoDB+PHP+Extension+on+Shared+Hosting" rel="nofollow" class="external" title="Share this on Facebook">Share this on Facebook</a>
		</li>
		<li class="shr-stumbleupon">
			<a href="http://www.stumbleupon.com/submit?url=http://blog.pnapieralski.com/mongodb/how-to-setup-mongodb-php-extension-on-shared-hosting/&amp;title=How+to+Setup+MongoDB+PHP+Extension+on+Shared+Hosting" rel="nofollow" class="external" title="Stumble upon something good? Share it on StumbleUpon">Stumble upon something good? Share it on StumbleUpon</a>
		</li>
</ul>
<div style="clear:both;"></div>
</div>

]]></content:encoded>
			<wfw:commentRss>http://blog.pnapieralski.com/mongodb/how-to-setup-mongodb-php-extension-on-shared-hosting/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Portfolio Redesign</title>
		<link>http://blog.pnapieralski.com/design/portfolio-redesign/</link>
		<comments>http://blog.pnapieralski.com/design/portfolio-redesign/#comments</comments>
		<pubDate>Wed, 09 Jun 2010 06:03:02 +0000</pubDate>
		<dc:creator>Phillip Napieralski</dc:creator>
				<category><![CDATA[Design]]></category>

		<guid isPermaLink="false">http://blog.pnapieralski.com/?p=50</guid>
		<description><![CDATA[I finally got around to redoing my <a href="http://pnapieralski.com" rel="shadowbox">portfolio</a> and I think it's a big improvement! ]]></description>
			<content:encoded><![CDATA[<p>I finally got around to redoing my <a href="http://pnapieralski.com" rel="shadowbox">portfolio</a> and I think it&#8217;s a big improvement! Click to expand the images.</p>
<h2>Before</h2>
<p><a href="http://blog.pnapieralski.com/wp-content/uploads/2010/06/pnapieralski-OLD.png" rel="shadowbox[post-50];player=img;"><img src="http://blog.pnapieralski.com/wp-content/uploads/2010/06/pnapieralski-OLD-300x268.png" alt="" title="pnapieralski old layout" width="300" height="268" class="alignnone size-medium wp-image-51" /></a></p>
<h2>After</h2>
<p><a href="http://blog.pnapieralski.com/wp-content/uploads/2010/06/2010-06-09_0059.png" rel="shadowbox[post-50];player=img;"><img src="http://blog.pnapieralski.com/wp-content/uploads/2010/06/2010-06-09_0059-300x189.png" alt="" title="pnapieralski new layout" width="300" height="189" class="alignnone size-medium wp-image-52" /></a></p>
<p>The main difference is the the navigation &#8220;dock&#8221; and the color scheme. It&#8217;s a lot more simplistic which I like.</p>


<div class="shr-bookmarks shr-bookmarks-expand shr-bookmarks-center">
<ul class="socials">
		<li class="shr-twitter">
			<a href="http://twitter.com/home?status=Portfolio+Redesign+-+http://b2l.me/2bmbw&amp;source=shareaholic" rel="nofollow" class="external" title="Tweet This!">Tweet This!</a>
		</li>
		<li class="shr-digg">
			<a href="http://digg.com/submit?phase=2&amp;url=http://blog.pnapieralski.com/design/portfolio-redesign/&amp;title=Portfolio+Redesign" rel="nofollow" class="external" title="Digg this!">Digg this!</a>
		</li>
		<li class="shr-reddit">
			<a href="http://reddit.com/submit?url=http://blog.pnapieralski.com/design/portfolio-redesign/&amp;title=Portfolio+Redesign" rel="nofollow" class="external" title="Share this on Reddit">Share this on Reddit</a>
		</li>
		<li class="shr-technorati">
			<a href="http://technorati.com/faves?add=http://blog.pnapieralski.com/design/portfolio-redesign/" rel="nofollow" class="external" title="Share this on Technorati">Share this on Technorati</a>
		</li>
		<li class="shr-comfeed">
			<a href="http://blog.pnapieralski.com/design/portfolio-redesign/feed" rel="nofollow" class="external" title="Subscribe to the comments for this post?">Subscribe to the comments for this post?</a>
		</li>
		<li class="shr-delicious">
			<a href="http://delicious.com/post?url=http://blog.pnapieralski.com/design/portfolio-redesign/&amp;title=Portfolio+Redesign" rel="nofollow" class="external" title="Share this on del.icio.us">Share this on del.icio.us</a>
		</li>
		<li class="shr-facebook">
			<a href="http://www.facebook.com/share.php?v=4&amp;src=bm&amp;u=http://blog.pnapieralski.com/design/portfolio-redesign/&amp;t=Portfolio+Redesign" rel="nofollow" class="external" title="Share this on Facebook">Share this on Facebook</a>
		</li>
		<li class="shr-stumbleupon">
			<a href="http://www.stumbleupon.com/submit?url=http://blog.pnapieralski.com/design/portfolio-redesign/&amp;title=Portfolio+Redesign" rel="nofollow" class="external" title="Stumble upon something good? Share it on StumbleUpon">Stumble upon something good? Share it on StumbleUpon</a>
		</li>
</ul>
<div style="clear:both;"></div>
</div>

]]></content:encoded>
			<wfw:commentRss>http://blog.pnapieralski.com/design/portfolio-redesign/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Flixel 2.0 Project Template for FlashDevelop</title>
		<link>http://blog.pnapieralski.com/flixel/flixel-2-0-project-template-for-flashdevelop/</link>
		<comments>http://blog.pnapieralski.com/flixel/flixel-2-0-project-template-for-flashdevelop/#comments</comments>
		<pubDate>Sun, 06 Jun 2010 17:17:09 +0000</pubDate>
		<dc:creator>Phillip Napieralski</dc:creator>
				<category><![CDATA[Flixel]]></category>

		<guid isPermaLink="false">http://blog.pnapieralski.com/?p=45</guid>
		<description><![CDATA[I've been doing a bit of <a href="http://flixel.org/">Flixel</a> (flash game library) programming lately, and to speed up the creation of games I created a Project Template for <a href="http://www.flashdevelop.org/">FlashDevelop</a> that includes a MenuState, PlayState and Preloader. <b><a href='http://blog.pnapieralski.com/wp-content/uploads/2010/06/Flixel2ProjectTemplate.zip'>Download the template</a></b>]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve been doing a bit of <a href="http://flixel.org/">Flixel</a> (flash game library) programming lately, and to speed up the creation of games I created a Project Template for <a href="http://www.flashdevelop.org/">FlashDevelop</a> that includes a MenuState, PlayState and Preloader. <b><a href='http://blog.pnapieralski.com/wp-content/uploads/2010/06/Flixel2ProjectTemplate.zip'>Download the template</a></b></p>
<h2>How to use it</h2>
<p>I will assume that you already have the Flex 4 SDK already setup for FlashDevelop.</p>
<p>To use the template, simply copy it into the &#8220;projects&#8221; folder in your FlashDevelop installation directory. For me, it was &#8220;C:\Program Files (x86)\FlashDevelop\Projects.&#8221; Then, in FlashDevelop, simply go to Project -> in the toolbar.<a href="http://blog.pnapieralski.com/wp-content/uploads/2010/06/post1.png" rel="shadowbox[post-45];player=img;"></p>
<p><img src="http://blog.pnapieralski.com/wp-content/uploads/2010/06/post1-300x113.png" alt="Project, New Project" title="Project, New Project" width="300" height="113" class="alignnone size-medium wp-image-47" /></a> </p>
<p>Then, there should be an option to create a new Flixel 2.0 project. </p>
<p><a href="http://blog.pnapieralski.com/wp-content/uploads/2010/06/post2-e1275844773290.png" rel="shadowbox[post-45];player=img;"><img src="http://blog.pnapieralski.com/wp-content/uploads/2010/06/post2-e1275844773290.png" alt="New Flixel 2.0 Project" title="New Flixel 2.0 Project" width="300" height="200" class="alignnone size-medium wp-image-48" /></a></p>
<p>That&#8217;s it! The new project will include 4 basic files on top of the flixel library (the current stable release as of today).</p>
<p><a href="http://blog.pnapieralski.com/wp-content/uploads/2010/06/post3.png" rel="shadowbox[post-45];player=img;"><img src="http://blog.pnapieralski.com/wp-content/uploads/2010/06/post3-300x186.png" alt="" title="4 files" width="300" height="186" class="alignnone size-medium wp-image-49" /></a></p>
<h2>Update Flixel version in the template</h2>
<p>To update the version of flixel in the template, go to where you extracted the template originally (mine was in C:\Program Files (x86)\FlashDevelop\Projects\410 Flixel 2.0 Project\). Then, in the &#8220;src&#8221; folder, you will see another folder called &#8220;org.&#8221; Simply overwrite the org folder with the org folder from the latest Flixel distribution. That&#8217;s it!</p>


<div class="shr-bookmarks shr-bookmarks-expand shr-bookmarks-center">
<ul class="socials">
		<li class="shr-twitter">
			<a href="http://twitter.com/home?status=Flixel+2.0+Project+Template+for+FlashDevelop+-+http://b2l.me/2bke2&amp;source=shareaholic" rel="nofollow" class="external" title="Tweet This!">Tweet This!</a>
		</li>
		<li class="shr-digg">
			<a href="http://digg.com/submit?phase=2&amp;url=http://blog.pnapieralski.com/flixel/flixel-2-0-project-template-for-flashdevelop/&amp;title=Flixel+2.0+Project+Template+for+FlashDevelop" rel="nofollow" class="external" title="Digg this!">Digg this!</a>
		</li>
		<li class="shr-reddit">
			<a href="http://reddit.com/submit?url=http://blog.pnapieralski.com/flixel/flixel-2-0-project-template-for-flashdevelop/&amp;title=Flixel+2.0+Project+Template+for+FlashDevelop" rel="nofollow" class="external" title="Share this on Reddit">Share this on Reddit</a>
		</li>
		<li class="shr-technorati">
			<a href="http://technorati.com/faves?add=http://blog.pnapieralski.com/flixel/flixel-2-0-project-template-for-flashdevelop/" rel="nofollow" class="external" title="Share this on Technorati">Share this on Technorati</a>
		</li>
		<li class="shr-comfeed">
			<a href="http://blog.pnapieralski.com/flixel/flixel-2-0-project-template-for-flashdevelop/feed" rel="nofollow" class="external" title="Subscribe to the comments for this post?">Subscribe to the comments for this post?</a>
		</li>
		<li class="shr-delicious">
			<a href="http://delicious.com/post?url=http://blog.pnapieralski.com/flixel/flixel-2-0-project-template-for-flashdevelop/&amp;title=Flixel+2.0+Project+Template+for+FlashDevelop" rel="nofollow" class="external" title="Share this on del.icio.us">Share this on del.icio.us</a>
		</li>
		<li class="shr-facebook">
			<a href="http://www.facebook.com/share.php?v=4&amp;src=bm&amp;u=http://blog.pnapieralski.com/flixel/flixel-2-0-project-template-for-flashdevelop/&amp;t=Flixel+2.0+Project+Template+for+FlashDevelop" rel="nofollow" class="external" title="Share this on Facebook">Share this on Facebook</a>
		</li>
		<li class="shr-stumbleupon">
			<a href="http://www.stumbleupon.com/submit?url=http://blog.pnapieralski.com/flixel/flixel-2-0-project-template-for-flashdevelop/&amp;title=Flixel+2.0+Project+Template+for+FlashDevelop" rel="nofollow" class="external" title="Stumble upon something good? Share it on StumbleUpon">Stumble upon something good? Share it on StumbleUpon</a>
		</li>
</ul>
<div style="clear:both;"></div>
</div>

]]></content:encoded>
			<wfw:commentRss>http://blog.pnapieralski.com/flixel/flixel-2-0-project-template-for-flashdevelop/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Is it spam? (According to Akismet)</title>
		<link>http://blog.pnapieralski.com/spam/is-it-spam-according-to-akismet/</link>
		<comments>http://blog.pnapieralski.com/spam/is-it-spam-according-to-akismet/#comments</comments>
		<pubDate>Sat, 05 Jun 2010 14:40:30 +0000</pubDate>
		<dc:creator>Phillip Napieralski</dc:creator>
				<category><![CDATA[Spam]]></category>

		<guid isPermaLink="false">http://blog.pnapieralski.com/?p=44</guid>
		<description><![CDATA[Akismet is perhaps the most popular form of spam protection today. I made a form so you can see the sort of things that Akismet thinks is spam. <a href="http://pnapieralski.com/tuts/isitspam" rel="shadowbox">Check it out</a>.]]></description>
			<content:encoded><![CDATA[<p>Akismet is perhaps the most popular form of spam protection today. I made a form so you can see the sort of things that Akismet thinks is spam. <a href="http://pnapieralski.com/tuts/isitspam" rel="shadowbox">Check it out</a>.</p>
<h2>Things to look for</h2>
<p><b>Spelling Errors?</b><br />
Check out <i>spam case 1</i>, &#8220;sunlasses shop.&#8221; The biggest reason for its classification is the mispelled word &#8220;somwhere.&#8221; Fix the spelling and test it again. It should show up as &#8220;ham&#8221; now! The original is an actual spam comment I received on this blog a couple days ago, I changed the links and e-mail slightly, however.</p>
<p><b>Hyperlinks</b><br />
Check out <i>spam case 2</i>, &#8220;Jim Boots.&#8221; It&#8217;s obvious if someone posted this comment on your blog that they are simply trying to promote a product. However, what makes it spammy is simply because the hyperlink to Mr. Boot&#8217;s website also has the hyperlink text as the website. If you click on ham case 1, you will notice the hyperlink text says &#8220;here&#8221; instead of &#8220;www.cowboyboots4thawin.com,&#8221; and is no longer identified as spam. Although, interestingly, if you change where the hyperlink actually goes to in the original spam case (eg, leave the hyperlink text as www.cowboyboots&#8230;, but change the link to go to a naughty site or something)</p>
<p>Finally, look at <i>ham case 2</i>, &#8220;Trustworthy Guy.&#8221; This is the perfect comment: solid spelling, grammar is good enough, and no hyperlinks at all. This is simply an example of what a comment should look like!</p>
<h2>Conclusion</h2>
<p>If you want your comments to show up on blogs (or whatever Akismet is safeguarding), it might be helpful to test it with this form before submitting your comment.</p>


<div class="shr-bookmarks shr-bookmarks-expand shr-bookmarks-center">
<ul class="socials">
		<li class="shr-twitter">
			<a href="http://twitter.com/home?status=Is+it+spam%3F+%28According+to+Akismet%29+-+http://b2l.me/2bke7&amp;source=shareaholic" rel="nofollow" class="external" title="Tweet This!">Tweet This!</a>
		</li>
		<li class="shr-digg">
			<a href="http://digg.com/submit?phase=2&amp;url=http://blog.pnapieralski.com/spam/is-it-spam-according-to-akismet/&amp;title=Is+it+spam%3F+%28According+to+Akismet%29" rel="nofollow" class="external" title="Digg this!">Digg this!</a>
		</li>
		<li class="shr-reddit">
			<a href="http://reddit.com/submit?url=http://blog.pnapieralski.com/spam/is-it-spam-according-to-akismet/&amp;title=Is+it+spam%3F+%28According+to+Akismet%29" rel="nofollow" class="external" title="Share this on Reddit">Share this on Reddit</a>
		</li>
		<li class="shr-technorati">
			<a href="http://technorati.com/faves?add=http://blog.pnapieralski.com/spam/is-it-spam-according-to-akismet/" rel="nofollow" class="external" title="Share this on Technorati">Share this on Technorati</a>
		</li>
		<li class="shr-comfeed">
			<a href="http://blog.pnapieralski.com/spam/is-it-spam-according-to-akismet/feed" rel="nofollow" class="external" title="Subscribe to the comments for this post?">Subscribe to the comments for this post?</a>
		</li>
		<li class="shr-delicious">
			<a href="http://delicious.com/post?url=http://blog.pnapieralski.com/spam/is-it-spam-according-to-akismet/&amp;title=Is+it+spam%3F+%28According+to+Akismet%29" rel="nofollow" class="external" title="Share this on del.icio.us">Share this on del.icio.us</a>
		</li>
		<li class="shr-facebook">
			<a href="http://www.facebook.com/share.php?v=4&amp;src=bm&amp;u=http://blog.pnapieralski.com/spam/is-it-spam-according-to-akismet/&amp;t=Is+it+spam%3F+%28According+to+Akismet%29" rel="nofollow" class="external" title="Share this on Facebook">Share this on Facebook</a>
		</li>
		<li class="shr-stumbleupon">
			<a href="http://www.stumbleupon.com/submit?url=http://blog.pnapieralski.com/spam/is-it-spam-according-to-akismet/&amp;title=Is+it+spam%3F+%28According+to+Akismet%29" rel="nofollow" class="external" title="Stumble upon something good? Share it on StumbleUpon">Stumble upon something good? Share it on StumbleUpon</a>
		</li>
</ul>
<div style="clear:both;"></div>
</div>

]]></content:encoded>
			<wfw:commentRss>http://blog.pnapieralski.com/spam/is-it-spam-according-to-akismet/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Biphasic Sleep Schedule &#8211; Week 1 Summary</title>
		<link>http://blog.pnapieralski.com/sleep/biphasic-sleep-schedule-week-1-summary/</link>
		<comments>http://blog.pnapieralski.com/sleep/biphasic-sleep-schedule-week-1-summary/#comments</comments>
		<pubDate>Fri, 04 Jun 2010 23:29:25 +0000</pubDate>
		<dc:creator>Phillip Napieralski</dc:creator>
				<category><![CDATA[Sleep]]></category>

		<guid isPermaLink="false">http://blog.pnapieralski.com/?p=43</guid>
		<description><![CDATA[Today is day 8 of my <a href="http://blog.pnapieralski.com/sleep/experimental-sleep-schedule/">new sleep schedule</a> and it's going good so far. Here's a summary of the week.]]></description>
			<content:encoded><![CDATA[<p>Today is day 8 of my <a href="http://blog.pnapieralski.com/sleep/experimental-sleep-schedule/">new sleep schedule</a> and it&#8217;s going good so far. Here&#8217;s a summary of the last week.</p>
<h2>Days 1-3</h2>
<p>Friday last week was the start of the experiment. The night before I got a solid 4.5 hours of sleep (midnight to 4:30am). Waking up wasn&#8217;t too hard since I &#8220;slept in&#8221; the night before. I started to get tired around noon and ended up taking a 1.5 hour nap at 1pm. I spent the morning before my nap programming and being incredibly efficient. After the nap, I spent more time socializing than anything. Overall, I felt pretty chipper and excited throughout the day since I was starting this new experiment. Energy: 95%.</p>
<p>On Saturday, waking up was slightly harder than on Friday with only 4.5 hours of sleep. I woke up early from my alarm, and I suspect it was so difficult since I was in a deep sleep when it went off. Although I was tired for a solid hour, I felt pretty chipper the rest of the day. I felt especially chipper after the nap, so it was a pretty good day. Energy: 80%.</p>
<p>On Sunday, I almost overslept. That is, I woke up after ~4.5 hours (around 6am) and just about threw in the towel&#8230; I wanted to sleep more. This was by far the hardest day so far. I was in &#8220;Zombie mode&#8221; until my nap, which I took an hour earlier (noon-ish). The nap helped a bit and I was able to get myself going afterwards, although I played video games most of the day. Energy: 60%, Mental Ability: 30%.</p>
<h2>Days 4-6</h2>
<p>Monday was about as hard to wake up for, but I must&#8217;ve woken up at the right time since I jumped out of bed a little easier. Besides, it was Memorial Day! I went over to my parents place for dinner. It was delicious, but I could sense following the schedule might be hard with all the meat we were eating (we did some grilling). I went home after hanging with my parents for a bit and went to bed around midnight (although I forced myself to stay awake until then). Energy: 70%.</p>
<p>On Tuesday, I had my first oversleep! I woke up around 6am, which means I overslept by 1.5 hours! This shows that eating a lot of food (especially meat) and trying to go to bed only causes problems (obvious right?). The oversleep helped quite a bit to get my energy up and I spent much of the morning programming. I decided to take the usual nap around 1pm and I felt even more energetic after that. Around 4pm, I had dinner&#8230; which consisted of a frozen pizza. I had a few slices then went to play tennis and eat ice cream with a friend. Overall, it was a good day, but I was really tired after tennis, I went to bed around 1am. Energy: 90% <b>with oversleep</b>.</p>
<p>On Wednesday, I had my second oversleep! This time it was a big oversleep, I got a solid 9 hours of sleep. I remember waking up after 4.5 hours AND after 6 hours and remembering not wanting to get up at all. I woke up around 10am and didn&#8217;t feel energetic at all (it was definitely because of too much sleep). I suspect this oversleep was a result of all the unhealthy food I ate the day before and the heavy physical activity, which I haven&#8217;t done in quite a while. I spent most of the day with friends, starting at noon. I had tea at about 3pm and the caffeine helped me get energized a bit. Pre-nap energy: 75% </i>with caffeine</i>.</p>
<p>Later in the night, I decided to still to take a nap around 8:30pm. I managed to take a solid 1.5 hour nap and it helped a lot! I woke up very chipper and I managed to get some programming done as well as socializing. Post-nap energy: 95%. </p>
<p>That night, I was determined to get back on my sleep schedule. </p>
<h2>Day 7</h2>
<p>So, I woke up chipper as ever Thursday morning (yesterday) at about 8:30 after a solid 4.5 hours of sleep. I spent the morning being quite efficient. I also ran some errands and finished up a lot of stuff that&#8217;s been needing to get done for a while. I took a nap around 2:30pm. It was a solid 1.5 hour nap and I felt great after that. A few hours later, I went to a bar &#038; grill with my roommates, ate some BBQ wings and had a few beers. I came home a little after 11pm and the power was out! Energy: 90%</p>
<p>I fell asleep around midnight, but I didn&#8217;t wake up until around 9am this morning (Friday)!</p>
<h2>Preliminary Conclusions</h2>
<p>From this weeks test, I can conclude a few things that seem to make it a lot harder to follow the schedule:</p>
<ul>
<li>Eating lots of food before sleeping</li>
<li>Eating more than one serving of meat</li>
<li>Eating &#8220;junk food&#8221; (aka, frozen pizzas and ice cream)</li>
<li>Any amount of alcohol</li>
</ul>
<p>I was thinking of adding &#8220;exercise&#8221; to the list, but the reality is that I had a frozen pizza before playing and ice cream right after playing. I&#8217;ll be playing tennis again next Tuesday, so I&#8217;ll make sure to eat healthy that day and see if I still oversleep after the exercise.</p>
<h2>Discussion</h2>
<p>It is said that it takes 30 days to build up a habit. If I&#8217;m going to really test this biphasic thing, I&#8217;m going to play it at least that long. Hopefully I&#8217;ll have less slipups this coming week. I&#8217;ll especially try to following my own advice above (eat less junk, etc).</p>


<div class="shr-bookmarks shr-bookmarks-expand shr-bookmarks-center">
<ul class="socials">
		<li class="shr-twitter">
			<a href="http://twitter.com/home?status=Biphasic+Sleep+Schedule+-+Week+1+Summary+-+http://b2l.me/2bkfa&amp;source=shareaholic" rel="nofollow" class="external" title="Tweet This!">Tweet This!</a>
		</li>
		<li class="shr-digg">
			<a href="http://digg.com/submit?phase=2&amp;url=http://blog.pnapieralski.com/sleep/biphasic-sleep-schedule-week-1-summary/&amp;title=Biphasic+Sleep+Schedule+-+Week+1+Summary" rel="nofollow" class="external" title="Digg this!">Digg this!</a>
		</li>
		<li class="shr-reddit">
			<a href="http://reddit.com/submit?url=http://blog.pnapieralski.com/sleep/biphasic-sleep-schedule-week-1-summary/&amp;title=Biphasic+Sleep+Schedule+-+Week+1+Summary" rel="nofollow" class="external" title="Share this on Reddit">Share this on Reddit</a>
		</li>
		<li class="shr-technorati">
			<a href="http://technorati.com/faves?add=http://blog.pnapieralski.com/sleep/biphasic-sleep-schedule-week-1-summary/" rel="nofollow" class="external" title="Share this on Technorati">Share this on Technorati</a>
		</li>
		<li class="shr-comfeed">
			<a href="http://blog.pnapieralski.com/sleep/biphasic-sleep-schedule-week-1-summary/feed" rel="nofollow" class="external" title="Subscribe to the comments for this post?">Subscribe to the comments for this post?</a>
		</li>
		<li class="shr-delicious">
			<a href="http://delicious.com/post?url=http://blog.pnapieralski.com/sleep/biphasic-sleep-schedule-week-1-summary/&amp;title=Biphasic+Sleep+Schedule+-+Week+1+Summary" rel="nofollow" class="external" title="Share this on del.icio.us">Share this on del.icio.us</a>
		</li>
		<li class="shr-facebook">
			<a href="http://www.facebook.com/share.php?v=4&amp;src=bm&amp;u=http://blog.pnapieralski.com/sleep/biphasic-sleep-schedule-week-1-summary/&amp;t=Biphasic+Sleep+Schedule+-+Week+1+Summary" rel="nofollow" class="external" title="Share this on Facebook">Share this on Facebook</a>
		</li>
		<li class="shr-stumbleupon">
			<a href="http://www.stumbleupon.com/submit?url=http://blog.pnapieralski.com/sleep/biphasic-sleep-schedule-week-1-summary/&amp;title=Biphasic+Sleep+Schedule+-+Week+1+Summary" rel="nofollow" class="external" title="Stumble upon something good? Share it on StumbleUpon">Stumble upon something good? Share it on StumbleUpon</a>
		</li>
</ul>
<div style="clear:both;"></div>
</div>

]]></content:encoded>
			<wfw:commentRss>http://blog.pnapieralski.com/sleep/biphasic-sleep-schedule-week-1-summary/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Experimental Sleep Schedule</title>
		<link>http://blog.pnapieralski.com/sleep/experimental-sleep-schedule/</link>
		<comments>http://blog.pnapieralski.com/sleep/experimental-sleep-schedule/#comments</comments>
		<pubDate>Fri, 28 May 2010 11:36:18 +0000</pubDate>
		<dc:creator>Phillip Napieralski</dc:creator>
				<category><![CDATA[Sleep]]></category>

		<guid isPermaLink="false">http://blog.pnapieralski.com/?p=41</guid>
		<description><![CDATA[You know that energetic feeling you get after a great night of sleep? That is the time I tend to be most productive. In fact, I didn't realize this until recently... but during the busiest times of my college career, I was actually a biphasic sleeper. I would get 6-7 hours of sleep at night and grab a ~30 minute nap sometime between lunch and dinner (the so called "siesta" time).]]></description>
			<content:encoded><![CDATA[<h2>What?</h2>
<p>You know that energetic feeling you get after a great night of sleep? That is the time I tend to be most productive. In fact, I didn&#8217;t realize this until recently&#8230; but during the busiest times of my college career, I was actually a biphasic sleeper. I would get 6-7 hours of sleep at night and grab a 20 minute nap sometime between lunch and dinner (the so called &#8220;siesta&#8221; time).</p>
<p>Studies have shown time and again that <a href="http://www.thecrimson.harvard.edu/article/2002/6/5/naps-may-increase-productivity-harvard-study/">nappers are more efficient people</a>. Some countries even have &#8220;house rules&#8221; where very few people call each other <a href="http://en.wikipedia.org/wiki/Siesta#Siesta_in_other_cultures">during the 3pm-5pm hours</a>. However, the latter is most likely because those countries tend to eat the most during lunchtime, which inevitably causes a person to crash. But, if you just had a BIG lunch and you&#8217;re feeling tired right afterwards&#8230; why would you continue attempting to work? Why not sleep now, and pick it up later feeling refreshed?</p>
<h2>Why?</h2>
<p>Lately I&#8217;ve been really packing on the sleep pounds. I just graduated with my B.S. degree (about to head to graduate school in the fall), and this summer I&#8217;m doing freelance work. I love freelancing, but it doesn&#8217;t require a set sleep schedule. While I was going no more than 8 hours each day/night during the school year, I&#8217;ve been sleeping up 9-10 hours each night since summer started, while waking up slightly later each day. I suspect that if this keeps going, I&#8217;ll find myself sleeping 10pm to 7pm and completely miss daylight! Well, to avoid that&#8230; I&#8217;m going to implement a new sleep schedule that takes advantage of that midday siesta too!</p>
<h2>Modus Operandi</h2>
<p>Technically, it&#8217;s called a biphasic sleep schedule. The plan is to get 4.5 hours of sleep starting at around 12am (midnight), and another 90 minute nap sometime between lunch and dinner. </p>
<p>I&#8217;ve also heard (anecdotal evidence) that people who are vegetarian, or even vegan, tend to require less sleep. I can&#8217;t say for sure if this is true, but I&#8217;m attempting to make the transition to a biphasic schedule a little easier by eating less meat. I&#8217;m also completely eliminating fast food from my diet.</p>
<p>If I can change from sleeping 9-10 hours a night to this new schedule of 6 hours, imagine how much more time I will have for work and other things! Consider the average recommended amount of sleep (8 hours) vs what I&#8217;ll be getting (6 hours). That means, if I keep to the above schedule, I&#8217;ll be gaining 2 hours each day over the recommended value. That&#8217;s 730 extra hours per year, or 30 extra days per year. That means, I have a whole month of things to accomplish over the average person. Imagine what I can accomplish in one month!</p>
<p>Is it really possibly for me to go from 9 hours to 6 hours? I think so. I did it for whole semesters before. The 9 hours thing was simply out of a lack of structure of my day. I also noticed that I&#8217;ve been yawning much more after starting the 9 hours sleep gig versus when I was in school (perhaps I&#8217;ve been oversleeping). The only thing a person needs each day/night is <a href="http://en.wikipedia.org/wiki/Sleep#Stages_of_sleep">~4 complete sleep cycles</a> and if a sleep cycle takes ~90 minutes to achieve, I&#8217;m meeting the requirement!</p>
<h2>Conclusion</h2>
<p>That&#8217;s all for now. I don&#8217;t suspect to have too much difficulty with this, but I&#8217;ll definitely give a weekly update.</p>
<p>If this goes really well, I may even try a <a href="http://en.wikipedia.org/wiki/Polyphasic_sleep">polyphasic experiment</a> in the future.</p>


<div class="shr-bookmarks shr-bookmarks-expand shr-bookmarks-center">
<ul class="socials">
		<li class="shr-twitter">
			<a href="http://twitter.com/home?status=Experimental+Sleep+Schedule+-+http://b2l.me/2bkfb&amp;source=shareaholic" rel="nofollow" class="external" title="Tweet This!">Tweet This!</a>
		</li>
		<li class="shr-digg">
			<a href="http://digg.com/submit?phase=2&amp;url=http://blog.pnapieralski.com/sleep/experimental-sleep-schedule/&amp;title=Experimental+Sleep+Schedule" rel="nofollow" class="external" title="Digg this!">Digg this!</a>
		</li>
		<li class="shr-reddit">
			<a href="http://reddit.com/submit?url=http://blog.pnapieralski.com/sleep/experimental-sleep-schedule/&amp;title=Experimental+Sleep+Schedule" rel="nofollow" class="external" title="Share this on Reddit">Share this on Reddit</a>
		</li>
		<li class="shr-technorati">
			<a href="http://technorati.com/faves?add=http://blog.pnapieralski.com/sleep/experimental-sleep-schedule/" rel="nofollow" class="external" title="Share this on Technorati">Share this on Technorati</a>
		</li>
		<li class="shr-comfeed">
			<a href="http://blog.pnapieralski.com/sleep/experimental-sleep-schedule/feed" rel="nofollow" class="external" title="Subscribe to the comments for this post?">Subscribe to the comments for this post?</a>
		</li>
		<li class="shr-delicious">
			<a href="http://delicious.com/post?url=http://blog.pnapieralski.com/sleep/experimental-sleep-schedule/&amp;title=Experimental+Sleep+Schedule" rel="nofollow" class="external" title="Share this on del.icio.us">Share this on del.icio.us</a>
		</li>
		<li class="shr-facebook">
			<a href="http://www.facebook.com/share.php?v=4&amp;src=bm&amp;u=http://blog.pnapieralski.com/sleep/experimental-sleep-schedule/&amp;t=Experimental+Sleep+Schedule" rel="nofollow" class="external" title="Share this on Facebook">Share this on Facebook</a>
		</li>
		<li class="shr-stumbleupon">
			<a href="http://www.stumbleupon.com/submit?url=http://blog.pnapieralski.com/sleep/experimental-sleep-schedule/&amp;title=Experimental+Sleep+Schedule" rel="nofollow" class="external" title="Stumble upon something good? Share it on StumbleUpon">Stumble upon something good? Share it on StumbleUpon</a>
		</li>
</ul>
<div style="clear:both;"></div>
</div>

]]></content:encoded>
			<wfw:commentRss>http://blog.pnapieralski.com/sleep/experimental-sleep-schedule/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Migrating from CakePHP 1.2.7 to 1.3</title>
		<link>http://blog.pnapieralski.com/php/cakephp/migrating-from-cakephp-1-2-to-1-3/</link>
		<comments>http://blog.pnapieralski.com/php/cakephp/migrating-from-cakephp-1-2-to-1-3/#comments</comments>
		<pubDate>Fri, 21 May 2010 22:05:50 +0000</pubDate>
		<dc:creator>Phillip Napieralski</dc:creator>
				<category><![CDATA[CakePHP]]></category>

		<guid isPermaLink="false">http://blog.pnapieralski.com/?p=38</guid>
		<description><![CDATA[I decided to migrate one of my in-progress projects to the latest release of CakePHP (1.3). My experience was quick and painless, and perhaps this writing will benefit someone...]]></description>
			<content:encoded><![CDATA[<p>I decided to migrate one of my in-progress projects to the latest release of CakePHP (1.3). My experience was quick and painless, and perhaps this writing will benefit someone.</p>
<h2>Copy/Overwrite</h2>
<p>Copy/overwrite app/config/core.php, in this file change the following</p>
<ul>
<li>Change cipherSeed value to something other than the default</li>
<li>Change the salt value to the same value you had before</li>
</ul>
<p>Copy/overwrite app/webroot/index.php</p>
<p>Lastly, completely copy over the latest cake, plugins and vendors folders. I didn&#8217;t need to do any other modifications to the app folder other than those stated above.</p>
<h2>Add to Code</h2>
<p>Add &#8216;Session&#8217; to the helpers AND components array in app/app_controller.php like so</p>
<pre class="brush: php;">
&lt;?php
class AppController extends Controller {
	var $components = array( ..., 'Session');    // Components used in controllers
	var $helpers = array( ..., 'Session' );         // Helpers used in views
}
?&gt;
</pre>
<p>Also,<br />
If using the <strong>Cookie</strong> Component anywhere, change any reference to del() to delete()</p>
<p>Lastly, $session->flash() no longer auto echoes (this code is probably in your layout). I had to change it like so in my code:</p>
<pre class="brush: php;">
&lt;?php
echo $session-&gt;flash();
echo $session-&gt;flash('auth');
?&gt;
</pre>
<h2>Debug Information</h2>
<p>The variable $cakeDebug no longer exists. Instead, use the following code</p>
<pre class="brush: php;">
&lt;?php echo $this-&gt;element('sql_dump'); ?&gt;
</pre>
<p>That&#8217;s all I had to do! Everything I mentioned here can be found in the <a href="http://book.cakephp.org/view/1561/Migrating-from-CakePHP-1-2-to-1-3">CakePHP migration guide</a>.</p>


<div class="shr-bookmarks shr-bookmarks-expand shr-bookmarks-center">
<ul class="socials">
		<li class="shr-twitter">
			<a href="http://twitter.com/home?status=Migrating+from+CakePHP+1.2.7+to+1.3+-+http://b2l.me/2bkfg&amp;source=shareaholic" rel="nofollow" class="external" title="Tweet This!">Tweet This!</a>
		</li>
		<li class="shr-digg">
			<a href="http://digg.com/submit?phase=2&amp;url=http://blog.pnapieralski.com/php/cakephp/migrating-from-cakephp-1-2-to-1-3/&amp;title=Migrating+from+CakePHP+1.2.7+to+1.3" rel="nofollow" class="external" title="Digg this!">Digg this!</a>
		</li>
		<li class="shr-reddit">
			<a href="http://reddit.com/submit?url=http://blog.pnapieralski.com/php/cakephp/migrating-from-cakephp-1-2-to-1-3/&amp;title=Migrating+from+CakePHP+1.2.7+to+1.3" rel="nofollow" class="external" title="Share this on Reddit">Share this on Reddit</a>
		</li>
		<li class="shr-technorati">
			<a href="http://technorati.com/faves?add=http://blog.pnapieralski.com/php/cakephp/migrating-from-cakephp-1-2-to-1-3/" rel="nofollow" class="external" title="Share this on Technorati">Share this on Technorati</a>
		</li>
		<li class="shr-comfeed">
			<a href="http://blog.pnapieralski.com/php/cakephp/migrating-from-cakephp-1-2-to-1-3/feed" rel="nofollow" class="external" title="Subscribe to the comments for this post?">Subscribe to the comments for this post?</a>
		</li>
		<li class="shr-delicious">
			<a href="http://delicious.com/post?url=http://blog.pnapieralski.com/php/cakephp/migrating-from-cakephp-1-2-to-1-3/&amp;title=Migrating+from+CakePHP+1.2.7+to+1.3" rel="nofollow" class="external" title="Share this on del.icio.us">Share this on del.icio.us</a>
		</li>
		<li class="shr-facebook">
			<a href="http://www.facebook.com/share.php?v=4&amp;src=bm&amp;u=http://blog.pnapieralski.com/php/cakephp/migrating-from-cakephp-1-2-to-1-3/&amp;t=Migrating+from+CakePHP+1.2.7+to+1.3" rel="nofollow" class="external" title="Share this on Facebook">Share this on Facebook</a>
		</li>
		<li class="shr-stumbleupon">
			<a href="http://www.stumbleupon.com/submit?url=http://blog.pnapieralski.com/php/cakephp/migrating-from-cakephp-1-2-to-1-3/&amp;title=Migrating+from+CakePHP+1.2.7+to+1.3" rel="nofollow" class="external" title="Stumble upon something good? Share it on StumbleUpon">Stumble upon something good? Share it on StumbleUpon</a>
		</li>
</ul>
<div style="clear:both;"></div>
</div>

]]></content:encoded>
			<wfw:commentRss>http://blog.pnapieralski.com/php/cakephp/migrating-from-cakephp-1-2-to-1-3/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Spam-proof Contact Form with PHP/Akismet</title>
		<link>http://blog.pnapieralski.com/php/spam-proof-contact-form-with-php-akismet/</link>
		<comments>http://blog.pnapieralski.com/php/spam-proof-contact-form-with-php-akismet/#comments</comments>
		<pubDate>Sun, 09 May 2010 21:55:20 +0000</pubDate>
		<dc:creator>Phillip Napieralski</dc:creator>
				<category><![CDATA[PHP]]></category>
		<category><![CDATA[Spam]]></category>
		<category><![CDATA[Akismet]]></category>
		<category><![CDATA[Spam Prevention]]></category>

		<guid isPermaLink="false">http://blog.pnapieralski.com/?p=36</guid>
		<description><![CDATA[<a href="http://pnapieralski.com/contact.php">Check out the demo</a>

This is an addition to my previous post to create a <a href="http://blog.pnapieralski.com/php/simple-contact-us-form-with-php/">simple contact form</a>. This post will utilize the <a href="http://akismet.com/">Akismet</a> service to classify some messages as spam.]]></description>
			<content:encoded><![CDATA[<p><a href="http://pnapieralski.com/contact.php">Check out the demo</a></p>
<p>This is in addition to my previous post about creating a <a href="http://blog.pnapieralski.com/php/simple-contact-us-form-with-php/">simple contact form</a>. This post will utilize the <a href="http://akismet.com/">Akismet</a> service to classify some messages as spam.</p>
<h2>The Prerequisites</h2>
<p>To follow this tutorial, I assume you already have a <a href="http://blog.pnapieralski.com/php/simple-contact-us-form-with-php/">simple contact form</a> in place.</p>
<h2>Akismet PHP Library</h2>
<p>The folks at <a href="http://www.achingbrain.net">Aching Brain</a> created a nifty PHP class to make utilizing the Akismet service easier. <a href="http://www.achingbrain.net/stuff/php/akismet">Download this library</a> then put it in the same directory as your contact form file.</p>
<p>There are implementations available in <a href="http://akismet.com/development/">other languages</a> as well.</p>
<h2>The PHP</h2>
<p>This code will completely replace the PHP code from the previous post. However, I assume the HTML used is unchanged.</p>
<p>First, include the Akismet library:</p>
<pre class="brush: php;">
&lt;?php
require &quot;Akismet.class.php&quot;;
</pre>
<p>Now, create a more generic function for sending an email:</p>
<pre class="brush: php;">
function send_mail( $name, $email, $website, $ip, $is_spam, $message)
  {
  		$subject = '';
  		if( $spam == true )
  			$subject = &quot;[SPAM?]&quot;;
  		$subject .= &quot;[Your_site.com] E-mail received from &quot;.$author_name.&quot;//&quot;.$author_email.&quot;//&quot;.$ip;

  		mail( &quot;send_to_this_address@to.com&quot;, $subject,
		$author_name.&quot;, &quot;.$author_email.&quot;, &quot;.$author_website. &quot;.\r\n\r\n&quot;.$message);
}
</pre>
<p>If the $is_spam parameter is set to true, we simply prepend &#8220;[SPAM?]&#8221; at the beginning of the subject line. This allows us to see right away what it is in our inbox. Further, you could create an <a href="http://mail.google.com/support/bin/answer.py?hl=en&#038;answer=6579">e-mail filter</a> to automatically put these messages in a different e-mail folder.</p>
<p>Now, we have to set-up the Akismet class. This will require a WordPress API Key. If you don&#8217;t have one, <a href="http://en.wordpress.com/api-keys/">it&#8217;s easy and free to get one</a>.</p>
<pre class="brush: php;">
	if(isset($_POST['action']))
	{
		$wp_key = 'xXxXxXxXxXxX';
		$our_url = 'http://www.your_website.com';

		$name = $_POST['name'];
		$email = $_POST['email'];
		$website = $_POST['website'];
		$message = $_POST['message'];
		$ip = $_SERVER['REMOTE_ADDR'];

		$akismet = new Akismet($our_url, $wp_key);
		$akismet-&gt;setCommentAuthor($name);
		$akismet-&gt;setCommentAuthorEmail($email);
		$akismet-&gt;setCommentAuthorURL($website);
		$akismet-&gt;setCommentContent($message);
		$akismet-&gt;setUserIP($ip);

		send_mail( $name, $email, $website, $ip, $akismet-&gt;isCommentSpam(), $message);
	}
?&gt;
</pre>
<p>That&#8217;s it! Now if a line of spammers hits your contact form, you have a safe guard against it. If you have questions about this piece of code or anything else, feel free to leave a comment!</p>
<p>In conlusion, Akismet is the best!</p>


<div class="shr-bookmarks shr-bookmarks-expand shr-bookmarks-center">
<ul class="socials">
		<li class="shr-twitter">
			<a href="http://twitter.com/home?status=Spam-proof+Contact+Form+with+PHP%2FAkismet+-+http://b2l.me/2bkfj&amp;source=shareaholic" rel="nofollow" class="external" title="Tweet This!">Tweet This!</a>
		</li>
		<li class="shr-digg">
			<a href="http://digg.com/submit?phase=2&amp;url=http://blog.pnapieralski.com/php/spam-proof-contact-form-with-php-akismet/&amp;title=Spam-proof+Contact+Form+with+PHP%2FAkismet" rel="nofollow" class="external" title="Digg this!">Digg this!</a>
		</li>
		<li class="shr-reddit">
			<a href="http://reddit.com/submit?url=http://blog.pnapieralski.com/php/spam-proof-contact-form-with-php-akismet/&amp;title=Spam-proof+Contact+Form+with+PHP%2FAkismet" rel="nofollow" class="external" title="Share this on Reddit">Share this on Reddit</a>
		</li>
		<li class="shr-technorati">
			<a href="http://technorati.com/faves?add=http://blog.pnapieralski.com/php/spam-proof-contact-form-with-php-akismet/" rel="nofollow" class="external" title="Share this on Technorati">Share this on Technorati</a>
		</li>
		<li class="shr-comfeed">
			<a href="http://blog.pnapieralski.com/php/spam-proof-contact-form-with-php-akismet/feed" rel="nofollow" class="external" title="Subscribe to the comments for this post?">Subscribe to the comments for this post?</a>
		</li>
		<li class="shr-delicious">
			<a href="http://delicious.com/post?url=http://blog.pnapieralski.com/php/spam-proof-contact-form-with-php-akismet/&amp;title=Spam-proof+Contact+Form+with+PHP%2FAkismet" rel="nofollow" class="external" title="Share this on del.icio.us">Share this on del.icio.us</a>
		</li>
		<li class="shr-facebook">
			<a href="http://www.facebook.com/share.php?v=4&amp;src=bm&amp;u=http://blog.pnapieralski.com/php/spam-proof-contact-form-with-php-akismet/&amp;t=Spam-proof+Contact+Form+with+PHP%2FAkismet" rel="nofollow" class="external" title="Share this on Facebook">Share this on Facebook</a>
		</li>
		<li class="shr-stumbleupon">
			<a href="http://www.stumbleupon.com/submit?url=http://blog.pnapieralski.com/php/spam-proof-contact-form-with-php-akismet/&amp;title=Spam-proof+Contact+Form+with+PHP%2FAkismet" rel="nofollow" class="external" title="Stumble upon something good? Share it on StumbleUpon">Stumble upon something good? Share it on StumbleUpon</a>
		</li>
</ul>
<div style="clear:both;"></div>
</div>

]]></content:encoded>
			<wfw:commentRss>http://blog.pnapieralski.com/php/spam-proof-contact-form-with-php-akismet/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Simple Contact Form with PHP</title>
		<link>http://blog.pnapieralski.com/php/simple-contact-us-form-with-php/</link>
		<comments>http://blog.pnapieralski.com/php/simple-contact-us-form-with-php/#comments</comments>
		<pubDate>Fri, 09 Apr 2010 01:08:54 +0000</pubDate>
		<dc:creator>Phillip Napieralski</dc:creator>
				<category><![CDATA[PHP]]></category>

		<guid isPermaLink="false">http://blog.pnapieralski.com/?p=34</guid>
		<description><![CDATA[This is something that <strong>every</strong> website should have, including my <a href="http://pnapieralski.com/contact" rel="shadowbox">personal portfolio</a>!]]></description>
			<content:encoded><![CDATA[<p>This is something that <strong>every</strong> website should have, including my <a href="http://pnapieralski.com/contact" rel="shadowbox">personal portfolio</a>!</p>
<h2>The HTML</h2>
<pre class="brush: xml;">
			&lt;form id=&quot;contact_form&quot; method=&quot;post&quot; action=&quot;contact.php&quot;&gt;
				&lt;input id=&quot;name&quot; type=&quot;text&quot; name=&quot;name&quot; tabindex=&quot;1&quot;/&gt; &lt;label for=&quot;name&quot;&gt;Name&lt;/label&gt;
				&lt;input id=&quot;email&quot; type=&quot;text&quot; name=&quot;email&quot; tabindex=&quot;2&quot;/&gt; &lt;label for=&quot;email&quot;&gt;E-mail&lt;/label&gt;
				&lt;input id=&quot;website&quot; type=&quot;text&quot; name=&quot;website&quot; tabindex=&quot;3&quot; value=&quot;http://&quot; /&gt; &lt;label for=&quot;website&quot;&gt;Website&lt;/label&gt;
				&lt;textarea id=&quot;message&quot; tabindex=&quot;4&quot; rows=&quot;10&quot; cols=&quot;60&quot; name=&quot;message&quot;&gt;&lt;/textarea&gt;
				&lt;input type=&quot;submit&quot; value=&quot;Send E-mail&quot; tabindex=&quot;5&quot; /&gt;
			&lt;/form&gt;
</pre>
<p>This is just a simple form. I included two things that increase usability quite a bit: Usage of the <strong>label</strong> tag and usage of the tabindex attribute of the various form inputs.</p>
<p>The label tag allows you to click the text next to an input box and have your cursor go into the textbox. You do this by setting the label&#8217;s &#8220;for&#8221; attribute equal to the &#8220;id&#8221; attribute of your input box. Find more information at <a href="http://www.w3schools.com/tags/tag_label.asp">w3schools</a>.</p>
<h2>The PHP</h2>
<pre class="brush: php;">
&lt;?php
if( isset($_POST['action']) )
{
		echo 'Thanks for the E-mail!';

		$name = $_POST['name'];
		$email = $_POST['email'];
		$website = $_POST['website'];

		mail( 'send_to_this_address@to.com', &quot;E-mail received from $name, $email, $website&quot;, $_POST['message'] );
}
?&gt;
</pre>
<p>Now, simply put the php code followed by the HTML code into the same php file (I called mine contact.php), and upload it to your webserver!</p>
<p>The php is pretty simple. We grab all the form variables and put them into php&#8217;s mail function. If this function does <strong>not</strong> work, you probably need to <a href="https://help.ubuntu.com/8.04/serverguide/C/postfix.html">install/configure postfix</a>.</p>
<h2>Discussion</h2>
<p>The code is really simple. You can find more information in the <a href="http://php.net/manual/en/function.mail.php">php manual</a> online. A big thing that I did NOT talk about, however, is how to prevent spammers from attacking your contact form. In fact, for a large site it&#8217;s a big problem (my blog gets 10+ spam messages per day).</p>
<p>Luckily! There is a great service available to detect and reject spam messages. It&#8217;s called <a href="http://akismet.com/">Akismet</a>. Expect a blog about this and other ways of protecting against spam in the near future.</p>


<div class="shr-bookmarks shr-bookmarks-expand shr-bookmarks-center">
<ul class="socials">
		<li class="shr-twitter">
			<a href="http://twitter.com/home?status=Simple+Contact+Form+with+PHP+-+http://b2l.me/2bkfp&amp;source=shareaholic" rel="nofollow" class="external" title="Tweet This!">Tweet This!</a>
		</li>
		<li class="shr-digg">
			<a href="http://digg.com/submit?phase=2&amp;url=http://blog.pnapieralski.com/php/simple-contact-us-form-with-php/&amp;title=Simple+Contact+Form+with+PHP" rel="nofollow" class="external" title="Digg this!">Digg this!</a>
		</li>
		<li class="shr-reddit">
			<a href="http://reddit.com/submit?url=http://blog.pnapieralski.com/php/simple-contact-us-form-with-php/&amp;title=Simple+Contact+Form+with+PHP" rel="nofollow" class="external" title="Share this on Reddit">Share this on Reddit</a>
		</li>
		<li class="shr-technorati">
			<a href="http://technorati.com/faves?add=http://blog.pnapieralski.com/php/simple-contact-us-form-with-php/" rel="nofollow" class="external" title="Share this on Technorati">Share this on Technorati</a>
		</li>
		<li class="shr-comfeed">
			<a href="http://blog.pnapieralski.com/php/simple-contact-us-form-with-php/feed" rel="nofollow" class="external" title="Subscribe to the comments for this post?">Subscribe to the comments for this post?</a>
		</li>
		<li class="shr-delicious">
			<a href="http://delicious.com/post?url=http://blog.pnapieralski.com/php/simple-contact-us-form-with-php/&amp;title=Simple+Contact+Form+with+PHP" rel="nofollow" class="external" title="Share this on del.icio.us">Share this on del.icio.us</a>
		</li>
		<li class="shr-facebook">
			<a href="http://www.facebook.com/share.php?v=4&amp;src=bm&amp;u=http://blog.pnapieralski.com/php/simple-contact-us-form-with-php/&amp;t=Simple+Contact+Form+with+PHP" rel="nofollow" class="external" title="Share this on Facebook">Share this on Facebook</a>
		</li>
		<li class="shr-stumbleupon">
			<a href="http://www.stumbleupon.com/submit?url=http://blog.pnapieralski.com/php/simple-contact-us-form-with-php/&amp;title=Simple+Contact+Form+with+PHP" rel="nofollow" class="external" title="Stumble upon something good? Share it on StumbleUpon">Stumble upon something good? Share it on StumbleUpon</a>
		</li>
</ul>
<div style="clear:both;"></div>
</div>

]]></content:encoded>
			<wfw:commentRss>http://blog.pnapieralski.com/php/simple-contact-us-form-with-php/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>

<!-- Dynamic page generated in 1.649 seconds. -->
<!-- Cached page generated by WP-Super-Cache on 2010-09-05 10:34:37 -->
