I’ve only finished up through Chapter 3, but that much alone justifies $20 for this book1 2
You can download the hardware simulator and build logic gates, an ALU, memory registers, etc (you are given a NAND and a flipflop). Then you write an assembler on top of that, then a compiler on top of that then an operating system out of that. Super awesome.
The book is presented as a college-level integration of other, separate college-level classes. But really, the parts I’ve read so far (only about ¼ of the book) could be used in high school easily. In fact, my 12 year old computer nerd son isn’t having much trouble, although he’s only up through Chapter 1. I think he’ll have more trouble writing a compiler than making an XOR gate.
I said that now the serious spending could begin. And it kind of has, since I bought supplies for the countershaft, some measuring tools, a toolbox to put them in, a drill chuck, a tailstock spindle and a replacement carriage gib stock that I cleft in twain. HOWEVER.
I HAVE ALSO CREATED LIFE mwahahahahahaha!!!
In that last post, I was building the countershaft to get lower speeds. It turns out that this lathe has “back gears” which basically means “a whole nother set of speeds, lower than the regular ones so you don’t need to have a countershaft”. 1 I didn’t realize it had back gears because a) I didn’t have a manual (another thing I bought since the last post) and b) the back gears selection knob thingie was missing. But I built another forged from the molten core of the Earth itself. Observe!
- Yes, that means all that work was for naught. ↩
On my old blog, I once did a post on Babbage’s Difference Engine and how to run it backwards. However, I didn’t really finish the thought there and just recently it came up again IRL. 1 So this time, I think I’ll do the whole post.
The DE computed polynomials and worked by simple addition. It consisted of a series of numerical columns each of which had multiple digits, each column representing different stages of the computation, as I’ll show below. Suppose you have a function like

I can compute this using only addition by starting with a table like this:

The
and
columns are pretty self-explanatory. The
and
columns are the differences between successive entries in the column to the left of each. For instance, the 3 at the top of the
column is the difference between the 2 and the 5 in the
column. The 2 at the top of the
column is the difference between the the 3 and the 5 in the
column. (There are exactly two difference columns because this is a 2nd degree polynomial.)
Once I have a table started, I compute the function using simple addition from the right to the left, starting with the constant in the rightmost column, like this:



So all Babbage’s Difference Engine had to do was be able to add columns and it could compute tables of values for any polynomial (of degree
for some number of columns in his machine).
Not a lot of call for computing mathematical tables today and that goes double for mechanical computers. However, this technique can be used in reverse for something that’s slightly more helpful. Say I have a function that I can compute, but I don’t have a polynomial expression for it. I’m going to choose a simple one that probably has other ways to figure out:

Start by just computing a few values:

Then the differences of those values

Then the differences of those differences

When the last column is constant, we are done and we know the degree of the polynomial we are looking for. 2 That polynomial can be expressed as

