Settin’ Up a Server

My little brother recently got a new computer, and gave the old mostly-broken one to me.  I merrily wiped the hard drive and set about installing Ubuntu Server so I could use it for remote backups.

It was surprisingly easy!

I downloaded the 10.04 LTS .iso from the Ubuntu Server homepage to my laptop (I used the torrent version, but it shouldn’t matter either way) and burned it to a disk using the instructions on the download page.

I hooked up the old computer to the router so it’d have internet, turned it on, and got the disk in before it went to boot. Ubuntu Server installation spash screen It happily loaded up the Ubuntu Server installation splash screen, and the install went without a hitch.  Once that I was done, I rebooted and did a quick ifconfig to make sure internet was working and to check the IP address. Back on my laptop, I tried to ssh in from my laptop… and it worked just fine. The server has  a preconfigured OpenSSH server set up, so I didn’t have to mess with the settings on that.  I set up ssh keys so I didn’t have to password everything, and tested everything with a rsync backup.  It worked perfectly, and there was much rejoicing.



Factoring Trinomials

Specifically, factoring trinomials where a is greater than one (assuming the form ax2+bx+c).

Everyone hates these. You can’t factor them using the method normally taught in school, so many teachers just teach “Guess and Check” for this type of trinomial, in the hopes that they’ll get good enough at guessing and checking.

This is dumb.

There IS a method to factor this sort of trinomials; it’s called The British Method. It’s the only memorable thing my Algebra II teacher taught me. Ready? Here we go.

Here it is in its generality, i.e. with variables And here it is as an example.
1. Realize that your trinomial is of the form ax2+bx+c 1. 2x2+x-1
2. Find a number s such that a*c=s. 2. 2*-1=-2.
3. Find two numbers p and q such that p*q=s and p+q=b. 3. p=2; q=-1: 2*-1=-2 and 2+-1=1.
4. Split the middle term into two binomials, thus: ax2+px and qx+c 4. 2x2+2x and –x-1
5. Factor completely the left binomial to obtain kx(ex+f). 5. 2x(x+1)
6. Factor the right binomial such that you get m(ex+f). 6. –(x+1)
7. Create two binomials (kx+m) and (ex+f); these are your factors! 7. (2x-1)(x+1)

Java Word Wrap Algorithm

On a recent coding project I’ve been working on, I had need for a simple line-wrapping method.  I googled around, but couldn’t find anything useful — so, like any coder, I made my own.  I think it’s pretty nice, if I do say so myself:

