<?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>Blog.ubrious &#187; Web</title>
	<atom:link href="http://blog.ubrio.us/category/web/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.ubrio.us</link>
	<description>An Ordinary Web Developer's Blog</description>
	<lastBuildDate>Fri, 26 Mar 2010 21:00:38 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.1</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Blogubrious Retiring &#8212; Moving to Proccli</title>
		<link>http://blog.ubrio.us/web/blogubrious-retiring-moving-to-proccli/</link>
		<comments>http://blog.ubrio.us/web/blogubrious-retiring-moving-to-proccli/#comments</comments>
		<pubDate>Fri, 26 Mar 2010 20:38:51 +0000</pubDate>
		<dc:creator>Rob Hurring</dc:creator>
				<category><![CDATA[Web]]></category>

		<guid isPermaLink="false">http://blog.ubrio.us/?p=222</guid>
		<description><![CDATA[I&#8217;m migrating all new blog entries to a new name/site: Proccli: Code Sprouts. 
I&#8217;ll try to keep on top of comments and such coming in here, but it will eventually start to decay (hopefully gracefully).
-Rob
]]></description>
			<content:encoded><![CDATA[<p>I&#8217;m migrating all new blog entries to a new name/site: <a href='http://proccli.com' onclick="pageTracker._trackPageview('/outgoing/proccli.com?referer=');">Proccli: Code Sprouts</a>. </p>
<p>I&#8217;ll try to keep on top of comments and such coming in here, but it will eventually start to decay (hopefully gracefully).</p>
<p>-Rob</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.ubrio.us/web/blogubrious-retiring-moving-to-proccli/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Ruby DSL for Apple Remotes</title>
		<link>http://blog.ubrio.us/web/ruby-dsl-for-apple-remotes/</link>
		<comments>http://blog.ubrio.us/web/ruby-dsl-for-apple-remotes/#comments</comments>
		<pubDate>Fri, 17 Jul 2009 01:31:33 +0000</pubDate>
		<dc:creator>Rob Hurring</dc:creator>
				<category><![CDATA[Web]]></category>

		<guid isPermaLink="false">http://blog.ubrio.us/?p=208</guid>
		<description><![CDATA[I was curious about RubyCocoa and decided to play around a bit. I came across this article on rubycocoa.com about the apple remote and ruby. I got it working and boredom took over&#8230; so I decided to wrap it with a simple DSL. It seems pretty pointless, although switching OSX spaces with it was fun&#8230;
How [...]]]></description>
			<content:encoded><![CDATA[<p>I was curious about RubyCocoa and decided to play around a bit. I came across this article on rubycocoa.com <a href='http://www.rubycocoa.com/appleremote/1' onclick="pageTracker._trackPageview('/outgoing/www.rubycocoa.com/appleremote/1?referer=');">about the apple remote</a> and ruby. I got it working and boredom took over&#8230; so I decided to wrap it with a simple DSL. It seems pretty pointless, although <a href='http://github.com/robhurring/apple-remote/blob/9fc726c85d7fa90701e6a701266a67f801bdcdfc/spaces.rb' onclick="pageTracker._trackPageview('/outgoing/github.com/robhurring/apple-remote/blob/9fc726c85d7fa90701e6a701266a67f801bdcdfc/spaces.rb?referer=');">switching OSX spaces with it</a> was fun&#8230;</p>
<h3>How does it look?</h3>
<p>More examples are on the GitHub project page linked below, but here is a small overview.</p>
<pre class="brush: ruby;">
require 'lib/apple_remote'

play do
  puts &quot;I'm playing... (Playing? #{playing?})&quot;
end

pause do
  puts &quot;I'm paused... (Playing? #{playing?})&quot;
end

menu do
  if playing?
    puts &quot;Do something with the menu while we're in 'play' state&quot;
  else
    puts &quot;Do something with the menu while we're not in the 'play' state&quot;
  end
end
</pre>
<p>Tons of fun <img src='http://blog.ubrio.us/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<h4>Code</h4>
<p><a href='http://github.com/robhurring/apple-remote' onclick="pageTracker._trackPageview('/outgoing/github.com/robhurring/apple-remote?referer=');">Ruby Apple Remote DSL project on GitHub</a></p>
]]></content:encoded>
			<wfw:commentRss>http://blog.ubrio.us/web/ruby-dsl-for-apple-remotes/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Rails: Mocking YAML arrays as ActiveRecord objects</title>
		<link>http://blog.ubrio.us/code/rails-mocking-yaml-arrays-as-activerecord-objects/</link>
		<comments>http://blog.ubrio.us/code/rails-mocking-yaml-arrays-as-activerecord-objects/#comments</comments>
		<pubDate>Wed, 24 Sep 2008 14:31:12 +0000</pubDate>
		<dc:creator>Rob Hurring</dc:creator>
				<category><![CDATA[Code]]></category>
		<category><![CDATA[Rails]]></category>
		<category><![CDATA[Ruby]]></category>
		<category><![CDATA[Web]]></category>
		<category><![CDATA[rails]]></category>
		<category><![CDATA[ruby on rails]]></category>
		<category><![CDATA[yaml]]></category>

		<guid isPermaLink="false">http://blog.ubrio.us/?p=103</guid>
		<description><![CDATA[I&#8217;ve been finding myself using YAML a lot for silly enums &#8212; maybe because I&#8217;m lazy, but mostly because there is no need to manage them via a database table. Here is just a simple example &#8212; I need to associate a region and division to a client. These will not change much and are [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve been finding myself using YAML a lot for silly enums &#8212; maybe because I&#8217;m lazy, but mostly because there is no need to manage them via a database table. Here is just a simple example &#8212; I need to associate a region and division to a client. These will not change much and are simple enough to keep as a Yaml array until more logic can be brought to the table. Here is how that YAML file looks:</p>
<pre class="brush: ruby;">
# RAILS_ROOT/config/app.yml

regions:
  - 'northeast'
  - 'southeast'
  - 'west'
  - 'central'
  - 'emerging east'
  - 'emerging west'
  - 'opportunity east'
  - 'opportunity west'
  - 'opportunity national east'
  - 'opportunity national west'

divisions:
  &lt;%= (1..71).map{ |i| &quot;Region #{i}&quot; }.to_yaml %&gt;
</pre>
<p>Loading it up using an initializer:</p>
<pre class="brush: ruby;">
# RAILS_ROOT/config/initializers/load_app_config.rb

fdata =File.open(File.join(RAILS_ROOT, &quot;config&quot;, &quot;app.yml&quot;)).read
APP = YAML::load(ERB.new(fdata).result(binding)).symbolize_keys
</pre>
<p>Now we have our APP hash chock full o&#8217; YAML goodness. My only problem with this is that I might want to eventually put this data set into a table and it is a pain to hunt and search for where the application references APP[:regions] and so on sooo: time to objectize.</p>
<p>I decided that since they are stupid simple objects they can all have the same parent: YamlArrayObject:</p>
<pre class="brush: ruby;">
# RAILS_ROOT/app/models/yaml_array_object.rb
# or in lib

class YamlArrayObject
  attr_reader :name
  def id
    0
  end
  def initialize(name)
    @name = name
  end
  def to_s
    name
  end
  def display_name
    to_s.titleize
  end
  def &lt;=&gt;(b)
    name &lt;=&gt; b.name
  end
end
</pre>
<p>Simple enough. Now we just inherit and overload as appropriate.</p>
<pre class="brush: ruby;">
# RAILS_ROOT/app/models/region.rb
class Region &lt; YamlArrayObject
  def self.all
    APP[:regions].map{ |r| Region.new(r) }
  end
end

# RAILS_ROOT/app/models/division.rb
class Division &lt; YamlArrayObject
  def &lt;=&gt;(b)
    name.to_i &lt;=&gt; b.name.to_i
  end
  def self.all
    APP[:divisions].map{ |d| Division.new(d) }
  end
end
</pre>
<p>This is all Jim Dandy right now since we can populate select boxes using cleaner code (bonus: won&#8217;t break if you decide to add Divisions to a database table)</p>
<pre class="brush: ruby;">
# i like
&lt;%= f.select :division, Division.all.sort.map{ |d| [d.display_name, d] } -%&gt;
# better than
&lt;%= f.select :division, APP[:divisions].sort{|a,b| a.to_i &lt;=&gt; b.to_i}.map{ |d| [d.titleize, d] } -%&gt;
</pre>
<p>The only real issue is that calling <code>Client.first.region</code> still returns a string, which is bad since we want to keep our code as ambiguous as possible. The last step is to override the Client class&#8217; methods for region and division (and whatever else we want to use):</p>
<pre name='code' class='ruby'>
# RAILS_ROOT/app/models/client.rb

def division
  Division.new(@attributes['division']) unless @attributes['division'].blank?
end
def region
  Region.new(@attributes['region']) unless @attributes['region'].blank?
end
</pre>
<p>Now in our views (client/show) we can simply call <code>@client.region.display_name</code> or whatever and not have to change the code when we finally get around to DBing those object.</p>
<p>(There might be better ways to do this that I&#8217;m missing, but this seems pretty okay for my needs right now.)</p>
<div class='tip'>You might also be able to define the simple objects within YAML itself &#8212; but than can get cumbersome</div>
]]></content:encoded>
			<wfw:commentRss>http://blog.ubrio.us/code/rails-mocking-yaml-arrays-as-activerecord-objects/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>self clearing text input fields with javascript</title>
		<link>http://blog.ubrio.us/javascript/self-clearing-text-input-fields-with-javascript/</link>
		<comments>http://blog.ubrio.us/javascript/self-clearing-text-input-fields-with-javascript/#comments</comments>
		<pubDate>Wed, 23 Apr 2008 13:49:13 +0000</pubDate>
		<dc:creator>Rob Hurring</dc:creator>
				<category><![CDATA[Code]]></category>
		<category><![CDATA[Javascript]]></category>
		<category><![CDATA[Web]]></category>
		<category><![CDATA[prototype]]></category>

		<guid isPermaLink="false">http://blog.ubrio.us/web/self-clearing-text-input-fields-with-javascript/</guid>
		<description><![CDATA[I found that I use a lot of input fields which need to display a simple message to the user like &#8220;type the molecular structure of didehydro-dimethylether onium cation&#8221; &#8212; and when they focus the box it needs to clear, and when they blur the box it needs to go back to that message. Theres [...]]]></description>
			<content:encoded><![CDATA[<p>I found that I use a lot of input fields which need to display a simple message to the user like &#8220;type the molecular structure of didehydro-dimethylether onium cation&#8221; &#8212; and when they focus the box it needs to clear, and when they blur the box it needs to go back to that message. Theres the sloppy way of doing it in the text box itself with the attribute callbacks &#8220;onfocus/blur&#8221; but thats annoying.  I decided to make a simple extension to the HTMLInputElement instead like a good boy.</p>
<p>Here is the input extension to make a text field (actually, _any_ input, but you can add that logic yourself:) ) self clearing:</p>
<h3>Requires <a href='http://www.prototypejs.org/' target='_blank' onclick="pageTracker._trackPageview('/outgoing/www.prototypejs.org/?referer=');">Prototype Javascript Library</a>!  <br/><small>I used v1.6 but I&#8217;m sure others will work fine.</small></h3>
<pre class="brush: jscript;">
// input_extensions.js

// extends HTMLInputElement to include a self-clearing method
// @author Rob Hurring
// @date 2008-04-23
// UPDATED: 12/02/08 -- thanks to Shawn for pointing out the IE flaw

var SelfClearingInput = Class.create();
SelfClearingInput.prototype = {
	initialize:function(element)
	{
		this.element = $(element);
		this.original_value = this.element.value
		Event.observe(this.element, 'focus', this.focus.bind(this));
		Event.observe(this.element, 'blur', this.blur.bind(this));
	},
	focus:function(e)
	{
		if(this.element.value == this.original_value)
			this.element.value = '';
	},
	blur:function(e)
	{
		if(this.element.value == '')
			this.element.value = this.original_value;
	}
};
</pre>
<p>when you want to use it, something like this can work:</p>
<pre class="brush: jscript;">
// In your javascript file somewhere
document.observe(&quot;dom:loaded&quot;, function()
{
	new SelfClearingInput('ID_OF_INPUT_BOX');
});
</pre>
<div class='help'>For more info check out the project page at <a href="http://github.com/robhurring/self_clearing_field" onclick="pageTracker._trackPageview('/outgoing/github.com/robhurring/self_clearing_field?referer=');">JavaScript Self Clearing Input @ GitHub</a></div>
]]></content:encoded>
			<wfw:commentRss>http://blog.ubrio.us/javascript/self-clearing-text-input-fields-with-javascript/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Firebug and YSlow for Safari</title>
		<link>http://blog.ubrio.us/web/firebug-safari-yslow/</link>
		<comments>http://blog.ubrio.us/web/firebug-safari-yslow/#comments</comments>
		<pubDate>Wed, 28 Nov 2007 00:37:27 +0000</pubDate>
		<dc:creator>Rob Hurring</dc:creator>
				<category><![CDATA[Mac OS X]]></category>
		<category><![CDATA[Web]]></category>
		<category><![CDATA[firebug]]></category>
		<category><![CDATA[optimizing]]></category>
		<category><![CDATA[performance]]></category>
		<category><![CDATA[safari]]></category>
		<category><![CDATA[web inspector]]></category>
		<category><![CDATA[yslow]]></category>

		<guid isPermaLink="false">http://blog.ubrio.us/osx/firebug-safari-yslow/</guid>
		<description><![CDATA[I was reading up on another one of those &#8220;top X command line hacks for OS X&#8221; posts (more specifically Mac OS X Tips) and came across something I never really paid attention to. It was the &#8220;Inspect Element&#8221; menu item on the right-click menu in safari. If you don&#8217;t see this, thats probably because [...]]]></description>
			<content:encoded><![CDATA[<p>I was reading up on another one of those &#8220;top X command line hacks for OS X&#8221; posts (more specifically <a href="http://macosxtips.co.uk/index_files/tips-for-safari-3.html" onclick="pageTracker._trackPageview('/outgoing/macosxtips.co.uk/index_files/tips-for-safari-3.html?referer=');">Mac OS X Tips</a>) and came across something I never really paid attention to. It was the &#8220;Inspect Element&#8221; menu item on the right-click menu in safari. If you don&#8217;t see this, thats probably because you do not have the Debug menu enabled, you can do that with </p>
<p><code><span>$></span>defaults write com.apple.Safari IncludeDebugMenu 1</code> </p>
<p>(<small>swapping the 1 with a 0 to remove it</small>).</p>
<p>This WebInspector window is actually pretty useful and shares a lot of the functionality of <a href="http://www.getfirebug.com/" onclick="pageTracker._trackPageview('/outgoing/www.getfirebug.com/?referer=');">FireBug</a> and <a href="http://developer.yahoo.com/yslow/" onclick="pageTracker._trackPageview('/outgoing/developer.yahoo.com/yslow/?referer=');">YSlow</a> for FireFox. I&#8217;m specifically referring to Safari 3.0 from here on out, and all screen shots will also be of this version.</p>
<h3>Lets do a little comparison &#8212; what does WebInspector offer?</h3>
<p><small>Using this site as my guinea pig</small></p>
<h5>FireBug Similarities</h5>
<p>This contains all the normal stuff such as DOM, stylesheet, javascript and image browsing. The only real difference here is that you cannot edit your CSS live &#8212; which I never really use anyway.</p>
<div class='wp-caption alignright'>
<a href="http://file.ubrio.us/blog/wi-document.png" rel="gallery[fbs]" title="WebInspector::HTML Document" class='lightview' onclick="pageTracker._trackPageview('/outgoing/file.ubrio.us/blog/wi-document.png?referer=');"><img src="http://file.ubrio.us/blog/wi-document-thumb.png" /></a></p>
<p class='wp-caption-text'>Web Inspector</p>
</div>
<div class='wp-caption alignleft'>
<a href="http://file.ubrio.us/blog/wi-console.png" rel="gallery[fbs]" title="WebInspector::Error Console"  class='lightview' onclick="pageTracker._trackPageview('/outgoing/file.ubrio.us/blog/wi-console.png?referer=');"><img src="http://file.ubrio.us/blog/wi-console-thumb.png" /></a></p>
<p class='wp-caption-text'>Web Inspector</p>
</div>
<p><br clear='both' /></p>
<p>The other handy feature is the console. This will alert you of all the website&#8217;s quirks. I had to use Google as an example here because my site, naturally, has no errors that show up <img src='http://blog.ubrio.us/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<h5>YSlow Similarities</h5>
<div class='wp-caption alignright'>
<a href="http://file.ubrio.us/blog/wi-network.png" rel="gallery[fbs]" title="WebInspector::Load Times" class='lightview' onclick="pageTracker._trackPageview('/outgoing/file.ubrio.us/blog/wi-network.png?referer=');"><img src="http://file.ubrio.us/blog/wi-network-thumb.png" /></a></p>
<p class='wp-caption-text'>Web Inspector</p>
</div>
<p>I recently downloaded YSlow a week or so ago and I&#8217;ve been messing around with it to see how I can optimize my dev projects. While I&#8217;m not overly impressed with YSlow&#8217;s scoring &#8212; its damn near impossible to get that score above a D/C, and I think its geared more towards higher end websites than general websites &#8212; the WebInspector provides the same functionality&#8230;  with less cockiness (see what I mean after the article).</p>
<p>It will show the loading times, or loading sizes for each element on the page which can help you visualize where your bottlenecks are. It also provides helpful little notes on compressing your CSS and JS code.</p>
<h3>Script Debugging</h3>
<p>Ahhh. The meat and cheese of website debugging. Pesky JavaScript errors. Positioned under the Debug menu, the &#8220;Show JavaScript Console&#8221; option will soon become your best friend. I really have no clue why this is not included by default on Safari, it has to be one of the most useful features&#8230; then again, I&#8217;m a developer. <img src='http://blog.ubrio.us/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<h3>Final Notes</h3>
<div class='wp-caption alignleft'>
<a href="http://file.ubrio.us/blog/yslow-score.png" rel="gallery[fbs]" title="ySlow Score"  class='lightview' onclick="pageTracker._trackPageview('/outgoing/file.ubrio.us/blog/yslow-score.png?referer=');"><img src="http://file.ubrio.us/blog/yslow-score-thumb.png" /></a></p>
<p class='wp-caption-text'>YSlow Score</p>
</div>
<p>Naturally Safari and FireFox will remain very different browsers and each will retain their strengths / weaknesses. Maybe I&#8217;m crazy, but I prefer to develop with Safari as my browser. I&#8217;m not really sure how this happened, but, meh, it works.</p>
<p>I&#8217;m not suggesting Safari is better, or even comparing it to FireFox for that matter &#8212; I just really think WebInspector offers a lot <del>more than I realized in the past</del> and is fairly unknown.</p>
<p>Since I&#8217;m doing general websites and not global, massive-traffic commercial sites things like CDN (<a href="http://developer.yahoo.com/performance/rules.html#cdn" onclick="pageTracker._trackPageview('/outgoing/developer.yahoo.com/performance/rules.html_cdn?referer=');">Content Delivery Network</a>) aren&#8217;t relative to me.  Also, <a href="http://developer.yahoo.com/performance/rules.html#etags" onclick="pageTracker._trackPageview('/outgoing/developer.yahoo.com/performance/rules.html_etags?referer=');">ETags</a> are a bit of a pain in the ass to implement for small sites. These 2 F&#8217;s can severely drag down your score which, while meaningless, is a bit of a bummer. (I know the Expires Headers can be important, but this shot was taken from a site on my development server, and not production so thats not implemented.)</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.ubrio.us/web/firebug-safari-yslow/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Ubrious Launched</title>
		<link>http://blog.ubrio.us/web/ubrious-launched/</link>
		<comments>http://blog.ubrio.us/web/ubrious-launched/#comments</comments>
		<pubDate>Mon, 08 Oct 2007 14:13:01 +0000</pubDate>
		<dc:creator>Rob Hurring</dc:creator>
				<category><![CDATA[Web]]></category>

		<guid isPermaLink="false">http://blog.ubrio.us/web/ubrious-launched/</guid>
		<description><![CDATA[I launched the project site Ubrious over the weekend, in addition to a photo gallery and a few other branches of ubrio.us. If any images / links are broken then, whoops, I&#8217;m still running through trying to clean everything up but my time is at a minimum. (The important stuff should be running&#8230;)
]]></description>
			<content:encoded><![CDATA[<p>I launched the project site <a href="http://ubrio.us" onclick="pageTracker._trackPageview('/outgoing/ubrio.us?referer=');">Ubrious</a> over the weekend, in addition to a photo gallery and a few other branches of ubrio.us. If any images / links are broken then, whoops, I&#8217;m still running through trying to clean everything up but my time is at a minimum. (The important stuff should be running&#8230;)</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.ubrio.us/web/ubrious-launched/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>How To Subdomain Localhost &#8212; Ubuntu / OSX</title>
		<link>http://blog.ubrio.us/web/how-to-subdomain-localhost-ubuntu-osx/</link>
		<comments>http://blog.ubrio.us/web/how-to-subdomain-localhost-ubuntu-osx/#comments</comments>
		<pubDate>Fri, 13 Jul 2007 23:48:48 +0000</pubDate>
		<dc:creator>Rob Hurring</dc:creator>
				<category><![CDATA[Apache]]></category>
		<category><![CDATA[Gnome]]></category>
		<category><![CDATA[Mac OS X]]></category>
		<category><![CDATA[Nix]]></category>
		<category><![CDATA[Ubuntu]]></category>
		<category><![CDATA[Web]]></category>

		<guid isPermaLink="false">http://blog.ubrio.us/gnome/how-to-subdomain-localhost-ubuntu-osx/</guid>
		<description><![CDATA[Using Gnome + Ubuntu (7.04 Feisty Fawn) + Apache 2
Step 1:
In gnome goto System -> Administration -> Network and click on the &#8216;Hosts&#8217; tab
Step 2:
For your normal localhost (127.0.0.1) double-click or hit &#8216;properties&#8217; to edit it. Add your list of subdomains under localhost.
*Ignore the text in this pic, I overlooked that you had to include [...]]]></description>
			<content:encoded><![CDATA[<h3>Using <a href="http://www.gnome.org/" target="_blank" onclick="pageTracker._trackPageview('/outgoing/www.gnome.org/?referer=');">Gnome</a> + <a href="http://www.ubuntu.com/" target="_blank" onclick="pageTracker._trackPageview('/outgoing/www.ubuntu.com/?referer=');">Ubuntu (7.04 Feisty Fawn)</a> + Apache 2</h3>
<p><strong>Step 1:</strong><br />
In gnome goto System -> Administration -> Network and click on the &#8216;Hosts&#8217; tab</p>
<p><strong>Step 2:</strong><br />
For your normal localhost (127.0.0.1) double-click or hit &#8216;properties&#8217; to edit it. Add your list of subdomains under localhost.</p>
<p><em>*<strong>Ignore the text in this pic, I overlooked that you had to include _all_ aliases in the same box. Whoops</strong></em><br />
<img src="http://pic.ubrio.us/blog_images/subdomain/host-alias-settings.png" /></p>
<p><strong>Step 3:</strong><br />
<small>The fun step</small><br />
Open a terminal and type <code>sudo gedit /etc/apache2/sites-available/default</code> &#8212; assuming you&#8217;re using the &#8220;default&#8221; httpd.conf. Chances are that you will be, and if you aren&#8217;t you should know what file I&#8217;m talking about anyway. (If you don&#8217;t, just load one of the enabled apache configuration files)</p>
<p>Change these lines:</p>
<pre>
NameVirtualHost *
&lt;VirtualHost *>
</pre>
<p><em>to</em></p>
<pre>
NameVirtualHost 127.0.0.1
&lt;VirtualHost 127.0.0.1>
</pre>
<p><strong>Step 4:</strong><br />
Add the following (for each subdomain you made) &#8212; changing the ServerName to whatever you aliased in the network host dialogue and DocumentRoot to wherever you want the subdomain to point.</p>
<pre>
&lt;VirtualHost 127.0.0.1>
	ServerName mysql.localhost
	DocumentRoot /var/www/phpmyadmin
&lt;/VirtualHost>
</pre>
<p><strong>Step 5:</strong><br />
In a terminal type: <code>sudo apache2ctl restart</code><br />
When that finishes, browse to http://mysql.localhost and you should see phpMyAdmin (going by my example)</p>
<h3>On OSX + Apache 1.33</h3>
<p><strong>Step 1:</strong><br />
Open /Applications/Utilities/NetInfo Manager and click on &#8220;machines&#8221;<br />
I usually just duplicate the localhost settings, or just create a new record below localhost that is something like:</p>
<p>ip_address: 127.0.0.1<br />
name: mysql.localhost<br />
serves: ./local</p>
<p><em>Click for bigger version</em><br />
<a href="http://pic.ubrio.us/blog_images/subdomain/osx-host-dialog.png" rel="gallery[a]" title="This is how my hosts dialog looks on OSX"  class='lightview' onclick="pageTracker._trackPageview('/outgoing/pic.ubrio.us/blog_images/subdomain/osx-host-dialog.png?referer=');"><img src="http://pic.ubrio.us/blog_images/subdomain/osx-host-dialog-sm.png" /></a></p>
<p><strong>Step 2:</strong><br />
Repeat Steps 3-5 above only editing &#8220;/etc/httpd/users/{yourname}.conf&#8221; instead.</p>
<p><em>Click for bigger version</em><br />
<a href="http://pic.ubrio.us/blog_images/subdomain/config-changes.png" rel="gallery[a]" class='lightview' title="This is how my httpd.conf file looks on OSX" onclick="pageTracker._trackPageview('/outgoing/pic.ubrio.us/blog_images/subdomain/config-changes.png?referer=');"><img src="http://pic.ubrio.us/blog_images/subdomain/config-changes-sm.png" /></a></p>
<p>Restart Apache and hopefully all went well. I found this useful because I hate typing unnecessary paths <img src='http://blog.ubrio.us/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
]]></content:encoded>
			<wfw:commentRss>http://blog.ubrio.us/web/how-to-subdomain-localhost-ubuntu-osx/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>Adding Custom Search Engines to Colibri</title>
		<link>http://blog.ubrio.us/code/adding-custom-search-engines-to-colibri/</link>
		<comments>http://blog.ubrio.us/code/adding-custom-search-engines-to-colibri/#comments</comments>
		<pubDate>Tue, 30 Jan 2007 15:29:51 +0000</pubDate>
		<dc:creator>Rob Hurring</dc:creator>
				<category><![CDATA[Code]]></category>
		<category><![CDATA[Web]]></category>

		<guid isPermaLink="false">http://blog.ubrio.us/web/adding-custom-search-engines-to-colibri/</guid>
		<description><![CDATA[What is Colibri? It&#8217;s the closes thing to Quicksilver you can get for the PC, and it makes life easy when you hate using the mouse. (If you read my quicksilver post you&#8217;d realize that id do everything via keyboard if I could&#8230;)
My few gripes with Colibri is the fact that it had no way [...]]]></description>
			<content:encoded><![CDATA[<p>What is <a href="http://colibri.leetspeak.org/" onclick="pageTracker._trackPageview('/outgoing/colibri.leetspeak.org/?referer=');">Colibri</a>? It&#8217;s the closes thing to <a href="http://quicksilver.blacktree.com/" onclick="pageTracker._trackPageview('/outgoing/quicksilver.blacktree.com/?referer=');">Quicksilver</a> you can get for the PC, and it makes life easy when you hate using the mouse. (If you read my quicksilver post you&#8217;d realize that id do everything via keyboard if I could&#8230;)</p>
<p>My few gripes with Colibri is the fact that it had no way to hardcode in specific search engines. Well, a few trips to their forums gave me the hint to grab <a href="http://sqlitebrowser.sourceforge.net/" onclick="pageTracker._trackPageview('/outgoing/sqlitebrowser.sourceforge.net/?referer=');">SQLite Database Browser</a> and start messing around with their database files. Simple enough..</p>
<p>The general breakdown is like this (using <a href="http://digg.com" onclick="pageTracker._trackPageview('/outgoing/digg.com?referer=');">Digg</a> as my main example because I&#8217;m horribly addicted, this should be obvious&#8230;):</p>
<p><strong>Adding Custom Search Engines:</strong></p>
<p>1) get SQLite Database Browser from sourceforge<br />
2) open Documents and Settings\user\Application Data\Colibri\Search Engines.sqlite<br />
3) hit the Execute SQL tab<br />
4) paste these guys in there</p>
<p><code><br />
INSERT INTO search_engines VALUES ('Delicious', 'Delicious', 'Delicious News', 'Generic', 'http://del.icio.us', 'http://del.icio.us/search/?fr=del_icio_us&#038;p=%s&#038;type=all');<br />
</code><br />
<code><br />
INSERT INTO search_engines VALUES ('Digg', 'Digg', 'Digg News', 'Generic', 'http://digg.com',<br />
'http://digg.com/search?s=%s');<br />
</code></p>
<p>5) hit Execute Query<br />
6) hopefully the forum didn&#8217;t miss something and you have them inserted.<br />
6a) if it did mess up, try <code>INSERT INTO search_engines VALUES('TMP', '', '', '', '','');</code> then manually edit in the values<br />
7) restart colibri</p>
<p><strong>Notes:</strong></p>
<p>If you searched (for example) Digg.com before to open a URL you need to do one more step </p>
<p>before colibri registers it as a search engine and not an item_history URL.</p>
<p>1) open Documents and Settings\user\Application Data\Colibri\Database.sqlite<br />
2) browse all references to (ex) Digg.com in your item_history table<br />
3) delete all rows containing (ex) Digg.com<br />
4) restart colibri</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.ubrio.us/code/adding-custom-search-engines-to-colibri/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Wordpress Plugin for Relative Digg Content</title>
		<link>http://blog.ubrio.us/php/wordpress-plugin-for-relative-digg-content/</link>
		<comments>http://blog.ubrio.us/php/wordpress-plugin-for-relative-digg-content/#comments</comments>
		<pubDate>Thu, 09 Nov 2006 16:49:37 +0000</pubDate>
		<dc:creator>Rob Hurring</dc:creator>
				<category><![CDATA[Code]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[Web]]></category>
		<category><![CDATA[Wordpress Plugins]]></category>

		<guid isPermaLink="false">http://blog.ubrio.us/web/wordpress-plugin-for-relative-digg-content/</guid>
		<description><![CDATA[MOVED: http://ubrio.us/plugins

Relative Digg Wordpress Plugin &#8211; Add related digg story links to the bottom of your post based on keywords
Note (5/13/07):
I just looked over this code and I made a lot of mistakes. Just use it as an example/reference or clean it up. I hacked it together pretty quick when I was bored at work, [...]]]></description>
			<content:encoded><![CDATA[<h3>MOVED: <a href="http://ubrio.us/plugins" onclick="pageTracker._trackPageview('/outgoing/ubrio.us/plugins?referer=');">http://ubrio.us/plugins</a></h3>
<p><br/></p>
<p><strong><a href="http://blog.ubrio.us/wp-content/uploads/2006/11/relative_digg-php.zip">Relative Digg Wordpress Plugin</a> &#8211; Add related digg story links to the bottom of your post based on keywords</a></strong></p>
<p><strong>Note (5/13/07):</strong><br />
I just looked over this code and I made a lot of mistakes. Just use it as an example/reference or clean it up. I hacked it together pretty quick when I was bored at work, so use your judgement.</p>
<p>Well, as you can tell by the post dates on the past few articles, I&#8217;m being lazy. This all changed the other day when I was messing around in a project with PHP and XML. Normally I think XML/PHP is the devil, but I remembered the SimpleXML classes in PHP5. This pretty much inspired me to write a little plugin for wordpress &#8211; well, that and my love for digg &#8211; that will add relative digg stories to the bottom of each post depending on the keywords you provide.</p>
<p>Its still in Beta mode, but if you guys are savvy enough to get it working I would greatly appreciate some feedback. </p>
<p><strong>What you need in order to run this, as of right now</strong></p>
<ol>
<li>PHP5 (should come with SimpleXML natively, but if not, you need this)</li>
<li>FOPEN (some servers don&#8217;t support this)</li>
</ol>
<p>I will probably re-write this to use cURL in the future to get around the FOPEN problem, and maybe even to get around SimpleXML.  Either way, this is just up here to test the waters on the idea and get some general feedback.</p>
<p>(Ps: If your server doesn&#8217;t run PHP5 or allow FOPEN, be a man and get in that shell and roll your own <img src='http://blog.ubrio.us/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p><strong>How To Install (almost the exact same procedure as my <a href="http://blog.ubrio.us/php/youtube-wordpress-plugin-with-technorati-tags/">YouTube PlugIn</a>)</strong></p>
<ol>
<li>Upload &#8220;relative_digg.php&#8221; to your /wp-content/plugins/ folder</li>
<li>In admin panel, go to: Plugins -> Relative Digg Stories -> Activate</li>
<li>Switch over to Presentation -> Theme Editor -> (edit) Single Post</li>
<li>Somewhere in there add <code>&lt;?php relative_digg(); ?&gt;</code>
<ul>
<li>Note: you can hardcode the tag using <code>relative_digg('tagname');</code></li>
<li>Note: param setup: <code>relative_digg('tagname', number_of_results, story_age, 'title');</code></li>
</ul>
</li>
<li>In your new post, somewhere near the bottom add: <code>&lt;!--digg:TAG--&gt;</code></li>
</ol>
<p>Let me know whatsup &#8211; hopefully some of you find this useful. Its terribly slow also, so I will have to check into that. Feedback is appreciated, yadda, yadda, etc.</p>
<p>Thanks</p>
<p>-rob</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.ubrio.us/php/wordpress-plugin-for-relative-digg-content/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>YouTube Wordpress Plugin With Technorati Tags</title>
		<link>http://blog.ubrio.us/php/youtube-wordpress-plugin-with-technorati-tags/</link>
		<comments>http://blog.ubrio.us/php/youtube-wordpress-plugin-with-technorati-tags/#comments</comments>
		<pubDate>Thu, 21 Sep 2006 18:44:55 +0000</pubDate>
		<dc:creator>Rob Hurring</dc:creator>
				<category><![CDATA[Code]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[Web]]></category>
		<category><![CDATA[Wordpress Plugins]]></category>

		<guid isPermaLink="false">http://blog.ubrio.us/web/youtube-wordpress-plugin-with-technorati-tags/</guid>
		<description><![CDATA[I&#8217;m no longer supporting this, and I&#8217;m unsure if the old YouTube API is still in place.


Download
Usage
Features
Change Log


Hey all, I was asked to write a simple plugin that will make use of the YouTube API to generate videos based on specific post tags.

Downloads

YouTube Wordpress Plugin
svn export http://public.svnme.com/youtubevideos .


Usage

open the .PHP file in a text editor, [...]]]></description>
			<content:encoded><![CDATA[<div class='error'>I&#8217;m no longer supporting this, and I&#8217;m unsure if the old YouTube API is still in place.</div>
<div id='sections' class='clearfix'>
<ul>
<li><a href='#download'>Download</a></li>
<li><a href='#usage'>Usage</a></li>
<li><a href='#features'>Features</a></li>
<li><a href='#changelog'>Change Log</a></li>
</ul>
</div>
<p>Hey all, I was asked to write a simple plugin that will make use of the YouTube API to generate videos based on specific post tags.</p>
<p><a name='download'></a></p>
<h3>Downloads</h3>
<ol>
<li><a href="http://public.svnme.com/youtubevideos/youtube-videos.php.zip" onclick="pageTracker._trackPageview('/outgoing/public.svnme.com/youtubevideos/youtube-videos.php.zip?referer=');">YouTube Wordpress Plugin</a></li>
<li><tt>svn export http://public.svnme.com/youtubevideos .</tt></li>
</ol>
<p><a name='usage'></a></p>
<h3>Usage</h3>
<ol>
<li>open the .PHP file in a text editor, on the line <code>$dev_id = "???"</code> insert your developer ID</li>
<li>upload the PHP file to wp-content/plugins/</li>
<li>activate the plugin from the Dashboard, Plugins menu</li>
<li>go to Presentation, Template Editor, Single Post and/or Main Index. Insert this<br />
code where you want the video to appear:<br />
<code>&lt;? youtubevideos(); ?&gt;</code></li>
<li>when you post, use the code: <code>&lt;!--youtube:YourTagHere--></code> to tell the plugin what video topic you want to show. For example, if you want a video on horses, put <code>&lt;!--youtube:horses--></code> at the end of your post. </li>
<li>that&#8217;s it. To change the number of videos shown or to tweak the filter settings, you have to modify that within the plugin PHP file itself.</li>
<li>Let me know of any bugs you find, or any tweaks you have made (this is a community after all <img src='http://blog.ubrio.us/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> )</li>
</ol>
<p><a name='features'></a></p>
<h3>Features</h3>
<ol>
<li>Set how many videos to show, could be 1, could be 1,000</li>
<li>Setup filters to block videos that contain bad keywords and keep your blog respectable</li>
<li>Change the output template to display the videos any way you want to better incorporate it with your blog</li>
<li>Manually add your own taggings to show videos you want.</li>
</ol>
<p><a name='changelog'></a></p>
<h3>Change Log</h3>
<ul>
<li><em>May 13</em> I just looked through this code and it is pretty sloppy, sorry. Use this as an example or starting point for your own plugin &#8212; or, if it still works, use it. Just a heads up (don&#8217;t judge me by that code <img src='http://blog.ubrio.us/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' /> )
<li><em>Oct 4</em> the new version needs to be tested &#8211; ill try to get to that today</li>
<li><em>Oct 4</em> Thanks to Mr. Nuck Chorris, the SimpleTags is now phased out, I have updated the file.</li>
<li><em>Oct 3</em> I removed the YouTube Developer ID, please use your own <img src='http://blog.ubrio.us/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </li>
<li><em>Oct 3</em> I am going to work on this again now that I am back. If you found bugs or have ideas for it, please send me an email and I will try to include them. </li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://blog.ubrio.us/php/youtube-wordpress-plugin-with-technorati-tags/feed/</wfw:commentRss>
		<slash:comments>86</slash:comments>
		</item>
	</channel>
</rss>
