<?xml version="1.0" encoding="UTF-8"?>
<!-- generator="wordpress/2.3.1" -->
<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/"
	>

<channel>
	<title>Matthew Harris</title>
	<link>http://matthewharris.org</link>
	<description>Blogging has never sucked more than this</description>
	<pubDate>Sat, 22 Dec 2007 04:33:32 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.3.1</generator>
	<language>en</language>
			<item>
		<title>Released: Duration 0.1.0</title>
		<link>http://matthewharris.org/blog/2007/12/21/released-duration-010/</link>
		<comments>http://matthewharris.org/blog/2007/12/21/released-duration-010/#comments</comments>
		<pubDate>Fri, 21 Dec 2007 05:40:11 +0000</pubDate>
		<dc:creator>Matt</dc:creator>
		
		<category><![CDATA[Programming]]></category>

		<category><![CDATA[Releases]]></category>

		<category><![CDATA[Ruby]]></category>

		<category><![CDATA[ruby duration]]></category>

		<guid isPermaLink="false">http://matthewharris.org/blog/2007/12/21/released-duration-010/</guid>
		<description><![CDATA[I&#8217;m thrilled to announce the release of Duration 0.1.0.
Duration is a timespan manipulation library that tells you how much time  has passed since a certain time, or how long a certain amount of seconds  is in more human-readable measurements.
As of 0.1.0, the Duration library has been completely rewritten,  BigDuration (and all its [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;m thrilled to announce the release of Duration 0.1.0.</p>
<p>Duration is a timespan manipulation library that tells you how much time  has passed since a certain time, or how long a certain amount of seconds  is in more human-readable measurements.</p>
<p>As of 0.1.0, the Duration library has been completely rewritten,  BigDuration (and all its features) have been completely stripped, and  I&#8217;ve got a few other nifty things added.</p>
<p>Duration is currently<strong class="moz-txt-star"> in no way<span class="moz-txt-tag"></span></strong> stable.  At this moment you can only  expect that it &#8220;works&#8221; how it should.</p>
<p>Please expect a stable release at 1.0.0, many more  releases should come  between.</p>
<p>Gem:</p>
<pre>$ gem install duration -r</pre>
<p>Without gem:</p>
<pre>$ svn checkout <a href="http://duration.rubyforge.org/svn/tags/duration-0.1.0" class="moz-txt-link-freetext">http://duration.rubyforge.org/svn/tags/duration-0.1.0</a></pre>
<p>After checking out, simply run:</p>
<pre>$ cd duration-0.1.0/

$ ruby setup.rb</pre>
<p>You can checkout latest version likeso:</p>
<pre>$ svn checkout <a href="http://duration.rubyforge.org/svn/trunk" class="moz-txt-link-freetext">http://duration.rubyforge.org/svn/trunk</a> duration

$ cd duration/

$ ruby setup.rb</pre>
]]></content:encoded>
			<wfw:commentRss>http://matthewharris.org/blog/2007/12/21/released-duration-010/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Two reasons why I think smokers can&#8217;t quit</title>
		<link>http://matthewharris.org/blog/2007/12/16/two-reasons-why-i-think-smokers-cant-quit/</link>
		<comments>http://matthewharris.org/blog/2007/12/16/two-reasons-why-i-think-smokers-cant-quit/#comments</comments>
		<pubDate>Sun, 16 Dec 2007 13:32:51 +0000</pubDate>
		<dc:creator>Matt</dc:creator>
		
		<category><![CDATA[Bad Habits]]></category>

		<category><![CDATA[smokers]]></category>

		<category><![CDATA[smoking]]></category>

		<category><![CDATA[tobacco]]></category>

		<guid isPermaLink="false">http://matthewharris.org/blog/2007/12/16/two-reasons-why-i-think-smokers-cant-quit/</guid>
		<description><![CDATA[The other day while coming home from KFC (buying dinner), I spent some time thinking (as a smoker myself) why a lot of people who smoke can or can&#8217;t quit the disgusting habit.  I came to realize that there are two significant reasons.
The two reasons are nicotine addiction (obviously) and will-power.   Now to many [...]]]></description>
			<content:encoded><![CDATA[<p>The other day while coming home from KFC (buying dinner), I spent some time thinking (as a smoker myself) why a lot of people who smoke can or can&#8217;t quit the disgusting habit.  I came to realize that there are two significant reasons.</p>
<p>The two reasons are <em>nicotine addiction</em> (obviously) and <em>will-power</em>.   Now to many this may seem very obvious but I didn&#8217;t realize how significant the second reason, will-power, is.</p>
<p>The first reason is obvious and everyone knows that long-time smokers are constantly craving for nicotine, but the second reason causes an imbalance between wanting to smoke or not wanting to smoke.  Yes, that&#8217;s right, the second reason makes a person <em>want</em> to smoke.  It&#8217;s like trying to get a person to quit an old habit they are fond of, or perhaps smoking has introduced a new aspect in their life that they don&#8217;t want to give up.  Maybe it has a positive effect that it reduces stress thus increasing the will power to smoke for people who rely on this symptom.  It can be many reasons, but the way I see it (from my point of view, as a smoker) it is 100% based on will-power.</p>
<p>Sure, withdrawel can make a person question their own motives to quit the nasty habit.  But a person with strong will-power to quit can do so.  However, a person who lacks that kind of will-power is unable to quit and gives in.  It is not the person&#8217;s fault, that&#8217;s just how they are.  That&#8217;s how their life is and people who smoke because it&#8217;s &#8220;cool&#8221; aren&#8217;t really smokers, they&#8217;re idiots.</p>
<p>I&#8217;m actually frustrated by people who make it seem so easy to quit smoking but has never been a smoker themselves.  If a person who was once a smoker suggests the other to quit, they know <strong>how hard</strong> it can be especially when it has become a big part of their lifestyle.  Smoking has only negative effects in a society and to the individual&#8217;s body, but to the individual&#8217;s mental state, there is nothing better.</p>
<p>I&#8217;m the type of person who needs a cigarette every 10 minutes to get my brain going, almost as if it&#8217;s fuel to my little devilish neurons.  What can I say, I&#8217;m an idiot without a pack next to me.</p>
<p>I&#8217;ve also come to realize that during my state of illness with a mere sore throat, it was painful to inhale and at that time I realized that I was smoking half as much as I was normally (also, considering the effects of cigarettes on me, I was also thinking half as much ;]).  So I realized that my will-power to avoid a painful experience almost won its place (but not quite) against the evil white sticks.</p>
<p>That&#8217;s it, I&#8217;ve pretty much concluded that more than nicotine addiction itself, a person can easily quit smoking with the strong will-power to do so, but does he or she have that will-power?  I don&#8217;t.</p>
]]></content:encoded>
			<wfw:commentRss>http://matthewharris.org/blog/2007/12/16/two-reasons-why-i-think-smokers-cant-quit/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Downloading YouTube videos, the programmer HOWTO</title>
		<link>http://matthewharris.org/blog/2007/12/14/downloading-youtube-videos-the-programmer-howto/</link>
		<comments>http://matthewharris.org/blog/2007/12/14/downloading-youtube-videos-the-programmer-howto/#comments</comments>
		<pubDate>Fri, 14 Dec 2007 02:44:00 +0000</pubDate>
		<dc:creator>Matt</dc:creator>
		
		<category><![CDATA[PHP]]></category>

		<category><![CDATA[Programming]]></category>

		<category><![CDATA[YouTube]]></category>

		<category><![CDATA[http]]></category>

		<guid isPermaLink="false">http://matthewharris.org/blog/2007/12/14/downloading-youtube-videos-the-programmer-howto/</guid>
		<description><![CDATA[Have you ever thought about making a script or program to download the Flash videos from YouTube?  I have, and I&#8217;ve done little research (or enough to know my way around) on figuring out how to successfully take a given URL where you watch the video and retrieving the actual URL to the video file using [...]]]></description>
			<content:encoded><![CDATA[<p>Have you ever thought about making a script or program to download the Flash videos from <a href="http://www.youtube.com">YouTube</a>?  I have, and I&#8217;ve done little research (or enough to know my way around) on figuring out how to successfully take a given URL where you watch the video and retrieving the actual URL to the video file using the watch URL as the base.</p>
<p>It&#8217;s all fairly simple, really.  When you go to the page where you watch a specific video and view the output source code (mixed HTML and JavaScript) it may be confusing to figure out how YouTube locates the video.  For the sake of keeping this article short and simple, I&#8217;ll get more to the point. In every page that lets you watch a particular video, there is (somewhere in the source) a definition to a JavaScript object called <code>swfArgs</code>.</p>
<p>Now, most of the information in this object is hardly any relevant to retrieving the URL to the actual Flash video. What&#8217;s important are the <code>video_id</code> and <code>t</code> attributes.  Using your favorite text editor and programming language, you can write a script or program to parse out these attributes from the object quite easily.  I won&#8217;t go into the details of how to do that.  Once you have gotten the values for the necessary attributes, you must construct an entirely different URL using those values.  The correct URL looks like this: <code>http://www.youtube.com/get_video?video_id=&lt;video_id&gt;&amp;t=&lt;t&gt;</code>.  The <code>&lt;video_id&gt;</code> and <code>&lt;t&gt;</code> values in the URL should be replaced with the values you parsed out of the <code>swfArgs</code> object.</p>
<p>Okay, you&#8217;re about less-than or around half-way there.  That was the easy part.  Now comes the hard part and this isn&#8217;t really hard if you have some good tools available to you.  Now that you&#8217;ve constructed the above URL, you must use your favorite HTTP library to make a request to it.  For performance reasons, I would recommend that you make a HEAD request instead of a GET request.  If you make a HEAD request you can avoid the web server trying to send you a body (which can speed up things significantly on slower connections).</p>
<p>In every case (I can almost bet on this) YouTube will tell you to redirect to another location.  Now keep in mind that YouTube is very large and has many (freakin&#8217; tons) of videos.  YouTube will keep asking you to redirect because it&#8217;s going through its Google file servers (where all the videos are kept) and looking for which server the video is stored on.  If the HTTP library you are using to make the request supports automatic following of redirect responses then that&#8217;s good.  If it doesn&#8217;t, then you will most definitely have to write a recursive function to do this for you.  If you end up writing your own function, all you have to do is follow the URL indicated by the &#8220;<code>Location:</code>&#8221; header in the response the server sends back to you.</p>
<p>If you get that far without any errors, you&#8217;ve probably hit the jackpot.  If the final response you get is an HTTP OK (status 200) response, then that final destination you have reached is the actual download URL to the Flash video.  If you made HEAD requests throughout the entire time, once you reach the final destination, the video will not be downloaded because the video is included as part of the body.  Instead you should make another separate request to the actual download URL and make sure it&#8217;s a GET request and that&#8217;s how you download the video.</p>
<p>I made a command-line PHP script that depends only on cURL called <a href="http://matthewharris.org/code/#tubescraper">TubeScraper</a> that takes the YouTube URL as its argument and spits back the actual download URL.  The script is more suited for *nix environments but will work anywhere PHP is supported.</p>
<p>That&#8217;s it, I hope you learned something from this article. If you have any questions or feedback, just leave comments and I&#8217;ll address them as soon as possible <img src='http://matthewharris.org/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /></p>
]]></content:encoded>
			<wfw:commentRss>http://matthewharris.org/blog/2007/12/14/downloading-youtube-videos-the-programmer-howto/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Happy birthday to me!</title>
		<link>http://matthewharris.org/blog/2007/12/13/happy-birthday-to-me/</link>
		<comments>http://matthewharris.org/blog/2007/12/13/happy-birthday-to-me/#comments</comments>
		<pubDate>Wed, 12 Dec 2007 22:07:25 +0000</pubDate>
		<dc:creator>Matt</dc:creator>
		
		<category><![CDATA[Anime]]></category>

		<category><![CDATA[Celebration]]></category>

		<category><![CDATA[birthday]]></category>

		<category><![CDATA[darker than black]]></category>

		<guid isPermaLink="false">http://blog.matthewharris.org/blog/2007/12/13/happy-birthday-to-me/</guid>
		<description><![CDATA[Well, this is it.  It&#8217;s December 13 here in Korea and it&#8217;s my birthday.  This is the day I turn 21!  Yay, everyone celebrate!  Where&#8217;s the booze!?
No presents today, probably won&#8217;t get any until I visit my folks on Saturday.  Yep, looks like there&#8217;s nothing for me to do until then.
I guess I can slack [...]]]></description>
			<content:encoded><![CDATA[<p>Well, this is it.  It&#8217;s December 13 here in Korea and it&#8217;s my birthday.  This is the day I turn 21!  Yay, everyone celebrate!  Where&#8217;s the booze!?</p>
<p>No presents today, probably won&#8217;t get any until I visit my folks on Saturday.  Yep, looks like there&#8217;s nothing for me to do until then.</p>
<p>I guess I can slack off and sleep some more (this deadline until I move back to the states is long and painful for me right now), maybe watch some animation, eat chips and try to get fat or something.</p>
<p>Aside from that, I just finished watching an <a href="http://en.wikipedia.org/wiki/Anime">anime</a> series called <a href="http://en.wikipedia.org/wiki/Darker_than_Black">Darker than Black</a> and I have to admit that it was pretty damn fun. I recommend it to all the anime lovers out there who haven&#8217;t seen it yet.</p>
]]></content:encoded>
			<wfw:commentRss>http://matthewharris.org/blog/2007/12/13/happy-birthday-to-me/feed/</wfw:commentRss>
		</item>
		<item>
		<title>What is Git? Torvalds explains</title>
		<link>http://matthewharris.org/blog/2007/12/12/what-is-git-torvalds-explains/</link>
		<comments>http://matthewharris.org/blog/2007/12/12/what-is-git-torvalds-explains/#comments</comments>
		<pubDate>Tue, 11 Dec 2007 21:42:36 +0000</pubDate>
		<dc:creator>Matt</dc:creator>
		
		<category><![CDATA[Technology]]></category>

		<category><![CDATA[YouTube]]></category>

		<category><![CDATA[git]]></category>

		<category><![CDATA[linus torvalds]]></category>

		<guid isPermaLink="false">http://blog.matthewharris.org/blog/2007/12/12/what-is-git-torvalds-explains/</guid>
		<description><![CDATA[A couple days ago while I was sitting in front of my MacBook just lazy and bored, I was presented with a YouTube video of Linus Torvalds explaining Git.
I like the idea of a truly distributed source control management software, but I haven&#8217;t tried it yet.  Perhaps this is something to look into for a [...]]]></description>
			<content:encoded><![CDATA[<p>A couple days ago while I was sitting in front of my MacBook just lazy and bored, I was presented with a <a href="http://youtube.com/watch?v=4XpnKHJAok8">YouTube video of Linus Torvalds explaining Git</a>.</p>
<p>I like the idea of a truly distributed source control management software, but I haven&#8217;t tried it yet.  Perhaps this is something to look into for a future project.</p>
]]></content:encoded>
			<wfw:commentRss>http://matthewharris.org/blog/2007/12/12/what-is-git-torvalds-explains/feed/</wfw:commentRss>
		</item>
		<item>
		<title>It&#8217;s alive!</title>
		<link>http://matthewharris.org/blog/2007/12/12/its-alive/</link>
		<comments>http://matthewharris.org/blog/2007/12/12/its-alive/#comments</comments>
		<pubDate>Tue, 11 Dec 2007 18:58:23 +0000</pubDate>
		<dc:creator>Matt</dc:creator>
		
		<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://blog.matthewharris.org/?p=1</guid>
		<description><![CDATA[Greetings to those who have chosen to read my boring weblog.  The original plan was to make one of my own from scratch but suddenly I got tremendously lazy and decided I want to do other things instead of worrying about a lousy blog.
This blog will probably be updated daily or from a period of [...]]]></description>
			<content:encoded><![CDATA[<p>Greetings to those who have chosen to read my boring weblog.  The original plan was to make one of my own from scratch but suddenly I got tremendously lazy and decided I want to do other things instead of worrying about a lousy blog.</p>
<p>This blog will probably be updated daily or from a period of 2 to 3 days (even, whatever I feel like) with the most unhelpful and offensive material you have ever seen!</p>
<p>No, I&#8217;m just joking.  I&#8217;ll try my best to update this blog with useful material and just things about me in general.</p>
<p>Stay tuned!</p>
]]></content:encoded>
			<wfw:commentRss>http://matthewharris.org/blog/2007/12/12/its-alive/feed/</wfw:commentRss>
		</item>
	</channel>
</rss>