Which means the first differences column can be expressed as:
![Rendered by QuickLaTeX.com \begin{eqnarray*} f'(x) & = & f(x+1) - f(x) \\ & = & \left[a(x+1)^2 + b(x+1) + c\right] - \left[ax^2 + bx + c\right] \\ & = & ax^2 + 2ax + a + bx + b +c - ax^2 - bx - c \\ & = & 2ax + a + b \end{eqnarray*}](http://david.rysdam.org/blog/wp-content/ql-cache/quicklatex.com-f46cb0536ed151edd789f05fcd9c7b16_l3.png)
Likewise, the second differences column can be expressed as:
![Rendered by QuickLaTeX.com \begin{eqnarray*} f''(x) & = & f'(x+1) - f'(x) \\ & = & \left[2a(x+1) + a + b\right] - \left[2ax + a + b\right]\\ & = & 2a \end{eqnarray*}](http://david.rysdam.org/blog/wp-content/ql-cache/quicklatex.com-4eab553f251483311401c4cb853b3fc8_l3.png)
This is the function for the last column, so now we know that in the searched-for polynomial
. With that, let’s back up a step and solve
using the known values of
and
.

And now do the same thing to solve for
.

So the final polynomial is

And there we have it.
I’ve been exploiting Emacs for more than text editing recently. 1 So I was about to buy a copy of the GNU Emacs manual when I noticed that it was version 22. And $45 into the bargain. You can get version 23.3 for free but they don’t have it in hardcopy yet.
So I uploaded the PDF to Lulu to have them print and bind it for me.
It’s well worth reading. I’ve already dog-eared several pages of useful stuff I didn’t already know and I’m only on like page 30. I also just now noticed that I’m running Emacs 23.1. 2
I really love tomato.1 One of my favorite things is the bandwidth graphs. I just happened to glance at them last night before bed and saw they were pegged at maximum and had been for several hours.
Me: Hey, are you uploading/downloading from your photo site?
Mrs: No.
Me: Hmmmmm
I go through all my processes: Nothing is downloading that much.
I shut down computers one at a time until only my computer is left: Still downloading.
I shut mine off: Downloading ceases.
I turn my computer back on: Downloading starts again.
Uh oh, I think, I’ve been hax0red. So I start looking more closely at netstat to see what net connections I’ve got. I see my email client in there, polling the server, so I decide to shut that off to clean up my display a bit….and the bandwidth drops down to a reasonable level. What the.
Background #1: I fetch my mail with offlineimap.2 I’ve found that it has a bug or something so that periodically it will get “stuck” and have to be killed. So I set up my cronjob to kill the previous instance, if any, before running the new one.
Background #2: My brother-in-law was going to use a file-sharing site to send me a ~10MB file. I actually typed out an email to suggest he just email to me, but then thought maybe I should learn to use these sharing sites for when I really do have a biggish file. So I just told him to do “whatevs”.
As it turned out, he did in fact email it to me. And offlineimap was downloading it. But it took more than a minute (my cronjob rate), so the next time it came around my script killed the previous instance and started over. All this pegged my bandwidth usage. I temporarily modified the script to not kill the previous instance, got the file in a little over a minute and then the bandwidth finally dropped.
So that problem is solved. However, I still have the issue of offlineimap periodically hanging. I guess I’ll have to make a more sophistimacated script. Run the script every minute, but let a particular instance go for several iterations before killing it. Or maybe it would simpler to just notify myself when an instance has to be killed. My local email (i.e. from cron, etc) doesn’t go into my regular email client, but maybe it should…
I bought an Egg-bot. It’s pretty hilarious and awesome. Here it is in action (sped up 4x…or 8x? I don’t even remember now):
I’m working on a mathematical recasting, but it seriously took me 2 days to figure out how to post this video right, so now I think I need a bit of a lie-down.
So I upgraded, as they put it, from Ubuntu to Debian (don’t ask why). I was using Firefox on the old system and I had no real problems with it. I wanted to use it on the new system. I also want to let my package manager do as much download; make; make install; asking-if-that-was-so-hard; for me as possible because I have a lot of important web browsing I have to do.
Problem the First! Firefox, per se, is not in Debian. Debian prefers to separate “upgrades for new features” from “fixing major bugs and security holes”, so they take future fixes and apply them to old releases so you can have software that works the same as it used to, just with added stability/security. OK, that makes sense. But I guess Mozilla doesn’t like that and made them rebrand it. It’s actually “IceWeasel” in Debian.
Problem the Second! The proxy at work blocks Firefoxen below version X.Y because of security problems. My IceWeasel is nominally below X.Y and therefore blocked, even though I probably have those security problems fixed (see Problem the First). No, I can’t just change the useragent string. For one think, that’s probably in violation of the DMCA. For another, it isn’t in the easily-changed portion of the string (I think it’s actually the Gecko revision string that it’s looking at). So I guess I’ll use Epiphany, which is based on WebKit instead of Gecko.
Problem the Third! Epiphany sucks! Slow, unconfigurable and the tabs Just Don’t Work Right (why would I want tabs to become invisible and be linearly-accessed?). So let’s download a recent version of Firefox.
Problem the Fourth! Only 32 bit versions are available and I have the 64 bit Flash plugin.
So I think I have 3 alternatives now:
Alternative the First! Forget about Flash. I wish.
Alternative the Second! Install the 32 bit Flash. Probably outside of Debian’s package management which means a treadmill for me.
Alternative the Third! Compile Firefox myself. Very unattractive prospect, but possibly the least unattractive.
I ♥ Computers
Due to a malfunctioning audiobook device, I was forced to listen to a little NPR this morning. They had on a woman who was protesting the “socialism” of the American government. Pressed for details, she complained about “giving handouts to bankers and corporations and doing nothing about regular working class people”.
where do i begin i don’t even
It’s such a tiny thing but it’s been bothering me for about 5 years now. I need a calendaring solution for Linux. My needs are very basic:
- I want it integrated with my mail. 99% of my scheduling needs are meetings that I’ve been “invited” to via email. Launching or switching to a separate for that is annoying. Also, when the meeting arrives, I’d like to have the agenda/location right there (or at least some hint of which email I should look that up in) and not have to copy it from the original email.
- Simple to use. Having to click a bunch of tiny buttons to set the exact start time of the meeting, having to change a bad default date, having to decline to “invite” other participants, etc is annoying. Just let me type in a time! And possibly a day!
- When the scheduled item is due, I need it to alert me asynchronously. I.e. don’t play a sound, because I might not be at my desk. Pop up a window or something that I’ll find when I return. (One previous calender did pop-unders which I don’t even.)
Yesterday, I was about to ask around for what other people were doing and I was trying to compose the query include CLI-friendly tools but not at. I was having trouble and finally thought “maybe that’s because at is a good solution”. It turns out it is!
But at performs arbitrary actions. I need an action to perform. That’s where notify-send comes in. (By far the longest part of setting up this system was getting notify-send working. Turns out that Ubuntu has messed it up by replacing the back-end notification-daemon with notify-osd which sucks in multiple dimensions. sudo apt-get remove notify-osd && apt-get install notification-daemon fixes that.)
The final piece of the puzzle is that my mail client is sup which, like some other mail clients, let’s me pipe a message to a shell command.
#!/bin/bash
icon=/usr/share/icons/gnome/scalable/actions/appointment.svg
msg=`sed -n 's/^Subject:\(.*\)/\1/p' < /dev/stdin`
timestr=$@
export DISPLAY=`hostname`:0.0
echo notify-send -t 0 "reminder" \"$msg\" | at $timestr
(at runs a shell that doesn't have $DISPLAY set, so that's why that's there.) I've saved this in ~/bin/remind.sh. Now here's the order of events:
- I get an email that says "Your gracious presence is humbly requested at 9:45 on Friday 6 August, 2010.
- I type | remind.sh 9:45 friday to pipe the email to my script along with the day/time.
- The script automatically strips the Subject: out of the message and schedules a notify-send for the given time.
- At the appointed time, a notification pops up on my screen (on all virtual desktops too, btw) that doesn't disappear until I click it.




