<?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>The Original Jelani Harris</title>
	<atom:link href="http://jelaniharris.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://jelaniharris.com</link>
	<description>The one and only</description>
	<lastBuildDate>Mon, 11 Jun 2012 17:46:39 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.5.1</generator>
		<item>
		<title>How to check if a jquery plugin is installed or available</title>
		<link>http://jelaniharris.com/2012/how-to-check-if-a-jquery-plugin-is-installed-or-available/</link>
		<comments>http://jelaniharris.com/2012/how-to-check-if-a-jquery-plugin-is-installed-or-available/#comments</comments>
		<pubDate>Mon, 11 Jun 2012 17:46:39 +0000</pubDate>
		<dc:creator>Jelani Harris</dc:creator>
				<category><![CDATA[Code Gems]]></category>
		<category><![CDATA[jquery]]></category>
		<category><![CDATA[Plugins]]></category>

		<guid isPermaLink="false">http://jelaniharris.com/?p=162</guid>
		<description><![CDATA[Most Jquery plugins act a lot like functions. They are attached to the main Jquery object, so essentially all we have to do is check that the function exists and is defined. if &#40;$.pluginFunction&#41; &#123; // Function exists, do your plugin stuff here. &#125; else &#123; // Plugin does not exist, use alternatives or do [...]]]></description>
				<content:encoded><![CDATA[<p>Most Jquery plugins act a lot like functions. They are attached to the main Jquery object, so essentially all we have to do is check that the function exists and is defined.</p>

<div class="wp_syntax"><table><tr><td class="code"><pre class="javascript" style="font-family:monospace;"><span style="color: #000066; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span>$.<span style="color: #660066;">pluginFunction</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
  <span style="color: #006600; font-style: italic;">// Function exists, do your plugin stuff here.</span>
<span style="color: #009900;">&#125;</span> <span style="color: #000066; font-weight: bold;">else</span> <span style="color: #009900;">&#123;</span>
  <span style="color: #006600; font-style: italic;">// Plugin does not exist, use alternatives or do nothing in here.</span>
<span style="color: #009900;">&#125;</span></pre></td></tr></table></div>

]]></content:encoded>
			<wfw:commentRss>http://jelaniharris.com/2012/how-to-check-if-a-jquery-plugin-is-installed-or-available/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Strip Whitespace on save with Aptana</title>
		<link>http://jelaniharris.com/2012/strip-whitespace-on-save-with-aptana/</link>
		<comments>http://jelaniharris.com/2012/strip-whitespace-on-save-with-aptana/#comments</comments>
		<pubDate>Mon, 04 Jun 2012 21:35:09 +0000</pubDate>
		<dc:creator>Jelani Harris</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[AnyEdit]]></category>
		<category><![CDATA[Aptana]]></category>

		<guid isPermaLink="false">http://jelaniharris.com/?p=286</guid>
		<description><![CDATA[So recently I had a coworker get slightly annoyed with me and my trailing whitespaces at the end of lines. I'm using Aptana and not anything crazy like vim to do my programming work, I don't actually see the whitespace I'm leaving around. However, they do show up in the git commits. Because I don't [...]]]></description>
				<content:encoded><![CDATA[<p>So recently I had a coworker get slightly annoyed with me and my trailing whitespaces at the end of lines. I'm using <a title="Aptana" href="http://www.aptana.com" target="_blank">Aptana</a> and not anything crazy like vim to do my programming work, I don't actually see the whitespace I'm leaving around.</p>
<p>However, they do show up in the git commits.</p>
<p>Because I don't want to turn on those annoying characters that show my line breaks and whitespace I tried to find an automated solution. My first thought was that maybe Aptana would have an option to remove all of the whitespace before I save. Alas, no option exists (at least with Aptana 3).</p>
<p>Then I found an Eclipse plugin called AnyEdit that solved my problem. <a href="http://andrei.gmxhome.de/anyedit/" target="_blank">AnyEdit</a> can be found at <a href="http://andrei.gmxhome.de/anyedit/" target="_blank">http://andrei.gmxhome.de/anyedit/</a> .</p>
<h2>Installing AnyEdit</h2>
<p>So the first thing you'll want to do is to load up Aptana, go to Help -&gt; Install New Software. You'll want to use <strong>http://andrei.gmxhome.de/eclipse/</strong> as the "Work With:" URL.</p>
<p><a href="http://jelaniharris.com/blog/wp-content/uploads/2011/11/anyedit_aptana_1.png"><img class="aligncenter size-full wp-image-289" title="anyedit_aptana_1" src="http://jelaniharris.com/blog/wp-content/uploads/2011/11/anyedit_aptana_1.png" alt="" width="735" height="667" /></a></p>
<p>Explore the drop downs and check the AnyEditTools plugin and then hit next. Go through the license agreement pages and Aptana will install the plugin. You'll be prompted to restart Aptana, which I always recommend.</p>
<p><a href="http://jelaniharris.com/blog/wp-content/uploads/2011/11/anyedit_aptana.png"><img class="aligncenter size-full wp-image-288" title="anyedit_aptana" src="http://jelaniharris.com/blog/wp-content/uploads/2011/11/anyedit_aptana.png" alt="" width="668" height="594" /></a></p>
<p>The best part, is that the strip whitespace feature is turned on by default across all of your projects. In the case where you <em>don't</em> want to have that functionality, you can go to the properties of a project, and go to the <strong>AnyEdit Tools</strong> section and turn on <strong>Enable Project Specific Settings</strong> and then <em>Remove Trailing Whitespace</em>.</p>
<p>And .. it's <em>that</em> easy. Enjoy having cleaner code and even cleaner git commits.</p>
]]></content:encoded>
			<wfw:commentRss>http://jelaniharris.com/2012/strip-whitespace-on-save-with-aptana/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>How to install Paperclip in Rails 3</title>
		<link>http://jelaniharris.com/2011/how-to-install-paperclip-in-rails-3/</link>
		<comments>http://jelaniharris.com/2011/how-to-install-paperclip-in-rails-3/#comments</comments>
		<pubDate>Sat, 24 Sep 2011 18:58:13 +0000</pubDate>
		<dc:creator>Jelani Harris</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[paperclip]]></category>
		<category><![CDATA[rails]]></category>

		<guid isPermaLink="false">http://jelaniharris.com/?p=210</guid>
		<description><![CDATA[Paperclip is a plugin/gem created by the talented folks at ThoughtBot. It will make using attachments and uploads in your rails application ridiculously easy to implement. Let's get started! Things you'll need installed  Before we start there is only one thing that you will need to have installed on your system before we can proceed. [...]]]></description>
				<content:encoded><![CDATA[<p>Paperclip is a plugin/gem created by the talented folks at <a title="Thoughtbot" href="http://thoughtbot.com/" target="_blank">ThoughtBot</a>. It will make using attachments and uploads in your rails application ridiculously easy to implement. Let's get started!</p>
<h3><strong>Things you'll need installed </strong></h3>
<p><strong></strong>Before we start there is only one thing that you will need to have installed on your system before we can proceed.</p>
<p><strong>ImageMagik</strong><br />
<a title="ImageMagick" href="http://www.imagemagick.org/" target="_blank"> ImageMagik</a> is a software suite that is used to edit and create images. Paperclip uses it to resize and modify images. The easiest way to install this is to first make sure that you have <a title="MacPorts Installation" href="http://www.macports.org/install.php" target="_blank">MacPorts installed</a>, and then running:<br />
<code><br />
sudo port install ImageMagick<br />
</code></p>
<p>This is a massive library and it will take a little while to install.</p>
<h3><strong>Installing Paperclip</strong></h3>
<p><strong></strong>So you can install Paperclip as a plugin, or you can install it as a gem.</p>
<p><strong>Install as a Gem</strong><br />
This is the recommended way of installing Paperclip. All you need to do is to add to your <em>config/environment.rb</em><br />
<code><br />
config.gem 'paperclip', :source => 'http://rubygems.org'<br />
</code><br />
Then run:<br />
<code><br />
rake gems:install<br />
rake gems:unpack</code></p>
<p>Or you can add it directly to your Gemfile if you have Bundler:</p>
<p><code> source 'http://rubygems.org'<br />
gem 'paperclip'<br />
</code></p>
<p><strong>Install as a Plugin<br />
</strong>To install it as a plugin you use:</p>
<p><code> ruby script/plugin install git://github.com/thoughtbot/paperclip.git<br />
</code></p>
<h3>Using Paperclip in Your Application</h3>
<p>Lets add the 'has_attached_file' attributes to the model we want to be able to attach files to:</p>

<div class="wp_syntax"><table><tr><td class="code"><pre class="ruby" style="font-family:monospace;"><span style="color:#9966CC; font-weight:bold;">class</span> Author <span style="color:#006600; font-weight:bold;">&gt;</span> <span style="color:#6666ff; font-weight:bold;">ActiveRecord::Base</span>
  has_attached_file <span style="color:#ff3333; font-weight:bold;">:avatar</span>,
    <span style="color:#ff3333; font-weight:bold;">:styles</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#006600; font-weight:bold;">&#123;</span>
      <span style="color:#ff3333; font-weight:bold;">:thumb</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#996600;">&quot;75x75#&quot;</span>,
      <span style="color:#ff3333; font-weight:bold;">:small</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#996600;">&quot;100x100#&quot;</span>,
      <span style="color:#ff3333; font-weight:bold;">:medium</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#996600;">&quot;150x150&gt;&quot;</span>
    <span style="color:#006600; font-weight:bold;">&#125;</span>
<span style="color:#9966CC; font-weight:bold;">end</span></pre></td></tr></table></div>

<p>Thankfully attached files do not need to have a separate model. Your attachments are essentially treated like another attribute. The image is not saved until your model is saved (if you desire, there are ways of forcing attachment creation/updates without model involvement - but that's another tutorial)</p>
<p>Now that we have our model paperclip enabled we need to add some database columns to provide full support for it.</p>

<div class="wp_syntax"><table><tr><td class="code"><pre class="ruby" style="font-family:monospace;"><span style="color:#9966CC; font-weight:bold;">class</span> AddAvatarToAuthor <span style="color:#006600; font-weight:bold;">&gt;</span> <span style="color:#6666ff; font-weight:bold;">ActiveRecord::Migration</span>
  <span style="color:#9966CC; font-weight:bold;">def</span> <span style="color:#0000FF; font-weight:bold;">self</span>.<span style="color:#9900CC;">up</span>
    add_column <span style="color:#ff3333; font-weight:bold;">:author</span>, <span style="color:#ff3333; font-weight:bold;">:avatar_file_name</span>, :<span style="color:#CC0066; font-weight:bold;">string</span>
    add_column <span style="color:#ff3333; font-weight:bold;">:author</span>, <span style="color:#ff3333; font-weight:bold;">:avatar_content_type</span>, :<span style="color:#CC0066; font-weight:bold;">string</span>
    add_column <span style="color:#ff3333; font-weight:bold;">:author</span>, <span style="color:#ff3333; font-weight:bold;">:avatar_file_size</span>, :<span style="color:#CC0066; font-weight:bold;">integer</span>
  <span style="color:#9966CC; font-weight:bold;">end</span>
  <span style="color:#9966CC; font-weight:bold;">def</span> <span style="color:#0000FF; font-weight:bold;">self</span>.<span style="color:#9900CC;">down</span>
    remove_column <span style="color:#ff3333; font-weight:bold;">:author</span>, <span style="color:#ff3333; font-weight:bold;">:avatar_file_name</span>
    remove_column <span style="color:#ff3333; font-weight:bold;">:author</span>, <span style="color:#ff3333; font-weight:bold;">:avatar_content_type</span>
    remove_column <span style="color:#ff3333; font-weight:bold;">:author</span>, <span style="color:#ff3333; font-weight:bold;">:avatar_file_size</span>
  <span style="color:#9966CC; font-weight:bold;">end</span>
<span style="color:#9966CC; font-weight:bold;">end</span></pre></td></tr></table></div>

<p>So the first part of the column name is the same as what we called our attachment attribute in our model. In this case that's <em>photo</em>. Now to update our database we use:</p>
<p><code> rake db:migrate </code></p>
<p>Now that we have our database and our model taken care of, we can start working on our content. So in our view we can add a file field:</p>

<div class="wp_syntax"><table><tr><td class="code"><pre class="ruby" style="font-family:monospace;"><span style="color:#006600; font-weight:bold;">&lt;%</span> form_for <span style="color:#ff3333; font-weight:bold;">:author</span>, <span style="color:#ff3333; font-weight:bold;">:html</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#006600; font-weight:bold;">&#123;</span>:multipart <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#0000FF; font-weight:bold;">true</span><span style="color:#006600; font-weight:bold;">&#125;</span> <span style="color:#9966CC; font-weight:bold;">do</span> <span style="color:#006600; font-weight:bold;">|</span>f<span style="color:#006600; font-weight:bold;">|</span> <span style="color:#006600; font-weight:bold;">%&gt;</span>
  <span style="color:#006600; font-weight:bold;">&lt;%</span>= f.<span style="color:#9900CC;">label</span> <span style="color:#ff3333; font-weight:bold;">:avatar</span> <span style="color:#006600; font-weight:bold;">%&gt;</span>&lt;br /&gt;
  <span style="color:#006600; font-weight:bold;">&lt;%</span>= f.<span style="color:#9900CC;">file_field</span> <span style="color:#ff3333; font-weight:bold;">:avatar</span> <span style="color:#006600; font-weight:bold;">%&gt;</span>
  <span style="color:#006600; font-weight:bold;">&lt;%</span>= f.<span style="color:#9900CC;">submit</span> <span style="color:#006600; font-weight:bold;">%&gt;</span>
<span style="color:#006600; font-weight:bold;">&lt;%</span> <span style="color:#9966CC; font-weight:bold;">end</span> <span style="color:#006600; font-weight:bold;">%&gt;</span></pre></td></tr></table></div>

<p><strong>Displaying Attachments</strong><br />
Now when you want to display your model's attachments all you need to do is use:</p>

<div class="wp_syntax"><table><tr><td class="code"><pre class="ruby" style="font-family:monospace;"><span style="color:#006600; font-weight:bold;">&lt;%</span>= image_tag <span style="color:#0066ff; font-weight:bold;">@author</span>.<span style="color:#9900CC;">avatar</span>.<span style="color:#9900CC;">url</span> <span style="color:#006600; font-weight:bold;">%&gt;</span>
<span style="color:#006600; font-weight:bold;">&lt;%</span>= image_tag <span style="color:#0066ff; font-weight:bold;">@author</span>.<span style="color:#9900CC;">avatar</span>.<span style="color:#9900CC;">url</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#ff3333; font-weight:bold;">:thumb</span><span style="color:#006600; font-weight:bold;">&#41;</span> <span style="color:#006600; font-weight:bold;">%&gt;</span></pre></td></tr></table></div>

]]></content:encoded>
			<wfw:commentRss>http://jelaniharris.com/2011/how-to-install-paperclip-in-rails-3/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>Fixing the error 0xe800400c or (-48) when syncing to Itunes</title>
		<link>http://jelaniharris.com/2011/fixing-the-error-0xe800400c-or-48-when-syncing-to-itunes/</link>
		<comments>http://jelaniharris.com/2011/fixing-the-error-0xe800400c-or-48-when-syncing-to-itunes/#comments</comments>
		<pubDate>Sun, 21 Aug 2011 21:35:18 +0000</pubDate>
		<dc:creator>Jelani Harris</dc:creator>
				<category><![CDATA[Troubleshooting]]></category>

		<guid isPermaLink="false">http://jelaniharris.com/?p=234</guid>
		<description><![CDATA[Imagine how disappointed I was when I had plugged in my brand new iPad 2 and only to realize that it simply cannot sync with my iTunes. If you're getting an error messages or weird stuff like: Device Timed Out error message Internal device error An unknown error has occurred 0xe800400c or -48 Failing on [...]]]></description>
				<content:encoded><![CDATA[<p>Imagine how disappointed I was when I had plugged in my brand new iPad 2 and only to realize that it simply cannot sync with my iTunes.</p>
<p>If you're getting an error messages or weird stuff like:</p>
<ul>
<li>Device Timed Out error message</li>
<li>Internal device error</li>
<li>An unknown error has occurred 0xe800400c or -48</li>
<li>Failing on particularly the song synchronization part - and claims that the songs cannot be found.</li>
<li>An unusual long time to sync  - compared to other apple products - and then just to fail right at the end.</li>
<li>Occasionally after an error message, my 16GB iPad would show that it was only 4GB large. If you reconnect it, it goes back to normal.</li>
</ul>
<p>I might have figured out how to fix this problem - at least for me. Your solution may be different of course. Here's what I did on my Windows PC.</p>
<ol>
<li>Install/upgrade iTunes to the latest version</li>
<li>Restore factory settings on the iPad</li>
<li>Disable firewall (so iTunes can talk to apple) and also disable your anti-virus software. Yes, Microsoft Security Essentials counts. You want to disable anything that can get between iTunes and the iPad.</li>
<li>Check to make sure that your BIOS is updated. My gigabyte P55 board was 7 versions out of date. This is at your own risk of course.</li>
<li>Reconnected the iPad to a different USB spot that <strong>is not</strong> the front ports, or a USB hub, or USB on a monitor. Use the back ones - the ones directly attached to the motherboard.</li>
</ol>
<p>My guess  is that the USB isn't providing enough power to charge  or perform syncs with the iPad. My motherboard had a bios update that actually resolves the underpowered USB issue. After praying for a successful patch and a reboot later my ipad was finally syncing.</p>
<p>I really, really hopes this helps and saves some people some time out there.</p>
]]></content:encoded>
			<wfw:commentRss>http://jelaniharris.com/2011/fixing-the-error-0xe800400c-or-48-when-syncing-to-itunes/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Installing Ruby on Rails 3 in Windows</title>
		<link>http://jelaniharris.com/2011/installing-ruby-on-rails-3-in-windows/</link>
		<comments>http://jelaniharris.com/2011/installing-ruby-on-rails-3-in-windows/#comments</comments>
		<pubDate>Sun, 29 May 2011 22:10:33 +0000</pubDate>
		<dc:creator>Jelani Harris</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://jelaniharris.com/?p=189</guid>
		<description><![CDATA[So last week I got a little tired of having to reboot my computer to dual-boot in a linux environment so that I could work on Rails stuff. Then I decided to try using Rails in Windows. Here's a step by step guide on how to install rails in Windows. Install Ruby 1.9 To install [...]]]></description>
				<content:encoded><![CDATA[<p>So last week I got a little tired of having to reboot my computer to dual-boot in a linux environment so that I could work on Rails stuff. Then I decided to try using Rails in Windows. Here's a step by step guide on how to install rails in Windows.</p>
<p><strong>Install Ruby 1.9</strong></p>
<p>To install ruby on our windows machine we will be using RubyInstaller. RubyInstaller is the easiest way to install ruby in windows. It includes the Ruby execution environment and documentation.</p>
<p>First download and install The <a href="http://rubyinstaller.org/download.html">RubyInstaller</a>.  Installing it to <em>C:\Ruby192</em> is perfectly fine. I would <strong>not</strong> recommend installing Ruby to a place that has spaces in it, like the Program Files folder.</p>
<p>From here you can also download the DevKit as well. It allows you to have RubyGems build C-based gems. If you decide to get the DevKit, just install it to the <em>C:\Ruby192\devkit</em> folder for now.</p>
<p>So as you're installing the RubyInstaller, Be sure to select, "Add Ruby Executables to your Path"</p>
<p><a href="http://jelaniharris.com/blog/wp-content/uploads/2011/05/installing_ruby_windows.jpg"><img class="aligncenter size-full wp-image-192" title="installing_ruby_windows" src="http://jelaniharris.com/blog/wp-content/uploads/2011/05/installing_ruby_windows.jpg" alt="" width="513" height="396" /></a></p>
<p><a href="http://jelaniharris.com/blog/wp-content/uploads/2011/05/installing_ruby_windows.jpg"></a>Now let's verify that Ruby has been correctly installed. Get to your command prompt (Via Start -&gt; Run -&gt; type in <em>cmd</em>). Then type in:</p>
<blockquote><p>ruby -v</p></blockquote>
<p>Then it should reply with something similar to:</p>
<blockquote><p>ruby 1.9.2p180 (2011-02-18) [i386-mingw32]</p></blockquote>
<p>Now with your command prompt still open, let's check to see that RubyGems was installed as well:</p>
<blockquote><p>gem -v</p></blockquote>
<p><a href="http://jelaniharris.com/blog/wp-content/uploads/2011/05/installing_ruby_windows_2.jpg"><img class="aligncenter size-full wp-image-193" title="installing_ruby_windows_2" src="http://jelaniharris.com/blog/wp-content/uploads/2011/05/installing_ruby_windows_2.jpg" alt="" width="677" height="340" /></a></p>
<p>Hey that wasn't so difficult was it? I told you that RubyInstaller was easy <img src='http://jelaniharris.com/blog/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p><strong>Install SqlLite3</strong></p>
<p>So when running rails we would like to have a database to start off with without having to set up a local database connection. And of course, Windows does not support SqlLite right out of the box. Thus we will have to get it ourselves.</p>
<p>Go to the <a title="SqlLite Download Page" href="http://sqlite.org/download.html">SQLite download page</a> and find the precompiled binaries for windows section and download the <a title="Sqlite for windows" href="http://www.sqlite.org/sqlite-dll-win32-x86-3070603.zip">sqlite-dll-win32-x86-3070603.zip</a></p>
<p>After unzipping that file, you should end up with the files sqlite3.dll and sqlite3.def. Copy both of those files into the <em>C:\Ruby192\bin</em> directory.</p>
<p>Also, while you're still at the SqlLite download page you should pick up the shell file (<a title="SQLite shell file" href="http://www.sqlite.org/sqlite-shell-win32-x86-3070603.zip">sqlite-shell-win32-x86-3070603.zip</a>) as well. The command line shell is useful for looking around in your sqlite3 databases. Copy the executable in the zip also to the <em>C:\Ruby192\bin</em> directory. You can verify that this is installed by typing:</p>
<blockquote><p>sqllite3 -version</p></blockquote>
<p>Now we should install the ruby bindings to SQLite3</p>
<blockquote><p>gem install sqlite3</p></blockquote>
<p>&nbsp;</p>
<p><strong>Install Rails 3</strong></p>
<p>Rails is distributed by RubyGems. When you install Ruby, the RubyGems system is also installed. This makes it really easy to install Rails.</p>
<p>Install Rails by typing:</p>
<blockquote><p>gem install rails</p></blockquote>
<p>This should take a few minutes because it is installing several of the Rails dependencies (ActiveRecord, ActionPack, ActiveSupport, etc).</p>
<p>When that is done installing, verify that the correct version of Rails was installed by typing</p>
<blockquote><p>rails -v</p></blockquote>
<p>And it should respond with 3.0.7 or higher</p>
<p>&nbsp;</p>
<p><strong>Creating a Rails application</strong></p>
<p>Go into your development directory and type in:</p>
<blockquote><p>rails new project_name</p></blockquote>
<p>Replace the project_name with the name of your new application. You should see it create a bunch of new directories and files</p>
<p>Now we need to install the gems we are going to use with this project. You can install the gems using:</p>
<blockquote><p>bundle install</p></blockquote>
<p>Once those gems are installed, we need to create the sqlite3 database in your project directory by typing in:</p>
<blockquote><p>rake db:migrate</p></blockquote>
<p>Once that is done, start your rails server by using the commands</p>
<blockquote><p>rails server</p></blockquote>
<p><a href="http://jelaniharris.com/blog/wp-content/uploads/2011/05/installing_ruby_windows_3.jpg"><img class="aligncenter size-full wp-image-200" title="installing_ruby_windows_3" src="http://jelaniharris.com/blog/wp-content/uploads/2011/05/installing_ruby_windows_3.jpg" alt="" width="677" height="160" /></a></p>
<p>And then navigate to <a href="http://localhost:3000/">http://localhost:3000/</a> to view your application. It should look something similar to this:</p>
<p><a href="http://jelaniharris.com/blog/wp-content/uploads/2011/05/installing_ruby_windows_4.jpg"><img class="aligncenter size-large wp-image-202" title="installing_ruby_windows_4" src="http://jelaniharris.com/blog/wp-content/uploads/2011/05/installing_ruby_windows_4-1024x572.jpg" alt="" width="550" height="307" /></a></p>
<p>&nbsp;</p>
<p>Now get out there and start working on your web projects!</p>
]]></content:encoded>
			<wfw:commentRss>http://jelaniharris.com/2011/installing-ruby-on-rails-3-in-windows/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>How to read remote files using PHP</title>
		<link>http://jelaniharris.com/2010/how-to-read-remote-files-using-php/</link>
		<comments>http://jelaniharris.com/2010/how-to-read-remote-files-using-php/#comments</comments>
		<pubDate>Wed, 08 Dec 2010 20:49:56 +0000</pubDate>
		<dc:creator>Jelani Harris</dc:creator>
				<category><![CDATA[Code Gems]]></category>

		<guid isPermaLink="false">http://jelaniharris.com/?p=128</guid>
		<description><![CDATA[When I was implementing pingback functionality in my custom blogging software, I needed to read files from a remote server. As long as allow_url_fopen is enabled in your php.ini configuration you can use HTTP and FTP urls with a majority of the functions that use a filename as a parameter. I found that there are [...]]]></description>
				<content:encoded><![CDATA[<p>When I was implementing pingback functionality in my custom blogging software, I needed to read files from a remote server.</p>
<p>As long as allow_url_fopen is enabled in your php.ini configuration you can use HTTP and FTP urls with a majority of the functions that use a filename as a parameter.</p>
<p>I found that there are 3 ways to read remote files using PHP.</p>
<p><strong>Fopen</strong></p>

<div class="wp_syntax"><table><tr><td class="code"><pre class="php" style="font-family:monospace;"><span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$filepointer</span> <span style="color: #339933;">=</span> <span style="color: #990000;">fopen</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;http://banditrevolvers.com&quot;</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">&quot;r&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
     <span style="color: #000088;">$site_content</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;&quot;</span><span style="color: #339933;">;</span>
&nbsp;
     <span style="color: #666666; font-style: italic;">//While we still have content to read, append it</span>
     <span style="color: #666666; font-style: italic;">//1k at a time</span>
     <span style="color: #b1b100;">while</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$line</span> <span style="color: #339933;">=</span> <span style="color: #990000;">fread</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$filepointer</span><span style="color: #339933;">,</span> <span style="color: #cc66cc;">1024</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
          <span style="color: #000088;">$site_content</span> <span style="color: #339933;">.=</span> <span style="color: #000088;">$line</span><span style="color: #339933;">;</span>
     <span style="color: #009900;">&#125;</span>
&nbsp;
<span style="color: #009900;">&#125;</span> <span style="color: #b1b100;">else</span> <span style="color: #009900;">&#123;</span>
     <span style="color: #666666; font-style: italic;">//Error occured while trying to read the url</span>
<span style="color: #009900;">&#125;</span>
&nbsp;
<span style="color: #990000;">fclose</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$filepointer</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></td></tr></table></div>

<p>Another example using <a href="http://php.net/manual/en/function.fgets.php">fgets </a>instead of <a href="http://php.net/manual/en/function.fread.php">fread</a></p>

<div class="wp_syntax"><table><tr><td class="code"><pre class="php" style="font-family:monospace;"><span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$filehandle</span> <span style="color: #339933;">=</span> <span style="color: #990000;">fopen</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;http://banditrevolvers.com&quot;</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'r'</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
&nbsp;
     <span style="color: #b1b100;">while</span><span style="color: #009900;">&#40;</span><span style="color: #339933;">!</span><span style="color: #990000;">feof</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$filehandle</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
          <span style="color: #000088;">$readline</span> <span style="color: #339933;">=</span> <span style="color: #990000;">fgets</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$filehandle</span><span style="color: #339933;">,</span> <span style="color: #cc66cc;">1024</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
          <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #990000;">eregi</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;&amp;lt;title&amp;gt;(.*)&amp;lt;/title&amp;gt;&quot;</span><span style="color: #339933;">,</span> <span style="color: #000088;">$readline</span><span style="color: #339933;">,</span> <span style="color: #000088;">$output</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
               <span style="color: #000088;">$title</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$output</span><span style="color: #009900;">&#91;</span><span style="color: #cc66cc;">1</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span>
               <span style="color: #b1b100;">break</span><span style="color: #339933;">;</span>
          <span style="color: #009900;">&#125;</span>
     <span style="color: #009900;">&#125;</span>
<span style="color: #009900;">&#125;</span> <span style="color: #b1b100;">else</span> <span style="color: #009900;">&#123;</span>
     <span style="color: #666666; font-style: italic;">//Error occured while trying to read the url</span>
<span style="color: #009900;">&#125;</span>
&nbsp;
<span style="color: #b1b100;">echo</span> <span style="color: #0000ff;">&quot;Title of the page is: &quot;</span> <span style="color: #339933;">.</span> <span style="color: #000088;">$title</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #990000;">fclose</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$filehandle</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></td></tr></table></div>

<p><em>Wait what's the difference between fgets and fread?</em></p>
<p>Glad you noticed that. The truth is that fread is the more preferable function to use when reading (or in this case streaming) data from a remote file. The reason is because the fgets function reads a line at a time. For example, if you had a 2000 line file that was only 35k in size, it would loop <em>2000 times</em> with fgets. However it would only loop <em>35 times</em> with fread (assuming a 1k buffer).</p>
<p>Then again, if you need to read a file one line at a time fgets is the function you'll need.</p>
<p><strong>File_get_contents</strong></p>
<p>This function will return the contents of a file in a string. To use it just specify a URL as a parameter. Be sure to check the return value to see if it was successful or not.</p>

<div class="wp_syntax"><table><tr><td class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000088;">$content</span> <span style="color: #339933;">=</span> <span style="color: #990000;">file_get_contents</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;http://banditrevolvers.com&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$content</span> <span style="color: #339933;">!==</span> <span style="color: #009900; font-weight: bold;">false</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
     <span style="color: #666666; font-style: italic;">//Do something with the content</span>
<span style="color: #009900;">&#125;</span> <span style="color: #b1b100;">else</span> <span style="color: #009900;">&#123;</span>
     <span style="color: #666666; font-style: italic;">//An error occurred</span>
<span style="color: #009900;">&#125;</span></pre></td></tr></table></div>

<p><strong>CURL</strong></p>
<p>Not all web hosts have the CURL library in their installation. Thus we have to check to see if the function exists before we attempt to use it.</p>

<div class="wp_syntax"><table><tr><td class="code"><pre class="php" style="font-family:monospace;"><span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #990000;">function_exists</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'curl_init'</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
     <span style="color: #666666; font-style: italic;">//Initialize a new resource for curl</span>
     <span style="color: #000088;">$ch</span> <span style="color: #339933;">=</span> <span style="color: #990000;">curl_init</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
     <span style="color: #666666; font-style: italic;">//Set the url the retrieve</span>
     <span style="color: #990000;">curl_setopt</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$ch</span><span style="color: #339933;">,</span> CURLOPT_URL<span style="color: #339933;">,</span> <span style="color: #0000ff;">'http://banditrevolvers.com'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
     <span style="color: #666666; font-style: italic;">//Return the value instead of outputting to the browser</span>
     <span style="color: #990000;">curl_setopt</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$ch</span><span style="color: #339933;">,</span> CURLOPT_RETURNTRANSFER<span style="color: #339933;">,</span> <span style="color: #cc66cc;">1</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
     <span style="color: #000088;">$contents</span> <span style="color: #339933;">=</span> <span style="color: #990000;">curl_exec</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$ch</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
     <span style="color: #990000;">curl_close</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$ch</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
     <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$contents</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
          <span style="color: #666666; font-style: italic;">//Do stuff with the contents</span>
     <span style="color: #009900;">&#125;</span> <span style="color: #b1b100;">else</span> <span style="color: #009900;">&#123;</span>
          <span style="color: #666666; font-style: italic;">//Show error message</span>
     <span style="color: #009900;">&#125;</span>
&nbsp;
<span style="color: #009900;">&#125;</span></pre></td></tr></table></div>

]]></content:encoded>
			<wfw:commentRss>http://jelaniharris.com/2010/how-to-read-remote-files-using-php/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Changing the pointer into the hand cursor in AS3</title>
		<link>http://jelaniharris.com/2010/changing-the-pointer-into-the-hand-cursor-in-as3/</link>
		<comments>http://jelaniharris.com/2010/changing-the-pointer-into-the-hand-cursor-in-as3/#comments</comments>
		<pubDate>Wed, 01 Dec 2010 10:29:51 +0000</pubDate>
		<dc:creator>Jelani Harris</dc:creator>
				<category><![CDATA[Code Gems]]></category>
		<category><![CDATA[as3]]></category>
		<category><![CDATA[flash]]></category>

		<guid isPermaLink="false">http://jelaniharris.com/?p=133</guid>
		<description><![CDATA[One of the problems that I ran into while migrating from Actionscript 2 (AS2) to ActionScript 3 (AS3) was the fact that not only was setting a mouse event of a MovieClip different, so does how the mouse cursor acts. In AS2, setting the onPress event for a MovieClip would automatically cause the cursor to [...]]]></description>
				<content:encoded><![CDATA[<p>One of the problems that I ran into while migrating from Actionscript 2 (AS2) to ActionScript 3 (AS3) was the fact that not only was setting a mouse event of a MovieClip different, so does how the mouse cursor acts.</p>
<p>In AS2, setting the onPress event for a MovieClip would automatically cause the cursor to switch the hand whenever you hovered over the element. However in AS3 I discovered that in order to get the same functionality it has to be done manually to get the same effect:</p>

<div class="wp_syntax"><table><tr><td class="code"><pre class="java" style="font-family:monospace;"><span style="color: #666666; font-style: italic;">//These are properties of the MovieClip class</span>
targetMc.<span style="color: #006633;">buttonMode</span> <span style="color: #339933;">=</span> <span style="color: #000066; font-weight: bold;">true</span><span style="color: #339933;">;</span>
targetMc.<span style="color: #006633;">useHandCursor</span> <span style="color: #339933;">=</span> <span style="color: #000066; font-weight: bold;">true</span><span style="color: #339933;">;</span></pre></td></tr></table></div>

<p>Upon discovering this bit of code, I noticed that I had already created more than a dozen of clickable instances that could use this code and not all of them had classes for them. I had searched for some kind of global variable that I could set to see if I could get this working with all of them the easy way. Alas, I came up with nothing. So instead I decided to create a base class to implement this functionality for me.</p>

<div class="wp_syntax"><table><tr><td class="code"><pre class="java" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">flash.display.MovieClip</span>
&nbsp;
<span style="color: #000000; font-weight: bold;">package</span> <span style="color: #006699;">com.jelaniharris</span> <span style="color: #009900;">&#123;</span>
     <span style="color: #000000; font-weight: bold;">class</span> ButtonMovieClip <span style="color: #000000; font-weight: bold;">extends</span> MovieClip <span style="color: #009900;">&#123;</span>
          <span style="color: #666666; font-style: italic;">//Override the default constructor and make this movieclip indicate it's a button to the user</span>
          <span style="color: #000000; font-weight: bold;">public</span> function ButtonMovieClip <span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">:</span> <span style="color: #000066; font-weight: bold;">void</span> <span style="color: #009900;">&#123;</span>
               <span style="color: #000000; font-weight: bold;">this</span>.<span style="color: #006633;">buttonMode</span> <span style="color: #339933;">=</span> <span style="color: #000066; font-weight: bold;">true</span><span style="color: #339933;">;</span>
               <span style="color: #000000; font-weight: bold;">this</span>.<span style="color: #006633;">useHandCursor</span> <span style="color: #339933;">=</span> <span style="color: #000066; font-weight: bold;">true</span><span style="color: #339933;">;</span>
          <span style="color: #009900;">&#125;</span>
     <span style="color: #009900;">&#125;</span>
<span style="color: #009900;">&#125;</span></pre></td></tr></table></div>

<p>Then all I needed to do was to go to my library and set the Base Class of all of my button-like elements to the ButtonMovieClip class.</p>
<p>I hoped this helped someone out there.</p>
]]></content:encoded>
			<wfw:commentRss>http://jelaniharris.com/2010/changing-the-pointer-into-the-hand-cursor-in-as3/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Using Jquery to disable the enter key</title>
		<link>http://jelaniharris.com/2010/using-jquery-to-disable-the-enter-key/</link>
		<comments>http://jelaniharris.com/2010/using-jquery-to-disable-the-enter-key/#comments</comments>
		<pubDate>Fri, 16 Jul 2010 18:45:06 +0000</pubDate>
		<dc:creator>Jelani Harris</dc:creator>
				<category><![CDATA[Code Gems]]></category>
		<category><![CDATA[jquery]]></category>
		<category><![CDATA[validation]]></category>

		<guid isPermaLink="false">http://jelaniharris.com/?p=38</guid>
		<description><![CDATA[There are times that you do not want a form to automatically submit when a user hits the enter key. Or if you want to do some validation via javascript before you allow the submit to go through. //Bind this keypress function to all of the input tags $&#40;&#34;input&#34;&#41;.keypress&#40;function &#40;evt&#41; &#123; //Deterime where our character [...]]]></description>
				<content:encoded><![CDATA[<p>There are times that you do not want a form to automatically submit when a user hits the enter key. Or if you want to do some validation via javascript before you allow the submit to go through.</p>

<div class="wp_syntax"><table><tr><td class="code"><pre class="javascript" style="font-family:monospace;"><span style="color: #006600; font-style: italic;">//Bind this keypress function to all of the input tags</span>
$<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;input&quot;</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">keypress</span><span style="color: #009900;">&#40;</span><span style="color: #000066; font-weight: bold;">function</span> <span style="color: #009900;">&#40;</span>evt<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
<span style="color: #006600; font-style: italic;">//Deterime where our character code is coming from within the event</span>
<span style="color: #000066; font-weight: bold;">var</span> charCode <span style="color: #339933;">=</span> evt.<span style="color: #660066;">charCode</span> <span style="color: #339933;">||</span> evt.<span style="color: #660066;">keyCode</span><span style="color: #339933;">;</span>
<span style="color: #000066; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span>charCode  <span style="color: #339933;">==</span> <span style="color: #CC0000;">13</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span> <span style="color: #006600; font-style: italic;">//Enter key's keycode</span>
<span style="color: #000066; font-weight: bold;">return</span> <span style="color: #003366; font-weight: bold;">false</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span>
<span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></td></tr></table></div>

<p>By returning false in the keypress function it tells the browser not to allow the enter key event.</p>
]]></content:encoded>
			<wfw:commentRss>http://jelaniharris.com/2010/using-jquery-to-disable-the-enter-key/feed/</wfw:commentRss>
		<slash:comments>9</slash:comments>
		</item>
		<item>
		<title>Removing empty elements from an array</title>
		<link>http://jelaniharris.com/2010/removing-empty-elements-from-an-array/</link>
		<comments>http://jelaniharris.com/2010/removing-empty-elements-from-an-array/#comments</comments>
		<pubDate>Tue, 04 May 2010 22:10:08 +0000</pubDate>
		<dc:creator>Jelani Harris</dc:creator>
				<category><![CDATA[Code Gems]]></category>
		<category><![CDATA[Javascript]]></category>
		<category><![CDATA[Php]]></category>

		<guid isPermaLink="false">http://jelaniharris.com/?p=90</guid>
		<description><![CDATA[When dealing with tag inputs from users, I find myself having to make sure they they don't enter in any blank or empty tags. Then I realized that I needed to find out how to remove undesirable elements not only from the Php side, but also from the Javascript side as well. Thus, here are [...]]]></description>
				<content:encoded><![CDATA[<p>When dealing with tag inputs from users, I find myself having to make sure they they don't enter in any blank or empty tags. Then I realized that I needed to find out how to remove undesirable elements not only from the Php side, but also from the Javascript side as well. Thus, here are some functions that may help some other people out if they're searching for similar functionality.</p>
<p><strong>In PHP</strong></p>

<div class="wp_syntax"><table><tr><td class="code"><pre class="php" style="font-family:monospace;">    <span style="color: #b1b100;">foreach</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$my_array</span> <span style="color: #b1b100;">as</span> <span style="color: #000088;">$key</span> <span style="color: #339933;">=&amp;</span>gt<span style="color: #339933;">;</span> <span style="color: #000088;">$value</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
      <span style="color: #666666; font-style: italic;">//We check to make sure that the value is either null or just an empty string</span>
      <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #990000;">is_null</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$value</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">||</span> <span style="color: #000088;">$value</span><span style="color: #339933;">==</span><span style="color: #0000ff;">&quot;&quot;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
        <span style="color: #990000;">unset</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$my_array</span><span style="color: #009900;">&#91;</span><span style="color: #000088;">$key</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
      <span style="color: #009900;">&#125;</span>
    <span style="color: #009900;">&#125;</span></pre></td></tr></table></div>

<p>An easier way to clean arrays is to use php's <a href="http://us.php.net/manual/en/function.array-filter.php">array_filter</a> function without a callback parameter. By default that function is set to remove elements that contain a false (or a 0), null or a "". I mean <em>seriously</em>, look at how much cleaner it is:</p>

<div class="wp_syntax"><table><tr><td class="code"><pre class="php" style="font-family:monospace;">   <span style="color: #666666; font-style: italic;">//This prunes out 'false', '0', 'null' or ''</span>
   <span style="color: #000088;">$my_array</span> <span style="color: #339933;">=</span> <span style="color: #990000;">array_filter</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$my_array</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></td></tr></table></div>

<p><strong>In JavaScript</strong></p>
<p>We can mimic the functionality of Php's array_filter in Javascript by using the Array.filter function.</p>

<div class="wp_syntax"><table><tr><td class="code"><pre class="javascript" style="font-family:monospace;">   <span style="color: #000066; font-weight: bold;">var</span> my_array <span style="color: #339933;">=</span> <span style="color: #009900;">&#91;</span><span style="color: #CC0000;">1</span><span style="color: #339933;">,</span><span style="color: #CC0000;">2</span><span style="color: #339933;">,</span><span style="color: #CC0000;">3</span><span style="color: #339933;">,</span><span style="color: #3366CC;">'4'</span><span style="color: #339933;">,</span><span style="color: #3366CC;">''</span><span style="color: #339933;">,</span> <span style="color: #CC0000;">0</span><span style="color: #339933;">,</span> <span style="color: #003366; font-weight: bold;">null</span><span style="color: #339933;">,</span> <span style="color: #3366CC;">'false'</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span>
   <span style="color: #000066; font-weight: bold;">function</span> emptyElement<span style="color: #009900;">&#40;</span>element<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
	<span style="color: #006600; font-style: italic;">//Removes nulls, zeros (also falses), text version of false, and blank element</span>
	<span style="color: #000066; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span>element <span style="color: #339933;">==</span> <span style="color: #003366; font-weight: bold;">null</span> <span style="color: #339933;">||</span> element <span style="color: #339933;">==</span> <span style="color: #CC0000;">0</span> <span style="color: #339933;">||</span> element.<span style="color: #660066;">toString</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">toLowerCase</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">==</span> <span style="color: #3366CC;">'false'</span> <span style="color: #339933;">||</span> element <span style="color: #339933;">==</span> <span style="color: #3366CC;">''</span><span style="color: #009900;">&#41;</span>
		<span style="color: #000066; font-weight: bold;">return</span> <span style="color: #003366; font-weight: bold;">false</span><span style="color: #339933;">;</span>
		<span style="color: #000066; font-weight: bold;">else</span> <span style="color: #000066; font-weight: bold;">return</span> <span style="color: #003366; font-weight: bold;">true</span><span style="color: #339933;">;</span>
	<span style="color: #009900;">&#125;</span>
&nbsp;
	<span style="color: #000066; font-weight: bold;">var</span> my_array <span style="color: #339933;">=</span> <span style="color: #009900;">&#91;</span><span style="color: #CC0000;">0</span><span style="color: #339933;">,</span><span style="color: #3366CC;">'false'</span><span style="color: #339933;">,</span><span style="color: #CC0000;">1</span><span style="color: #339933;">,</span><span style="color: #003366; font-weight: bold;">null</span><span style="color: #339933;">,</span> <span style="color: #CC0000;">2</span><span style="color: #339933;">,</span><span style="color: #3366CC;">''</span><span style="color: #339933;">,</span><span style="color: #CC0000;">3</span><span style="color: #339933;">,</span><span style="color: #3366CC;">'4'</span><span style="color: #339933;">,</span><span style="color: #003366; font-weight: bold;">false</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span>
	my_array <span style="color: #339933;">=</span> my_array.<span style="color: #660066;">filter</span><span style="color: #009900;">&#40;</span>emptyElement<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
   <span style="color: #009900;">&#125;</span></pre></td></tr></table></div>

<p>Then my_array will include 1,2,3,4.</p>
<p>I hope this was somewhat useful.</p>
]]></content:encoded>
			<wfw:commentRss>http://jelaniharris.com/2010/removing-empty-elements-from-an-array/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Increasing performance of Adobe CS3 Flash in Vista</title>
		<link>http://jelaniharris.com/2009/increasing-performance-of-adobe-cs3-flash-in-vista/</link>
		<comments>http://jelaniharris.com/2009/increasing-performance-of-adobe-cs3-flash-in-vista/#comments</comments>
		<pubDate>Wed, 16 Sep 2009 22:47:30 +0000</pubDate>
		<dc:creator>Jelani Harris</dc:creator>
				<category><![CDATA[Code Gems]]></category>
		<category><![CDATA[adobe]]></category>
		<category><![CDATA[cs3]]></category>
		<category><![CDATA[flash]]></category>
		<category><![CDATA[vista]]></category>

		<guid isPermaLink="false">http://jelaniharris.com/?p=42</guid>
		<description><![CDATA[When I first started to use Flash CS3 in Vista I noticed that all of my flash movies were performing very very slowly. Honestly .. I'm not sure why. But, here's how you can make it perform better. Navigate to your Program Files -&#62; Adobe folder(s) -&#62; Adobe Flash CS3 and find the Flash.exe. Right [...]]]></description>
				<content:encoded><![CDATA[<p>When I first started to use Flash CS3 in Vista I noticed that all of my flash movies were performing very very slowly.</p>
<p>Honestly .. I'm not sure why. But, here's how you can make it perform better.</p>
<div id="attachment_77" class="wp-caption aligncenter" style="width: 550px"><img class="size-full wp-image-77" title="speeding-up-flash-for-vista" src="http://jelaniharris.com/blog/wp-content/uploads/2009/09/speeding-up-flash-for-vista.jpg" alt="Here's how to speed up flash CS3 for vista" width="540" height="399" /><p class="wp-caption-text">Here&#39;s how to speed up flash CS3 for vista</p></div>
<ol>
<li>Navigate to your Program Files -&gt; Adobe  folder(s) -&gt; Adobe Flash CS3 and find the Flash.exe.</li>
<li>Right click on that file and goto the Compatibility tab.</li>
<li>Check "run this program in compatibility mode", and voila, suddenly it's running as fast as it did on XP. Happy coding!</li>
</ol>
]]></content:encoded>
			<wfw:commentRss>http://jelaniharris.com/2009/increasing-performance-of-adobe-cs3-flash-in-vista/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
