<?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>Alex Rasmussen &#187; Computers</title>
	<atom:link href="http://alexras.info/category/computers/feed/" rel="self" type="application/rss+xml" />
	<link>http://alexras.info</link>
	<description>I make things that do stuff with computers</description>
	<lastBuildDate>Wed, 01 Sep 2010 19:02:04 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.1</generator>
		<item>
		<title>Thoughts on Neutralitygate</title>
		<link>http://alexras.info/2010/08/10/brief-thoughts-on-verizongoogle-neutrality-announcement/</link>
		<comments>http://alexras.info/2010/08/10/brief-thoughts-on-verizongoogle-neutrality-announcement/#comments</comments>
		<pubDate>Tue, 10 Aug 2010 08:31:57 +0000</pubDate>
		<dc:creator>Alex</dc:creator>
				<category><![CDATA[Computers]]></category>
		<category><![CDATA[Opinions (Uninformed)]]></category>

		<guid isPermaLink="false">http://alexras.info/?p=421</guid>
		<description><![CDATA[There has been a lot of sound and fury today (well, technically yesterday) surrounding Verizon and Google&#8217;s joint net neutrality policy announcement. I didn&#8217;t really know about it until Tim brought it to my attention. He wanted to know my thoughts about this, and blogs are practically designed for uninformed opinions, so why not? In [...]]]></description>
			<content:encoded><![CDATA[<p style="text-align: center;"><img class="aligncenter" src="http://assets.sbnation.com/assets/92594/neutral_planet.jpg" alt="The Neutral Planet" width="576" height="338" /></p>
<p>There has been a lot of sound and fury today (well, technically yesterday) surrounding <a href="http://bits.blogs.nytimes.com/2010/08/09/live-blogging-google-verizon-call-on-net-neutrality/">Verizon and Google&#8217;s joint net neutrality policy announcement</a>. I didn&#8217;t really know about it until <a href="http://timinprint.com/">Tim</a> brought it to my attention. He wanted to know my thoughts about this, and blogs are practically designed for uninformed opinions, so why not?</p>
<p>In the interest of full disclosure, I&#8217;ve worked at Google in the past. Several friends of mine are either current or former Googlers. Money from Google&#8217;s generous intern salary paid for all the furniture in my living room. I&#8217;m totally biased, I freely admit. The rest of this post will also probably reveal my profound ignorance, but that&#8217;s why there are comments.</p>
<p>Frankly, I&#8217;m surprised at the amount of rage that I&#8217;m picking up about this announcement. This isn&#8217;t a net-neutrality-crushing alliance between Google and Verizon. It&#8217;s not binding. There&#8217;s nothing in the language that says that it&#8217;s not open for discussion and feedback. This is basically these two companies saying, &#8220;This is how we think we&#8217;re going to deal with the net neutrality thing right now.&#8221;</p>
<p>The notion of allowing carriers to &#8220;offer new types of services that are not part of the open Internet&#8221; is also not all that surprising to me. In my view, net neutrality says &#8220;if two computers on the Internet want to talk to one another, the carriers providing Internet access to either of the two shouldn&#8217;t be able to stop them&#8221;. Under &#8220;shouldn&#8217;t be able to stop them&#8221;, I mean that my computer shouldn&#8217;t be unable to talk to Google&#8217;s computers because I&#8217;m on a &#8220;Microsoft-friendly&#8221; ISP. What Google and Verizon seem to be proposing here is that companies should be able to create services that don&#8217;t operate over the public Internet as long as those services don&#8217;t circumvent net neutrality. It&#8217;s not really clear what they mean by &#8220;not part of the open Internet&#8221; here; are we saying that the computers making up this service aren&#8217;t world-routable? If so, then companies are already doing this internally. Large corporate intranets could be seen as an example of a service that operates separately from the open Internet. Do they mean creating a parallel network over which these services run? In that case, data center networks seem to fit that description pretty well and clearly companies are providing dedicated networks for data center networks, or just buying their own. Again, on the face of it I&#8217;m not too terribly distressed.</p>
<p>Most of the rage seems to be directed at the fact that they don&#8217;t think that wireless access to the Internet should be protected in the same way that wired access is. Judging by <a href="http://googlepublicpolicy.blogspot.com/2010/08/joint-policy-proposal-for-open-internet.html">Google&#8217;s blog post on the subject</a> (see how biased I am?) their justification seems to be that they don&#8217;t know what the mobile Internet really looks like yet. It seems to me that this is basically a political compromise; Google caves somewhat on the wireless issue so that Verizon will agree to come on board with the agreement. Notice that the transparency requirement opens the door for any company that tries to pull any pro-neutrality funny business to be publicly reamed by their customers (you need only look at the Comcast P2P filtering scandal to see how much good press anti-neutrality practices generate for the telcos that implement them). Google promises to not be non-neutral in access to its properties, and it and Verizon get to be great friends; everybody wins.</p>
<p>Are Google and Verizon both huge multinational corporations that are interested primarily in pulling in a lot of cash? Absolutely. Does the language of this announcement open up the possibility of abuse, corruption and rampant mismanagement? Of course, but so does every other agreement between more than one person. Does this announcement violate Google&#8217;s &#8220;Do no evil&#8221; mission statement? Hardly. To me, this just sounds like Verizon and Google getting all buddy-buddy and announcing the sort of long-term, under-defined recommendations that make PR people all warm and fuzzy because they don&#8217;t actually require you to promise to do anything. Everything I&#8217;m hearing from Google indicates they&#8217;re really self-conscious about this whole thing (&#8220;it&#8217;s not an aggreement&#8221;, &#8220;we are still committed to net neutrality&#8221;, &#8220;we&#8217;re not sure what the mobile market looks like, so we have to keep our options open&#8221;), which gives me some comfort; the second you get a &#8220;so what?&#8221; announcement out of a company Google&#8217;s size (see Comcast&#8217;s P2P shenanigans, <a href="http://articles.latimes.com/2010/aug/09/business/la-fi-apple-iphone-20100810">Antennagate</a>), it&#8217;s time to be concerned. Yes, I know I&#8217;m totally defending Google here. I told you, I&#8217;m biased.</p>
<p>It might sound like I don&#8217;t care about net neutrality, but nothing could be further from the truth. People are absolutely right when they say that the Internet is the most democratic medium ever conceived, and it&#8217;s really important that it stays that way. The Internet is big business, and these days it&#8217;s dominated by big businesses with a lot of influence and a lot of money. As citizens of a democracy, we have every right (and, some may argue, the responsibility) to be outraged when a large, powerful entity looks like it&#8217;s trying to gain control of a fundamentally democratic communications medium like the Internet. I just don&#8217;t think that this announcement represents anything close to such a power grab.</p>
<p>And that is my opinion on the subject. Release the trolls!</p>
]]></content:encoded>
			<wfw:commentRss>http://alexras.info/2010/08/10/brief-thoughts-on-verizongoogle-neutrality-announcement/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>The Death of the KVM Switch</title>
		<link>http://alexras.info/2010/06/23/the-death-of-the-kvm-switch/</link>
		<comments>http://alexras.info/2010/06/23/the-death-of-the-kvm-switch/#comments</comments>
		<pubDate>Thu, 24 Jun 2010 02:07:18 +0000</pubDate>
		<dc:creator>Alex</dc:creator>
				<category><![CDATA[Computers]]></category>

		<guid isPermaLink="false">http://alexras.info/?p=408</guid>
		<description><![CDATA[This post is the first in a series tentatively titled &#8220;First-World Problems: How I Use Way Too Many Computers&#8221;. It&#8217;s true, I use and administrate way too many computers. Many times, I&#8217;ve had to interact with multiple different computers at a time, whether it&#8217;s to download patches or because one machine has specialized hardware for [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://alexras.info/wp-content/uploads/2010/06/IOGear-MiniView-Micro-KVM-Switch.jpg"><img class="alignleft size-full wp-image-409" style="margin-left: 20px; margin-right: 20px;" title="KVM Switch" src="http://alexras.info/wp-content/uploads/2010/06/IOGear-MiniView-Micro-KVM-Switch.jpg" alt="" width="368" height="221" /></a>This post is the first in a series tentatively titled &#8220;First-World Problems: How I Use Way Too Many Computers&#8221;. It&#8217;s true, I use and administrate way too many computers. Many times, I&#8217;ve had to interact with multiple different computers at a time, whether it&#8217;s to download patches or because one machine has specialized hardware for a particular task. It&#8217;s sometimes useful for those computers to share a keyboard and mouse, particularly so I don&#8217;t have to switch back and forth between two keyboards all the time. Traditionally, people have accomplished this with KVM (Keyboard, Video and Mouse) switches. A KVM switch has two or more input connections and an output connection; simply hook your computers to the inputs and your keyboard, mouse and display to the output and viola, you can share them.</p>
<p>I&#8217;m going to assert that KVM switches are awful. There are a couple reasons why:</p>
<ol>
<li>You have to switch back and forth between machines with a key combo. Often, this combo is not documented anywhere on the switch itself. Almost always, it&#8217;s non-modifiable. Always, it&#8217;s cumbersome.</li>
<li>KVM switches are stuck in 1997. Most KVM switches use <a href="http://en.wikipedia.org/wiki/PS/2_connector">PS/2</a> and <a href="http://en.wikipedia.org/wiki/VGA_connector">VGA</a> connectors. Getting this to work with computers that use USB and DVI requires a bunch of separate dongles that only nerds like me have in abundance. Good luck finding a native USB/DVI KVM switch for under $150.</li>
<li>More cables. Seriously, I&#8217;ve got enough cables cluttering up the back of my desk, I&#8217;d rather not introduce more cables if I can avoid it.</li>
</ol>
<p>Thankfully, there are software solutions that allow you to bypass the need for a KVM switch altogether.</p>
<p><a href="http://synergy2.sourceforge.net/">Synergy</a> allows you to use a single keyboard and mouse among an arbitrary collection of computers. Synergy runs a server on the machine with the keyboard and mouse attached and clients on all the other machines. The user specifies how the displays of these multiple machines are arranged with respect to one another; for example, I could say that my laptop&#8217;s display is to the left of my workstation&#8217;s display. Synergy detects when the mouse hits the edge of a display and &#8220;switches&#8221; the keyboard and mouse from one computer to another based on the configured arrangement. So when my mouse hits the left edge of my workstation&#8217;s display, it is seamlessly transferred to the right edge of my laptop&#8217;s display. I&#8217;ve used Synergy this way for a while now, and I&#8217;ll never even think of buying a KVM just to share a keyboard and mouse again.</p>
<p>Of course, Synergy doesn&#8217;t take care of sharing a single display between multiple computers. Most monitors have multiple inputs, and if you&#8217;re willing to press the input change button, Synergy might still work, but it&#8217;s still cumbersome. Another alternative is to use <a href="http://www.realvnc.com/">VNC</a>. VNC is a communications protocol, and is implemented by a ton of different clients for all platforms (Google &#8220;VNC&#8221; for a list of the big ones). It essentially allows you to view and control another computer remotely. Those of you running Mac OS X Snow Leopard will probably use Screen Sharing for this, but under the covers it&#8217;s still VNC.</p>
<p>Both these solutions are cross-platform, pretty easy to set up and have a wide range of graphical helper applications and front-ends. They share the common disadvantage that they send data unencrypted, which means that any enterprising hacker could view your keystrokes as they travel over the network. Thankfully, it&#8217;s easy to solve this problem. There are a number of applications that will create a secure <em>tunnel</em> between two computers (Google &#8220;SSH tunnel&#8221; for more information). Alternative protocols to VNC like <a href="http://en.wikipedia.org/wiki/NX_technology">NX</a> provide all the functionality of VNC over an encrypted connection. There are a lot of options, and the best part is that almost all of them are <em>free</em>.</p>
<p>So in short, if you&#8217;re thinking of buying a KVM, save $100 in cables and dongles and use software instead.</p>
]]></content:encoded>
			<wfw:commentRss>http://alexras.info/2010/06/23/the-death-of-the-kvm-switch/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Wolfram Alpha is My Master Now</title>
		<link>http://alexras.info/2010/06/06/wolfram-alpha-is-my-master-now/</link>
		<comments>http://alexras.info/2010/06/06/wolfram-alpha-is-my-master-now/#comments</comments>
		<pubDate>Mon, 07 Jun 2010 03:22:30 +0000</pubDate>
		<dc:creator>Alex</dc:creator>
				<category><![CDATA[Computers]]></category>

		<guid isPermaLink="false">http://alexras.info/?p=401</guid>
		<description><![CDATA[Part of my research lately has involved asking a lot of questions like &#8220;What&#8217;s 100 TB / X / (N*D) in MB per second?&#8221; and &#8220;What&#8217;s the amount of time it takes for a 7200 RPM disk to go through half a revolution?&#8221; (reasons for this will be revealed later). Google Calculator is great for [...]]]></description>
			<content:encoded><![CDATA[<p>Part of my research lately has involved asking a lot of questions like &#8220;What&#8217;s 100 TB / X / (N*D) in MB per second?&#8221; and &#8220;What&#8217;s the amount of time it takes for a 7200 RPM disk to go through half a revolution?&#8221; (reasons for this will be revealed later). Google Calculator is great for this. If you&#8217;ve never heard of Google Calculator, that&#8217;s because it&#8217;s built into Google Search. Try going to Google and search for &#8220;10 hectares in square parsecs&#8221; to get an idea for what I mean. It supports tons of unit conversion formats, but it&#8217;s lacking in support for calculations relating to bytes.</p>
<h3>Megabytes or Mibibytes?</h3>
<p>As a bit of exposition: a common question when buying hard drives is &#8220;I just bought a 500 GB drive but it only has 465 GB of capacity when I hook it to my computer. I want my extra space back!&#8221; This discrepancy isn&#8217;t because hard drive companies want to screw you over (OK, they might be trying to screw you over, but not with this), it has to do with how computer science deals with bytes. In a network setting, measurement is typically done in powers of 10, so a gigabyte is 1000 megabytes. With storage, measurement is typically done in powers of 2, so a gigabyte is 1024 megabytes. So when you buy a 500 GB drive, your computer will tell you it&#8217;s a 465.7 GB drive because they gave you the powers-of-10 capacity and the OS displays it in powers-of-two. I know that Snow Leopard no longer does this to avoid confusion, but I&#8217;m not sure what Windows 7 does.</p>
<p>In an effort to resolve the confusion, the International Electrotechnical Commission (IEC) instituted a set of units of measurement that used powers of two, and kept powers of ten as the default. So according to IEC, a megabyte is 1000 kilobytes, and a <em>mibibyte</em> is 1000 <em>kibibytes. </em>The &#8216;-&#8217;-bi&#8217; was supposed to invoke the word &#8220;binary&#8221; in the user&#8217;s mind. Personally I think they deliberately did this to make computer scientists sound ridiculous. Once you get up high enough you hit <em>yobibytes, </em>for Pete&#8217;s sake; that sounds like something you&#8217;d give Scooby Doo&#8217;s second-cousin Yobi Doo to make him cooperate.</p>
<p>Google Calculator deals explicitly in IEC units, but doesn&#8217;t follow the standard: if you ask it &#8220;how many bytes in a yottabyte&#8221; and &#8220;how many bytes in a yobibyte&#8221;, you get the same answer. This is intensely irritating if you care about powers of ten when you&#8217;re dealing with bytes.</p>
<h3>Enter Wolfram Alpha</h3>
<p><a title="Wolfram Alpha" href="http://www.wolframalpha.com/">Wolfram Alpha</a> is basically a thin veneer on top of Mathematica that allows you to access some of its simpler functionality for free. Mathematica is a mathematical toolbox that is so absurdly sophisticated and full-featured that I&#8217;m expecting it to gain sentience any minute. Just to give you an idea, the Mathematica documentation &#8211; complete with typesetting and figures &#8211; was written <em>entirely</em> in Mathematica. Scary.</p>
<p>I was hunting around for an alternative to Google Calculator&#8217;s unit conversion (and considering writing my own, such was my level of desperation) when I decided to ask Alpha. After all, you can ask Alpha <a href="http://www.wolframalpha.com/input/?i=how+many+roads+must+a+man+walk+down+before+you+can+call+him+a+man%3F">&#8220;How many roads must a man walk down before you can call him a man?&#8221;</a> so it must be able to do unit conversion, right? Turns out it can, and it honors the IEC specification! So if I ask it &#8220;how many bytes in a kilobyte&#8221;, not only will it give me powers of ten, it will ask me if that&#8217;s what I wanted and suggest kibibytes as an alternative!</p>
<p>It can also convert between decimal, binary (twos-compliment and unsigned), hex and octal. Hot damn.</p>
]]></content:encoded>
			<wfw:commentRss>http://alexras.info/2010/06/06/wolfram-alpha-is-my-master-now/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Esoteric Tip of the Day #1: Dead Man&#8217;s Check</title>
		<link>http://alexras.info/2009/12/12/esoteric-tip-of-the-day-1-dead-mans-check/</link>
		<comments>http://alexras.info/2009/12/12/esoteric-tip-of-the-day-1-dead-mans-check/#comments</comments>
		<pubDate>Sat, 12 Dec 2009 17:00:38 +0000</pubDate>
		<dc:creator>Alex</dc:creator>
				<category><![CDATA[Computers]]></category>

		<guid isPermaLink="false">http://alexras.info/?p=375</guid>
		<description><![CDATA[I&#8217;m responsible for the care and feeding of way too many computers. I say &#8220;way too many&#8221; because the probability of one of your computers doing something stupid on a Friday night increases in proportion to the number of computers that can do something stupid. Most of the time, the stupidity is routine (&#8220;Oh hey, [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;m responsible for the care and feeding of way too many computers. I say &#8220;way too many&#8221; because the probability of one of your computers doing something stupid on a Friday night increases in proportion to the number of computers that can do something stupid. Most of the time, the stupidity is routine (&#8220;Oh hey, what a surprise! Firefox is using all my RAM!&#8221;) but every so often, they surprise you. I&#8217;m going to post something here whenever I manage to fix one of these more &#8220;WTF&#8221;-type errors under the heading <strong>Esoteric Tip of the Day</strong>. Chances are you won&#8217;t care, but someone Google searching might, and I want to make this sort of information easy to find so that others won&#8217;t have to endure this same issue.</p>
<p>I noticed a couple days ago that my Mac mini (which acts as a storage server but will probably be doing more media serving once I get a better TV) was not visible to the rest of my home network. It turns out that the mini&#8217;s network interface was having serious issues, because the mini couldn&#8217;t even get an IP address. Doing a little digging into the log, I found a lot of log segments that look like this:</p>
<pre class="brush:plain">
kernel  AppleYukon2: error - FATAL: SkGeStopPort() does not terminate (Rx)
kernel  AppleYukon2: error - Event queued in Init Level 0
configd[14] network configuration changed.
Firewall[66]  krb5kdc is listening from :::88 proto=6
Firewall[66]  krb5kdc is listening from 0.0.0.0:88 proto=6
kernel  Ethernet [AppleYukon2]: Link up on en0, 100-Megabit, Full-duplex, Symmetric flow-control, Debug [796d,6c0c,0de1,0200,4de1,4000]
configd[14] network configuration changed.
Firewall[66]  krb5kdc is listening from :::88 proto=6
Firewall[66]  krb5kdc is listening from 0.0.0.0:88 proto=6
kernel  AppleYukon2: 00000000,00000000 sk98nif - deadmanCheck - nothing received, soft reset of chip
kernel  AppleYukon2: 00000000,00000000 sk98nif - deadmanCheck - nothing received, soft reset of chip
kernel  AppleYukon2: 00000000,00000000 sk98nif - deadmanCheck - nothing received, soft reset of chip
kernel  AppleYukon2: 00000000,00000000 sk98nif - deadmanCheck - nothing received, soft reset of chip
kernel  AppleYukon2: 00000000,00000000 sk98nif - deadmanCheck - nothing received, soft reset of chip
kernel  AppleYukon2: 00000000,00000000 sk98nif - deadmanCheck - still nothing received, hard reset of chip
</pre>
<p>There is only one group of people who know exactly what these messages mean, and they are the guys that wrote the AppleYukon2 driver.  Thankfully, a little Googling and some link clicking later, I had a plausible explanation. Apparently this sort of error occurs when one of the networking-related preferences that OS X stores is corrupted somehow. This apparently happened quite a bit when users upgraded to 10.5.7, and it also happened to me. The driver reads a corrupted preferences file, takes some ridiculous action and wedges the underlying hardware in some kind of bizarre state that only a reboot can correct.</p>
<p>Thankfully, OS X can regenerate its preferences files. To do this cleanly:</p>
<ul>
<li>Reboot holding down the Shift key. This will force the computer to boot in Safe Mode and (as a side-effect) rebuild its caches, which is a good thing if they&#8217;ve been populated with garbage from your corrupted preferences files, which they probably have been.</li>
<li>Delete the following files in /Library/Preferences/SystemConfiguration: NetworkInterfaces.plist, com.apple.airport.preferences.plist, com.apple.network.identification.plist</li>
<li>Reboot and re-apply your network settings (IP address, et al)</li>
</ul>
<p>Special thanks to Daniel Palmer, the poor soul who sat on the phone with Apple to get this resolved. Here&#8217;s <a href="http://discussions.apple.com/message.jspa?messageID=9505791#9505791">the thread containing the solution</a>.</p>
<p><strong>Update 3/3/10</strong>: This problem has reared its ugly head once again, and I&#8217;ve found out a little more information about it:</p>
<p>When you set the speed and duplex settings of your wired network adapter manually rather than keeping the setting at &#8220;Automatically&#8221; and you disable IPv6, the driver no longer triggers hard resets for whatever reason. In my case, it triggers soft resets at precise 6-minute intervals.</p>
<p>Also, as reader lafber pointed out, this problem only seems to occur when there is no traffic on the wired network. To solve this problem, I wrote a one-line AppleScript script. The application start a command that pings my router every 30 seconds. The command itself runs in a virtual terminal, so I don&#8217;t have to keep an application running in the foreground. The AppleScript looks like this:</p>
<p>do shell script &#8220;screen -m -d ping -i 30 192.168.1.1&#8243;</p>
<p>To get it to start at bootup, I saved that AppleScript script as an application and added the application to my default user&#8217;s Login Items in the Accounts system preference pane.</p>
]]></content:encoded>
			<wfw:commentRss>http://alexras.info/2009/12/12/esoteric-tip-of-the-day-1-dead-mans-check/feed/</wfw:commentRss>
		<slash:comments>10</slash:comments>
		</item>
		<item>
		<title>Decent Python Code Folding in TextMate</title>
		<link>http://alexras.info/2009/07/16/decent-python-code-folding-in-textmate/</link>
		<comments>http://alexras.info/2009/07/16/decent-python-code-folding-in-textmate/#comments</comments>
		<pubDate>Thu, 16 Jul 2009 18:38:53 +0000</pubDate>
		<dc:creator>Alex</dc:creator>
				<category><![CDATA[Computers]]></category>

		<guid isPermaLink="false">http://alexras.info/?p=337</guid>
		<description><![CDATA[TextMate is a great editor, and Python is a great programming languages, but they both have their limitations. One of TextMate&#8217;s nicer features is code folding, which allows you to collapse a block of code (a function, a conditional block, etc.) down to a single line in the editor. This often makes a large piece [...]]]></description>
			<content:encoded><![CDATA[<p><img class="alignleft size-full wp-image-364" title="textmate_logo" src="http://alexras.info/wp-content/uploads/2009/07/textmate_logo.jpg" alt="textmate_logo" width="163" height="146" /><a title="TextMate" href="http://www.macromates.com/">TextMate</a> is a great editor, and <a title="Python" href="http://python.org/">Python</a> is a great programming languages, but they both have their limitations.</p>
<p>One of TextMate&#8217;s nicer features is code folding, which allows you to collapse a block of code (a function, a conditional block, etc.) down to a single line in the editor. This often makes a large piece of code much easier to navigate. TextMate determines where code can be folded by evaluating each line of the code and tagging particular lines with start and end markers.</p>
<p>Doing code folding for Python in this method (only considering a single line at a time) is impossible, since the only clear end of a function in Python is a reduction in indentation level on the next line. For example, here&#8217;s a function in C followed by a statement:</p>
<pre class="brush:python">int foo(int value) {
   printf("%d", value + 5);
}

foo(24);</pre>
<p><br/>Here&#8217;s the same code written in Python:</p>
<pre class="brush:python">def foo(value):
   print "%d" % (value + 5)

foo(24)</pre>
<p><br/>As you can see, if you look at the code one line at a time, it&#8217;s not clear where the definition of foo in Python ends, whereas the closing curly brace (}) is clearly the end of foo&#8217;s definition in C.</p>
<p>By default, TextMate punts: it defines the start of a function or class definition as the start of a foldable region and the first subsequent blank line as the end of that foldable region.  This doesn&#8217;t really work well, because function definitions without any blank lines aren&#8217;t really readable past a certain size.</p>
<p>There is, however, a way to hack your way around this issue. Another of TextMate&#8217;s killer features is that you can customize almost everything, including the definition for a given language.</p>
<p>Open the Language Editor through the &#8220;Bundles &gt; Bundle Editor &gt;Edit Languages &#8230;&#8221; menu item (as of TextMate 1.5.8, anyway).</p>
<p>Pull up the language editor for Python, find a line that looks like this:</p>
<pre class="brush:cpp">foldingStopMarker = '^\s*$|^\s*\}|^\s*\]|^\s*\)|^\s*"""\s*$';</pre>
<p><br/>and replace it with this:</p>
<pre class="brush:cpp">foldingStopMarker = '^\s*#\s*END_DEF ([a-zA-Z0-9_&lt;]+)';</pre>
<p><br/>Now, if you want to fold a function definition in Python, stick a comment at the end of it:</p>
<pre class="brush:python">def foo(value):
   print "%d" % (value + 5)
#END_DEF foo</pre>
<p><br/>Hope fully this helps out some of you who are using TextMate for Python programming.</p>
]]></content:encoded>
			<wfw:commentRss>http://alexras.info/2009/07/16/decent-python-code-folding-in-textmate/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Dealing with WordPress Database Inconsistency</title>
		<link>http://alexras.info/2009/05/20/dealing-with-wordpress-database-inconsistency/</link>
		<comments>http://alexras.info/2009/05/20/dealing-with-wordpress-database-inconsistency/#comments</comments>
		<pubDate>Thu, 21 May 2009 01:00:24 +0000</pubDate>
		<dc:creator>Alex</dc:creator>
				<category><![CDATA[Computers]]></category>

		<guid isPermaLink="false">http://alexras.info/?p=332</guid>
		<description><![CDATA[I just finished wrestling with a problem with WordPress. Editing a really old page tickled some sort of internal inconsistency in the database, which created a zombie page that could neither be edited nor deleted. I really wasn&#8217;t looking forward to crawling around in the database, so I did some googling and came up with [...]]]></description>
			<content:encoded><![CDATA[<p>I just finished wrestling with a problem with WordPress. Editing a really old page tickled some sort of internal inconsistency in the database, which created a zombie page that could neither be edited nor deleted. I really wasn&#8217;t looking forward to crawling around in the database, so I did some googling and came up with Lester Chan&#8217;s brilliant <a title="WP-DBManager Homepage" href="http://lesterchan.net/wordpress/readme/wp-dbmanager.html">WP-DBManager</a>. One click of the &#8220;Repair&#8221; button and allowed me to deliver the deathblow to the zombie page, saving me a boatload of time in the process. Thanks, Lester!</p>
]]></content:encoded>
			<wfw:commentRss>http://alexras.info/2009/05/20/dealing-with-wordpress-database-inconsistency/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Preventing data loss</title>
		<link>http://alexras.info/2009/01/21/preventing-data-loss/</link>
		<comments>http://alexras.info/2009/01/21/preventing-data-loss/#comments</comments>
		<pubDate>Thu, 22 Jan 2009 04:01:42 +0000</pubDate>
		<dc:creator>Alex</dc:creator>
				<category><![CDATA[Computers]]></category>

		<guid isPermaLink="false">http://alexras.info/?p=320</guid>
		<description><![CDATA[I&#8217;ve always been the sort of person that saves receipts. Until very recently, I had an entire filing box full of receipts, warranty cards and software license keys. This system bothered me in much the same way that keeping paper copies of research papers did: they can&#8217;t be searched (did I file the receipt for [...]]]></description>
			<content:encoded><![CDATA[<p style="text-align: center;"><img class="size-full wp-image-322 aligncenter" title="Smokey bear" src="http://alexras.info/wp-content/uploads/2009/01/d834smokey-bear-only-you-posters.jpg" alt="OK, so it's not a forest fire, but you get the point." width="353" height="450" /></p>
<p>I&#8217;ve always been the sort of person that saves receipts. Until very recently, I had an entire filing box full of receipts, warranty cards and software license keys. This system bothered me in much the same way that <a title="Previous post &quot;My Digital Transition&quot;" href="http://alexras.info/2008/11/01/my-digital-transition/">keeping paper copies of research papers</a> did: they can&#8217;t be searched (did I file the receipt for my coffee table under C for coffee table, T for table, I for Ikea, F for furniture?), and they take up space in my apartment, where space is pretty limited. There&#8217;s the additional problem of a paper receipt&#8217;s relative fragility: there&#8217;s only one copy of it, and it can be burned, crumpled, crushed, soaked, can fade into unreadability, and so on. The solution was pretty straightforward; I scanned everything in the box, gave them descriptive file names and let Spotlight index them.  To provide some additional protection against data loss, I burned two copies of the newly-scanned PDFs onto two separate DVDs and mailed one to my parents. This got me thinking; sure, this way it&#8217;s much less likely that my important documents will be destroyed in the event of a disaster. Really though, how safe is my data? More importantly, how safe can my data really be?</p>
<p>Some studies point to the fact that the lifespan of recordable CDs and DVDs is quite short (in the neighborhood of three to five years), which means that any &#8220;permanent&#8221; storage on DVDs would need to be refreshed on about that interval to remain current. Now, given that most of what I burned on those DVDs don&#8217;t need to be kept for more than five years, that shouldn&#8217;t really be a problem. Also, these are kept in relatively controlled conditions &#8211; no direct sunlight, ambient temperature where they are doesn&#8217;t get much colder than about 55 or much hotter than about 100. But what about things like photos, home videos? Stuff that is irreplaceable and would need to be stored over a period of, say, decades?</p>
<p>Every data retention scheme you can name has its breaking point, some condition that could irretrievably kill your data. In my opinion, the important factors are the likelihood and inevitability of the failure and if the failure can be proactively avoided. Let&#8217;s take a look at a few ways to store data sorted from least paranoid to &#8220;tin-foil hat&#8221; paranoid.</p>
<p><strong>Single disk:<br />
</strong></p>
<ul>
<li>Data is lost when: the disk fails.</li>
<li>How likely/inevitable is this?: All disks will fail, it&#8217;s just a matter of when.</li>
<li>Proactive avoidance?: Unless you go to some outside storage source, none.</li>
</ul>
<p>Scarily, this is what most people are relying on. Professional drive recovery companies might be able to get your data off the disk, but it will cost a pretty penny.</p>
<p><strong>RAID array (multiple, redundant disks):</strong></p>
<ul>
<li>Data is lost when:
<ul>
<li>All redundant disks fail before the array can be rebuilt. Especially heinous if your disks all croak of the same hardware problem, or your power supply kills them by catching on fire.</li>
<li>(Hardware RAID only) RAID controller fails, no replacement or equivalent controller can be found</li>
</ul>
</li>
<li>How likely/inevitable is this?: With enough diligence (and enough backup disks), this shouldn&#8217;t be too likely.</li>
<li>Proactive avoidance?: More redundant disks, software RAID, quick monitoring and early detection of drive errors, always having a spare drive or two handy.</li>
</ul>
<p><strong>Burning to CD/DVD:</strong></p>
<ul>
<li>Data is lost when: the disk becomes unreadable (crushed, melted, thoroughly scratched, hacked into un-spinnable chunks, or some other loss of structural integrity)</li>
<li>How likely/inevitable is this?: Some might argue that it will happen eventually, but it&#8217;s a lot less likely than your disk failing, especially if you don&#8217;t expect to touch the data itself frequently.</li>
<li>Proactive avoidance?: More copies, stored in more places. Re-burning periodically.</li>
</ul>
<p><strong>Backup to off-site computer/external disk that&#8217;s kept somewhere else:</strong></p>
<ul>
<li>Data is lost when: both the storage system storing the original and the storage system storing the backup fail<strong> </strong>before an additional backup can be brought online</li>
<li>How likely/inevitable is this?: Unless you&#8217;re not paying attention to your backup for long periods of time or there&#8217;s a nuclear war, you&#8217;re probably OK. The amount of time you have to react depends, of course, on the storage setup of the two machines.</li>
<li>Proactive avoidance?: More than one backup, as widely distributed geographically as you can afford.</li>
</ul>
<p><strong>Cloud Storage (Amazon&#8217;s S3, others):</strong></p>
<ul>
<li>Data is lost when: hopefully never. Companies providing cloud storage services spend a lot of money making sure that this doesn&#8217;t ever happen. Amazon&#8217;s SLA for S3 doesn&#8217;t even mention data loss, just the minimum amount of time they guarantee that the service will be available per year.</li>
<li>How likely/inevitable is this?: Much like the nuclear war scenario, if S3 loses data it will probably be on the news, at least in the Silicon Valley.</li>
<li>Proactive avoidance?: Multiple storage clouds, owned by multiple vendors. This is truly the peak of tinfoil-hat paranoia.</li>
</ul>
<p>In my opinion, there are only two real downsides to the cloud storage approach. The first is that upload bandwidth, for most residential Internet customers in the United States, just plain sucks, and uploading a non-trivial amount of data is painfully slow. Fiber to the home (and a technology-friendly executive branch) might change this, but it won&#8217;t happen in the immediate future. Second, S3 costs money, both to upload data and to store it there. If you&#8217;re not willing (or able) to pay the bill, this isn&#8217;t for you.</p>
<p>This is by no means an exhaustive list, and there are a lot of hybrid approaches. I back up my computer&#8217;s hard drives to external drives periodically, and those drives spend most of their time in my desk drawer. My various media (photos, music, digital copies of DVDs) are stored on a software RAID-1 in the media center PC. As an additional layer of protection, all my photos are on Flickr, all my music is synchronized with my iPod fairly regularly and my DVDs are, well, DVDs.</p>
<p>This setup, while pretty decent, is by no means foolproof. One major concern that I haven&#8217;t talked about here is data corruption, and I&#8217;ve got pretty much zero defense against that. Once Apple releases Snow Leopard, hopefully I&#8217;ll be able to transfer all my data over to ZFS volumes. I could nerd out over ZFS for a whole other post, but the short of it is that ZFS makes far fewer assumptions about data&#8217;s integrity and comes pretty close to eliminating the data corruption problem.</p>
]]></content:encoded>
			<wfw:commentRss>http://alexras.info/2009/01/21/preventing-data-loss/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>Automatic Everything</title>
		<link>http://alexras.info/2008/08/21/automatic-everything/</link>
		<comments>http://alexras.info/2008/08/21/automatic-everything/#comments</comments>
		<pubDate>Thu, 21 Aug 2008 07:21:59 +0000</pubDate>
		<dc:creator>Alex</dc:creator>
				<category><![CDATA[Computers]]></category>
		<category><![CDATA[Ranting]]></category>

		<guid isPermaLink="false">http://alexras.info/?p=281</guid>
		<description><![CDATA[This was going to be an extended rant on how people use databases where people shouldn&#8217;t use databases, but the more I wrote the more I realized that this had been analyzed quite a bit by many in the systems research community and blogosphere at large, many members of which are far more knowledgeable than [...]]]></description>
			<content:encoded><![CDATA[<p style="text-align: center;"><a href="http://alexras.info/wp-content/uploads/2008/08/failwhale.png"><img class="size-full wp-image-282 aligncenter" title="Fail Whale" src="http://alexras.info/wp-content/uploads/2008/08/failwhale.png" alt="" width="288" height="216" /></a></p>
<p>This was going to be an extended rant on how people use databases where people shouldn&#8217;t use databases, but the more I wrote the more I realized that this had been analyzed quite a bit by many in the systems research community and blogosphere at large, many members of which are far more knowledgeable than I. So I&#8217;ll summarize my rant in a paragraph and then move onto more philosophical, &#8220;meta&#8221;-type comments.</p>
<p>Twitter&#8217;s architecture (as much as they&#8217;ve shown us) is a Ruby on Rails app backed by a MySQL database. This combination is the Golden Hammer of Web 2.0. A frighteningly large number of web application developers seem to follow the mantra, &#8220;If I need to store data, use SQL as a Big-Ass Table (no, not <em>that</em> <a href="http://www.engadget.com/2007/06/20/microsoft-surface-one-day-your-computer-will-be-a-big-ass-table/">Big-Ass Table</a>). Who needs high-speed middleware? I&#8217;ll write everything in Ruby!&#8221; The problem is that schema design is as close to alchemy as CS gets and tuning databases is tedious and hard to do right. If you are writing something that must process tens of thousands of messages a day, do not think you can write it in an interpreted language and have it frequently converse with a database. If you think this will work, you are living in a magical dream world. I&#8217;m talking directly to you, Twitter, you poor sad whipping boy of the Web 2.0 universe. Please, for your own sake, rewrite Starling in C or C++ and use a more suitable back-end.</p>
<p>That concludes the synopsis of my multi-page rant of doom. Now, for the meta: if I were to write an essay for NPR&#8217;s This I Believe, the following would be that essay.</p>
<p>I believe in telling systems what I want, not how to get it, and having them give it to me as quickly as possible. I believe that programmers are lazy, and that middleware should give them the ability to do the right thing the easy way. I believe in intrinsic scalability and building on sound principles. I believe that the disk is evil and writing to it should be avoided until you have no other choice. I believe in most of what databases do and in the potential of what their descendant systems can and will do.</p>
<p>I believe in the awesome potential of automatic <em>everything</em>.</p>
]]></content:encoded>
			<wfw:commentRss>http://alexras.info/2008/08/21/automatic-everything/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Messing with Thom Yorke&#8217;s head</title>
		<link>http://alexras.info/2008/07/25/messing-with-thom-yorkes-head/</link>
		<comments>http://alexras.info/2008/07/25/messing-with-thom-yorkes-head/#comments</comments>
		<pubDate>Fri, 25 Jul 2008 05:45:38 +0000</pubDate>
		<dc:creator>Alex</dc:creator>
				<category><![CDATA[Computers]]></category>
		<category><![CDATA[Fun and Games]]></category>

		<guid isPermaLink="false">http://alexras.info/?p=257</guid>
		<description><![CDATA[Radiohead&#8217;s latest music video was shot without cameras. Instead, they used a combination of reflected light and lasers to generate clouds of points in 3D. Google was nice enough to provide the rest of the world with some of the 3D point cloud data collected for that music video. A big piece of that data [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://code.google.com/creative/radiohead/">Radiohead&#8217;s latest music video</a> was shot without cameras. Instead, they used a combination of reflected light and lasers to generate clouds of points in 3D. Google was nice enough to provide the rest of the world with some of the 3D point cloud data collected for that music video. A big piece of that data is about 2100 frames of lead singer Thom Yorke&#8217;s head. A frame of the original data (when output via <a href="http://www.processing.org/">Processing</a>) looks like this:</p>
<p style="text-align: center;"><a href="http://alexras.info/wp-content/uploads/2008/07/0192.png"><img class="size-full wp-image-259 aligncenter" title="Raw Radiohead Input" src="http://alexras.info/wp-content/uploads/2008/07/0192.png" alt="" width="400" height="400" /></a></p>
<p style="text-align: left;">If you look closely, you&#8217;ll notice that the point cloud is really noisy around the edges. A simple high-pass filter later and that same frame looks like this:</p>
<p style="text-align: center;">
<p style="text-align: center;"><a href="http://alexras.info/wp-content/uploads/2008/07/0192_threshold.png"><img class="size-full wp-image-260 aligncenter" title="Radiohead Data - Threshold Applied" src="http://alexras.info/wp-content/uploads/2008/07/0192_threshold.png" alt="" width="400" height="400" /></a></p>
<p style="text-align: left;">That&#8217;s a little more manageable. I figured, why stop at point when you can have 3D surfaces? One of the more straightforward ways to make a 3D surface out of a bunch of points is to stick a bunch of triangles in between the points, creating what&#8217;s called a <a href="http://en.wikipedia.org/wiki/Delaunay_triangulation">Delaunay triangulation</a>. This is a <em>really</em> compute-intensive calculation and I don&#8217;t exactly have a supercomputer on hand, so I did a lot of fudging and approximation. Even with all that fudging, each of these frames took as much as 5 minutes to render. This process has been running for most of last week while I&#8217;ve been at work. That same frame above looks like this when Delaunay-triangulated:</p>
<p style="text-align: center;"><a href="http://alexras.info/wp-content/uploads/2008/07/0192_delaunay.png"><img class="size-full wp-image-261 aligncenter" title="Radiohead - Delaunay Triangulation Applied" src="http://alexras.info/wp-content/uploads/2008/07/0192_delaunay.png" alt="" width="400" height="400" /></a></p>
<p style="text-align: left;">Notice that it&#8217;s a little noisy, which is mainly due to some approximation on my part as well as some leftover noise in the point cloud. The video below shows what happens when you sequence all 2100 frames together. Enjoy!</p>
<p style="text-align: center;"><object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" width="400" height="400" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0"><param name="allowfullscreen" value="true" /><param name="allowscriptaccess" value="always" /><param name="src" value="http://www.vimeo.com/moogaloop.swf?clip_id=1404285&amp;server=www.vimeo.com&amp;show_title=0&amp;show_byline=0&amp;show_portrait=0&amp;color=00ADEF&amp;fullscreen=1" /><embed type="application/x-shockwave-flash" width="400" height="400" src="http://www.vimeo.com/moogaloop.swf?clip_id=1404285&amp;server=www.vimeo.com&amp;show_title=0&amp;show_byline=0&amp;show_portrait=0&amp;color=00ADEF&amp;fullscreen=1" allowscriptaccess="always" allowfullscreen="true"></embed></object></p>
]]></content:encoded>
			<wfw:commentRss>http://alexras.info/2008/07/25/messing-with-thom-yorkes-head/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>This is the future &#8211; why are my updates still failing?</title>
		<link>http://alexras.info/2008/07/12/this-is-the-future-why-are-my-updates-still-failing/</link>
		<comments>http://alexras.info/2008/07/12/this-is-the-future-why-are-my-updates-still-failing/#comments</comments>
		<pubDate>Sat, 12 Jul 2008 00:16:33 +0000</pubDate>
		<dc:creator>Alex</dc:creator>
				<category><![CDATA[Computers]]></category>
		<category><![CDATA[Ranting]]></category>

		<guid isPermaLink="false">http://alexras.info/?p=227</guid>
		<description><![CDATA[So anyone who has an iPhone or iPod Touch will be pretty aware that Apple&#8217;s update servers basically fell over in response to all the demand today due to the new iPhone firmware. Recently, Firefox&#8217;s update servers suffered exactly the same problem. Now I&#8217;m sure that these guys have a really expensive load balancer in front [...]]]></description>
			<content:encoded><![CDATA[<p><img class="alignleft size-full wp-image-228" style="padding-right: 10px;" title="softwareupdate" src="http://alexras.info/wp-content/uploads/2008/07/softwareupdate.png" alt="Software Updates are Broken" width="137" height="132" />So anyone who has an iPhone or iPod Touch will be pretty aware that Apple&#8217;s update servers basically <a href="http://arstechnica.com/news.ars/post/20080711-launch-woes-turn-iphone-parousia-into-activation-apocalypse.html">fell over</a> in response to all the demand today due to the new iPhone firmware. Recently, Firefox&#8217;s update servers <a href="http://www.techcrunch.com/2008/06/17/its-firefox-3-world-record-download-day-but-im-still-waiting/">suffered exactly the same problem</a>. Now I&#8217;m sure that these guys have a really expensive load balancer in front of their update server cluster, but why in the world are so many major companies still having all their users go to a single place for updates?</p>
<p>If I want to download an update from Software Update today on my home computers, I have to do it three times - once for my Mac Mini (file server/backup server/media center), once for my laptop and once for my tower. The actual update binary is, in most cases, identical. If I wanted to only download the update once, I&#8217;d have to find where Software Update keeps the update&#8217;s installer file, copy it to the other machines and run it there. In some cases I have to download tens or hundreds of megabytes of file that could easily be transferred over my home network, saving both my time and the update provider&#8217;s money.</p>
<p>The thing that&#8217;s the most irritating about this is that it&#8217;s a completely solved problem. Blizzard, for example, distributes updates to World of Warcraft over Bittorrent. My roommate just started playing WoW again and had to install a patch (~2 GB) on two of his computers. He downloaded and installed the patch on the first computer, which took about an hour and a half. The download-and-install process for the second computer took all of about five minutes because the computer automatically recognized that a source for the update existed on its local network and downloaded the file peer-to-peer from the other machine.</p>
<p>Imagine if everyone interested in downloading the iPhone patch could download it not only from Apple but from each other. After the first few hundred downloads (which would have to pull directly from Apple) most of the remaining transfer would be peer-to-peer. If iTunes needs to authenticate the phone with Apple before installing, that&#8217;s fine; the load on the servers from authorization would be far lower and of a much shorter duration than the load from patch downloading. Security, of course, is an issue with Bittorrent-esque downloads, but there are relatively straightforward ways to deal with that.</p>
<p>I&#8217;m just saying it&#8217;s about time that someone did something about this, because it&#8217;s getting a little ridiculous.</p>
]]></content:encoded>
			<wfw:commentRss>http://alexras.info/2008/07/12/this-is-the-future-why-are-my-updates-still-failing/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