public static String wrap(String in,int len) {
if(in.length()<len) return in;
if(in.substring(0, len).contains("\n"))
return in.substring(0, in.indexOf("\n")).trim() + "\n\n" + wrap(in.substring(in.indexOf("\n") + 1), len);
int place=Math.max(Math.max(in.lastIndexOf(" ",len),in.lastIndexOf("\t",len)),in.lastIndexOf("-",len));
return in.substring(0,place).trim()+"\n"+wrap(in.substring(place),len);

That first “in.indexOf()” has the space string (” “) as an argument, not an empty string.

I apologize for the difficult-to-read-ness of this code; I had it nicely spaced and indented but WordPress ate my formatting.
If you want to be really fancy, switch out the “\n” with a System.getProperties(line.separator).

Gedit Themes

Okay, first of all, I realize I have posted anything in nearly three months.  This has no excuse; I am shamed.  SHAMED.


So, I was thinking, I want to do another computer-y post. But then I thought about how so far I’ve really just done software reviews and stuff — and it’s not like that doesn’t already exist elsewhere.  I don’t need to reinvent the wheel.  So I decided to post something more original — two gedit themes I created.

gedit (all lowercase, always) is the default GNOME text editor.  It handles syntax highlighting, line numbers, margins, adjustable tab width… it’s pretty full-featured.  Visually, it starts out pretty basic but it’s got great plugin support and some pretty good built-in color themes.  However, all of them had something that bugged me; I decided to fix it.

Screenshot of my Oblivion++ theme

Click through for large size!

My first theme, Oblivion++, is based off the ships-with-gedit theme Oblivion.  It’s much bluer.

You can download the .xml file here or view it here; scroll  to the bottom of the post for installation instructions.

Screenshot of my gedit theme Vim Stylin'

This one has a large size too -- click it!

My other theme is Vim Stylin’, based off Vim color interpretations.  You can download the .xml here or view it here, just like the other.  Also just like the other, scroll to the bottom of the post for installation instructions.

If you do want one of these (if I do say so myself) pretty cool themes, download them to ~/.gnome2/gedit/styles, which may need to be created first.

gedit, as far as I know, works on Linux, Mac OS, and Windows, but comes with and works best on Linux.  If you have gedit on a non-linux OS, the file location will be different; it /should/ work okay from somewhere else but I haven’t tested it.

Once it’s downloaded and saved, open gedit.  In the menu bar choose Edit and navigate to Preferences.  Once there, click Fonts & Colors and click the Add button.  Navigate to and choose the downloaded theme; it should change immediately.


Edit:  The text in the images is a bit of the code of Keylime Py, a fail-pun-named text-based adventure game I’m writing in python.  I’ll be blogging about it once it’s ready to be let out to teh interwebs.

This Link Kills Spam

Email harvesting bots — also known as data miners — trawl the internet for anything that looks like an email address.  When they find one, they send spam to said address.  They then search the site on which the email was found and search everything linked to there.  The good people at the Office of Strategic Influence have created a site with a script that generates gigabytes of fail email messages (like “”) and have handily provided links to it.  Whenever this site, or any other site that links to the script, is found by an email harvester, the harvester also checks the script-hosting site.  And dies.  They can’t handle the millions of fake emails.  Death to spam!

If you want a text-only link on your site, paste

<a href=””&gt;
This link kills spam</a><br />

into your posts.  If you want an image link (like the one below; both kinds work equally well) paste

<a href=””&gt;
<img alt=”This link kills spam” src=”; border=0></a><br />


This link kills spam

Whitelines graph paper

Some of you may have heard of Whitelines, a kind of graph paper with white lines on a light gray background.  It’s great; your nice axes (the plural of axis) don’t get Inverted graph paperobscured by heavy lines.  It’s also kinda expensive, $9.50 for 160 spiral-bound pages.  That’s about six cents per page.  Well, you can print your own, here (it’s called “inverted graph paper”), for about four cents per page (about three cents of ink per page, and about a cent of paper per page).  I like line thickness at 0.5 and color at #DEDEDE.

Even More Great Books

Moar epic!

  • For Us, The Living by Robert Heinlein; Perry Nelson gets into a car crash in 1939 and wakes up in 2086. The world has completely changed, and Perry must get accustomed to a new society and economy. Heinlein’s first book, it’s really more of a description of an ideal society than a real novel — but it happens to make an excellent book.
  • Digital Fortress by Dan Brown; Susan Fletcher, a codebreaker for the NSA, is employed to help crack a code that the NSA cannot break — an unprecedented event. She is shot at and betrayed by even the NSA itself in her quest to solve the code before a worm hidden in it demolishes the NSA’s firewalls and cripples the United States.
  • Star Wars: Tales of the Bounty Hunters compiled and edited by Kevin J. Anderson; features the stories of five of the bounty hunters hired to capture Han Solo.
  • Maskerade by Terry Pratchett; another of the Discworld books, the Ghost in the opera house in Ankh-Morpok goes insane and starts killing people. Granny Weatherwax and Nanny Ogg, witches from Lancre, must stop him because after all — the show must go on!
  • The Chronicles of Chrestomanci: Volume I by Diana Wynne Jones; several stories about Chrestomanci, a nine-lived enchanter who presides over the magical world. Very, very, good. Also, I think, better than Volume II.
  • Heavy Weather by Bruce Sterling; storm chasers in the future — the Storm Troupe — are following the possible formation of a F-6 tornado, which is impossible in today’s weather and climate. They use VR gear and military surplus AI’d vehicles to chase the storms. None of them, however, (not even their brilliant leader, Dr. Mulcahey) imagined the actuality of the F-6 and what happened in its wake.