<?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/"
	xmlns:itunes="http://www.itunes.com/dtds/podcast-1.0.dtd"
>

<channel>
	<title>John Desu &#187; Tutorials</title>
	<atom:link href="http://www.johndesu.com/category/tutorials/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.johndesu.com</link>
	<description>culture, tech, music, and code</description>
	<lastBuildDate>Sat, 05 Jun 2010 04:52:54 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0</generator>
<!-- podcast_generator="Blubrry PowerPress/1.0.9" mode="advanced" entry="normal" -->
	<itunes:summary>Monthly or so mixes of the latest electronic, progressive, and trance tunes.</itunes:summary>
	<itunes:author>John Dyer</itunes:author>
	<itunes:explicit>no</itunes:explicit>
	<itunes:image href="http://www.johndesu.com/images/podcastlogo.jpg" />
	<itunes:owner>
		<itunes:name>John Dyer</itunes:name>
		<itunes:email>lbrapid@gmail.com</itunes:email>
	</itunes:owner>
	<managingEditor>lbrapid@gmail.com (John Dyer)</managingEditor>
	<itunes:subtitle>Moving forward with the web and great music</itunes:subtitle>
	<itunes:keywords>trance,free,mixes,electronic,electro,progressive</itunes:keywords>
	<image>
		<title>John Desu &#187; Tutorials</title>
		<url>http://www.johndesu.com/images/podcastlogo.jpg</url>
		<link>http://www.johndesu.com/category/tutorials/</link>
	</image>
	<itunes:category text="Music" />
	<itunes:category text="Technology">
		<itunes:category text="Podcasting" />
	</itunes:category>
		<item>
		<title>Tooltips in CSS</title>
		<link>http://www.johndesu.com/2009/01/14/tooltips-in-css/</link>
		<comments>http://www.johndesu.com/2009/01/14/tooltips-in-css/#comments</comments>
		<pubDate>Wed, 14 Jan 2009 17:08:45 +0000</pubDate>
		<dc:creator>John Dyer</dc:creator>
				<category><![CDATA[CSS]]></category>
		<category><![CDATA[Tutorials]]></category>
		<category><![CDATA[css]]></category>
		<category><![CDATA[tooltips]]></category>
		<category><![CDATA[tutorial]]></category>
		<category><![CDATA[xhtml]]></category>

		<guid isPermaLink="false">http://www.johndesu.com/?p=86</guid>
		<description><![CDATA[A tooltip is a small box that appear near an object in a graphical user interface when a pointer or other cursor controlled by a mouse passes over or rests on that object and which contains a brief text message identifying or explaining the object. In the context of a website the information shown in [...]]]></description>
			<content:encoded><![CDATA[<p>A tooltip is a small box that appear near an object in a graphical user interface when a pointer or other cursor controlled by a mouse passes over or rests on that object and which contains a brief text message identifying or explaining the object. In the context of a website the information shown in a tooltip is read from the title tags of an element on a page. These are stylized all over the web general using JavaScript and CSS. That&#8217;s not what I&#8217;m going to be teaching you to create though. I am going to show you how to write a tooltip in pure CSS.</p>
<p>Let&#8217;s start with a basic XHTML document.</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;">p</span>&gt;</span>
    <span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">a</span> <span style="color: #000066;">href</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;http://www.johndesu.com/&quot;</span> <span style="color: #000066;">class</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;tooltip&quot;</span>&gt;</span>
    John Dyer<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">span</span>&gt;</span> (Visit my blog) <span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">span</span>&gt;&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">a</span>&gt;</span>
    is a student at the University of Pittsburgh majoring in computer science.
<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">p</span>&gt;</span></pre></div></div>

<p>Notice that the link has been given a class of tooltip. Inside my link I have added the text I want to be displayed as the link text and the text I want to be displayed in a tooltip. It is good practice to enclose the tooltip text in brackets like I have done so that it will still make sense if styles are turned off.</p>
<p>Now we need to set the position property of the anchor tag to relative in order to be able to position the contents of the span absolutely in relation to it&#8217;s parent element, the anchor tag. We also don&#8217;t want the tooltip text to display by default so we will set it&#8217;s display property to none.</p>

<div class="wp_syntax"><div class="code"><pre class="css" style="font-family:monospace;">a<span style="color: #6666ff;">.tooltip</span> <span style="color: #00AA00;">&#123;</span>
    <span style="color: #000000; font-weight: bold;">position</span><span style="color: #00AA00;">:</span> <span style="color: #993333;">relative</span><span style="color: #00AA00;">;</span>
<span style="color: #00AA00;">&#125;</span>
&nbsp;
a<span style="color: #6666ff;">.tooltip</span> span <span style="color: #00AA00;">&#123;</span>
    <span style="color: #000000; font-weight: bold;">display</span><span style="color: #00AA00;">:</span> <span style="color: #993333;">none</span><span style="color: #00AA00;">;</span>
<span style="color: #00AA00;">&#125;</span></pre></div></div>

<p>Next we want to make the text contained in the span tag appear when the anchor is hovered over. We do this by setting the display property of tooltip:hover span to block and positioning the contents of the span below and to the right of anchor using absolute positioning.</p>

<div class="wp_syntax"><div class="code"><pre class="css" style="font-family:monospace;">a<span style="color: #6666ff;">.tooltip</span><span style="color: #3333ff;">:hover </span>span <span style="color: #00AA00;">&#123;</span>
    <span style="color: #000000; font-weight: bold;">display</span><span style="color: #00AA00;">:</span> <span style="color: #993333;">block</span><span style="color: #00AA00;">;</span>
    <span style="color: #000000; font-weight: bold;">position</span><span style="color: #00AA00;">:</span> <span style="color: #993333;">absolute</span><span style="color: #00AA00;">;</span>
    <span style="color: #000000; font-weight: bold;">top</span><span style="color: #00AA00;">:</span> <span style="color: #933;">1em</span><span style="color: #00AA00;">;</span>
    <span style="color: #000000; font-weight: bold;">left</span><span style="color: #00AA00;">:</span> <span style="color: #933;">2em</span><span style="color: #00AA00;">;</span>
<span style="color: #00AA00;">&#125;</span></pre></div></div>

<p>And that&#8217;s really all there is to it. Let&#8217;s add some custom styling now to make it look more like a tooltip. Feel free to change any of stylistic settings to your liking. This is obviously just an example.</p>

<div class="wp_syntax"><div class="code"><pre class="css" style="font-family:monospace;">a<span style="color: #6666ff;">.tooltip</span><span style="color: #3333ff;">:hover </span>span <span style="color: #00AA00;">&#123;</span>
    <span style="color: #000000; font-weight: bold;">display</span><span style="color: #00AA00;">:</span> <span style="color: #993333;">block</span><span style="color: #00AA00;">;</span>
    <span style="color: #000000; font-weight: bold;">position</span><span style="color: #00AA00;">:</span> <span style="color: #993333;">absolute</span><span style="color: #00AA00;">;</span>
    <span style="color: #000000; font-weight: bold;">top</span><span style="color: #00AA00;">:</span> <span style="color: #933;">1em</span><span style="color: #00AA00;">;</span>
    <span style="color: #000000; font-weight: bold;">left</span><span style="color: #00AA00;">:</span> <span style="color: #933;">2em</span><span style="color: #00AA00;">;</span>
    <span style="color: #000000; font-weight: bold;">border</span><span style="color: #00AA00;">:</span> <span style="color: #933;">1px</span> <span style="color: #993333;">solid</span> <span style="color: #cc00cc;">#996633</span><span style="color: #00AA00;">;</span>
    <span style="color: #000000; font-weight: bold;">padding</span><span style="color: #00AA00;">:</span> <span style="color: #933;">0.3em</span> <span style="color: #933;">0.5em</span><span style="color: #00AA00;">;</span>
    <span style="color: #000000; font-weight: bold;">background-color</span><span style="color: #00AA00;">:</span> <span style="color: #cc00cc;">#FFFF66</span><span style="color: #00AA00;">;</span>
    <span style="color: #000000; font-weight: bold;">color</span><span style="color: #00AA00;">:</span> <span style="color: #cc00cc;">#000</span><span style="color: #00AA00;">;</span>
<span style="color: #00AA00;">&#125;</span></pre></div></div>

<p>Note that this technique requires a standards compliant browser such as Firefox. Of course there are issues in IE and for some reason there can be problems in Safari as well. A quick fix for IE 5.x from <a href="http://www.andybudd.com">Andy Budd</a> is the following:</p>

<div class="wp_syntax"><div class="code"><pre class="css" style="font-family:monospace;">a<span style="color: #6666ff;">.tooltip</span><span style="color: #3333ff;">:hover </span><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;"><span style="color: #cc66cc;">100</span>%</span><span style="color: #00AA00;">;</span> <span style="color: #808080; font-style: italic;">/* Fixes bug in IE5.x/Win */</span>
<span style="color: #00AA00;">&#125;</span></pre></div></div>

<p><a href="http://www.johndesu.com/tutorials/css/tooltips/index.html">View a working example</a></p>
<p><em>If you enjoyed this tutorial, why not <a href="http://www.johndesu.com/feed/">subscribe</a> to my feed to receive the latest updates and tutorials from JohnDesu.</em></p>
<img src="http://www.johndesu.com/?ak_action=api_record_view&id=86&type=feed" alt="" />]]></content:encoded>
			<wfw:commentRss>http://www.johndesu.com/2009/01/14/tooltips-in-css/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Getting Started With Rails Migrations Part 1: Creating Migrations</title>
		<link>http://www.johndesu.com/2009/01/13/getting-started-with-rails-migrations-part-1-creating-migrations/</link>
		<comments>http://www.johndesu.com/2009/01/13/getting-started-with-rails-migrations-part-1-creating-migrations/#comments</comments>
		<pubDate>Tue, 13 Jan 2009 06:19:59 +0000</pubDate>
		<dc:creator>John Dyer</dc:creator>
				<category><![CDATA[Ruby on Rails]]></category>
		<category><![CDATA[Tutorials]]></category>
		<category><![CDATA[ActiveRecord]]></category>
		<category><![CDATA[databases]]></category>
		<category><![CDATA[migrations]]></category>

		<guid isPermaLink="false">http://www.johndesu.com/?p=77</guid>
		<description><![CDATA[A migration is simply a Ruby source file in your application’s db/migrate directory. These files help to make small changes to the database extremely easy and quick. Want to add a table or rename a column? Write another migration and run rake db:migrate. With automatic versioning you are able to see the changes made to [...]]]></description>
			<content:encoded><![CDATA[<p>A migration is simply a Ruby source file in your application’s db/migrate directory. These files help to make small changes to the database extremely easy and quick. Want to add a table or rename a column? Write another migration and run <i>rake db:migrate. </i>With automatic versioning you are able to see the changes made to the model just by looking at the latest migration file. No more repetitive SQL queries. Now you can access your data in an understandable way right in your code. With that, let&#8217;s get coding!</p>
<p>First we can use either the rails generator to create a migration or use the model generator, which will also give us a migration file. Note: you could create these files by hand, but it is less error-prone and probably more efficient to use a built-in generator. </p>
<p>To create a migration with the model generator we would do something like this:</p>

<div class="wp_syntax"><div class="code"><pre class="rails" style="font-family:monospace;">ruby script<span style="color:#006600; font-weight:bold;">/</span>generate model post
  exists app<span style="color:#006600; font-weight:bold;">/</span>models<span style="color:#006600; font-weight:bold;">/</span>
  exists test<span style="color:#006600; font-weight:bold;">/</span>unit<span style="color:#006600; font-weight:bold;">/</span>
  exists test<span style="color:#006600; font-weight:bold;">/</span>fixtures<span style="color:#006600; font-weight:bold;">/</span>
  create app<span style="color:#006600; font-weight:bold;">/</span>models<span style="color:#006600; font-weight:bold;">/</span>post.<span style="color:#9900CC;">rb</span>
  create test<span style="color:#006600; font-weight:bold;">/</span>unit<span style="color:#006600; font-weight:bold;">/</span>post_test.<span style="color:#9900CC;">rb</span>
  create test<span style="color:#006600; font-weight:bold;">/</span>fixtures<span style="color:#006600; font-weight:bold;">/</span>posts.<span style="color:#9900CC;">yml</span>
  create db<span style="color:#006600; font-weight:bold;">/</span>migrate
  create db<span style="color:#006600; font-weight:bold;">/</span>migrate<span style="color:#006600; font-weight:bold;">/</span><span style="color:#006666;">20090113055719</span>_create_posts.<span style="color:#9900CC;">rb</span></pre></div></div>

<p>To create a migration on its own we would do something similar to this:</p>

<div class="wp_syntax"><div class="code"><pre class="rails" style="font-family:monospace;">ruby script<span style="color:#006600; font-weight:bold;">/</span>generate migration add_category_column
exists db<span style="color:#006600; font-weight:bold;">/</span>migrate
create db<span style="color:#006600; font-weight:bold;">/</span>migrate<span style="color:#006600; font-weight:bold;">/</span><span style="color:#006666;">20090113055952</span>_add_category_column.<span style="color:#9900CC;">rb</span></pre></div></div>

<p>To run the migration we use the db:migrate task</p>

<div class="wp_syntax"><div class="code"><pre class="rails" style="font-family:monospace;">rake db:migrate</pre></div></div>

<p>When running the db:migrate Rake task, a <i>schema_migrations</i> table is looked for to keep track of migration versions. If one isn&#8217;t found it will be created on the fly. After each migration is run a row in the <i>schema_migration</i> table is added. </p>
<p>You can also use the db:migrate Rake task to force the database to a specific version by supplying it with the <i>Version=</i> parameter.</p>

<div class="wp_syntax"><div class="code"><pre class="rails" style="font-family:monospace;">rake db:migrate VERSION=<span style="color:#006666;">20090113055719</span></pre></div></div>

<p>To revert the database to it&#8217;s original state supply <i>Version=</i> paramter with 0.</p>

<div class="wp_syntax"><div class="code"><pre class="rails" style="font-family:monospace;">rake db:migrate VERSION=<span style="color:#006666;">0</span></pre></div></div>

<p>If you run a migration whose version is higher than the version of the current database, the migration will be applied. Somewhat differently, if you run a migration whose version is lower than the version of the current database, Rails will look for the migration file whose number matches the database version and undo it. </p>
<p>I hope this tutorial has helped you to begin to understand ActiveRecord and how useful migrations can be. In the next article in this series we look at what makes up a migration in more detail.</p>
<img src="http://www.johndesu.com/?ak_action=api_record_view&id=77&type=feed" alt="" />]]></content:encoded>
			<wfw:commentRss>http://www.johndesu.com/2009/01/13/getting-started-with-rails-migrations-part-1-creating-migrations/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
