<?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; Advice (Unsolicited)</title>
	<atom:link href="http://alexras.info/category/advice/feed/" rel="self" type="application/rss+xml" />
	<link>http://alexras.info</link>
	<description>Yelling about computers to an empty room since 1999</description>
	<lastBuildDate>Sun, 13 May 2012 06:01:08 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.2</generator>
		<item>
		<title>Esoteric Tip #7: SSH Agent Forwarding and Screen Sessions</title>
		<link>http://alexras.info/2012/03/03/esoteric-tip-7-ssh-agent-forwarding-and-screen-sessions/</link>
		<comments>http://alexras.info/2012/03/03/esoteric-tip-7-ssh-agent-forwarding-and-screen-sessions/#comments</comments>
		<pubDate>Sat, 03 Mar 2012 21:41:35 +0000</pubDate>
		<dc:creator>Alex</dc:creator>
				<category><![CDATA[Esoteric Tips]]></category>

		<guid isPermaLink="false">http://alexras.info/?p=1136</guid>
		<description><![CDATA[I used to have distinct, passwordless SSH key pairs on every machine I used. Once this was in place, I could access any machine from any other without entering a password. Turns out that this wasn&#8217;t a good idea; someone got access to one of my publicly-routable machines, grabbed one of my key pairs, and [...]]]></description>
			<content:encoded><![CDATA[<p>I used to have distinct, passwordless SSH key pairs on every machine I used. Once this was in place, I could access any machine from any other without entering a password. Turns out that this wasn&#8217;t a good idea; someone <a href="http://alexras.info/2011/10/16/secure-your-ssh-keys/">got access to one of my publicly-routable machines</a>, grabbed one of my key pairs, and suddenly had the keys to the kingdom. My immediate reaction was to purge all key pairs and set up new, stronger ones that were protected by passwords, using <code>ssh-agent</code> to limit the number of times I&#8217;d have to enter a password to authenticate.</p>
<p><code>ssh-agent</code> by itself is a pretty good solution, but agent forwarding is what makes it truly effective. In a nutshell, SSH agent forwarding routes any authentication requests back to your <code>ssh-agent</code> instance, rather than handling them on the machine itself. I won&#8217;t retread an explanation of how agent forwarding works, since <a href="http://unixwiz.net/techtips/ssh-agent-forwarding.html#agent">unixwiz.net has already provided a great explanation</a>. Agent forwarding is particularly useful because it limits the number of key pairs you have to create; you can essentially use a single key pair for every machine that you&#8217;ve authorized (and that has agent forwarding enabled in <code>sshd</code>).</p>
<p>Unfortunately, SSH agent forwarding breaks when you introduce shells that persist after you log out, like those generated by <code>screen</code> and <code>tmux</code>. The problem is that certain environment variables set in the shell the first time you logged in with agent forwarding enabled will be stale when you log in a second time. Luckily, <a href="http://www.deadman.org/sshscreen.php">Sam Rowe has already figured out a solution to this problem</a>.</p>
<p>While Mr. Rowe&#8217;s <code>grabssh</code>/<code>fixssh</code> approach works just fine, I didn&#8217;t want to have to bother typing those commands in (or, more likely, forgetting to type them in) to keep my agent state up-to-date. Luckily, it&#8217;s not that hard to automate the process with a bash script. I&#8217;ve only automated this for <code>tmux</code> at this point, since it&#8217;s what I use pretty much all the time these days. <code>tmux</code> exports the <code>TMUX</code> environment variable to all its child shells; this gives me a convenient way to detect if I&#8217;m in a <code>tmux</code> shell or not. The script runs <code>grabssh</code> if I&#8217;m not in a <code>tmux</code> shell, and <code>fixssh</code> if I am. You can <a href="https://github.com/alexras/dotfiles/blob/03280b015ea170c65238c5847ecf6f233d341e8d/bin/updatessh">view the script on Github</a> if you&#8217;re curious.</p>
<p>Keeping the shells themselves up-to-date is fairly straightforward as well; I simply set Bash&#8217;s <code>PROMPT_COMMAND</code> environment variable to <code>source /path/to/script</code>, so it updates the environment state appropriately every time I execute a command. That might sound like a lot of overhead, but I have yet to notice it.</p>
<p><strong>Update</strong>: I&#8217;ve found a solution for <code>tmux</code> that I think is a little more robust, especially in the case of SSH connections within <code>tmux</code> sessions (which my previous solution didn&#8217;t handle properly). In a nutshell, it relies on tmux&#8217;s environment variable forwarding functionality. To enable it, you can add</p>
<p><code>set-option -g update-environment "SSH_ASKPASS SSH_AUTH_SOCK SSH_AGENT_PID SSH_CONNECTION"</code></p>
<p>to your <code>.tmux.conf</code> file; this will export the appropriate values to the session&#8217;s environment whenever it&#8217;s reattached. Since <code>tmux</code>&#8216;s environment variable precedence rules seem to be a little weird, I had to modify my <code>updatessh</code> script to grab the appropriate SSH variables from <code>tmux show-environment</code> and export them manually. The modified script is <a href="https://github.com/alexras/dotfiles/blob/e5b0797b41a864fbc7ff6325302b68b799017fe5/bin/updatessh">also on GitHub</a>.</p>
<p>Keep in mind that a malicious root user on remote machines can gain access to your SSH agent if they know what they&#8217;re doing, so you&#8217;re taking a risk. You can always disable SSH agent forwarding by adding</p>
<p><code>ForwardAgent no</code></p>
<p>to your <code>~/.ssh/config</code> file.</p>
]]></content:encoded>
			<wfw:commentRss>http://alexras.info/2012/03/03/esoteric-tip-7-ssh-agent-forwarding-and-screen-sessions/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Secure Your SSH Keys</title>
		<link>http://alexras.info/2011/10/16/secure-your-ssh-keys/</link>
		<comments>http://alexras.info/2011/10/16/secure-your-ssh-keys/#comments</comments>
		<pubDate>Mon, 17 Oct 2011 01:23:21 +0000</pubDate>
		<dc:creator>Alex</dc:creator>
				<category><![CDATA[Advice (Unsolicited)]]></category>

		<guid isPermaLink="false">http://alexras.info/?p=973</guid>
		<description><![CDATA[Until about a week ago, I used password-less SSH key pairs. I would keep a private key on a machine and stick its corresponding public key in authorized_keys files for my accounts everywhere else so that I would be able to log into any machine from any other without using a password. I figured the [...]]]></description>
			<content:encoded><![CDATA[<p>Until about a week ago, I used password-less SSH key pairs. I would keep a private key on a machine and stick its corresponding public key in <code>authorized_keys</code> files for my accounts everywhere else so that I would be able to log into any machine from any other without using a password. I figured the only way something really bad could ever happen is if someone were to get ahold of one of my private keys &#8211; and what are the odds of that happening, right?</p>
<p>Turns out Murphy&#8217;s Law applies here too. Somehow, someone got ahold of one of my private keys last week. I won&#8217;t go into the gory details of how, mostly because I don&#8217;t <em>know</em> exactly how they did it. I spent a couple days last week frantically changing every password I have and regenerating all of my key pairs. I then <a href="http://youtu.be/2s1MspmfEwg">nuked the offending machine from orbit</a>.</p>
<p>To say the whole event was unsettling is the mother of all understatements. The fact of the matter is that I have no idea what they did, what they took or didn&#8217;t take, what files they accessed &#8230; it&#8217;s that <em>lack</em> of information that&#8217;s the most terrifying. I&#8217;m not a computer security expert by any means, but I&#8217;m not a complete layman; I took a lot of precautions on the server in question to make sure this wouldn&#8217;t happen, and it did anyway.</p>
<p>This whole event triggered a lot of research and soul-searching. Here are some thoughts/recommendations that have come out of that process.</p>
<p>One of the blogs I read on the subject said that password-less SSH keys are &#8220;like credit cards without PIN numbers&#8221;. The analogy is pretty appropriate, I think. Let my mistake serve as an example &#8211; just don&#8217;t use them. They just aren&#8217;t safe.</p>
<p>You should generate <strong>separate, strong key pairs</strong> for each machine you use. I used 1024-bit DSA keys before, but I&#8217;m using 4096-bit RSA key pairs everywhere now. 4096-bit keys have modest performance overheads relative to 2048-bit RSA keys (<code>ssh-keygen</code>&#8216;s default), and should still be really hard to compromise by brute force for the next couple decades barring some major theoretical advance or access to an enormous botnet. Nothing&#8217;s foolproof, of course, but it&#8217;s a start.</p>
<p>The keys you generate should have <strong>distinct passwords</strong>. That is, keys&#8217; passwords should be both distinct from your normal password for that machine and distinct from one another.</p>
<p><strong>Use <code>ssh-agent</code></strong> to save yourself the headache of providing a password every time. The web is littered with tutorials on how to use <code>ssh-agent</code>, so I won&#8217;t talk about that here. These days, I start an <code>ssh-agent</code> process when I log in, and make sure it gets terminated when I log out. See <a href="https://gist.github.com/1291631">this Github gist</a> for the appropriate incantations to make this happen. On OS X, it&#8217;s even easier; <code>ssh-agent</code> has been nicely integrated into Keychain and <code>launchd</code> since Leopard. Really, there&#8217;s no excuse <em>not</em> to use <code>ssh-agent</code>.</p>
<p>Finally, <strong>minimize your attack surface</strong>. If a service can run in a separate user account with no privileges, it should. If a service must run as root, run it in a sandbox. If a port doesn&#8217;t absolutely have to be open, it shouldn&#8217;t be open. If a machine can still do its job while not being world-routable, make it non-world-routable.</p>
<p>Personally, I&#8217;m done running my own publicly-visible servers. Unless you&#8217;re in the business of running and securing servers (and have the known-how to keep them secure), I just don&#8217;t see how it&#8217;s worth the trouble.</p>
]]></content:encoded>
			<wfw:commentRss>http://alexras.info/2011/10/16/secure-your-ssh-keys/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Advice for New Graduate Students</title>
		<link>http://alexras.info/2011/09/24/advice-for-new-graduate-students/</link>
		<comments>http://alexras.info/2011/09/24/advice-for-new-graduate-students/#comments</comments>
		<pubDate>Sun, 25 Sep 2011 05:00:38 +0000</pubDate>
		<dc:creator>Alex</dc:creator>
				<category><![CDATA[Advice (Unsolicited)]]></category>
		<category><![CDATA[School]]></category>

		<guid isPermaLink="false">http://alexras.info/?p=955</guid>
		<description><![CDATA[It looks like it&#8217;s about time for school to start again. Inspired by Justine&#8217;s post, I&#8217;ve decided that it&#8217;s time for yet another set of unsolicited advice for new students. This is the start of my fifth (oh jeez) year as a graduate student, so I feel that I can share some things that I [...]]]></description>
			<content:encoded><![CDATA[<p>It looks like it&#8217;s about time for school to start again. Inspired by <a href="http://lmbgp.tumblr.com/post/9392682401/this-is-the-time-of-the-year-where-you-give-advice-to">Justine&#8217;s post</a>, I&#8217;ve decided that it&#8217;s time for yet another set of unsolicited advice for new students. This is the start of my fifth (oh jeez) year as a graduate student, so I feel that I can share some things that I didn&#8217;t quite grok in the early part of my graduate career.  I apologize if any of these pieces of advice are cliched or obvious. This is particularly geared toward students in the systems and networking sub-disciplines of computer science, since that&#8217;s what I know. YMMV.</p>
<p>I&#8217;ll start with the one that all first-year graduate students hear and most completely fail to act on: <em>grades don&#8217;t matter as long as they&#8217;re good enough</em>. By this I mean that, as long as you pass, your grade in a graduate-level course does not matter at all. Nobody will ever look at your grades in graduate coursework, for internships, jobs or otherwise.</p>
<p>This will be really hard for you to accept, because you have been in the business of performing well in classes your entire life. Resist the temptation to spend more time than absolutely necessary on coursework. Make every effort to make every course project you do relevant to your research or publishable in some way. Time spent on your research is time spent productively. Time spent on anything else is time you should be spending on research (or, heaven forbid, actually enjoying yourself <em>outside</em> of work).</p>
<p>Graduate school is an emotional rollercoaster. You will have really good weeks.  Who&#8217;s-the-man, major-results-every-day, high-fives-all-around weeks. If you&#8217;re anything like me, you&#8217;ll also have weeks when you feel like you haven&#8217;t gotten anything done. This is completely normal. If it happens more than once or twice in a row, take some time to step back and reconsider what you&#8217;re doing or how you&#8217;re doing it.</p>
<p>Some of your papers will be rejected. Some of them will be rejected several times in a row. Some might never even see the light of day. This does not mean that you&#8217;re a failure as a graduate student or that your research is garbage. You probably aren&#8217;t and it&#8217;s probably not.</p>
<p>The thing that is hard to come to grips with coming out of college is that papers aren&#8217;t accepted or rejected based on some objective rubric. A great deal of the selection process is very unscientific. Program committees are comprised of people, and everyone has their own opinions and biases. You might just have caught a reviewer on a bad day.</p>
<p>Treat every failed submission as a learning experience. Act on the legitimate complaints, ignore the inscrutable, bizarre and mean-spirited ones, and move on. Most importantly, don&#8217;t let it reflect on your opinions of yourself or your work. It doesn&#8217;t do you or anybody else any good. The <em>only</em> thing you can do is consider any constructive criticism and produce the highest quality work you are capable of producing. As long as you keep doing that, you&#8217;ll do fine.</p>
<p>Don&#8217;t be afraid to discard an idea you&#8217;ve been working on for a while or a piece of code that took you a long time to write if it&#8217;s clear that you&#8217;re going in the wrong direction. At the same time, don&#8217;t be too quick to abandon an idea if it doesn&#8217;t work out immediately.</p>
<p>Write down everything you try. If you run an experiment for a paper, write down how you ran it, when you ran it, and what the results were. In general, take good notes. They will save you a ton of time down the road.</p>
<p>There will be times during your career as a graduate student when you&#8217;ll ask yourself, &#8220;Why, oh why didn&#8217;t I just take that job at Large Software Company X out of college, with its hefty salary and reasonable hours?&#8221; The answer, hopefully, is that you wanted to gain a depth of understanding in a portion of your field and advance the state of the art. Eventually, probably when you start to see a tangible endpoint, you&#8217;ll feel like you&#8217;ve done that. Hang in there.</p>
]]></content:encoded>
			<wfw:commentRss>http://alexras.info/2011/09/24/advice-for-new-graduate-students/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Hard Drives II: Correlated Failures and Misleading Drive Sizes</title>
		<link>http://alexras.info/2011/09/03/hard-drives-ii/</link>
		<comments>http://alexras.info/2011/09/03/hard-drives-ii/#comments</comments>
		<pubDate>Sun, 04 Sep 2011 00:00:46 +0000</pubDate>
		<dc:creator>Alex</dc:creator>
				<category><![CDATA[Advice (Unsolicited)]]></category>
		<category><![CDATA[Computers]]></category>

		<guid isPermaLink="false">http://alexras.info/?p=934</guid>
		<description><![CDATA[Last week, I talked about the bathtub curve and what it can tell you about bad hard drive reviews. I&#8217;m going to expand on that a little this week and talk about how replacing your drive doesn&#8217;t necessarily mean you&#8217;re solving the problem. Then we&#8217;ll briefly touch on another common source of consumer angst, hard [...]]]></description>
			<content:encoded><![CDATA[<p>Last week, I talked about the bathtub curve and what it can tell you about bad hard drive reviews. I&#8217;m going to expand on that a little this week and talk about how replacing your drive doesn&#8217;t necessarily mean you&#8217;re solving the problem. Then we&#8217;ll briefly touch on another common source of consumer angst, hard drive sizes.</p>
<h1>Correlated Failures</h1>
<p>A common pattern in one-star hard drive reviews is the following:</p>
<blockquote><p>
  First drive failed, sent it back. Replacement failed two weeks later. You computer people are all monsters. I&#8217;m going back to using a typewriter.
</p></blockquote>
<p>If you buy a drive from a company and it hits the wrong end of the bathtub curve, they will usually replace it. This is basically what hard drive warranties are for: they prevent customers on the wrong side of the bathtub from getting screwed over. Unfortunately, they will probably just pull the next hard drive box off the wall and send you that one. Those two drives probably arrived at their warehouse on the same shipping palette, which probably means that they were manufactured and left the factory at approximately the same time. If there was an unnoticed defect in that particular production batch, you&#8217;re much more likely to see the same problem on the replacement that you had with the original.</p>
<p>Incidentally, this is why you should never buy multiple instances of the same drive at the same time if you&#8217;re planning on building a RAID array with them; correlated failures might come back and bite you in a big way.</p>
<h1>Drive Sizes Lie to You</h1>
<p>Stop me if you&#8217;ve heard this complaint before:</p>
<blockquote><p>
  I bought a 500GB hard drive, but it&#8217;s only got 465.7GB of space! I want my 34.3GB back!
</p></blockquote>
<p>I talked about this <a href="http://alexras.info/2010/06/06/wolfram-alpha-is-my-master-now/">last year</a> in the context of Wolfram Alpha. The short answer is that drive manufacturers are advertising their capacities in powers of ten and shipping with capacities in powers of two.</p>
<p>Operating systems vendors seem to be converging on lying to their customers rather than confusing them; Apple&#8217;s Disk Utility, for example, gives capacities in powers of two and units in powers of ten (500GB when it&#8217;s really 500 GiB). In my opinion, this is like <a href="http://en.wikipedia.org/wiki/Indiana_Pi_Bill">setting the value of pi to 3.2</a>; not only does it mask the problem, it hides some of the fundamental truths underlying it.</p>
]]></content:encoded>
			<wfw:commentRss>http://alexras.info/2011/09/03/hard-drives-ii/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Let&#8217;s Talk about Hard Drives</title>
		<link>http://alexras.info/2011/08/27/lets-talk-about-hard-drives/</link>
		<comments>http://alexras.info/2011/08/27/lets-talk-about-hard-drives/#comments</comments>
		<pubDate>Sat, 27 Aug 2011 21:00:00 +0000</pubDate>
		<dc:creator>Alex</dc:creator>
				<category><![CDATA[Advice (Unsolicited)]]></category>
		<category><![CDATA[Computers]]></category>

		<guid isPermaLink="false">http://alexras.info/?p=913</guid>
		<description><![CDATA[Last week, one of my external drives failed, and another indicated that it&#8217;s about to die by failing a read and causing my RAID volume to degrade. Neither of these failures were surprising; both drives were well outside of their warranty periods. The way these drives failed and the (sadly ongoing) quest to replace them [...]]]></description>
			<content:encoded><![CDATA[<p>Last week, one of my external drives failed, and another indicated that it&#8217;s about to die by failing a read and causing my RAID volume to degrade. Neither of these failures were surprising; both drives were well outside of their warranty periods. The way these drives failed and the (sadly ongoing) quest to replace them has brought up a couple of things that I&#8217;ll talk about here.</p>
<p>Failed drives means shopping for replacements. When it comes to external hard drives, we seem to be presented with a multitude of choices, none of which are good. Judging by reviews on <a href="https://www.newegg.com/">NewEgg</a>, external consumer-grade hard drives are some combination of:</p>
<ul>
<li>Unreliable</li>
<li>Slow</li>
<li>Feature-poor</li>
<li>Plagued with awful customer support</li>
</ul>
<p>I was surprised at how many of the one- and two-star reviews for hard drives on NewEgg (and virtually everywhere else that sells drives) display some of the same common misconceptions. It&#8217;s a sad indicator that as an industry, we still haven&#8217;t figured out how to make computers anything less than magical and inscrutable to the average consumer. I&#8217;m going to lay out a couple of those misconceptions in the next couple of posts. They&#8217;ve doubtlessly been rehashed elsewhere, but these are things that deserve repeating.</p>
<h1>The Bathtub Curve</h1>
<p>If you were to plot failure rate of hard drives versus time on a graph, the graph would probably look like the blue line in the graph below (thanks, Wikipedia!):</p>
<p><img src="http://www.alexras.info/wp-content/uploads/2011/08/500px-Bathtub_curve.png" alt="The Notorious Bathtub Curve, Image Courtesy of Wikipedia" /></p>
<p>This blue line is what&#8217;s referred to in reliability engineering as a <em>bathtub curve</em>, because its shape is evocative of a bathtub. In plain English, the bathtub curve basically says</p>
<ul>
<li>Things that are shipped with defects usually fail early.</li>
<li>Things that work as designed still eventually wear out.</li>
<li>In the middle, anything can happen, but failure is less likely. </li>
</ul>
<p>Many one-star NewEgg reviews I came across were some variant of:</p>
<blockquote><p>
  Drive fails after X days of use. What a piece of crap. I&#8217;m never buying from this company again.
</p></blockquote>
<p>These are people who have unfortunately hit the wrong end of the bathtub curve.</p>
<p>Why does this happen? Well, some of it has to do with manufacturing; with something this intricate there will inevitably be defects, regardless of how much quality assurance you put into it. Some of it might have to do with what happens to the drives during shipping. Sometimes there is actually a systemic defect in a particular model or production batch that goes undetected by quality assurance; this usually results in a class action lawsuit months or years down the road.</p>
<p>The best bet, as I&#8217;ve stated here several times in the past, is to never assume that the drive will last another day. I was shocked at the number of times I read a review like this:</p>
<blockquote><p>
  Bought this drive and it died three days later. Now 50,000 photos of my cat Muffins are gone. I hate you, Seagate, and so does Muffins.
</p></blockquote>
<p>So you bought this drive, and copied your photos to it, and then &#8230; you <em>deleted the originals?!</em> I&#8217;ve said it before and I&#8217;ll say it again: if there&#8217;s only one copy, it is only a matter of time before you lose that data.</p>
<p>Next week: why the replacement for your failed drive is more likely to fail, and why hard drive manufacturers are lying to you.</p>
]]></content:encoded>
			<wfw:commentRss>http://alexras.info/2011/08/27/lets-talk-about-hard-drives/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Esoteric Tip #6: Dead Simple Screencasts in OS X</title>
		<link>http://alexras.info/2011/08/10/esoteric-tip-6-dead-simple-screencasts-in-os-x/</link>
		<comments>http://alexras.info/2011/08/10/esoteric-tip-6-dead-simple-screencasts-in-os-x/#comments</comments>
		<pubDate>Thu, 11 Aug 2011 04:00:56 +0000</pubDate>
		<dc:creator>Alex</dc:creator>
				<category><![CDATA[Esoteric Tips]]></category>

		<guid isPermaLink="false">http://alexras.info/?p=884</guid>
		<description><![CDATA[I was looking around for software for doing screencasts so that I could make a short tutorial video for my students. I was a little bewildered by the lack of good, free screencast software for OS X; surely there must be something that can capture audio and video from the screen. Turns out there is [...]]]></description>
			<content:encoded><![CDATA[<p>I was looking around for software for doing screencasts so that I could make a short tutorial video for my students. I was a little bewildered by the lack of good, free screencast software for OS X; surely there must be <em>something </em>that can capture audio and video from the screen. Turns out there is &#8211; good ol&#8217; trusty QuickTime Player 10.</p>
<p>If you select New Screen Recording from the File menu, it will present you with a window with a prominently-featured &#8220;record&#8221; button. Simply configure your audio input and hit the button and you&#8217;re recording. It&#8217;s CPU intensive and doesn&#8217;t have a very high framerate, but it certainly worked well enough for my purposes.</p>
]]></content:encoded>
			<wfw:commentRss>http://alexras.info/2011/08/10/esoteric-tip-6-dead-simple-screencasts-in-os-x/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Reflections on CS61A</title>
		<link>http://alexras.info/2011/08/07/reflections-on-cs61a/</link>
		<comments>http://alexras.info/2011/08/07/reflections-on-cs61a/#comments</comments>
		<pubDate>Sun, 07 Aug 2011 07:32:27 +0000</pubDate>
		<dc:creator>Alex</dc:creator>
				<category><![CDATA[Advice (Unsolicited)]]></category>
		<category><![CDATA[School]]></category>

		<guid isPermaLink="false">http://alexras.info/?p=879</guid>
		<description><![CDATA[Sometimes I am reminded of how long it&#8217;s been since I took my first programming course in college. I came across a post called &#8220;SICP is Under Attack&#8221; written by an undergrad from the class of 2015 named Vedant Kumar. In this post, he points out that CS61A (the introductory CS course at Berkeley) is [...]]]></description>
			<content:encoded><![CDATA[<p>Sometimes I am reminded of how long it&#8217;s been since I took my first programming course in college. I came across a post called &#8220;<a href="http://vedantk.tumblr.com/post/8424437797/sicp-is-under-attack-updated">SICP is Under Attack</a>&#8221; written by an undergrad from the class of 2015 named Vedant Kumar. In this post, he points out that CS61A (the introductory CS course at Berkeley) is switching from Scheme to Python, although they won&#8217;t be switching entirely away from the course textbook, Structure and Interpretation of Computer Programs (commonly abbreviated SICP), which (as Mr. Kumar points out) is an incredibly good introductory computer science textbook.</p>
<p>I won&#8217;t go into detail on why they&#8217;re making the switch. Brian Harvey, the prof who has taught the course for the last 25 years (although he didn&#8217;t teach it when I took it), has already <a href="http://www.cs.berkeley.edu/~bh/61a.html">written about this at length</a> on his website. I reacted to news of 61A&#8217;s transition away from Scheme the same way that I reacted to finding out that the Shakey&#8217;s Pizza near my parents&#8217; house where I went for team parties as a kid had been bulldozed and replaced by a Wallgreens. I recognize that things can&#8217;t stay the way we remember them forever, but it&#8217;s still a little sad. The news did get me reflecting on that course and that time in my life. If this thing had visuals, this is where the flashback ripple effect would kick in.</p>
<p>I took CS61A in the fall of 2003. Before that point, I had very little practical experience with programming (I had futzed around with HyperCard and Object Logo, and done a little bit of PHP programming, but hadn&#8217;t programmed anything &#8220;real&#8221; at that point). I remember there being talk among my fellow incoming freshmen about an entrance exam, in which you&#8217;d have to demonstrate your knowledge of this technique called recursion that I&#8217;d never heard of before. Almost everyone I met that week didn&#8217;t seem that concerned; they&#8217;d programmed tons before, or done well on the CS AP exam, or even <em>taken</em> the CS AP exam. I was convinced that I would get destroyed by the entrance exam and be forced to take some sort of remedial course and then <em>everything would be ruined forever</em>. This sort of thing happened to me a lot during that first year; that little voice that keeps saying &#8220;These people are way smarter than you and you don&#8217;t belong here&#8221; just would not shut up.</p>
<p>My friend Naren told me years later that when he met me that first day in 61A, I &#8220;looked super angry&#8221;. Far from it &#8211; I was <em>terrified</em>. It turns out that there was no entrance exam, much to my relief. It also turns out that the course was to be taught in a language that hardly anybody had ever heard of before. Some of the savvier students asked, &#8220;Why Scheme? Why not just use Common Lisp?&#8221; The point, the profs explained, was that they weren&#8217;t teaching you a programming language. They were going to teach you how to think like a computer scientist, and that meant teaching you recursion. Teaching you recursion is easier, they said, if the one of the only constructs the language supports is recursion.</p>
<p>61A was somewhat of a trial by fire. It was a lot of work and it was not by any means easy. At the time, I bitched and moaned about it a great deal. I missed our triple-overtime win against USC studying for a 61A midterm (current undergrads, learn from my mistakes!).However, it introduced me to a wide swatch of the fundamentals of computer programming and computer science &#8211; recursion, complexity analysis, debugging, logic languages, dynamic programming, the list goes on. It also helped me figure out that I wasn&#8217;t that much better or worse at this whole programming thing than anyone else there, and that there hadn&#8217;t been some horrible mistake in the admissions office.</p>
<p>I understand the desire to &#8220;modernize&#8221; the curriculum, and I am an enormous fan of Python, but for a course like 61A the choice of language doesn&#8217;t really matter all that much. The purpose of the course is to teach the fundamentals, and to give you an introduction to what computer science is all about so you can figure out if it&#8217;s the right major for you. As long as the course accomplishes those goals, nothing major will have changed. Regardless of what textbook they&#8217;re using by default, I think that SICP will remain an important volume for that course in the same way that The Art of Computer Programming is important, not for the language that the examples are written in but for its exceptional quality as a teaching, learning, and reference tool.</p>
]]></content:encoded>
			<wfw:commentRss>http://alexras.info/2011/08/07/reflections-on-cs61a/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Esoteric Tip #5: Finding Undocumented Files with Doxygen</title>
		<link>http://alexras.info/2011/07/16/esoteric-tip-5-finding-undocumented-files-with-doxygen/</link>
		<comments>http://alexras.info/2011/07/16/esoteric-tip-5-finding-undocumented-files-with-doxygen/#comments</comments>
		<pubDate>Sat, 16 Jul 2011 22:00:42 +0000</pubDate>
		<dc:creator>Alex</dc:creator>
				<category><![CDATA[Esoteric Tips]]></category>

		<guid isPermaLink="false">http://alexras.info/?p=845</guid>
		<description><![CDATA[In an effort to practice what I preach, I&#8217;ve been spending 15 minutes a day documenting code. I&#8217;ve been using Doxygen for all my C++ documentation. One thing that I wanted to do early on was easily identify all the files where I was missing documentation and, if possible, the particular places where documentation was [...]]]></description>
			<content:encoded><![CDATA[<p>In an effort to <a title="On (Lack of) Documentation" href="http://alexras.info/2011/05/07/on-lack-of-documentation/">practice what I preach</a>, I&#8217;ve been spending 15 minutes a day documenting code. I&#8217;ve been using Doxygen for all my C++ documentation. One thing that I wanted to do early on was easily identify all the files where I was missing documentation and, if possible, the particular places where documentation was missing. I think I&#8217;ve managed to do it (or at least come close).</p>
<p>In my Doxyfile, I&#8217;ve got the following lines:</p>
<blockquote>
<pre>WARNINGS = YES
WARN_IF_UNDOCUMENTED = YES
WARN_IF_DOC_ERROR = YES
WARN_LOGFILE = doxygen_warn.log</pre>
</blockquote>
<p>This means that Doxygen will generate warnings for undocumented members as well as if the documentation is incomplete or isn&#8217;t syntactically correct, and that it will log all warnings to the file doxygen_warn.log.</p>
<p>In order to get a list of undocumented files, I look for warnings about missing documentation, extract the filenames for each warning, and make sure that the list of files doesn&#8217;t contain any duplicates:</p>
<blockquote>
<pre>grep "is not documented" doxygen_warn.log | awk '{print $1}' | sed -E 's/:[0-9]+://g' |
    sort | uniq</pre>
</blockquote>
<p>In order to further expand that list to include the undocumented members in each file, I do something similar, except I extract the filename and information about the undocumented member instead of just the filename:</p>
<blockquote>
<pre>grep "is not documented" doxygen_warn.log | sed -E 's/is not documented.//g' |
    cut -d' ' -f 1,3- | sed -E 's/:[0-9]+:/ : /g' | sort</pre>
</blockquote>
<p>It&#8217;s kind of quick and dirty, but it seems to do the job. These commands run automatically whenever I generate documentation. The goal (unreasonable though it may be) is to bring the list of undocumented files down to zero.</p>
]]></content:encoded>
			<wfw:commentRss>http://alexras.info/2011/07/16/esoteric-tip-5-finding-undocumented-files-with-doxygen/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>The Importance of Searchability</title>
		<link>http://alexras.info/2011/04/24/the-importance-of-searchability/</link>
		<comments>http://alexras.info/2011/04/24/the-importance-of-searchability/#comments</comments>
		<pubDate>Mon, 25 Apr 2011 03:00:06 +0000</pubDate>
		<dc:creator>Alex</dc:creator>
				<category><![CDATA[Advice (Unsolicited)]]></category>

		<guid isPermaLink="false">http://alexras.info/?p=776</guid>
		<description><![CDATA[When I was in college, I wrote notes in a collection of spiral notebooks. I also had a three-ring binder with a divider tab per class where I put things like graded midterms and assignments. After classes were over, I&#8217;d donate the midterms to the HKN exam archive and recycle everything else. As my classes [...]]]></description>
			<content:encoded><![CDATA[<p>When I was in college, I wrote notes in a collection of spiral notebooks. I also had a three-ring binder with a divider tab per class where I put things like graded midterms and assignments. After classes were over, I&#8217;d donate the midterms to the HKN exam archive and recycle everything else. As my classes shifted more toward reading a lot of papers, the papers would go in their own separate three-ring binder, with a divider tab per class.</p>
<p>What a waste.</p>
<p>In retrospect, I see a lot of this exercise as more psychological than actually helpful. I spent a lot of time in college feeling overwhelmed (whether or not I was <em>actually</em> overwhelmed is an open question), and the act of collecting and organizing this mountain of paper into something resembling order was a way to feel more in control of the situation. Also, taking notes certainly helped me stay focused in class. But the fact is, much of that mountain of paper was pretty much useless.</p>
<p>First, it was really hard to actually find anything. Trying to find all the information I had collected on a topic, or the definition for a particular term, usually involved doing a scan through a few weeks of notes or a glossary lookup in the course&#8217;s textbook, despite the fact that I had things fairly well organized.</p>
<p>Second, I didn&#8217;t actually need most of that data. My move from taking a notebook full of notes per class to a few dozen pages spoke more to my increased ability to separate what was important to capture from lecture from information that I could grab from lecture slides or the textbook. Keeping exams was helpful, but only because it told me what I didn&#8217;t understand well enough; the actual content of my answers wasn&#8217;t really all that helpful.</p>
<p>Third, my handwriting is <em>terrible</em>. Especially when I&#8217;m writing fast, which is what I&#8217;m doing when I&#8217;m writing notes or writing down answers for an exam. Many was the time where I looked at my notes and said, &#8220;Well, here&#8217;s where the stuff I&#8217;m looking for is, but I can&#8217;t make heads or tails of what I was writing here.&#8221;</p>
<p>I realized too late (after I had mostly stopped taking classes and had shifted into doing research full-time) that the only result of capturing all of this information by sticking it in binders and putting them on bookshelves was more full bookshelves.</p>
<p>It was then that I decided to adopt the following guiding principle for every piece of information I will ever need to look at more than once:</p>
<p><strong>If I can&#8217;t search it, I will never find it again.</strong></p>
<p>This immediately applies to things like notes. I found that it&#8217;s easier to use paper notes than to lug a full-sized laptop around, but with the emergence of tablets that&#8217;s becoming a decreasingly relevant problem. These days, I hardly write anything on paper anymore; I type significantly faster than I write, I can actually read what I wrote afterwards, and most importantly everything I type is instantly searchable.</p>
<p>Any piece of paper I need to keep (bills, receipts, etc.) gets scanned. I&#8217;m not as good at passing scanned papers through OCR as I should be (I&#8217;m still trying to figure out an effective OCR solution), but I make sure to name these scanned documents descriptively so that I can search by description later. Another huge benefit of this approach is that everything is backed up. I&#8217;ve lost notebooks for classes in the middle of the quarter before. It really sucks.</p>
<p>In the last post, I went over how I handle organizing and taking notes on research papers; a big component of making that process work effectively is the ability do full-text search on papers. Related work searches get so much easier when you can just straight-up search through reams of papers at once. One of my favorite Google Talk features is the ability to search past instant message conversations; it&#8217;s the one value-add feature that keeps me coming back to GTalk. GMail makes e-mail searchable (then again, so does basically everything else these days), which is always really helpful.</p>
<p>This &#8220;make everything searchable&#8221; principle has really helped me keep on top of the mountain of data that I receive and/or generate every day.</p>
]]></content:encoded>
			<wfw:commentRss>http://alexras.info/2011/04/24/the-importance-of-searchability/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Backups Revisited Part 2</title>
		<link>http://alexras.info/2011/02/21/backups-revisited-part-2/</link>
		<comments>http://alexras.info/2011/02/21/backups-revisited-part-2/#comments</comments>
		<pubDate>Mon, 21 Feb 2011 19:56:46 +0000</pubDate>
		<dc:creator>Alex</dc:creator>
				<category><![CDATA[Advice (Unsolicited)]]></category>
		<category><![CDATA[Computers]]></category>

		<guid isPermaLink="false">http://alexras.info/?p=713</guid>
		<description><![CDATA[In this post, I&#8217;ll focus on the practical side of backups. Last time, I asserted that in order for a backup to really be a backup, your data has to be automatically replicated on two different drives using two separate filesystems on two different computers that are geographically separated, and one of those backups needs [...]]]></description>
			<content:encoded><![CDATA[<p>In this post, I&#8217;ll focus on the practical side of backups.</p>
<p>Last time, I asserted that in order for a backup to really be a backup, your data has to be automatically replicated on two different drives using two separate filesystems on two different computers that are geographically separated, and one of those backups needs to be able to go back in time by at least 24 hours.</p>
<p>Satisfying all of these criteria at once usually isn&#8217;t free, but it doesn&#8217;t have to be hard, and you&#8217;re probably closer to a workable solution than you think.</p>
<p>In this post, I&#8217;ll examine a few possible solutions and point out some non-obvious ones. This isn&#8217;t meant to be comprehensive, but rather serves to give a general flavor of the state of backup solutions.</p>
<h2>Built-In Solutions</h2>
<p>OS X&#8217;s Time Machine fits some of our criteria for backups, but falls short in others. You can back up to two different drives,  the filesystems are distinct, and you&#8217;re able to move the Time Machine drive back in time if needed. Backing up to other computers with Time Machine is possible, but it&#8217;s unsupported and not very reliable (at least in my experience).</p>
<p>Using a network-enabled USB drive or a Time Capsule is essentially equivalent to backing up to another computer (they&#8217;re practically little computers themselves), but that costs a good deal of additional money. Unless you really know what you&#8217;re doing and are willing to take the time to make it work (and keep it working), making remote backups work with the Time Capsule is not really feasible.</p>
<p>Although I&#8217;ve never used it personally, Windows 7&#8242;s Backup and Restore feature appears to be feature-for-feature equivalent to Time Machine, but without Apple&#8217;s high-gloss glittery front-end. If you have a Professional or above license, it can backup to network shares, which is an improvement over Time Machine but requires you to pay more for the OS itself, which is kind of a drag.</p>
<p>You can use <a href="http://samba.anu.edu.au/rsync/">rsync</a> by itself on pretty much any platform or with any one of a plethora of (usually OS-specific) front-ends. rsync can push files to pretty much anywhere and it supports incremental backups, so you could definitely satisfy all your backup demands with rsync, although it would take a little bit of work to get everything set up.</p>
<h2>Sneakernet</h2>
<p>If you&#8217;ve got a USB drive and are willing to lug it back and forth, there&#8217;s a relatively inexpensive way to come pretty close to an optimal backup solution. If you leave your USB drive at work, take it home and do backups every Monday night and bring the drive back to work on Tuesday, you&#8217;ve got your bases mostly covered. The problem here, of course, is that you have to remember to take the drive home with you, your backup granularity is kind of coarse (if your drive dies, you lose at most a week&#8217;s worth of stuff), and there&#8217;s a small window of vulnerability when your USB drive is at home. You get geographic distance for free, though.</p>
<h2>Enter the Cloud</h2>
<p>There are several companies that have recently started to offer so-called &#8220;cloud backup&#8221; services that provide you with some amount of storage space to which you can back up. Notable companies in this space include <a href="http://www.mozy.com/">Mozy</a>, <a href="http://www.backblaze.com/">Backblaze</a> and <a href="http://www.crashplan.com/">CrashPlan</a>. With cloud backup services, you easily satisfy all of our desirable backup properties simultaneously (unless you happen to live next to one of their data centers, of course), but it will usually cost you and doing the initial backup over the wide-area Internet may take weeks or months. Most services will ship you an external hard drive to which you can do your initial backup, but you have to eat the cost of a hard drive (~$100-150) for the privilege of writing to the drive and mailing it right back.</p>
<p>In my opinion, the standout favorite contender in this space is CrashPlan for one simple reason &#8211; they allow two computers running CrashPlan to back up an unlimited amount of data to each other for free. So if you and your friend both want to run backups, you can back up to each other.</p>
<h2>Unexpected Surprises</h2>
<p>If you care about your photos, you&#8217;ll want them backed up. If you share your photos on a site like Facebook or Flickr, you&#8217;re most of the way to an ideal backup of those photos. The only major drawbacks here is that restoring your photos isn&#8217;t trivial (you have to re-download them, although there are applications that will help automate that process) and you might incur a loss in quality when the site scales your image down. If you don&#8217;t mind those things though, these are great inexpensive ways to backup.</p>
<p>&#8220;But what about our time travel requirement&#8221; you might ask? If you&#8217;re editing photos, you might care about reverting to a previous edit. Most of the time though, you take pictures, upload them and never modify them again. Static data like pictures or music, where individual items never change but the set of items is expected to grow larger, is easier to back up because as long as you never delete anything the time travel requirement isn&#8217;t necessary.</p>
<h2>My Setup</h2>
<p>I have three computers that I care about &#8211; my desktop, my laptop and my home theatre PC. My desktop has an OS X partition and a Windows 7 partition and my laptop runs Debian in a VM, so I need to back up five filesystems in total. The HTPC has external storage drives that hold movies and music.</p>
<p>I admit that I break my own rules a bit &#8211; the external media drive on the HTPC is a RAID 1 with no other backups. I know, scary right?</p>
<p>Every system runs CrashPlan, even the Linux VM on my laptop. All systems backup to two places. The first is an old external drive attached to the HTPC. The second is a workstation under my desk at UCSD. Since I had an extra drive lying around, my desktop&#8217;s OS X partition also runs a Time Machine backup on a second internal drive.</p>
<p>That about covers it. Next week, something not related to backups!</p>
]]></content:encoded>
			<wfw:commentRss>http://alexras.info/2011/02/21/backups-revisited-part-2/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

