<?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>Life on Ubuntu</title>
	<atom:link href="http://lifeonubuntu.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://lifeonubuntu.com</link>
	<description>Ubuntu tips, tricks and solutions</description>
	<lastBuildDate>Mon, 02 Apr 2012 19:05:36 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.2.1</generator>
		<item>
		<title>How to automagically get friendly URLs in Rails 3</title>
		<link>http://lifeonubuntu.com/how-to-automagically-get-friendly-urls-in-rails-3/</link>
		<comments>http://lifeonubuntu.com/how-to-automagically-get-friendly-urls-in-rails-3/#comments</comments>
		<pubDate>Mon, 02 Apr 2012 18:48:23 +0000</pubDate>
		<dc:creator>Editor</dc:creator>
				<category><![CDATA[Ruby on Rails Tips]]></category>

		<guid isPermaLink="false">http://lifeonubuntu.com/?p=212</guid>
		<description><![CDATA[By default, Rails uses ID&#8217;s in URLs. For example, let&#8217;s say we have a list of categories stored in the categories table of the database. The &#8220;Super Cool&#8221; category is stored with categories#id = 5. To view that category our URL will look like: http://yourAwesomeDomain.com/category/5 That works great, but it&#8217;s not very user friendly. It&#8217;s [...]


No related posts.]]></description>
			<content:encoded><![CDATA[<p></p><p>By default, Rails uses ID&#8217;s in URLs.  For example, let&#8217;s say we have a list of categories stored in the categories table of the database.  The &#8220;Super Cool&#8221; category is stored with categories#id = 5.  To view that category our URL will look like:</p>
<p>http://yourAwesomeDomain.com/category/5</p>
<p>That works great, but it&#8217;s not very user friendly.  It&#8217;s also not very good for SEO purposes.  A better URL would use a human-readable and search-engine-decipherable slug instead of an ID.  For example:</p>
<p>http://yourAwesomeDomain.com/category/super-cool</p>
<p>How do we get that?  Easy!</p>
<p>First, add a column named &#8220;slug&#8221; to the categories table:</p>
<pre class="brush: plain; title: ; notranslate">
# \db\migrate\20120402020611_create_categories.rb

class CreateCategories &lt; ActiveRecord::Migration
  def change
    create_table :categories do |t|
      t.string :name
      t.string :slug
      t.timestamps
    end
  end
end
</pre>
<p>Next, add these lines to your category model:</p>
<pre class="brush: plain; title: ; notranslate">
# \app\models\category.rb

class Category &lt; ActiveRecord::Base
  before_create :generate_slug
  attr_protected :slug

  def generate_slug
    self.slug = name.parameterize
  end

  def to_param
    slug
  end

end
</pre>
<p>Bam!  You are done.  Your rails helpers and other logic will now automagically use slugs instead ID&#8217;s.  For example:</p>
<pre class="brush: plain; title: ; notranslate">
@my_new_cat =  Category.create(:name =&gt; 'Super Cool')
=&gt;  #&lt;Category id: 3, name: &quot;Super Cool&quot;, slug: &quot;super-cool&quot;, created_at: &quot;2012-04-02 18:43:08&quot;, updated_at: &quot;2012-04-02 18:43:08&quot;&gt;

category_path(@my_new_cat)
=&gt; /category/super-cool

link_to(@my_new_cat.name, @my_new_cat)
=&gt; &lt;a href=&quot;/category/super-cool&quot;&gt;Super Cool&lt;/a&gt;
</pre>
<p>And in your controller, you can find the category by searching with the slug:</p>
<pre class="brush: plain; title: ; notranslate">
# \app\controllers\category_controller.rb

class CategoryController &lt; ApplicationController
  def show
    @category = Category.find_by_slug(params[:id])
  end
end
</pre>
<p>Pretty cool, huh?</p>


<p>No related posts.</p>]]></content:encoded>
			<wfw:commentRss>http://lifeonubuntu.com/how-to-automagically-get-friendly-urls-in-rails-3/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Why Your Controller Methods Should be Private</title>
		<link>http://lifeonubuntu.com/why-your-controller-methods-should-be-private/</link>
		<comments>http://lifeonubuntu.com/why-your-controller-methods-should-be-private/#comments</comments>
		<pubDate>Fri, 16 Dec 2011 14:55:59 +0000</pubDate>
		<dc:creator>Editor</dc:creator>
				<category><![CDATA[Ruby on Rails Tips]]></category>

		<guid isPermaLink="false">http://lifeonubuntu.com/?p=210</guid>
		<description><![CDATA[Most of your controller methods are public actions that display pages on your website. Your app&#8217;s routes will point to these methods and show the corresponding page (view). For example: But hopefully you are keeping things modular and breaking up complexity into smaller methods. For example, you might want to perform some check before you [...]


Related posts:<ol><li><a href='http://lifeonubuntu.com/use-rubys-autoload-instead-of-require-for-your-ruby-and-rails-apps/' rel='bookmark' title='Use Ruby&#8217;s &#8216;autoload&#8217; instead of &#8216;require&#8217; for your Ruby and Rails Apps'>Use Ruby&#8217;s &#8216;autoload&#8217; instead of &#8216;require&#8217; for your Ruby and Rails Apps</a></li>
</ol>]]></description>
			<content:encoded><![CDATA[<p></p><p>Most of your controller methods are public actions that display pages on your website.  Your app&#8217;s routes will point to these methods and show the corresponding page (view).  For example:</p>
<pre class="brush: plain; title: ; notranslate">
class PostsController &lt; ApplicationController
  def new
    @post = Post.new
  end

  def show
    @post = Post.find(params[:id])
  end

end
</pre>
<p>But hopefully you are keeping things modular and breaking up complexity into smaller methods.  For example, you might want to perform some check before you allow the user to add a new post:</p>
<pre class="brush: plain; title: ; notranslate">
class PostsController &lt; ApplicationController
  def new
    check_something
    @post = Post.new
  end

  def show
    @post = Post.find(params[:id])
  end

  def check_something
    redirect_to(root_path) and return if something
  end
end
</pre>
<p>This is great.  BUT, you should be sure to make the check_something method private and make it accessible by defining it as a helper method:</p>
<pre class="brush: plain; title: ; notranslate">
class PostsController &lt; ApplicationController
  helper_method :check_something

  def new
    check_something
    @post = Post.new
  end

  def show
    @post = Post.find(params[:id])
  end

private

  def check_something
    redirect_to(root_path) and return if something
  end
end
</pre>
<h2>Why Make the Helper Methods Private?</h2>
<p>So, why is it important to make methods like this private?  Because you don&#8217;t want them to be accessible to your users.  They can&#8217;t hit that method unless you have defined a route that points to it as an action. While unlikely, it&#8217;s possible that you might have such a route defined.  Or, if you have some type of catch-all route defined, then this check_something method could actually be accessed by a user.</p>
<p>In most cases, this will be unlikely to happen.  And if it does happen, it&#8217;s likely that little harm could be done.  However, making these non-action methods privates also makes your code a bit more clear by declaring that these methods are NOT accessible via any routes.  So, simply put, you should make the non-action methods private because it&#8217;s a best practice.</p>


<p>Related posts:<ol><li><a href='http://lifeonubuntu.com/use-rubys-autoload-instead-of-require-for-your-ruby-and-rails-apps/' rel='bookmark' title='Use Ruby&#8217;s &#8216;autoload&#8217; instead of &#8216;require&#8217; for your Ruby and Rails Apps'>Use Ruby&#8217;s &#8216;autoload&#8217; instead of &#8216;require&#8217; for your Ruby and Rails Apps</a></li>
</ol></p>]]></content:encoded>
			<wfw:commentRss>http://lifeonubuntu.com/why-your-controller-methods-should-be-private/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Use Ruby&#8217;s &#8216;autoload&#8217; instead of &#8216;require&#8217; for your Ruby and Rails Apps</title>
		<link>http://lifeonubuntu.com/use-rubys-autoload-instead-of-require-for-your-ruby-and-rails-apps/</link>
		<comments>http://lifeonubuntu.com/use-rubys-autoload-instead-of-require-for-your-ruby-and-rails-apps/#comments</comments>
		<pubDate>Wed, 07 Dec 2011 16:25:12 +0000</pubDate>
		<dc:creator>Editor</dc:creator>
				<category><![CDATA[Ruby on Rails Tips]]></category>

		<guid isPermaLink="false">http://lifeonubuntu.com/?p=202</guid>
		<description><![CDATA[When googling to find the answer to a ruby (or rails) coding problem, it struck me that code snippets always use &#8220;require&#8221; to include any necessary libraries. For example, I recently searched for a way to compare IP addresses using CIDR notation. (I had IP ranges stored in CIDR notation and wanted to see if [...]


No related posts.]]></description>
			<content:encoded><![CDATA[<p></p><p>When googling to find the answer to a ruby (or rails) coding problem, it struck me that code snippets always use &#8220;require&#8221; to include any necessary libraries.  For example, I recently searched for a way to compare IP addresses using CIDR notation. (I had IP ranges stored in CIDR notation and wanted to see if the user&#8217;s IP was in the range.) </p>
<p>After hunting around, I came up with this solution:</p>
<pre class="brush: plain; title: ; notranslate">

require 'ipaddr'

admin_ip = IPAddr.new('192.168.1.0/24')
client_ip = IPAddr.new('192.168.1.2')
admin_ip.include?client_ip =&gt; true

# Do it in one line:
IPAddr.new('192.168.2.0/24').include?IPAddr.new('192.168.2.100') =&gt; true
</pre>
<p>Using require in this code snippet is clear and it makes lots of sense to show it this way.  You can see immediately that the code is dependent on the ruby IPAddr library.  But in real code, you should never use require to include libraries or other files.</p>
<h2>Best Practice: Use Autoload Instead of Require</h2>
<p>Instead of using require, you should use autoload.  And furthermore, you should never put the autoload statement in middle of your code, as might implied by typical snippets.  Includes should always happen at the top of any file.  For example, looking at a ruby file some_class.rb:</p>
<pre class="brush: plain; title: ; notranslate">

autoload :IPAddr, 'ipaddr'

class SomeClass

    # returns true if ip_check is contained in ip_master range (CIDR notation)
    def check_ip(ip_master,ip_check)
        IPAddr.new(ip_master).include?IPAddr.new(ip_check)
    end
end
</pre>
<h2>Why use Autoload instead of Require?</h2>
<p>So, why use autoload instead of require?  Because require loads the file immediately when ruby processes the require line.  Autoload, on the other hand, doesn&#8217;t load the file until you try to access the symbol defined in the autoload statement.  If you don&#8217;t accesses it, it doesn&#8217;t get loaded and you eliminate any unnecessary overhead processing.</p>
<p>But autoload uses require under the hood.  So just like require, autoloaded files are only included once.  By comparison, using &#8216;include&#8217; would load and include the file every time.</p>
<h2>Why Put Autoload at the top of the file?</h2>
<p>This is just a best practice.  You don&#8217;t want to hide dependencies buried deep within a method.  When I open a file, I want to see the dependencies right away.  This makes code maintenance and debugging much less error prone &#8211; especially if you are working on a project with multiple engineers or returning code you wrote last year.</p>


<p>No related posts.</p>]]></content:encoded>
			<wfw:commentRss>http://lifeonubuntu.com/use-rubys-autoload-instead-of-require-for-your-ruby-and-rails-apps/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>How to test IE9, IE8 and IE7 from the same computer</title>
		<link>http://lifeonubuntu.com/how-to-test-ie9-ie8-and-ie7-from-the-same-computer/</link>
		<comments>http://lifeonubuntu.com/how-to-test-ie9-ie8-and-ie7-from-the-same-computer/#comments</comments>
		<pubDate>Tue, 25 Oct 2011 03:18:34 +0000</pubDate>
		<dc:creator>Editor</dc:creator>
				<category><![CDATA[windows]]></category>

		<guid isPermaLink="false">http://lifeonubuntu.com/?p=189</guid>
		<description><![CDATA[I&#8217;m a software developer and I often need to make sure that a web page or site will display correctly in multiple versions of Internet Explorer. Specifically, I need to test a site in Internet Explorer 7 (IE7), Internet Explorer 8 (IE8) and Internet Explorer 9 (IE9). When I installed IE9, I of course lost [...]


No related posts.]]></description>
			<content:encoded><![CDATA[<p></p><p>I&#8217;m a software developer and I often need to make sure that a web page or site will display correctly in multiple versions of Internet Explorer.  Specifically, I need to test a site in Internet Explorer 7 (IE7), Internet Explorer 8 (IE8) and Internet Explorer 9 (IE9).</p>
<p>When I installed IE9, I of course lost IE8.  A quick Google search told that I could not have both IE8 and IE9 on the same machine.  And many sites tried to push towards tools like IE Tester (<a href="http://www.my-debugbar.com/wiki/IETester/HomePage"target="_blank">http://www.my-debugbar.com/wiki/IETester/HomePage</a>) or Browser Sandbox (<a href="http://www.spoon.net/browsers/" target="_blank">http://www.spoon.net/browsers/</a>).  <strong><em>BUT,</em></strong> you don&#8217;t need to go there.</p>
<p>I&#8217;m no Microsoft fan, but apparently they realized that it&#8217;s insanely annoying and frustrating to support the various poorly-written versions of their browser, so <strong>Microsoft Internet Explorer 9 has a built in developer tool to view a site as an IE7 or IE8 browser!</strong>  This is actually pretty cool.</p>
<p>To check out how a page displays on different versions of Internet Explorer, just press F12 and then select the browser mode that you want to use to view the page.  Problem solved!  And no need to install funky toolbars and plugins, and no need to jump through any hoops <img src='http://lifeonubuntu.com/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' /> </p>
<div id="attachment_190" class="wp-caption aligncenter" style="width: 600px">
	<a href="http://lifeonubuntu.com/files/2011/10/View_IE8_or_IE7_from_IE9_screenshot.gif"><img src="http://lifeonubuntu.com/files/2011/10/View_IE8_or_IE7_from_IE9_screenshot.gif" alt="Screenshot of how to view IE8 or IE7 from Internet Explorer 9" title="View_IE8_or_IE7_from_IE9_screenshot" width="600" height="417" class="size-full wp-image-190" /></a>
	<p class="wp-caption-text">If you have installed IE9 and you want to view a page as it would display in IE7 or IE8, just press F12 and then choose your browser mode.</p>
</div>


<p>No related posts.</p>]]></content:encoded>
			<wfw:commentRss>http://lifeonubuntu.com/how-to-test-ie9-ie8-and-ie7-from-the-same-computer/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Windows 7 Can&#8217;t Connect to Default Administrative Share C$</title>
		<link>http://lifeonubuntu.com/windows-7-cant-connect-to-default-administrative-share/</link>
		<comments>http://lifeonubuntu.com/windows-7-cant-connect-to-default-administrative-share/#comments</comments>
		<pubDate>Tue, 06 Sep 2011 22:09:01 +0000</pubDate>
		<dc:creator>Editor</dc:creator>
				<category><![CDATA[networking]]></category>
		<category><![CDATA[windows]]></category>

		<guid isPermaLink="false">http://lifeonubuntu.com/?p=175</guid>
		<description><![CDATA[The Problem: Windows 7 Fails to Connect to Default Windows Admin Shares on Networked Drives I got a new laptop with Windows 7 and I found I suddenly could not connect to the default administrative shares on other networked windows machines. For example: using \\remoteComputerName\C$ to connect to the default C drive admin share on [...]


Related posts:<ol><li><a href='http://lifeonubuntu.com/setting-up-cups-and-installing-local-printer-in-ubuntu-server/' rel='bookmark' title='Setting up CUPS and installing local printer in Ubuntu Server'>Setting up CUPS and installing local printer in Ubuntu Server</a></li>
<li><a href='http://lifeonubuntu.com/firefox-dropdown-menus-are-flickering-on-2nd-monitor/' rel='bookmark' title='Firefox dropdown menus are flickering on 2nd monitor'>Firefox dropdown menus are flickering on 2nd monitor</a></li>
</ol>]]></description>
			<content:encoded><![CDATA[<p></p><h2>The Problem: Windows 7 Fails to Connect to Default Windows Admin Shares on Networked Drives</h2>
<p>I got a new laptop with Windows 7 and I found I suddenly could not connect to the default administrative shares on other networked windows machines.  For example:  using \\remoteComputerName\C$ to connect to the default C drive admin share on the machine named remoteComputerName.  My credentials where not accepted, even though I knew they were correct.  </p>
<p>This was driving me nuts because I could do it just fine from my Windows Vista or Windows XP machines.  I could also successfully log in to those machines as an administrator.</p>
<h2>The Fix: Tweak the Local Security Policy</h2>
<p>I finally found the answer.  You need to properly set the Local Security Policy, which annoying comes with no default value set.  Here&#8217;s how:</p>
<div id="attachment_177" class="wp-caption alignright" style="width: 300px">
	<a href="http://lifeonubuntu.com/files/2011/09/Windows-7-Fails-To-Connect-To-Network-Shares.png"><img src="http://lifeonubuntu.com/files/2011/09/Windows-7-Fails-To-Connect-To-Network-Shares-300x197.png" alt="Windows 7 Can&#039;t Connect to Shared Network Drives." title="Windows-7-Fails-To-Connect-To-Network-Shares" width="300" height="197" class="size-medium wp-image-177" /></a>
	<p class="wp-caption-text">By default, Windows 7 can't connect to network shares. Fix this with a Local Security Policy Change. (Click image to enlarge.)</p>
</div>
<ul>
<li>Click on the start button</li>
<li>type secpol.msc to run the Local Security Policy manager</li>
<li>In the left pane, navigate your way to Local Policies &#8211;> Security Options and click on Security Options.</li>
<li>In the right pane, find &#8220;Network security: LAN Manager authentication level&#8221; and double-click it.</li>
<li>In the drop down box, choose &#8220;Send LM &#038; NTLM &#8211; use NTLMv2 session if negotiated&#8221;</li>
<li>Click apply.</li>
<p>BINGO!  You should now be all set to connect to the default administrative share on your network drives.</p>


<p>Related posts:<ol><li><a href='http://lifeonubuntu.com/setting-up-cups-and-installing-local-printer-in-ubuntu-server/' rel='bookmark' title='Setting up CUPS and installing local printer in Ubuntu Server'>Setting up CUPS and installing local printer in Ubuntu Server</a></li>
<li><a href='http://lifeonubuntu.com/firefox-dropdown-menus-are-flickering-on-2nd-monitor/' rel='bookmark' title='Firefox dropdown menus are flickering on 2nd monitor'>Firefox dropdown menus are flickering on 2nd monitor</a></li>
</ol></p>]]></content:encoded>
			<wfw:commentRss>http://lifeonubuntu.com/windows-7-cant-connect-to-default-administrative-share/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Firefox dropdown menus are flickering on 2nd monitor</title>
		<link>http://lifeonubuntu.com/firefox-dropdown-menus-are-flickering-on-2nd-monitor/</link>
		<comments>http://lifeonubuntu.com/firefox-dropdown-menus-are-flickering-on-2nd-monitor/#comments</comments>
		<pubDate>Fri, 26 Aug 2011 17:13:50 +0000</pubDate>
		<dc:creator>Editor</dc:creator>
				<category><![CDATA[firefox shortcuts, tweaks, and tips]]></category>

		<guid isPermaLink="false">http://lifeonubuntu.com/?p=166</guid>
		<description><![CDATA[The Problem: Firefox Menus Flicker and Go Blank Had a very weird problem with Firefox on my Windows 7 box. (It might also happen on Ubuntu desktop.) I switched the connection on my second, extended desktop monitor to use DVI instead of VGA. Suddenly, all the Firefox drop-down menus went blank. They would flicker briefly [...]


No related posts.]]></description>
			<content:encoded><![CDATA[<p></p><h2>The Problem: Firefox Menus Flicker and Go Blank</h2>
<p>Had a very weird problem with Firefox on my Windows 7 box.  (It might also happen on Ubuntu desktop.)  I switched the connection on my second, extended desktop monitor to use DVI instead of VGA.  Suddenly, all the Firefox drop-down menus went blank.  They would flicker briefly and I could see the contents, but then they would go blank.</p>
<p>For example, when typing in a URL in the Firefox wonderbar, I get a code completion drop down list with all matching URLs and locations I&#8217;ve recently visited.  The drop down list is there and appears for a split fraction of second, but then it goes blank and I can&#8217;t see it.  It&#8217;s just a big blank rectangle.  Oddly, I can select items from it and they appear in the wonderbar, but I don&#8217;t see them until I select them and all remaining items remain blank.</p>
<p>The same thing happens for the search box, some Firefox menus, etc.</p>
<h2>The Solution: Turn off Firefox Hardware Acceleration</h2>
<p>This was driving me nuts and I had a hard time googling the answer.  But I finally found the solution:</p>
<p><div id="attachment_172" class="wp-caption alignleft" style="width: 300px">
	<a href="http://lifeonubuntu.com/files/2011/08/Firefox-dropdown-menus-flicker.png"><img src="http://lifeonubuntu.com/files/2011/08/Firefox-dropdown-menus-flicker-300x281.png" alt="Firefox dropdown menus are flickering" title="Firefox-dropdown-menus-flicker" width="300" height="281" class="size-medium wp-image-172" /></a>
	<p class="wp-caption-text">How to fix Firefox flickering dropdown menus: turn off Hardware Acceleration (click image to enlarge)</p>
</div>Got to the Firefox  Options &#8211;> Advanced tab &#8211;> General tab.  In the &#8220;Browsing&#8221; section uncheck the box marked &#8220;Use hardware acceleration when available&#8221;</p>
<p>Cha-ching!!!  Problem solved.</p>


<p>No related posts.</p>]]></content:encoded>
			<wfw:commentRss>http://lifeonubuntu.com/firefox-dropdown-menus-are-flickering-on-2nd-monitor/feed/</wfw:commentRss>
		<slash:comments>31</slash:comments>
		</item>
		<item>
		<title>Setting Ubunutu 10.04 Raid with Dell PowerEdge T310 and PERC S100</title>
		<link>http://lifeonubuntu.com/setting-ubunutu-10-04-raid-with-dell-poweredge-t310-and-perc-s10/</link>
		<comments>http://lifeonubuntu.com/setting-ubunutu-10-04-raid-with-dell-poweredge-t310-and-perc-s10/#comments</comments>
		<pubDate>Wed, 11 Aug 2010 18:24:49 +0000</pubDate>
		<dc:creator>Editor</dc:creator>
				<category><![CDATA[file commands]]></category>
		<category><![CDATA[setup]]></category>
		<category><![CDATA[ubuntu server]]></category>

		<guid isPermaLink="false">http://lifeonubuntu.com/?p=148</guid>
		<description><![CDATA[It turns out that Dell PowerEdge servers (like the T310) with PERC S100 do not support RAID on Ubuntu. Bummer. But here is how I got Ubunutu software RAID 1 to work with my Dell PowerEdge T310, PERC S100 and Ubuntu 10.04 LTS&#8230; The main trick was to turn re-initialize the PERC Controller to use [...]


Related posts:<ol><li><a href='http://lifeonubuntu.com/setting-up-cups-and-installing-local-printer-in-ubuntu-server/' rel='bookmark' title='Setting up CUPS and installing local printer in Ubuntu Server'>Setting up CUPS and installing local printer in Ubuntu Server</a></li>
<li><a href='http://lifeonubuntu.com/7-handy-firefox-shortcuts-that-i-use-most-often/' rel='bookmark' title='7 Handy Firefox Shortcuts that I Use Most Often'>7 Handy Firefox Shortcuts that I Use Most Often</a></li>
</ol>]]></description>
			<content:encoded><![CDATA[<p></p><p>It turns out that Dell PowerEdge servers (like the T310) with PERC S100 do not support RAID on Ubuntu.  Bummer.  But here is how I got Ubunutu software RAID 1 to work with my Dell PowerEdge T310, PERC S100 and Ubuntu 10.04 LTS&#8230;</p>
<p>The main trick was to turn re-initialize the PERC Controller to use non-raid:</p>
<ul>
<li>As the Dell T310 boots, you will see a brief prompt from the Perc Controller telling you to press CTRL-R to configure it.  Press CTRL-R.</li>
<li>Choose &#8220;Initialize Physical Disks&#8221;</li>
<li>Choose &#8220;Initialize to non-raid&#8221;</li>
<li>Select both disks and continue</li>
<li>NOTE: I went through this twice, and I found that before I could complete the steps above, I had to first choose &#8220;Delete Virtual Disks.&#8221;  Again, I chose both disks and continued, and then I was able to complete the steps above.</li>
</ul>
<p>Now you should be all set to set up the Ubuntu built-in software RAID 1.  Here is a good guide to walk you through that:</p>
<p><a href="https://help.ubuntu.com/10.04/serverguide/C/advanced-installation.html">https://help.ubuntu.com/10.04/serverguide/C/advanced-installation.html</a></p>


<p>Related posts:<ol><li><a href='http://lifeonubuntu.com/setting-up-cups-and-installing-local-printer-in-ubuntu-server/' rel='bookmark' title='Setting up CUPS and installing local printer in Ubuntu Server'>Setting up CUPS and installing local printer in Ubuntu Server</a></li>
<li><a href='http://lifeonubuntu.com/7-handy-firefox-shortcuts-that-i-use-most-often/' rel='bookmark' title='7 Handy Firefox Shortcuts that I Use Most Often'>7 Handy Firefox Shortcuts that I Use Most Often</a></li>
</ol></p>]]></content:encoded>
			<wfw:commentRss>http://lifeonubuntu.com/setting-ubunutu-10-04-raid-with-dell-poweredge-t310-and-perc-s10/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>How to view and debug PHP arrays</title>
		<link>http://lifeonubuntu.com/how-to-view-and-debug-php-arrays/</link>
		<comments>http://lifeonubuntu.com/how-to-view-and-debug-php-arrays/#comments</comments>
		<pubDate>Wed, 20 Jan 2010 14:14:48 +0000</pubDate>
		<dc:creator>Editor</dc:creator>
				<category><![CDATA[debug]]></category>
		<category><![CDATA[php]]></category>

		<guid isPermaLink="false">http://lifeonubuntu.com/?p=135</guid>
		<description><![CDATA[Sometimes when coding or debugging in PHP, it&#8217;s helpful to see the entire contents of an array. An easy way to do this is with the print_r command. To make it more readable, wrap it in &#60;pre&#62; tags. For example, to see the contents of associative array $FormData: You&#8217;ll see output like this: Array ( [...]


No related posts.]]></description>
			<content:encoded><![CDATA[<p></p><p>Sometimes when coding or debugging in PHP, it&#8217;s helpful to see the entire contents of an array.  An easy way to do this is with the print_r command. To make it more readable, wrap it in &lt;pre&gt; tags.</p>
<p>For example, to see the contents of associative array $FormData:</p>
<pre class="brush: plain; title: ; notranslate">
&lt;pre&gt;&lt;?= print_r($FormData) ?&gt;&lt;/pre&gt;
</pre>
<p>You&#8217;ll see output like this:</p>
<pre> Array
(
    [CustomerId] =&gt; 2
    [Rating] =&gt; 5
    [DateOfBirth] =&gt; 01/01/1970
    [FirstName] =&gt; John
    [LastName] =&gt; Smith
    [Address1] =&gt; 1 Main St
    [Address2] =&gt;
    [City] =&gt; Santa Monica
    [State] =&gt; CA
    [PostalCode] =&gt; 90201
    [PhoneNumber] =&gt;
)
1</pre>


<p>No related posts.</p>]]></content:encoded>
			<wfw:commentRss>http://lifeonubuntu.com/how-to-view-and-debug-php-arrays/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Setup WordPress or WPMU to make an atomic version switch &#8212; AND allow you to revert</title>
		<link>http://lifeonubuntu.com/setup-wp-wpmu-for-atomic-version-switch-and-revert/</link>
		<comments>http://lifeonubuntu.com/setup-wp-wpmu-for-atomic-version-switch-and-revert/#comments</comments>
		<pubDate>Thu, 05 Nov 2009 17:11:03 +0000</pubDate>
		<dc:creator>Editor</dc:creator>
				<category><![CDATA[apache]]></category>
		<category><![CDATA[command line]]></category>
		<category><![CDATA[ubuntu server]]></category>
		<category><![CDATA[wordpress]]></category>
		<category><![CDATA[wpmu]]></category>

		<guid isPermaLink="false">http://lifeonubuntu.com/?p=119</guid>
		<description><![CDATA[I have a new WordPress MU (WPMU) install and I am ready for my first upgrade. I couldn&#8217;t get automatic upgrade to work, and all the forums said: do it by hand manually. This is fine, but I didn&#8217;t want my site to be in flux with some old an some new files as I [...]


Related posts:<ol><li><a href='http://lifeonubuntu.com/how-to-move-or-copy-a-directory/' rel='bookmark' title='How to move or copy a directory'>How to move or copy a directory</a></li>
<li><a href='http://lifeonubuntu.com/how-to-check-the-ubuntu-version/' rel='bookmark' title='How to Check the Ubuntu Version.'>How to Check the Ubuntu Version.</a></li>
</ol>]]></description>
			<content:encoded><![CDATA[<p></p><p>I have a new WordPress MU (WPMU) install and I am ready for my first upgrade.  I couldn&#8217;t get automatic upgrade to work, and all the forums said: do it by hand manually.  This is fine, but I didn&#8217;t want my site to be in flux with some old an some new files as I make all the copies.  To solve the problem, I used a symbolic link to set up an atomic switch that allows me to instantly (atomically) switch from one version to the next.  If it fails, I can also revert back.</p>
<p>Here&#8217;s how I did it on my Ubuntu Hardy (8.04 LTS) server&#8230;</p>
<h2>Backup WordPress Install</h2>
<p>You should be backing up your WP install regularly.  You should CERTAINLY do a backup before you try anything like the steps outlined in this article.  AND, be sure to verify your backup.</p>
<p>If you don&#8217;t know about backups, read up on them before you proceed with this article.  Here&#8217;s some <a href="http://codex.wordpress.org/WordPress_Backups">useful WordPress backup info</a>.</p>
<h2>Make A Copy of Your Current WordPress or WPMU Files</h2>
<p>First, we are going to make a copy of our current WP files.  Make the copy in the same place as you current files &#8212; likely your web root.  My WPMU install is in /var/www/wpmu/.  You can use any name you want for the copy.  I thought it most clear to give it a name that reflects the WP or WPMU version, so I called my copy wpmu-2.8.4.   Note that it&#8217;s important to preserve the file attributes (permissions, ownership, etc.) during the copy.  Do this with the &#8211;preserve parameter.  </p>
<p>These lines handled everything for me:</p>
<pre class="brush: plain; title: ; notranslate">
cd /var/www/
sudo cp -r --preserve=all wpmu wpmu-2.8.4
</pre>
<h2>Create a Symbolic Link to the WP Files</h2>
<p>A symbolic link looks and acts like a file or directory, but all it does is point to another one.  Any command you perform on the symbolic link (ls, cd, edit, etc.) is automagically acted on the file or directory to which the link points.</p>
<p>We want to create a symbolic link that will be the new document of our WP or WPMU install.  We will then point this link to the version-specific set of files that we want to run at any given time.  You can call the symbolic link anything you want.  I chose to call mine <em>wpmu-current</em>, as it will always point to my current wpmu version files.</p>
<p>Here&#8217;s how I created the symbolic link:</p>
<pre class="brush: plain; title: ; notranslate">
cd /var/www/
sudo ln -s wpmu-2.8.4 wpmu-current
</pre>
<p>Now, any reference to <em>wpmu-current</em> automagically affects <em>wpmu-2.8.4</em>.</p>
<h2>Point your Apache2 Install to the New Symbolic Link</h2>
<p>Now, to make it all work, we need to point our Apache2 installation to use the new symbolic link.  Mine is setup as a virtual host, so I changed the document root in my Virtual Host file.</p>
<p>Old line in my Virtual Host file:</p>
<pre class="brush: plain; title: ; notranslate">
        DocumentRoot /var/www/wpmu
</pre>
<p>New line:</p>
<pre class="brush: plain; title: ; notranslate">
        DocumentRoot /var/www/wpmu-current
</pre>
<p>To make it take effect, reload apache:</p>
<pre class="brush: plain; title: ; notranslate">
sudo /etc/init.d/apache2 reload
</pre>
<p>Now your WP or WPMU install should be running off the new files.  Check out your site(s) and make sure that everything looks good.</p>
<h2>Atomically Switch From one WP or WPMU Version to Another</h2>
<p>You are now all set to make atomic switches between WP or WPMU versions.  And if something goes wrong, you will be able to instantly revert back.</p>
<p>To do it, set up your new WP or WPMU upgraded version in a new folder.  For example, /var/www/wpmu-2.8.5.2.  Creating your upgraded version is beyond the scope of this article.  For help, check out <a href="http://codex.wordpress.org/Upgrading_WordPress">upgrade docs from WordPress</a>.</p>
<p>Once the new version is all set up in your new folder, switch to it atomically by changing the symbolic link to point to the new files.  Note changing the target of a symbolic link is not truly an atomic operation, so we will use one line to create a new temporary link and then rename the new link.  (If you want to understand this better, <a href="http://blog.moertel.com/articles/2005/08/22/how-to-change-symlinks-atomically">Tom Moertel does a great job of explaining how to change atomically change a symbolic link</a>).  Assuming the new WP install is in directory wpmu-2.8.5.2, this code does the trick:</p>
<pre class="brush: plain; title: ; notranslate">
cd /var/www/
sudo ln -s wpmu-2.8.5.2 wpmu-current-tmp &amp;&amp; sudo mv -Tf wpmu-current-tmp wpmu-current
</pre>
<p>Bingo. We have now switched to the 2.8.5.2 files.  Quickly check out your site(s) and make sure it all looks good.  If not, you can revert back to the old version files by pointing the symbolic link to back to the original files.</p>


<p>Related posts:<ol><li><a href='http://lifeonubuntu.com/how-to-move-or-copy-a-directory/' rel='bookmark' title='How to move or copy a directory'>How to move or copy a directory</a></li>
<li><a href='http://lifeonubuntu.com/how-to-check-the-ubuntu-version/' rel='bookmark' title='How to Check the Ubuntu Version.'>How to Check the Ubuntu Version.</a></li>
</ol></p>]]></content:encoded>
			<wfw:commentRss>http://lifeonubuntu.com/setup-wp-wpmu-for-atomic-version-switch-and-revert/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>How to keep the existing file attributes (owner, timestamp, etc) when copying files or directories</title>
		<link>http://lifeonubuntu.com/keep-existing-file-attributes-during-copy/</link>
		<comments>http://lifeonubuntu.com/keep-existing-file-attributes-during-copy/#comments</comments>
		<pubDate>Thu, 05 Nov 2009 15:04:16 +0000</pubDate>
		<dc:creator>Editor</dc:creator>
				<category><![CDATA[command line]]></category>
		<category><![CDATA[file commands]]></category>
		<category><![CDATA[newbie]]></category>
		<category><![CDATA[ubuntu server]]></category>

		<guid isPermaLink="false">http://lifeonubuntu.com/?p=115</guid>
		<description><![CDATA[When copying files and especially directories, sometimes you want to keep the existing file attributes. For example, you may likely want to keep the same owner, group, timestamp, etc. You can keep the attributes by using the preserve argument. preserve=all will keep everything: You can use the -p version of preserve to keep the default [...]


Related posts:<ol><li><a href='http://lifeonubuntu.com/newbie-how-to-edit-file-from-command/' rel='bookmark' title='Newbie: how to edit a file from the command line'>Newbie: how to edit a file from the command line</a></li>
<li><a href='http://lifeonubuntu.com/setup-wp-wpmu-for-atomic-version-switch-and-revert/' rel='bookmark' title='Setup WordPress or WPMU to make an atomic version switch &#8212; AND allow you to revert'>Setup WordPress or WPMU to make an atomic version switch &#8212; AND allow you to revert</a></li>
</ol>]]></description>
			<content:encoded><![CDATA[<p></p><p>When copying files and especially directories, sometimes you want to keep the existing file attributes.  For example, you may likely want to keep the same owner, group, timestamp, etc.</p>
<p>You can keep the attributes by using the <em>preserve</em> argument.  preserve=all will keep everything:</p>
<pre class="brush: plain; title: ; notranslate">
sudo cp -r --preserve=all original_directory_name copied_directory_name
</pre>
<p>You can use the -p version of preserve to keep the default attributes.  On my Ubuntu Hardy server, the default attributes are mode, ownership, timestamps:</p>
<pre class="brush: plain; title: ; notranslate">
sudo cp -r -p original_directory_name copied_directory_name
</pre>
<p>If you want to keep a different subset of attributes, you can specify in comma separated list a list with &#8211;preserve=[ATTR_LIST].</p>
<pre class="brush: plain; title: ; notranslate">
sudo cp -r --preserve=mode,ownership,timestamps original_directory_name copied_directory_name
</pre>
<p>Note that this last example is the same as -p, since I listed the default attributes.  On my system, the available attributes are mode, ownership, timestamps, context, links, all.</p>
<p>See the help page on your system for available attributes:</p>
<pre class="brush: plain; title: ; notranslate">
cp --help | less
</pre>


<p>Related posts:<ol><li><a href='http://lifeonubuntu.com/newbie-how-to-edit-file-from-command/' rel='bookmark' title='Newbie: how to edit a file from the command line'>Newbie: how to edit a file from the command line</a></li>
<li><a href='http://lifeonubuntu.com/setup-wp-wpmu-for-atomic-version-switch-and-revert/' rel='bookmark' title='Setup WordPress or WPMU to make an atomic version switch &#8212; AND allow you to revert'>Setup WordPress or WPMU to make an atomic version switch &#8212; AND allow you to revert</a></li>
</ol></p>]]></content:encoded>
			<wfw:commentRss>http://lifeonubuntu.com/keep-existing-file-attributes-during-copy/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

