<?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>Zero Mu Tech Articles &#187; Programming</title>
	<atom:link href="http://www.techarticles.zeromu.net/category/programming/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.techarticles.zeromu.net</link>
	<description>Solutions to computer problems that were in my way.</description>
	<lastBuildDate>Sun, 09 May 2010 03:48:03 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0</generator>
		<item>
		<title>Keeping Track of Elapsed Time in Python</title>
		<link>http://www.techarticles.zeromu.net/programming/keeping-track-of-elapsed-time-in-python/</link>
		<comments>http://www.techarticles.zeromu.net/programming/keeping-track-of-elapsed-time-in-python/#comments</comments>
		<pubDate>Wed, 21 May 2008 03:20:49 +0000</pubDate>
		<dc:creator>Jake D</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[Python]]></category>
		<category><![CDATA[MySQLdb]]></category>

		<guid isPermaLink="false">http://www.techarticles.zeromu.net/?p=32</guid>
		<description><![CDATA[This article shows how to put a few lines of python code into your python script so you can tell how long the script has been running, or how long a certain part of the task took to run. The Quick Answer: For the most accurrate time elapsed, use the time module and make 2<br/><br/><a href="http://www.techarticles.zeromu.net/programming/keeping-track-of-elapsed-time-in-python/">Read more...</a>]]></description>
			<content:encoded><![CDATA[<p>This article shows how to put a few lines of python code into your python script so you can tell how long the script has been running, or how long a certain part of the task took to run.</p>
<p><strong>The Quick Answer</strong>: For the most accurrate time elapsed, use the <code>time</code> module and make 2 <code>time.time()</code> objects.  The difference between these objects is the time elapsed. Do not use <code>time.clock()</code>.</p>
<h1>The Whole Story</h1>
<p>Its pretty basic: I have certain parts of a large python script (that happen to access a MySQL database) that I would like to keep track of how long it took them to execute.</p>
<h2>Wrong Answers</h2>
<p>Initially, I read on a <a href="http://pleac.sourceforge.net/pleac_python/datesandtimes.html" target="_blank">PLEAC-Python article, Dates and Times</a> (which really is a <strong>great</strong> overview of Python&#8217;s <code>time</code> module), about some ways to use Python&#8217;s <code>time</code> module.  That article suggests that all you need to do is:</p>
<blockquote><pre class="brush: python;">
#-----------------------------
# High Resolution Timers

t1 = time.clock()
# Do Stuff Here
t2 = time.clock()
print t2 - t1

# 2.27236813618
# Accuracy will depend on platform and OS,
# but time.clock() uses the most accurate timer it can
</pre>
</blockquote>
<p>For one of my projects, that worked fine.  But then I had a bigger script that used a lot of MySQL via the Python module <a href="http://mysql-python.sourceforge.net/MySQLdb.html" target="_blank">MySQLdb</a>, and I would look at my script&#8217;s run time after leaving, and the times looked short&#8230; but not too short. Eventually after running a script that took a 7 hour sleep and then some to run &#8212; but the script reported only taking an hour or so &#8212; I knew something was wrong.</p>
<h2>Only timing the work of Python?</h2>
<p>It seemed as if using the <code>time.clock()</code> approach was only timing what Python (as opposed to MySQL?) was doing.  I created this test script</p>
<pre class="brush: python;">
import time

yearstart = time.clock()
print yearstart

for x in range(0, 1000000):
    z = x + 6

yearend = time.clock()
print yearend
elapsed= yearend-yearstart
min = elapsed/60

print elapsed, min
</pre>
<p>And I didn&#8217;t find a problem, but my script still did.  I was wanting to time an event of a known length, and so I found out about the <code>time.sleep()</code> function from the aforementioned article. I incorporated the <code>sleep()</code> function:</p>
<pre class="brush: python;">
import time

yearstart = time.clock()
print yearstart

time.sleep(3)

yearend = time.clock()
print yearend
elapsed= yearend-yearstart
min = elapsed/60

print elapsed, min
</pre>
<p>and ran the script.  You would expect to see 3 seconds as a result, or at least something close, but my output was:</p>
<pre>0.03
0.03
0.0 0.0</pre>
<p>That was funny (although I didn&#8217;t laugh) because <code>yearend</code> was not supposed to sample the <code>clock()</code> until after the sleep.  I still don&#8217;t know why this does this, but it does.  I am sure this has its uses, but this was not the use I was wanting.</p>
<h2>Use <code>time.time()</code></h2>
<p>Still referencing the PLEAC-Python article, I tried using <code>time.time()</code>, which is supposed to just be the seconds since that day in 1970 and compared it to the <code>time.clock()</code> approach:</p>
<pre class="brush: python;">
import time

yearstart = time.clock()
print yearstart

time.sleep(3)

yearend = time.clock()
print yearend
elapsed= yearend-yearstart
min = elapsed/60

print elapsed, min

yearstart = time.time()
print yearstart

time.sleep(3)

yearend = time.time()
print yearend

elapsed= yearend-yearstart

min = elapsed/60

print elapsed, min
</pre>
<p>And got the output:</p>
<pre>0.03
0.03
0.0 0.0
1211338788.69
1211338791.69
3.00004386902 0.0500007311503</pre>
<h1>No Fluff Answer:</h1>
<p>Read nothing else (on this page). This code will get you going:</p>
<pre class="brush: python;">
import time

start = time.time()

# whatever you want to time, put between these two statements

end = time.time()

elapsed= end - start

#if you want to convert to minutes, just divide
min = elapsed/60

print &quot;Your stuff took&quot;, elapsed, &quot;seconds to run, which is the same as&quot;, min, &quot;minutes&quot;
</pre>
<p>So, this works for me.  I supose that <code>time.clock()</code> does not reference absolute time, which was a problem for me. Hope this helps, or at least saves you some head-scratching.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.techarticles.zeromu.net/programming/keeping-track-of-elapsed-time-in-python/feed/</wfw:commentRss>
		<slash:comments>8</slash:comments>
		</item>
		<item>
		<title>Get rid of WordPress messing with your quotes while writing code</title>
		<link>http://www.techarticles.zeromu.net/programming/get-rid-of-wordpress-messing-with-your-quotes-while-writing-code/</link>
		<comments>http://www.techarticles.zeromu.net/programming/get-rid-of-wordpress-messing-with-your-quotes-while-writing-code/#comments</comments>
		<pubDate>Fri, 02 May 2008 06:45:15 +0000</pubDate>
		<dc:creator>Jake D</dc:creator>
				<category><![CDATA[Fixes/Hacks]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[Python]]></category>
		<category><![CDATA[Web]]></category>
		<category><![CDATA[WordPress]]></category>
		<category><![CDATA[wordpress]]></category>

		<guid isPermaLink="false">http://www.techarticles.zeromu.net/?p=28</guid>
		<description><![CDATA[<a href="http://www.techarticles.zeromu.net/programming/get-rid-of-wordpress-messing-with-your-quotes-while-writing-code/"><img align="right" hspace="5" width="96" src="http://www.techarticles.zeromu.net/wp-content/uploads/2008/05/picture-2281.png" class="alignright wp-post-image tfe" alt="" title="badcode" /></a>Problem: Recently I was writing an article where I posted some python code.  Using WordPress, I was switching between HTML/Code view and &#8220;Visual&#8221; view.  Every time that I switched, the WordPress editor would change some of my code, namely the quotes.  I ended up with something that looked like this: Solution: Not exactly sure, but<br/><br/><a href="http://www.techarticles.zeromu.net/programming/get-rid-of-wordpress-messing-with-your-quotes-while-writing-code/">Read more...</a>]]></description>
			<content:encoded><![CDATA[<p><strong>Problem</strong>: Recently I was writing <a href="http://www.techarticles.zeromu.net/programming/get-attributes-and-filter-out-methods-a-private-attributes/">an article where I posted some python code</a>.  Using WordPress, I was switching between HTML/Code view and &#8220;Visual&#8221; view.  Every time that I switched, the WordPress editor would change some of my code, namely the quotes.  I ended up with something that looked like this:</p>
<p><a href="http://www.techarticles.zeromu.net/wp-content/uploads/2008/05/picture-2281.png"><img class="alignnone size-full wp-image-31" title="badcode" src="http://www.techarticles.zeromu.net/wp-content/uploads/2008/05/picture-2281.png" alt="" width="500" height="30" /></a></p>
<p><strong>Solution</strong>: Not exactly sure, but it seems to have stopped.</p>
<p>There are <a href="http://en.forums.wordpress.com/tags.php?tag=sourcecode">several WordPress posts</a> that go over an issue of using the</p>
<pre class="brush: plain;">[/sourcecode]

tag to write sourcecode.

Personally, I was very frustrated because while writing in Python, where whitespace matters, my indents would all be lost when switching between the visual and HTML editor in WordPress.

My solution was to wrap my

[sourcecode]</pre>
<p>tags in &lt;pre&gt; tags.</p>
<h2>Check the plugin?</h2>
<p>I originally was using the</p>
<pre class="brush: plain;">[/sourcecode]

tag from &lt;a href=&quot;http://code.google.com/p/syntaxhighlighter/&quot;&gt;SyntaxHighlighter&lt;/a&gt;, then found another one, called SyntaxHilighter Plus.

I don't have time to go over all of this, but I disabled the Plus version, re-enabled the regular SyntaxHighlighter, and made sure to wrap my

[sourcecode]</pre>
<p>s in &lt;pre&gt; tags.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.techarticles.zeromu.net/programming/get-rid-of-wordpress-messing-with-your-quotes-while-writing-code/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>How to split pages in WordPress 2.5 with nextpage</title>
		<link>http://www.techarticles.zeromu.net/programming/web/how-to-split-pages-in-wordpress-25-with-nextpage/</link>
		<comments>http://www.techarticles.zeromu.net/programming/web/how-to-split-pages-in-wordpress-25-with-nextpage/#comments</comments>
		<pubDate>Fri, 02 May 2008 04:50:53 +0000</pubDate>
		<dc:creator>Jake D</dc:creator>
				<category><![CDATA[HTML/XHTML]]></category>
		<category><![CDATA[Web]]></category>
		<category><![CDATA[WordPress]]></category>
		<category><![CDATA[nextpage]]></category>
		<category><![CDATA[wordpress]]></category>
		<category><![CDATA[WYSIWYG]]></category>

		<guid isPermaLink="false">http://www.techarticles.zeromu.net/?p=27</guid>
		<description><![CDATA[Problem: In WordPress 2.5.1, I was trying to make a multiple-page article using the &#60;!&#8211;nextpage&#8211;&#62; quicktag, but it wasn&#8217;t working. Quick Answer: When you want a page break, switch to HTML/Code view and then type &#60;!&#8211;nextpage&#8211;&#62;. Whole Story As simple as this sounds, it took me 20 minutes to get this to work.  My problem<br/><br/><a href="http://www.techarticles.zeromu.net/programming/web/how-to-split-pages-in-wordpress-25-with-nextpage/">Read more...</a>]]></description>
			<content:encoded><![CDATA[<p><strong>Problem</strong>: In WordPress 2.5.1, I was trying to make a multiple-page article using the &lt;!&#8211;nextpage&#8211;&gt; quicktag, but it wasn&#8217;t working.</p>
<p><strong>Quick Answer:</strong> When you want a page break, switch to HTML/Code view and then type &lt;!&#8211;nextpage&#8211;&gt;.</p>
<h2>Whole Story</h2>
<p>As simple as this sounds, it took me 20 minutes to get this to work.  My problem was that I thought the usage was like other plugin quicktags, where you can just put it in anywhere.  But if you put in &lt;!&#8211;nextpage&#8211;&gt; while using the &#8220;Visual&#8221; or WYSIWYG editor, it will change your greater than and less than sign into the html entities.</p>
<p>The problem with having to switch to the HTML or code view is that I have to scroll down and find where my spot was in the article (if I am putting in page breaks after publishing).  It would be great if WordPress had a button on the writing toolbar, like the &#8220;More&#8221; tag, that would insert page breaks without having to switch to HTML or Code view, or worrying about whether you are in the right view or not.</p>
<p>This took me so much longer than it should have that this qualifies as a &#8220;computer problem that got in my way&#8221;.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.techarticles.zeromu.net/programming/web/how-to-split-pages-in-wordpress-25-with-nextpage/feed/</wfw:commentRss>
		<slash:comments>13</slash:comments>
		</item>
		<item>
		<title>Get attributes and filter out methods a private attributes</title>
		<link>http://www.techarticles.zeromu.net/programming/get-attributes-and-filter-out-methods-a-private-attributes/</link>
		<comments>http://www.techarticles.zeromu.net/programming/get-attributes-and-filter-out-methods-a-private-attributes/#comments</comments>
		<pubDate>Thu, 01 May 2008 23:59:32 +0000</pubDate>
		<dc:creator>Jake D</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[Python]]></category>

		<guid isPermaLink="false">http://www.techarticles.zeromu.net/?p=26</guid>
		<description><![CDATA[This articles covers how I was able to get the managed attributes from an object, and then get the public and managed attributes from an object.  There used to be an __members__ method, but that has been depreciated according to http://docs.python.org/lib/specialattrs.html. Really, I hope there is a better way to do this, but I can&#8217;t<br/><br/><a href="http://www.techarticles.zeromu.net/programming/get-attributes-and-filter-out-methods-a-private-attributes/">Read more...</a>]]></description>
			<content:encoded><![CDATA[<p>This articles covers how I was able to get the managed attributes from an object, and then get the public and managed attributes from an object.  There used to be an <code>__members__ </code>method, but that has been depreciated according to http://docs.python.org/lib/specialattrs.html. Really, I hope there is a better way to do this, but I can&#8217;t seem to find it (let me know).</p>
<p><strong>Quick Answer (for managed attributes only):</strong></p>
<pre>
<pre class="brush: python;">
class dumb:
    def dummy():
        pass

def attributes(o):
    print &quot;object:&quot;, o
    print &quot;Initialized attribute values:&quot;
    step=0
    for var in dir(o):
        vartype=-1
        exec(&quot;vartype = type(o.&quot;+str(var)+&quot;)&quot;)
        if not(var in o.__dict__) and not(vartype == type( dumb.dummy)) and not(&quot;__&quot; == var[:2]):
            value = -30
            exec(&quot;value = o.&quot;+str(dir(o)[step]))
            print '%40s' % var  +&quot;: &quot;+ str(value)
        step += 1
</pre>
<p><span id="more-26"></span></pre>
<h2>The whole story</h2>
<p>Either I am just really new to python (I am) or it is just really hard when you have an object and you just want to get the public attributes.</p>
<p>The code above uses the <a href="http://diveintopython.org/power_of_introspection/built_in_functions.html"><code>dir()</code></a> function to get everything from the object.  Besides both public and private attributes, this also gets user defined and inherited methods.  Then, i crop out those that are not public attributes.</p>
<h2>Code Walkthrough (Get managed attributes only)</h2>
<p>Managed attributes are those that are defined in an object&#8217;s definition.  Here is an example:</p>
<pre>
<pre class="brush: python;">
class Widget(object):
    &quot;&quot;&quot;The Widget represents an object of work.  it can be processed by a worker. it is assigned to a worker by an organization.&quot;&quot;&quot;
        self.__id=id
        self.test=35

    ### MANAGED ATTRIBUTES ###

    #id
    def id():
        &quot;&quot;&quot;id is readonly&quot;&quot;&quot;
            return self.__id
        return locals()
    id = property(**id())
    #END id

    ### END MANAGED ATTRIBUTES ###

    def spoil_step(self):
        &quot;&quot;&quot;Increases the steps that this widget has been spoiling&quot;&quot;&quot;
        old = self.__time_spoiling
        self.__time_spoiling += 1
        #check for sure
        if old + 1 == self.__time_spoiling:
            return self.__time_spoiling
        else:
            return False

    ####END Widget OBJECT ####
</pre>
</pre>
<p><em>The Following list references the code at the top of the page</em></p>
<ol>
<li>I created a dumb object with a dummy function.  This will be used to identify &#8220;instance methods&#8221;. The <code>pass</code> instruction is just a filler.
<pre>
<pre class="brush: python;">
class dumb:
    def dummy():
        pass
</pre>
</pre>
</li>
<li>I created a function that takes an object, <code>o</code>, as input.  It then just prints out the object and lets the user know that it is about to go through it:
<pre>
<pre class="brush: python;">
def attributes(o):
    print &quot;object:&quot;, o
    print &quot;Initialized attribute values:&quot;
</pre>
</pre>
</li>
<li>I created a variable to keep track of which thing we are looking at, starting at the 0-index:
<pre>
<pre class="brush: python;">
     step=0
</pre>
</pre>
</li>
<li>Then I go through each member of the object:
<pre>
<pre class="brush: python;">
     for var in dir(o):
</pre>
</pre>
</li>
<li>I then create a variable, and assign the type of the object to this variable:
<pre>
<pre class="brush: python;">
          vartype=-1
          exec(&quot;vartype = type(o.&quot;+str(var)+&quot;)&quot;)
</pre>
</pre>
</li>
<li>Next comes the key conditional statement:
<pre>
<pre class="brush: python;">
          if not(var in o.__dict__) and not(vartype == type( dumb.dummy)) and not(&quot;__&quot; == var[:2]):
</pre>
</pre>
<p>The first part says exclude if you find it in <code>o.__dict__</code>, which contains the private attributes from the <code>__init__()</code> function.  The second part excludes things that are of the same type as an instance method; so this gets rid of the object&#8217;s methods.  The last part looks at the first to characters of the thing, and if it is equal to <code>__,</code> it is excluded.</li>
<li>Within the conditional, we just name and value of that thing, which should be only managed attributes:
<pre>
<pre class="brush: python;">
               value = -30
               exec(&quot;value = o.&quot;+str(dir(o)[step]))
               print '%40s' % var  +&quot;: &quot;+ str(value)
</pre>
</pre>
</li>
</ol>
<p>The next page goes over how to get both the managed and public (not just the managed) attributes from an object</p>
]]></content:encoded>
			<wfw:commentRss>http://www.techarticles.zeromu.net/programming/get-attributes-and-filter-out-methods-a-private-attributes/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Using RedirectMatch in .htaccess to redirect entire web site</title>
		<link>http://www.techarticles.zeromu.net/programming/apache/using-redirectmatch-in-htaccess-to-redirect-entire-web-site/</link>
		<comments>http://www.techarticles.zeromu.net/programming/apache/using-redirectmatch-in-htaccess-to-redirect-entire-web-site/#comments</comments>
		<pubDate>Thu, 06 Mar 2008 05:50:17 +0000</pubDate>
		<dc:creator>Jake D</dc:creator>
				<category><![CDATA[Apache]]></category>
		<category><![CDATA[.htaccess]]></category>
		<category><![CDATA[redirectmatch]]></category>

		<guid isPermaLink="false">http://www.techarticles.zeromu.net/2008/03/05/using-redirectmatch-in-htaccess-to-redirect-entire-web-site/</guid>
		<description><![CDATA[When changing websites, I was trying to use Apache&#8217;s RedirectMatch to send all documents from one domain to another domain. I used code that I found on other websites, but I found that it didn&#8217;t do what I wanted. What I wanted was for a user to put in http://www.olddomain.com/a_file.html and be redirected to http://newdomain.com/a_file.html.<br/><br/><a href="http://www.techarticles.zeromu.net/programming/apache/using-redirectmatch-in-htaccess-to-redirect-entire-web-site/">Read more...</a>]]></description>
			<content:encoded><![CDATA[<p>When changing websites, I was trying to use Apache&#8217;s <code>RedirectMatch</code> to send all documents from one domain to another domain.  I used code that I found on other websites, but I found that it didn&#8217;t do what I wanted.</p>
<p>What I wanted was for a user to put in <code>http://www.olddomain.com/a_file.html</code> and be redirected to <code>http://newdomain.com/a_file.html</code>.  I wanted it to do that for each file, and I didn&#8217;t want to specify a redirect for each file.  I didn&#8217;t want to use <code>mod_rewrite</code> because I wanted to give the 301 redirect for Search Engine Optimization (SEO) reasons.</p>
<p><strong>Quick Answer</strong>: use  <code>RedirectMatch permanent ^(.*)$ http://www.newdomain.com$1</code> in a <code>.htaccess</code> file in your old domain.</p>
<p>Initially, I read that this line</p>
<p><code>RedirectMatch permanent ^(.*)$ http://www.newdomain.com</code></p>
<p>would redirect all files from the old domain to files on the new domain of the same name when placed in the <code>.htaccess</code> file in the <code>/www/</code> directory of the old domain.  However, when I tried this, all of my redirects simply redirected to the index file of the new domain.  For example,</p>
<p><code>http://www.olddomain.com/file_a.html</p>
<p>http://www.olddomain.com/file_b.html</code></p>
<p>would both redirect to</p>
<p><code>http://www.newdomain.com/index.html</code></p>
<p>Then I modified the apache directive to</p>
<p><code>RedirectMatch permanent ^(.*)$ http://www.newdomain.com$1</code></p>
<p>and this worked for me.  Even when I put in a bad filename, I got my new domain&#8217;s 404 error document.</p>
<p>Not sure why I found <code>RedirectMatch permanent ^(.*)$ http://www.newdomain.com</code> in several sources and it didn&#8217;t work&#8230;</p>
]]></content:encoded>
			<wfw:commentRss>http://www.techarticles.zeromu.net/programming/apache/using-redirectmatch-in-htaccess-to-redirect-entire-web-site/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Moving Your Mac Leopard Time Machine to a New Drive</title>
		<link>http://www.techarticles.zeromu.net/applemac/moving-your-mac-leopard-time-machine-to-a-new-drive/</link>
		<comments>http://www.techarticles.zeromu.net/applemac/moving-your-mac-leopard-time-machine-to-a-new-drive/#comments</comments>
		<pubDate>Tue, 19 Feb 2008 04:57:14 +0000</pubDate>
		<dc:creator>Jake D</dc:creator>
				<category><![CDATA[Apple/Mac]]></category>
		<category><![CDATA[WordPress]]></category>
		<category><![CDATA[Apple]]></category>
		<category><![CDATA[hard drive]]></category>
		<category><![CDATA[how to]]></category>
		<category><![CDATA[Macintosh]]></category>
		<category><![CDATA[Time Machine]]></category>

		<guid isPermaLink="false">http://www.techarticles.zeromu.net/2008/02/18/moving-your-mac-leopard-time-machine-to-a-new-drive/</guid>
		<description><![CDATA[<a href="http://www.techarticles.zeromu.net/applemac/moving-your-mac-leopard-time-machine-to-a-new-drive/"><img align="right" hspace="5" width="96" src="http://www.techarticles.zeromu.net/wp-content/uploads/2008/02/picture-99.png" class="alignright wp-post-image tfe" alt="Select highest parent" title="" /></a>I recently upgraded to a 1 Terabyte external hard drive and wanted to move my Time Machine backups to that drive (and start using this new drive for Time Machine). This is how I did it. Quick Solution: Use Disk Utility to Restore your old drive to your new drive, then tell Time Machine that<br/><br/><a href="http://www.techarticles.zeromu.net/applemac/moving-your-mac-leopard-time-machine-to-a-new-drive/">Read more...</a>]]></description>
			<content:encoded><![CDATA[<p>I recently upgraded to a 1 Terabyte external hard drive and wanted to move my Time Machine backups to that drive (and start using this new drive for Time Machine).  This is how I did it.</p>
<p><strong>Quick Solution</strong>: Use Disk Utility to <em>Restore</em> your old drive to your new drive, then tell Time Machine that you want to use a different disk</p>
<h2>The Whole Story</h2>
<p>When I got the 1TB drive, it was formatted as FAT32.  I had been using Time Machine (I am running Mac OS 10.5.2) and I wanted to use my new drive for Time Machine, but I wanted to keep my current Time Machine history.  My vision was to have the exact same data, but now my external drive can hold more.  I ran into a few issues while trying to do this, so here is how I solved them.</p>
<p><em><strong>Note</strong>: The sections &#8220;Formatting the new hard drive&#8221;, &#8220;Transfer the files&#8221;, and &#8220;Transfer Problems&#8221; narrate the problems I had while trying to just copy files&#8230; see the following section, &#8220;Use Disk Utility Instead&#8221;, for enumerated instructions on how I actually solved the problem. </em></p>
<h3>Formatting the new hard drive</h3>
<p>When I first plugged in the drive, Leopard recognized it.  I thought that I might just be able to dump the files from my old external hard drive (formatted in HFS+) onto the new one (FAT32). When I selected the files to move and dragged them to the new folder, I heard the &#8220;pang&#8221; sound that Finder makes when you copy files, but nothing actually happened.</p>
<p>Since I will only use this new drive on a Mac, I thought maybe I should reformat to HFS+ (I also thought that Time Machine might require it).  Using Disk Utility, I ran into a few vague errors and the disk would never be successfully formatted.  I found the solution on the <a title="Apple Forum on reformatting large drives" href="http://discussions.apple.com/thread.jspa?threadID=1244486">Apple Discussion Forums</a> .</p>
<p>This basically says that you must select the highest parent of the drive you want to format<br />
<img src="http://www.techarticles.zeromu.net/wp-content/uploads/2008/02/picture-99.png" alt="Select highest parent" /></p>
<p>and select the &#8220;Partition&#8221; page.</p>
<p><img src="http://www.techarticles.zeromu.net/wp-content/uploads/2008/02/picture-100.png" alt="Partition Page" /></p>
<p>Then go to &#8220;Options&#8230;&#8221; and select the top option: &#8220;GUID&#8221;.</p>
<p>The formatting should only take a few seconds.</p>
<p>The next page goes over transferring your files.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.techarticles.zeromu.net/applemac/moving-your-mac-leopard-time-machine-to-a-new-drive/feed/</wfw:commentRss>
		<slash:comments>25</slash:comments>
		</item>
		<item>
		<title>How to move WordPress to a subdomain</title>
		<link>http://www.techarticles.zeromu.net/fixeshacks/how-to-move-wordpress-to-a-subdomain/</link>
		<comments>http://www.techarticles.zeromu.net/fixeshacks/how-to-move-wordpress-to-a-subdomain/#comments</comments>
		<pubDate>Sat, 09 Feb 2008 23:29:47 +0000</pubDate>
		<dc:creator>Jake D</dc:creator>
				<category><![CDATA[Fixes/Hacks]]></category>
		<category><![CDATA[WordPress]]></category>
		<category><![CDATA[how to]]></category>
		<category><![CDATA[subdomain]]></category>
		<category><![CDATA[wordpress]]></category>

		<guid isPermaLink="false">http://www.techarticles.zeromu.net/2008/02/09/how-to-move-wordpress-to-a-subdomain/</guid>
		<description><![CDATA[I recently made a WordPress blog for one of our clients. Everything was setup fine in a directory similar to www.thewebsite.com/blog/. Then I decided that I wanted the blog to have its own subdirectory, www.blog.thewebsite.com. The quick answer: export your data and reinstall WordPress. The whole story: So I used the cPanel interface of the<br/><br/><a href="http://www.techarticles.zeromu.net/fixeshacks/how-to-move-wordpress-to-a-subdomain/">Read more...</a>]]></description>
			<content:encoded><![CDATA[<p>I recently made a <a title="WordPress.org" href="http://wordpress.org/">WordPress</a> blog for one of our clients. Everything was setup fine in a directory similar to <code>www.thewebsite.com/blog/</code>.  Then I decided that I wanted the blog to have its own subdirectory, <code>www.blog.thewebsite.com</code>.</p>
<p><strong>The quick answer:</strong> export your data and reinstall WordPress.</p>
<p>The whole story:</p>
<p>So I used the cPanel interface of the web hoster and created a subdomain, blog, and set the document root to <code>/www/blog/</code>.  When I would try to pull up <code>www.blog.thewebsite.com </code>, the browser would just redirect to <code>www.thewebsite.com/</code>, and no blog would appear.</p>
<p>I was going to go through all of the things that I did to try to hack-up WordPress so that I would not have to reinstall, but then I realized that none of that actually worked. I could get far enough that the page would show up and about half of the links would work, but there ended up being an issue with the permalinks.</p>
<p>What I had to do was use the Manage-&gt;Export feature of the WordPress admin area to save my categories, posts, etc.  Then, to uninstall WordPress, I deleted all of the tables in my WordPress database, then ran the <code>install.php</code> script again.  I probably could have kept the <code>users</code> table, and perhaps a few other tables with the plugin settings, but I didn&#8217;t.  So I had to reactivate my plugins and all of the other options that I had changed from the default values.</p>
<p>If you have a better fix for this, please leave a comment!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.techarticles.zeromu.net/fixeshacks/how-to-move-wordpress-to-a-subdomain/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>
