<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" media="screen" href="/~d/styles/rss2full.xsl"?><?xml-stylesheet type="text/css" media="screen" href="http://feeds.feedburner.com/~d/styles/itemcontent.css"?><rss 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:feedburner="http://rssnamespace.org/feedburner/ext/1.0" version="2.0">

<channel>
	<title>e.g.TheBlog</title>
	
	<link>http://www.egtheblog.com</link>
	<description>Modern Trends in Technology &amp; Design</description>
	<pubDate>Fri, 05 Jun 2009 15:04:36 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.7.1</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="self" type="application/rss+xml" href="http://feeds.feedburner.com/Egtheblog" /><feedburner:info uri="egtheblog" /><atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="hub" href="http://pubsubhubbub.appspot.com/" /><item>
		<title>SVN: Attempted to lock an already-locked dir Error</title>
		<link>http://feedproxy.google.com/~r/Egtheblog/~3/7qNn3yDo3zs/</link>
		<comments>http://www.egtheblog.com/?p=137#comments</comments>
		<pubDate>Fri, 05 Jun 2009 15:03:07 +0000</pubDate>
		<dc:creator>e.</dc:creator>
		
		<category><![CDATA[Technology]]></category>

		<category><![CDATA[Subversion]]></category>

		<category><![CDATA[SVN]]></category>

		<category><![CDATA[svn cleanup]]></category>

		<category><![CDATA[svn lock]]></category>

		<guid isPermaLink="false">http://www.egtheblog.com/?p=137</guid>
		<description><![CDATA[So you&#8217;ve been working hard on your project and you&#8217;re ready to check in when all of a sudden Subversion throws you this weird error message: Attempted to lock an already-locked dir. &#8220;What the hell is this about?&#8221; you ask yourself. Well, Subversion is a really cautious fella and likes to bookkeep all of its transactions. [...]]]></description>
			<content:encoded><![CDATA[<p>So you&#8217;ve been working hard on your project and you&#8217;re ready to check in when all of a sudden Subversion throws you this weird error message: Attempted to lock an already-locked dir. &#8220;What the hell is this about?&#8221; you ask yourself. Well, Subversion is a really cautious fella and likes to bookkeep all of its transactions. So whenever you attempt to modify your working copy it&#8217;ll write its intentions to a log file, execute the commands in the log file, then remove the log file. If for one reason or another this process gets interrupted, this file still remains on disk.</p>
<p>So whenever Subversion ever tells you &#8220;Attempted to lock an already-locked dir&#8221;. You say nay, and type &#8220;<strong>svn cleanup</strong>&#8221; This command searches you current working copy re-runs any leftover log files and removes any locks in the process.</p>
<p>I personally use Subclipse, the SVN eclipse plugin. To get rid of this error in Subclipse, right-click the offending directory and click Team&gt;cleanup.</p>
<p>Happy coding.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.egtheblog.com/?feed=rss2&amp;p=137</wfw:commentRss>
		<feedburner:origLink>http://www.egtheblog.com/?p=137</feedburner:origLink></item>
		<item>
		<title>Installing Grails on Mac OSX Leopard</title>
		<link>http://feedproxy.google.com/~r/Egtheblog/~3/VJsB2GKuqoY/</link>
		<comments>http://www.egtheblog.com/?p=126#comments</comments>
		<pubDate>Sun, 12 Apr 2009 17:14:38 +0000</pubDate>
		<dc:creator>e.</dc:creator>
		
		<category><![CDATA[Grails]]></category>

		<category><![CDATA[Technology]]></category>

		<category><![CDATA[.profile]]></category>

		<category><![CDATA[OSX]]></category>

		<guid isPermaLink="false">http://www.egtheblog.com/?p=126</guid>
		<description><![CDATA[Here&#8217;s a quick tutorial to get Grails up and running on your Mac OSX machine:

Download the latest Binary from here.
To keep it clean, let&#8217;s unpack the archive and move the folder to /usr/share. Open up a terminal window and type: $ sudo mv ~/Downloads/grails-1.1 /usr/share 
Change the permissions on these files $cd /usr/share
$sudo chown -R [...]]]></description>
			<content:encoded><![CDATA[<p>Here&#8217;s a quick tutorial to get Grails up and running on your Mac OSX machine:</p>
<ol>
<li>Download the latest Binary from <a href="http://grails.org/Download">here</a>.</li>
<li>To keep it clean, let&#8217;s unpack the archive and move the folder to /usr/share. Open up a terminal window and type:<code> $ sudo mv ~/Downloads/grails-1.1 /usr/share </code></li>
<li>Change the permissions on these files <code>$cd /usr/share<br />
$sudo chown -R root:wheel grails-1.1/<br />
$sudo chmod 0755 grails-1.1/bin/*<br />
</code></li>
<li>Let&#8217;s create a symlink to the grails directory <code> $ln -s grails-1.1 grails </code> </li>
<li>Finally, let&#8217;s add the GRAILS_HOME var to our ~/.profile file and point it to the symlink that we just created. If you&#8217;re like me, and don&#8217;t find vi particularly easy to use, here&#8217;s an easy way to edit your .profile file using TextEdit <code> open ~/.profile<br />
</code><br />
If for some reason TextEdit is not the default application for this type of file, you can force it to open this file by typing <code> open -a TextEdit ~/.profile </code><br />
Here&#8217;s an example of what a .profile file might look like when GRAILS_HOME is added: <code> GRAILS_HOME=/usr/share/grails; export GRAILS_HOME<br />
export PATH=/opt/local/bin:/opt/local/sbin:$GRAILS_HOME/bin:$PATH</code>
</li>
<li>That&#8217;s it! Let&#8217;s test it out. Type in grails in the Terminal and you should see the following output.<br />
<code> $grails<br />
Welcome to Grails 1.1 - http://grails.org/<br />
Licensed under Apache Standard License 2.0<br />
Grails home is set to: /usr/share/grails </br><br />
No script name specified. Use &#8216;grails help&#8217; for more info or &#8216;grails interactive&#8217; to enter interactive mode<br />
</code></li>
</ol>
]]></content:encoded>
			<wfw:commentRss>http://www.egtheblog.com/?feed=rss2&amp;p=126</wfw:commentRss>
		<feedburner:origLink>http://www.egtheblog.com/?p=126</feedburner:origLink></item>
		<item>
		<title>Javascript Countdown Timer</title>
		<link>http://feedproxy.google.com/~r/Egtheblog/~3/Bw490K1TqoE/</link>
		<comments>http://www.egtheblog.com/?p=110#comments</comments>
		<pubDate>Tue, 24 Mar 2009 04:53:08 +0000</pubDate>
		<dc:creator>e.</dc:creator>
		
		<category><![CDATA[JavaScript]]></category>

		<category><![CDATA[countdown]]></category>

		<category><![CDATA[timer]]></category>

		<guid isPermaLink="false">http://www.egtheblog.com/?p=110</guid>
		<description><![CDATA[Need a stylish Javascript countdown timer? No problem. Here&#8217;s a quick and dirty way to get one up that&#8217;s clean and usable. Check out the demo to see it in action.
To install:
Add the following HTML snippet to the section of your page where you want the timer to be placed

&#60;div id=&#34;counter&#34; class=&#34;counter&#34;&#62;
	&#60;ul class=&#34;countdown&#34;&#62;
		&#60;li&#62;&#60;div class=&#34;countdown_num&#34; id=&#34;countdown_day&#34;&#62;&#60;/div&#62;&#60;div&#62;Days&#60;/div&#62;&#60;/li&#62;
		&#60;li&#62;&#60;div [...]]]></description>
			<content:encoded><![CDATA[<p>Need a stylish Javascript countdown timer? No problem. Here&#8217;s a quick and dirty way to get one up that&#8217;s clean and usable. Check out the <a href="http://egtheblog.com/demos/countdown_timer/">demo</a> to see it in action.</p>
<p>To install:</p>
<p>Add the following HTML snippet to the section of your page where you want the timer to be placed</p>

<div class="wp_syntax"><div class="code"><pre class="html4strict" style="font-family:monospace;"><span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">div</span> <span style="color: #000066;">id</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;counter&quot;</span> <span style="color: #000066;">class</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;counter&quot;</span>&gt;</span>
	<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">ul</span> <span style="color: #000066;">class</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;countdown&quot;</span>&gt;</span>
		<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">li</span>&gt;&lt;<span style="color: #000000; font-weight: bold;">div</span> <span style="color: #000066;">class</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;countdown_num&quot;</span> <span style="color: #000066;">id</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;countdown_day&quot;</span>&gt;&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">div</span>&gt;&lt;<span style="color: #000000; font-weight: bold;">div</span>&gt;</span>Days<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">div</span>&gt;&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">li</span>&gt;</span>
		<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">li</span>&gt;&lt;<span style="color: #000000; font-weight: bold;">div</span> <span style="color: #000066;">class</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;countdown_num&quot;</span> <span style="color: #000066;">id</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;countdown_hour&quot;</span>&gt;&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">div</span>&gt;&lt;<span style="color: #000000; font-weight: bold;">div</span>&gt;</span>Hours<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">div</span>&gt;&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">li</span>&gt;</span>
		<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">li</span>&gt;&lt;<span style="color: #000000; font-weight: bold;">div</span> <span style="color: #000066;">class</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;countdown_num&quot;</span> <span style="color: #000066;">id</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;countdown_min&quot;</span>&gt;&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">div</span>&gt;&lt;<span style="color: #000000; font-weight: bold;">div</span>&gt;</span>Minutes<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">div</span>&gt;&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">li</span>&gt;</span>
		<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">li</span>&gt;&lt;<span style="color: #000000; font-weight: bold;">div</span> <span style="color: #000066;">class</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;countdown_num&quot;</span> <span style="color: #000066;">id</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;countdown_sec&quot;</span>&gt;&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">div</span>&gt;&lt;<span style="color: #000000; font-weight: bold;">div</span>&gt;</span>Seconds<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">div</span>&gt;&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">li</span>&gt;</span>
	<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">ul</span>&gt;</span>
<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">div</span>&gt;</span>
<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">div</span> <span style="color: #000066;">id</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;expired&quot;</span> <span style="color: #000066;">style</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;display:none;&quot;</span>&gt;</span>
	The deadline has passed.
<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">div</span>&gt;</span></pre></div></div>

</p>
<p>Next, add the following CSS to give it some style!</br></p>

<div class="wp_syntax"><div class="code"><pre class="css" style="font-family:monospace;"><span style="color: #808080; font-style: italic;">/*COUNTER SPECIFIC STYLES */</span>
.counter<span style="color: #00AA00;">&#123;</span>
	<span style="color: #000000; font-weight: bold;">width</span><span style="color: #00AA00;">:</span> <span style="color: #933;">610px</span><span style="color: #00AA00;">;</span>
<span style="color: #00AA00;">&#125;</span>
<span style="color: #6666ff;">.counter</span> ul.countdown<span style="color: #00AA00;">&#123;</span>
	<span style="color: #000000; font-weight: bold;">list-style-type</span><span style="color: #00AA00;">:</span> <span style="color: #993333;">none</span><span style="color: #00AA00;">;</span>
	<span style="color: #000000; font-weight: bold;">color</span><span style="color: #00AA00;">:</span> <span style="color: #993333;">white</span><span style="color: #00AA00;">;</span>
	<span style="color: #000000; font-weight: bold;">font-weight</span><span style="color: #00AA00;">:</span> <span style="color: #993333;">bold</span><span style="color: #00AA00;">;</span>
	<span style="color: #000000; font-weight: bold;">text-align</span><span style="color: #00AA00;">:</span> <span style="color: #993333;">center</span><span style="color: #00AA00;">;</span>
<span style="color: #00AA00;">&#125;</span>
<span style="color: #6666ff;">.counter</span> ul<span style="color: #6666ff;">.countdown</span> li<span style="color: #00AA00;">&#123;</span>
	<span style="color: #000000; font-weight: bold;">float</span><span style="color: #00AA00;">:</span> <span style="color: #000000; font-weight: bold;">left</span><span style="color: #00AA00;">;</span>
	<span style="color: #000000; font-weight: bold;">background</span><span style="color: #00AA00;">:</span> <span style="color: #993333;">url</span><span style="color: #00AA00;">&#40;</span><span style="color: #ff0000; font-style: italic;">digit.png</span><span style="color: #00AA00;">&#41;</span> <span style="color: #993333;">no-repeat</span><span style="color: #00AA00;">;</span>
	<span style="color: #000000; font-weight: bold;">height</span><span style="color: #00AA00;">:</span><span style="color: #933;">110px</span><span style="color: #00AA00;">;</span>
	<span style="color: #000000; font-weight: bold;">width</span><span style="color: #00AA00;">:</span> <span style="color: #933;">105px</span><span style="color: #00AA00;">;</span>
	<span style="color: #000000; font-weight: bold;">padding-top</span><span style="color: #00AA00;">:</span> <span style="color: #933;">15px</span><span style="color: #00AA00;">;</span>
<span style="color: #00AA00;">&#125;</span>
<span style="color: #6666ff;">.counter</span> ul<span style="color: #6666ff;">.countdown</span> li div<span style="color: #00AA00;">&#123;</span>
	<span style="color: #000000; font-weight: bold;">font-size</span><span style="color: #00AA00;">:</span> <span style="color: #933;">15px</span><span style="color: #00AA00;">;</span>
<span style="color: #00AA00;">&#125;</span>
<span style="color: #6666ff;">.counter</span> ul<span style="color: #6666ff;">.countdown</span> li div.countdown_num<span style="color: #00AA00;">&#123;</span>
	<span style="color: #000000; font-weight: bold;">font-size</span><span style="color: #00AA00;">:</span> <span style="color: #933;">48px</span><span style="color: #00AA00;">;</span>
<span style="color: #00AA00;">&#125;</span>
<span style="color: #6666ff;">.counter</span> ul<span style="color: #6666ff;">.countdown</span> li.no_countdown<span style="color: #00AA00;">&#123;</span>
	<span style="color: #000000; font-weight: bold;">padding-top</span><span style="color: #00AA00;">:</span><span style="color: #933;">4px</span><span style="color: #00AA00;">;</span>
	<span style="color: #000000; font-weight: bold;">background</span><span style="color: #00AA00;">:</span><span style="color: #993333;">transparent</span><span style="color: #00AA00;">;</span>
	<span style="color: #000000; font-weight: bold;">height</span><span style="color: #00AA00;">:</span><span style="color: #933;">110px</span><span style="color: #00AA00;">;</span>
	<span style="color: #000000; font-weight: bold;">width</span><span style="color: #00AA00;">:</span><span style="color: #933;">180px</span><span style="color: #00AA00;">;</span>
<span style="color: #00AA00;">&#125;</span></pre></div></div>

</p>
<p>Finally, here&#8217;s the Javascript to make it work. Just add this script to the bottom of your page.</br></p>

<div class="wp_syntax"><div class="code"><pre class="javascript" style="font-family:monospace;"><span style="color: #339933;">&lt;</span>script type<span style="color: #339933;">=</span><span style="color: #3366CC;">&quot;text/javascript&quot;</span><span style="color: #339933;">&gt;</span>
         <span style="color: #006600; font-style: italic;">/*
		Countdown Timer
		Based on the &quot;Count down until any date script&quot; - By JavaScript Kit (www.javascriptkit.com)
		Author: (c) 2009 Elbert Bautista
		URL: http://www.egTheBlog.com
		Licence : Open Source MIT Licence
&nbsp;
	*/</span>
&nbsp;
	<span style="color: #003366; font-weight: bold;">var</span> current<span style="color: #339933;">=</span><span style="color: #3366CC;">&quot;Expired&quot;</span>
	<span style="color: #003366; font-weight: bold;">var</span> montharray<span style="color: #339933;">=</span><span style="color: #003366; font-weight: bold;">new</span> Array<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;Jan&quot;</span><span style="color: #339933;">,</span><span style="color: #3366CC;">&quot;Feb&quot;</span><span style="color: #339933;">,</span><span style="color: #3366CC;">&quot;Mar&quot;</span><span style="color: #339933;">,</span><span style="color: #3366CC;">&quot;Apr&quot;</span><span style="color: #339933;">,</span><span style="color: #3366CC;">&quot;May&quot;</span><span style="color: #339933;">,</span><span style="color: #3366CC;">&quot;Jun&quot;</span><span style="color: #339933;">,</span><span style="color: #3366CC;">&quot;Jul&quot;</span><span style="color: #339933;">,</span><span style="color: #3366CC;">&quot;Aug&quot;</span><span style="color: #339933;">,</span><span style="color: #3366CC;">&quot;Sep&quot;</span><span style="color: #339933;">,</span><span style="color: #3366CC;">&quot;Oct&quot;</span><span style="color: #339933;">,</span><span style="color: #3366CC;">&quot;Nov&quot;</span><span style="color: #339933;">,</span><span style="color: #3366CC;">&quot;Dec&quot;</span><span style="color: #009900;">&#41;</span>
&nbsp;
	<span style="color: #003366; font-weight: bold;">function</span> countdown<span style="color: #009900;">&#40;</span>yr<span style="color: #339933;">,</span>m<span style="color: #339933;">,</span>d<span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
		theyear<span style="color: #339933;">=</span>yr<span style="color: #339933;">;</span>themonth<span style="color: #339933;">=</span>m<span style="color: #339933;">;</span>theday<span style="color: #339933;">=</span>d
		<span style="color: #003366; font-weight: bold;">var</span> today<span style="color: #339933;">=</span><span style="color: #003366; font-weight: bold;">new</span> Date<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>
		<span style="color: #003366; font-weight: bold;">var</span> todayy<span style="color: #339933;">=</span>today.<span style="color: #660066;">getYear</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>
		<span style="color: #000066; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span>todayy <span style="color: #339933;">&lt;</span> <span style="color: #CC0000;">1000</span><span style="color: #009900;">&#41;</span>
		todayy<span style="color: #339933;">+=</span><span style="color: #CC0000;">1900</span>
		<span style="color: #003366; font-weight: bold;">var</span> todaym<span style="color: #339933;">=</span>today.<span style="color: #660066;">getMonth</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>
		<span style="color: #003366; font-weight: bold;">var</span> todayd<span style="color: #339933;">=</span>today.<span style="color: #660066;">getDate</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>
		<span style="color: #003366; font-weight: bold;">var</span> todayh<span style="color: #339933;">=</span>today.<span style="color: #660066;">getHours</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>
		<span style="color: #003366; font-weight: bold;">var</span> todaymin<span style="color: #339933;">=</span>today.<span style="color: #660066;">getMinutes</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>
		<span style="color: #003366; font-weight: bold;">var</span> todaysec<span style="color: #339933;">=</span>today.<span style="color: #660066;">getSeconds</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>
		<span style="color: #003366; font-weight: bold;">var</span> todaystring<span style="color: #339933;">=</span>montharray<span style="color: #009900;">&#91;</span>todaym<span style="color: #009900;">&#93;</span><span style="color: #339933;">+</span><span style="color: #3366CC;">&quot; &quot;</span><span style="color: #339933;">+</span>todayd<span style="color: #339933;">+</span><span style="color: #3366CC;">&quot;, &quot;</span><span style="color: #339933;">+</span>todayy<span style="color: #339933;">+</span><span style="color: #3366CC;">&quot; &quot;</span><span style="color: #339933;">+</span>todayh<span style="color: #339933;">+</span><span style="color: #3366CC;">&quot;:&quot;</span><span style="color: #339933;">+</span>todaymin<span style="color: #339933;">+</span><span style="color: #3366CC;">&quot;:&quot;</span><span style="color: #339933;">+</span>todaysec
		futurestring<span style="color: #339933;">=</span>montharray<span style="color: #009900;">&#91;</span>m<span style="color: #339933;">-</span><span style="color: #CC0000;">1</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">+</span><span style="color: #3366CC;">&quot; &quot;</span><span style="color: #339933;">+</span>d<span style="color: #339933;">+</span><span style="color: #3366CC;">&quot;, &quot;</span><span style="color: #339933;">+</span>yr
		dd<span style="color: #339933;">=</span>Date.<span style="color: #660066;">parse</span><span style="color: #009900;">&#40;</span>futurestring<span style="color: #009900;">&#41;</span><span style="color: #339933;">-</span>Date.<span style="color: #660066;">parse</span><span style="color: #009900;">&#40;</span>todaystring<span style="color: #009900;">&#41;</span>
		dday<span style="color: #339933;">=</span>Math.<span style="color: #660066;">floor</span><span style="color: #009900;">&#40;</span>dd<span style="color: #339933;">/</span><span style="color: #009900;">&#40;</span><span style="color: #CC0000;">60</span><span style="color: #339933;">*</span><span style="color: #CC0000;">60</span><span style="color: #339933;">*</span><span style="color: #CC0000;">1000</span><span style="color: #339933;">*</span><span style="color: #CC0000;">24</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">*</span><span style="color: #CC0000;">1</span><span style="color: #009900;">&#41;</span>
		dhour<span style="color: #339933;">=</span>Math.<span style="color: #660066;">floor</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#40;</span>dd<span style="color: #339933;">%</span><span style="color: #009900;">&#40;</span><span style="color: #CC0000;">60</span><span style="color: #339933;">*</span><span style="color: #CC0000;">60</span><span style="color: #339933;">*</span><span style="color: #CC0000;">1000</span><span style="color: #339933;">*</span><span style="color: #CC0000;">24</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">/</span><span style="color: #009900;">&#40;</span><span style="color: #CC0000;">60</span><span style="color: #339933;">*</span><span style="color: #CC0000;">60</span><span style="color: #339933;">*</span><span style="color: #CC0000;">1000</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">*</span><span style="color: #CC0000;">1</span><span style="color: #009900;">&#41;</span>
		dmin<span style="color: #339933;">=</span>Math.<span style="color: #660066;">floor</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#40;</span>dd<span style="color: #339933;">%</span><span style="color: #009900;">&#40;</span><span style="color: #CC0000;">60</span><span style="color: #339933;">*</span><span style="color: #CC0000;">60</span><span style="color: #339933;">*</span><span style="color: #CC0000;">1000</span><span style="color: #339933;">*</span><span style="color: #CC0000;">24</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">%</span><span style="color: #009900;">&#40;</span><span style="color: #CC0000;">60</span><span style="color: #339933;">*</span><span style="color: #CC0000;">60</span><span style="color: #339933;">*</span><span style="color: #CC0000;">1000</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">/</span><span style="color: #009900;">&#40;</span><span style="color: #CC0000;">60</span><span style="color: #339933;">*</span><span style="color: #CC0000;">1000</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">*</span><span style="color: #CC0000;">1</span><span style="color: #009900;">&#41;</span>
		dsec<span style="color: #339933;">=</span>Math.<span style="color: #660066;">floor</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#40;</span>dd<span style="color: #339933;">%</span><span style="color: #009900;">&#40;</span><span style="color: #CC0000;">60</span><span style="color: #339933;">*</span><span style="color: #CC0000;">60</span><span style="color: #339933;">*</span><span style="color: #CC0000;">1000</span><span style="color: #339933;">*</span><span style="color: #CC0000;">24</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">%</span><span style="color: #009900;">&#40;</span><span style="color: #CC0000;">60</span><span style="color: #339933;">*</span><span style="color: #CC0000;">60</span><span style="color: #339933;">*</span><span style="color: #CC0000;">1000</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">%</span><span style="color: #009900;">&#40;</span><span style="color: #CC0000;">60</span><span style="color: #339933;">*</span><span style="color: #CC0000;">1000</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">/</span><span style="color: #CC0000;">1000</span><span style="color: #339933;">*</span><span style="color: #CC0000;">1</span><span style="color: #009900;">&#41;</span>
		<span style="color: #000066; font-weight: bold;">if</span><span style="color: #009900;">&#40;</span>dday<span style="color: #339933;">==</span><span style="color: #CC0000;">0</span><span style="color: #339933;">&amp;&amp;</span>dhour<span style="color: #339933;">==</span><span style="color: #CC0000;">0</span><span style="color: #339933;">&amp;&amp;</span>dmin<span style="color: #339933;">==</span><span style="color: #CC0000;">0</span><span style="color: #339933;">&amp;&amp;</span>dsec<span style="color: #339933;">==</span><span style="color: #CC0000;">1</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
			document.<span style="color: #660066;">getElementById</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'counter'</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">style</span>.<span style="color: #660066;">display</span><span style="color: #339933;">=</span><span style="color: #3366CC;">'none'</span><span style="color: #339933;">;</span>
			document.<span style="color: #660066;">getElementById</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'expired'</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">style</span>.<span style="color: #660066;">display</span><span style="color: #339933;">=</span><span style="color: #3366CC;">'block'</span><span style="color: #339933;">;</span>
			<span style="color: #000066; font-weight: bold;">return</span>
		<span style="color: #009900;">&#125;</span>
		<span style="color: #000066; font-weight: bold;">else</span><span style="color: #009900;">&#123;</span>
			document.<span style="color: #660066;">getElementById</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'countdown_day'</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">innerHTML</span><span style="color: #339933;">=</span>dday<span style="color: #339933;">;</span>
			document.<span style="color: #660066;">getElementById</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'countdown_hour'</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">innerHTML</span><span style="color: #339933;">=</span>dhour<span style="color: #339933;">;</span>
			document.<span style="color: #660066;">getElementById</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'countdown_min'</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">innerHTML</span><span style="color: #339933;">=</span>dmin<span style="color: #339933;">;</span>
			document.<span style="color: #660066;">getElementById</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'countdown_sec'</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">innerHTML</span><span style="color: #339933;">=</span>dsec<span style="color: #339933;">;</span>
			setTimeout<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;countdown(theyear,themonth,theday)&quot;</span><span style="color: #339933;">,</span><span style="color: #CC0000;">1000</span><span style="color: #009900;">&#41;</span>
		<span style="color: #009900;">&#125;</span>
	<span style="color: #009900;">&#125;</span>
&nbsp;
        <span style="color: #006600; font-style: italic;">// THIS IS JUST TEST DATA FOR THE EXAMPLE, REMOVE</span>
	<span style="color: #003366; font-weight: bold;">var</span> deadline<span style="color: #339933;">=</span><span style="color: #003366; font-weight: bold;">new</span> Date<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	deadline.<span style="color: #660066;">setDate</span><span style="color: #009900;">&#40;</span>deadline.<span style="color: #660066;">getDate</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">+</span><span style="color: #CC0000;">5</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	<span style="color: #003366; font-weight: bold;">var</span> deadlineYear <span style="color: #339933;">=</span> deadline.<span style="color: #660066;">getYear</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	<span style="color: #000066; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span>deadlineYear <span style="color: #339933;">&lt;</span> <span style="color: #CC0000;">1000</span><span style="color: #009900;">&#41;</span>
	deadlineYear<span style="color: #339933;">+=</span><span style="color: #CC0000;">1900</span>
        <span style="color: #006600; font-style: italic;">// ---------------------------</span>
&nbsp;
&nbsp;
	<span style="color: #006600; font-style: italic;">//MODIFY THIS LINE: enter the count down date using the format year/month/day</span>
        <span style="color: #006600; font-style: italic;">//e.g. countdown(2009, 03, 23);</span>
	countdown<span style="color: #009900;">&#40;</span>deadlineYear<span style="color: #339933;">,</span> deadline.<span style="color: #660066;">getMonth</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">+</span><span style="color: #CC0000;">1</span><span style="color: #339933;">,</span> deadline.<span style="color: #660066;">getDate</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #339933;">&lt;/</span>script<span style="color: #339933;">&gt;</span></pre></div></div>

</p>
<p>That&#8217;s it! Check out the final demo <a href="http://egtheblog.com/demos/countdown_timer/">here</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.egtheblog.com/?feed=rss2&amp;p=110</wfw:commentRss>
		<feedburner:origLink>http://www.egtheblog.com/?p=110</feedburner:origLink></item>
		<item>
		<title>Populating Tables with Data Using Migrations</title>
		<link>http://feedproxy.google.com/~r/Egtheblog/~3/q_USkZvUqRo/</link>
		<comments>http://www.egtheblog.com/?p=92#comments</comments>
		<pubDate>Tue, 17 Mar 2009 20:08:01 +0000</pubDate>
		<dc:creator>g.</dc:creator>
		
		<category><![CDATA[Ruby on Rails]]></category>

		<category><![CDATA[Technology]]></category>

		<category><![CDATA[data]]></category>

		<category><![CDATA[database]]></category>

		<category><![CDATA[migrations]]></category>

		<category><![CDATA[populating]]></category>

		<category><![CDATA[rails]]></category>

		<guid isPermaLink="false">http://www.egtheblog.com/?p=92</guid>
		<description><![CDATA[I can think of very few Rails sites that don&#8217;t need some kind of data pre-populated in their tables. When you talk to a Rails developer, the first thing that comes to mind when talking about populating the db is fixtures. This is not what we&#8217;re talking about here. Fixtures populate your TEST database with [...]]]></description>
			<content:encoded><![CDATA[<p>I can think of very few Rails sites that don&#8217;t need some kind of data pre-populated in their tables. When you talk to a Rails developer, the first thing that comes to mind when talking about populating the db is fixtures. This is <em>not</em> what we&#8217;re talking about here. Fixtures populate your TEST database with sample data for testing purposes. What I mean is what if you have a table that holds all 50 US states? Or a table that holds user roles like &#8220;admin&#8221;, &#8220;moderator&#8221;, &#8220;member&#8221;, and so forth? Ideally, you want this data populated as soon as your app is deployed and running, and inputting it manually is of course out of the question. </p>
<p>There are certainly many ways to do this, but I want to focus on what I&#8217;ve found to be a very <strong>elegant</strong> solution. We&#8217;re going to use migrations, so that when you do your initial rake db:migrate, things are setup and ready to go. And if you want to rollback a specific populating of a table, you could do that as well! </p>
<p>The example I&#8217;m going to use is a table that needs to hold the 50 US states. Create a migration like the following:</p>

<div class="wp_syntax"><div class="code"><pre class="ruby" style="font-family:monospace;">script<span style="color:#006600; font-weight:bold;">/</span>generate migration add_states</pre></div></div>

<p>Now open up the migration file you just created, and make it look something like this (I&#8217;m not going to fill in all 50 states for this example):</p>

<div class="wp_syntax"><div class="code"><pre class="ruby" style="font-family:monospace;"><span style="color:#9966CC; font-weight:bold;">class</span> AddStates <span style="color:#006600; font-weight:bold;">&lt;</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>
    <span style="color:#006600; font-weight:bold;">%</span>w<span style="color:#006600; font-weight:bold;">&#40;</span>AL AK AZ AR CA CO CT DE DC FL<span style="color:#006600; font-weight:bold;">&#41;</span>.<span style="color:#9900CC;">each</span> <span style="color:#9966CC; font-weight:bold;">do</span> <span style="color:#006600; font-weight:bold;">|</span>s<span style="color:#006600; font-weight:bold;">|</span>
        State.<span style="color:#9900CC;">new</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#ff3333; font-weight:bold;">:name</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> s<span style="color:#006600; font-weight:bold;">&#41;</span>.<span style="color:#9900CC;">save</span>
    <span style="color:#9966CC; font-weight:bold;">end</span>
  <span style="color:#9966CC; font-weight:bold;">end</span>
&nbsp;
  <span style="color:#9966CC; font-weight:bold;">def</span> <span style="color:#0000FF; font-weight:bold;">self</span>.<span style="color:#9900CC;">down</span>
    State.<span style="color:#9900CC;">destroy_all</span>
  <span style="color:#9966CC; font-weight:bold;">end</span>
<span style="color:#9966CC; font-weight:bold;">end</span></pre></div></div>

<p>In the &#8220;up&#8221; migration you&#8217;re iterating through an array of states (which are Strings), and for each one creating a new State object in memory (with whatever attributes you need, in our case just the name), then saving the record to the db with the save method. Easy and elegant. </p>
<p>The beauty is that in the &#8220;down&#8221; migration, we wipe out everything in the states table, as it should be. Be aware that when you run the down migration, if you have an auto-incrementing primary key id, it does not reset. So if you populated the 50 states, ran the down migration, then ran it again, the id would start counting at 51, not 1. </p>
]]></content:encoded>
			<wfw:commentRss>http://www.egtheblog.com/?feed=rss2&amp;p=92</wfw:commentRss>
		<feedburner:origLink>http://www.egtheblog.com/?p=92</feedburner:origLink></item>
		<item>
		<title>Rotating Ruby on Rails Log Files Using Logrotate</title>
		<link>http://feedproxy.google.com/~r/Egtheblog/~3/is6XhH4d16U/</link>
		<comments>http://www.egtheblog.com/?p=72#comments</comments>
		<pubDate>Tue, 10 Mar 2009 21:42:34 +0000</pubDate>
		<dc:creator>g.</dc:creator>
		
		<category><![CDATA[Ruby on Rails]]></category>

		<category><![CDATA[Technology]]></category>

		<category><![CDATA[logs]]></category>

		<category><![CDATA[rails]]></category>

		<category><![CDATA[rotate]]></category>

		<guid isPermaLink="false">http://www.egtheblog.com/?p=72</guid>
		<description><![CDATA[If you don&#8217;t pay much attention to the size of your log files in your production apps, you might want to take a look! If left alone, files such as production.log can grow quite large and bog down your application or server&#8217;s performance. In Linux, there is a tool called logrotate to help you manage [...]]]></description>
			<content:encoded><![CDATA[<p>If you don&#8217;t pay much attention to the size of your log files in your production apps, you might want to take a look! If left alone, files such as production.log can grow quite large and bog down your application or server&#8217;s performance. In Linux, there is a tool called <strong>logrotate</strong> to help you manage and archive your log files on a regular basis (on my installation of Ubuntu it was already there, I think it&#8217;s built-in. If not, try something like <em>sudo apt-get install logrotate</em>). </p>
<p>Let&#8217;s go through an example of how to rotate your production.log file. Navigate to /etc/logrotate.d. In there should be one or more config files, which specify what logs to rotate and with what options. My logrotate.d folder already had a few config files in there for apache2, mysql-server, etc. I created a new one and named it <strong>ruby</strong>. </p>
<p>Open up the newly created file (<strong>/etc/logrotate.d/ruby</strong> to be clear) and fill it with something like this:</p>
<blockquote><p>
/var/railsapps/myapp/shared/log/production.log {<br />
daily<br />
rotate 12<br />
compress<br />
missingok<br />
copytruncate<br />
}
</p></blockquote>
<p>So the first line points to whichever log file we want to deal with (I just used a sample path, yours is likely to differ). Something interesting you can do is instead of just doing this for production.log, put something like <strong>*.log</strong> and then logrotate will work its magic on any file in that folder which ends with <strong>.log</strong>!<br />
Inside the brackets is just a sampling of the options you can put. I won&#8217;t go through all of them, just Google &#8220;logrotate options&#8221; or something like that and you&#8217;ll find all of them in no time, with thorough explanations. For the sake of this quick tutorial, I&#8217;ll explain a few:</p>
<ul>
<li><strong>daily</strong>: rotate log files daily (could have also said <em>weekly</em> or <em>monthly</em>)</li>
<li><strong>rotate 12</strong>: keep 12 weeks worth of backlogs</li>
<li><strong>compress</strong>: if you want your log files compressed to save diskspace (uses gzip)</li>
</ul>
<p>You get the point. I read somewhere that if you are using Mongrel, you need the <strong>copytruncate</strong> option in order for the log to keep being written to, thus avoiding a restart (not sure of the accuracy of this statement, just a heads up!). To actually USE logrotate, all you have to do is wait for the time period you specified (if daily, wait for the next day) and rotation should happen automatically. </p>
<p>I hope this served as a good intro to rotating your Rails logs, if you have questions please post them!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.egtheblog.com/?feed=rss2&amp;p=72</wfw:commentRss>
		<feedburner:origLink>http://www.egtheblog.com/?p=72</feedburner:origLink></item>
		<item>
		<title>Pass Additional Parameters to REST Named Routes</title>
		<link>http://feedproxy.google.com/~r/Egtheblog/~3/6qhHKNlOEsk/</link>
		<comments>http://www.egtheblog.com/?p=65#comments</comments>
		<pubDate>Wed, 04 Feb 2009 22:01:09 +0000</pubDate>
		<dc:creator>g.</dc:creator>
		
		<category><![CDATA[Ruby on Rails]]></category>

		<category><![CDATA[Technology]]></category>

		<category><![CDATA[named routes]]></category>

		<category><![CDATA[parameters]]></category>

		<category><![CDATA[params]]></category>

		<category><![CDATA[rails]]></category>

		<category><![CDATA[REST]]></category>

		<guid isPermaLink="false">http://www.egtheblog.com/?p=65</guid>
		<description><![CDATA[Here&#8217;s a quick one, but a useful reference nonetheless. How do you pass additional parameters to REST named routes?
Say you have the following route from the restful_authentication plugin:

map.logout '/logout', :controller =&#62; 'sessions', :action =&#62; 'destroy'

This enables you to say something like this:

redirect_to logout_url

And if you want to pass extra params to that URL? It&#8217;s as [...]]]></description>
			<content:encoded><![CDATA[<p>Here&#8217;s a quick one, but a useful reference nonetheless. How do you pass additional parameters to REST named routes?<br />
Say you have the following route from the <a href="http://github.com/technoweenie/restful-authentication/tree/master">restful_authentication</a> plugin:</p>

<div class="wp_syntax"><div class="code"><pre class="ruby" style="font-family:monospace;">map.<span style="color:#9900CC;">logout</span> <span style="color:#996600;">'/logout'</span>, <span style="color:#ff3333; font-weight:bold;">:controller</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#996600;">'sessions'</span>, <span style="color:#ff3333; font-weight:bold;">:action</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#996600;">'destroy'</span></pre></div></div>

<p>This enables you to say something like this:</p>

<div class="wp_syntax"><div class="code"><pre class="ruby" style="font-family:monospace;">redirect_to logout_url</pre></div></div>

<p>And if you want to pass extra params to that URL? It&#8217;s as easy as:</p>

<div class="wp_syntax"><div class="code"><pre class="ruby" style="font-family:monospace;">redirect_to logout_url<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#ff3333; font-weight:bold;">:some_param</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#0000FF; font-weight:bold;">true</span>, <span style="color:#ff3333; font-weight:bold;">:some_other_param</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#006666;">24</span><span style="color:#006600; font-weight:bold;">&#41;</span></pre></div></div>

]]></content:encoded>
			<wfw:commentRss>http://www.egtheblog.com/?feed=rss2&amp;p=65</wfw:commentRss>
		<feedburner:origLink>http://www.egtheblog.com/?p=65</feedburner:origLink></item>
		<item>
		<title>Using Reserved Words in your Database Tables</title>
		<link>http://feedproxy.google.com/~r/Egtheblog/~3/PJXzBp_aZ1E/</link>
		<comments>http://www.egtheblog.com/?p=27#comments</comments>
		<pubDate>Fri, 17 Oct 2008 17:11:02 +0000</pubDate>
		<dc:creator>g.</dc:creator>
		
		<category><![CDATA[Ruby on Rails]]></category>

		<category><![CDATA[database]]></category>

		<category><![CDATA[MySQL]]></category>

		<category><![CDATA[rails]]></category>

		<category><![CDATA[reserved words]]></category>

		<category><![CDATA[table]]></category>

		<guid isPermaLink="false">http://www.egtheblog.com/?p=27</guid>
		<description><![CDATA[I was banging my head against the wall the other day for several hours wondering why an extremely simple MyModel.find(:all) call was giving me the error: ArgumentError: wrong number of arguments (0 for 1).
There was absolutely nothing strange about the table, my controller, or model object. The next day it dawned on me, I thought [...]]]></description>
			<content:encoded><![CDATA[<p>I was banging my head against the wall the other day for several hours wondering why an extremely simple MyModel.find(:all) call was giving me the error: <strong>ArgumentError: wrong number of arguments (0 for 1)</strong>.</p>
<p>There was absolutely nothing strange about the table, my controller, or model object. The next day it dawned on me, I thought &#8220;I <em>bet</em> one of the column names in my table is a reserved word&#8221;. Well, that turned out to be precisely the problem. One of my columns was named <strong>type</strong>, and that completely threw off ActiveRecord. I also think you cannot name a column <strong>open</strong>. I&#8217;m not sure if there is a complete list of reserved words somewhere, but double-check anytime you name a column something that sounds like it COULD be a reserved word. It could save you hours of mindless troubleshooting!</p>
<p><strong>EDIT:</strong><br />
OK, so here is a list of reserved words that could help: <a href="http://wiki.rubyonrails.org/rails/pages/ReservedWords" target="_blank">List of Reserved Words in Ruby on Rails</a></p>
<p>Also, it would be nice to be able to alias columns in your models. In my case, I can&#8217;t just change the column name from <strong>type</strong> to something else, because I&#8217;m wrapping an existing table that cannot be altered. If anyone has an elegant solution, feel free to comment!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.egtheblog.com/?feed=rss2&amp;p=27</wfw:commentRss>
		<feedburner:origLink>http://www.egtheblog.com/?p=27</feedburner:origLink></item>
		<item>
		<title>Inspiration - 50 Beautiful Movie Posters</title>
		<link>http://feedproxy.google.com/~r/Egtheblog/~3/CYGfmKa6chI/</link>
		<comments>http://www.egtheblog.com/?p=26#comments</comments>
		<pubDate>Mon, 13 Oct 2008 01:40:57 +0000</pubDate>
		<dc:creator>e.</dc:creator>
		
		<category><![CDATA[Design]]></category>

		<category><![CDATA[Movie Posters]]></category>

		<guid isPermaLink="false">http://www.egtheblog.com/?p=26</guid>
		<description><![CDATA[50 Beautiful Movie Posters
http://www.smashingmagazine.com/2008/10/12/50-beautiful-movie-posters/
- My personal favorites:

Alfred Hitchcock&#8217;s The Birds
Pulp Fiction
THX 1138

]]></description>
			<content:encoded><![CDATA[<p>50 Beautiful Movie Posters</p>
<p><a title="50 Beautiful Movie Posters" href="http://www.smashingmagazine.com/2008/10/12/50-beautiful-movie-posters/" target="_blank">http://www.smashingmagazine.com/2008/10/12/50-beautiful-movie-posters/</a></p>
<p>- My personal favorites:</p>
<ul>
<li>Alfred Hitchcock&#8217;s The Birds</li>
<li>Pulp Fiction</li>
<li>THX 1138</li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://www.egtheblog.com/?feed=rss2&amp;p=26</wfw:commentRss>
		<feedburner:origLink>http://www.egtheblog.com/?p=26</feedburner:origLink></item>
		<item>
		<title>5 Awesome JavaScript Solutions</title>
		<link>http://feedproxy.google.com/~r/Egtheblog/~3/UpQ_V_zCUGU/</link>
		<comments>http://www.egtheblog.com/?p=25#comments</comments>
		<pubDate>Mon, 15 Sep 2008 21:53:58 +0000</pubDate>
		<dc:creator>e.</dc:creator>
		
		<category><![CDATA[JavaScript]]></category>

		<category><![CDATA[Ajax]]></category>

		<category><![CDATA[CSS]]></category>

		<category><![CDATA[Facebook]]></category>

		<category><![CDATA[Forms]]></category>

		<category><![CDATA[JQuery]]></category>

		<guid isPermaLink="false">http://www.egtheblog.com/?p=25</guid>
		<description><![CDATA[Here are 5 awesome JavaScript solutions for your professional design:
 
Facebook Inspired Auto-Complete Form - One of the best multiple select text forms is on facebook. This post shows you how to do it.


CSS Sprites Using JQuery - A cool post that shows you how to do CSS Sprites using JQuery. Very Useful

 
JParallax - This is a cool tool [...]]]></description>
			<content:encoded><![CDATA[<p>Here are 5 awesome JavaScript solutions for your professional design:</p>
<p> </p>
<p><strong><a title="Facebook Inspired Auto-Complete" href="http://devthought.com/textboxlist-meets-autocompletion/" target="_blank">Facebook Inspired Auto-Complete Form</a><span style="font-weight: normal;"> - One of the best multiple select text forms is on facebook. This post shows you how to do it.</span></strong></p>
<p><strong></strong><a href="http://devthought.com/textboxlist-meets-autocompletion/" target="_blank"><img style="vertical-align: top;" src="http://egtheblog.com/demos/awesome_javascript/autocomplete.png" alt="Autocomplete JavaScript" width="378" height="193" /></a></p>
<p><a href="http://devthought.com/textboxlist-meets-autocompletion/" target="_blank"></a><br />
<strong><a title="CSS Sprites Using JQuery" href="http://alistapart.com/articles/sprites2" target="_blank">CSS Sprites Using JQuery</a><span style="font-weight: normal;"> - A cool post that shows you how to do CSS Sprites using JQuery. Very Useful</span></strong></p>
<p><a href="http://alistapart.com/articles/sprites2" target="_blank"><img style="vertical-align: top;" src="http://egtheblog.com/demos/awesome_javascript/sprites.png" alt="CSS Sprites" width="429" height="227" /></a></p>
<p> </p>
<p><strong><a title="JParallax" href="http://urlgreyhot.com/personal/weblog/jparralax" target="_blank">JParallax </a></strong>- This is a cool tool from Stephen Band. Think of looking through a camera and having layers of objects at various distances moving around. This library achieves that effect using multiple static images, one for each layer.</p>
<p><a href="http://urlgreyhot.com/personal/weblog/jparralax" target="_blank"><img src="http://egtheblog.com/demos/awesome_javascript/jparallax.jpg" alt="JParallax" width="320" height="240" /></a></p>
<p> </p>
<p><strong><a title="Coda Bubble using JQuery" href="http://jqueryfordesigners.com/coda-popup-bubbles/" target="_blank">Coda Popup Bubble using JQuery</a><span style="font-weight: normal;"> - Very cool popup that can be used as a tooltip or on:hover element</span></strong></p>
<p><a href="http://jqueryfordesigners.com/coda-popup-bubbles/" target="_blank"><img style="vertical-align: top;" src="http://egtheblog.com/demos/awesome_javascript/coda-bubble.jpg" alt="Coda Bubble" width="423" height="144" /></a></p>
<p> </p>
<p> </p>
<p><strong><a title="Ajax Auto-Suggest" href="http://www.brandspankingnew.net/archive/2006/08/ajax_auto-suggest_auto-complete.html" target="_blank">Ajax Auto-Suggest</a><span style="font-weight: normal;"> - The <strong>AutoSuggest class</strong> adds a popdown menu of suggested values to a text field. The user can either click directly on a suggestion to enter it into the field, or navigate the list using the up and down arrow keys, selecting a value using the tab key. The values for the suggestion list are to provided as XML (by a PHP script, or similar).</span></strong></p>
<p><a href="http://www.brandspankingnew.net/archive/2006/08/ajax_auto-suggest_auto-complete.html" target="_blank"><img src="http://egtheblog.com/demos/awesome_javascript/autosuggest.jpg" alt="AutoSuggest" width="475" height="200" /></a></p>
<p> </p>
<p> </p>
<p> </p>
<p> </p>
]]></content:encoded>
			<wfw:commentRss>http://www.egtheblog.com/?feed=rss2&amp;p=25</wfw:commentRss>
		<feedburner:origLink>http://www.egtheblog.com/?p=25</feedburner:origLink></item>
		<item>
		<title>Going from acts_as_taggable_on_steroids to acts_as_taggable_on Plugin</title>
		<link>http://feedproxy.google.com/~r/Egtheblog/~3/YTDMSYr71fw/</link>
		<comments>http://www.egtheblog.com/?p=24#comments</comments>
		<pubDate>Thu, 04 Sep 2008 19:48:15 +0000</pubDate>
		<dc:creator>g.</dc:creator>
		
		<category><![CDATA[Ruby on Rails]]></category>

		<category><![CDATA[acts_as_taggable_on]]></category>

		<category><![CDATA[acts_as_taggable_on_steroids]]></category>

		<category><![CDATA[migrate]]></category>

		<category><![CDATA[plugins]]></category>

		<category><![CDATA[Rails 2.1]]></category>

		<guid isPermaLink="false">http://www.egtheblog.com/?p=24</guid>
		<description><![CDATA[For one reason or another, once I upgraded my app to Rails 2.1, I started getting these mysterious &#8220;stack level too deep&#8221; errors. I&#8217;m not too sure what that even means, but I won&#8217;t get into it here. After diving into the stack trace for a little while, I noticed that the problem was with [...]]]></description>
			<content:encoded><![CDATA[<p>For one reason or another, once I upgraded my app to Rails 2.1, I started getting these mysterious &#8220;stack level too deep&#8221; errors. I&#8217;m not too sure what that even means, but I won&#8217;t get into it here. After diving into the stack trace for a little while, I noticed that the problem was with the <strong>acts_as_taggable_on_steroids plugin</strong> (for whatever reason). It turns out this plugin isn&#8217;t even being maintained anymore (I may be wrong on that, but I read it in a few places). </p>
<p>In comes the improved <strong>acts_as_taggable_on</strong> plugin. In addition to being compatible with Rails 2.1, it has a few more really cool features like having different &#8220;categories&#8221; or &#8220;sets&#8221; of tags. I&#8217;ll leave you to read all about it <a href="http://github.com/sml/acts-as-taggable-on/tree/master" target="_blank">here</a>. </p>
<p>But if you&#8217;re like me, you already have all sorts of tags and taggings in your existing database, and you REALLY don&#8217;t want to wipe all your data and run the acts_as_taggable_on migration from scratch. I found a blog post that got me started on the migration process, but it had a few errors and was incomplete, hence my reason for writing this.</p>
<p>Luckily the database structure between AATOS and AATO is very similar. We&#8217;ll get to that in a second. First, you&#8217;ll want to install AATO like normal (again, refer to <a href="http://github.com/sml/acts-as-taggable-on/tree/master" target="_blank">this</a> link).<br />
<strong>Note:</strong> I was doing this on a Windows machine, and I needed to install git before I could run the <em>script/plugin install git://github.com/mbleigh/acts-as-taggable-on.git</em>. I got it from http://code.google.com/p/msysgit/downloads/list, and at the time of writing the version I installed was Git-1.5.6.1-preview20080701.exe. </p>
<p>Next, you&#8217;ll want to generate your migration file, exactly like you did back in the day (which was a Wednesday by the way) when you installed AATOS. So, <em>script/generate acts_as_taggable_on_migration</em>. If you didn&#8217;t previously use any tagging plugin, running <em>rake db:migrate</em> now would create two new tables, <strong>tags </strong>and <strong>taggings</strong>. But you already have those two tables! So running that migration as is would probably cause all sorts of a mess. What we want to do is edit the migration file to ALTER your existing tables, thus keeping all your precious existing tags around and working. </p>
<p><strong>Note:</strong> If you&#8217;re committed to doing this upgrade, it is safe to delete your acts_as_taggable_on_steroids folder found in vendor/plugins.</p>
<p>So, we shall change the migration to look like this (read my code comments to understand what&#8217;s going on):</p>

<div class="wp_syntax"><div class="code"><pre class="ruby" style="font-family:monospace;"><span style="color:#9966CC; font-weight:bold;">class</span> ActsAsTaggableOnMigration <span style="color:#006600; font-weight:bold;">&lt;</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>
    <span style="color:#008000; font-style:italic;"># this has been modified to upgrade the tables previously created by acts_as_taggable_on_steroids</span>
&nbsp;
    <span style="color:#008000; font-style:italic;"># get rid of the old table index in the taggings table</span>
    remove_index <span style="color:#ff3333; font-weight:bold;">:taggings</span>, <span style="color:#006600; font-weight:bold;">&#91;</span><span style="color:#ff3333; font-weight:bold;">:taggable_id</span>,:taggable_type<span style="color:#006600; font-weight:bold;">&#93;</span>
&nbsp;
    <span style="color:#008000; font-style:italic;"># these are the three new columns necessary for the new plugin to work</span>
    add_column <span style="color:#ff3333; font-weight:bold;">:taggings</span>, <span style="color:#ff3333; font-weight:bold;">:tagger_id</span>, <span style="color:#ff3333; font-weight:bold;">:integer</span>
    add_column <span style="color:#ff3333; font-weight:bold;">:taggings</span>, <span style="color:#ff3333; font-weight:bold;">:tagger_type</span>, <span style="color:#ff3333; font-weight:bold;">:string</span>
    add_column <span style="color:#ff3333; font-weight:bold;">:taggings</span>, <span style="color:#ff3333; font-weight:bold;">:context</span>, <span style="color:#ff3333; font-weight:bold;">:string</span>
&nbsp;
    <span style="color:#008000; font-style:italic;"># these are the two new indexes necessary for the new plugin to work</span>
    add_index <span style="color:#ff3333; font-weight:bold;">:taggings</span>, <span style="color:#ff3333; font-weight:bold;">:tag_id</span>
    add_index <span style="color:#ff3333; font-weight:bold;">:taggings</span>, <span style="color:#006600; font-weight:bold;">&#91;</span><span style="color:#ff3333; font-weight:bold;">:taggable_id</span>, <span style="color:#ff3333; font-weight:bold;">:taggable_type</span>, <span style="color:#ff3333; font-weight:bold;">:context</span><span style="color:#006600; font-weight:bold;">&#93;</span>
  <span style="color:#9966CC; font-weight:bold;">end</span>
&nbsp;
  <span style="color:#9966CC; font-weight:bold;">def</span> <span style="color:#0000FF; font-weight:bold;">self</span>.<span style="color:#9900CC;">down</span>
    drop_table <span style="color:#ff3333; font-weight:bold;">:taggings</span>
    drop_table <span style="color:#ff3333; font-weight:bold;">:tags</span>
  <span style="color:#9966CC; font-weight:bold;">end</span>
<span style="color:#9966CC; font-weight:bold;">end</span></pre></div></div>

<p>Now, run that migration with <em>rake db:migrate</em>. We still need to make a few changes. Go to your model(s) which actually have tags. Previously you declared something like <strong>acts_as_taggable</strong> in each of them. You&#8217;ll need to change this to specify the tag &#8220;category&#8221; or &#8220;set&#8221; like we previously mentioned. So change that acts_as_taggable line to read <strong>acts_as_taggable_on :tags</strong>. You can put whatever you want in the place of :tags, but I&#8217;m just making it generic. </p>
<p>One more step is necessary to get your existing tags working again. In your database, your <em>taggings </em>table now has 3 new columns (all three should be empty). You need to fill in the :context column with the value &#8220;tags&#8221;, which is what I arbitrarily showed above. If you chose to say <strong>acts_as_taggable_on :interests</strong>, then the context column needs to be populated with &#8220;interests&#8221;. That should do it!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.egtheblog.com/?feed=rss2&amp;p=24</wfw:commentRss>
		<feedburner:origLink>http://www.egtheblog.com/?p=24</feedburner:origLink></item>
	</channel>
</rss>
