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.

Yaaaaay!

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) {
in=in.trim();
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.

Anyways.

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.

Enjoy!

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 “qzloxqsiy@rluzuhv.net”) 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=”http://officeofstrategicinfluence.com/spam/”&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=”http://officeofstrategicinfluence.com/spam/”&gt;
<img alt=”This link kills spam” src=”http://officeofstrategicinfluence.com/spam/icon.png&#8221; border=0></a><br />

in.


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.

Why DRM is Bad: The Law of Unintended Consequences

DRM is software used to restrict your access to your files.  And it is one of the worst ideas of the modern world. To quote Cory Doctorow in his book Someone Comes To Town, Someone Leaves Town,

No one woke up this morning and said, “Damn, I wish there was a way to do less with my books, movies and music.”

It was intended, originally, to keep copyright laws working.  Before about the 20th century, copying another work was an arduous process (no computers, no recording mechanisms, etc), so restricting the copying of an item (like a song, or a picture) was most easily done at the stage of copying.

All that has changed.  Now we have computers, cheap cameras, video recorders, scanners, recorders, and so on.  It’s suddenly very hard to keep people from copying.

The Law of Unintended Consequenses states:

Any intervention in a complex system may or may not have the intended result, but will inevitably create unanticipated and often undesirable outcomes.

Basically, that means “Anything you do might work, but it will always do something you didn’t expect or want.”

The attempt to keep copyright working in today’s day and age is DRM, which keeps you from copying and using files how you want.  And it’s not just constricted to copying, either:

  • In July of 2009 Amazon deleted copies of two books from Kindles, as the books were illegally placed in the Amazon ebook store.  Ironically, they were Nineteen Eighty-Four and Animal Farm, both by George Orwell.Now, assume a leaked copy of a secret eight Harry Potter book (of which there are in fact rumors) is bound by an individual and placed in Borders.  You walk in and want to buy it — you don’t know that it shouldn’t be there.  The teller, who doesn’t really like fantasy, doesn’t know that they shouldn’t be selling that book.  Later that night, it is revealed to the manager that this book was sold.  Some of his workers break into your house, take the book (you had already been reading it; you were about halfway through) and leave.  I believe you would be sufficiently enraged.  What’s to stop Amazon from deleting or editing any book you have on a Kindle?
  • DRM is on many DVDs in order to keep the market from getting too segmented — spread out over too many demographics, which is a huge hassle (if I read correctly) for marketing and the company in general.  Now, assume you just bought a new DVD.  You’re going on vacation to Japan soon, and haven’t yet had a chance to watch it.  You bring with you, to watch in the hotel one night.  Woops, too bad!  Many DVDs only work in players manufactured for the same country the DVD was manufactured in, and possibly a few others.
  • Or maybe, while in Japan, you buy some anime DVD to watch at home. Too bad, so sad.
  • Don’t like Safari on the iPhone?  Want, perhaps, Opera Mini?  Oh wait — everything on the iPhone is slathered in DRM.  You can’t use third-party software not from the App Store, and Opera Mini hasn’t been accepted yet.  So, it does get accepted, then an update changes its code some.  Apple doesn’t like the new version.  Oh, sorry, it appears Opera Mini isn’t on your iPhone anymore.  Download a vehemently anti-Apple article on your iPad?  Nope.  It’s deleted.  They can do that, if they want.  At any time.  To any one.  On any thing.
  • So, you just downloaded this ebook and man, is it great.  You want your friend to read it, but he doesn’t want to buy it.  “Okay,” you think, “I’ll just send it to him.”  Woops, sorry!  You can’t share your files if their DRM says so.
  • Any song you download from iTunes has DRM on it. You can only have iTunes accounts on three computers, and those songs are very restricted. This is doubly stupid. Not only is DRM a bad idea, but each of those songs is available on CD without DRM. iTunes DRM’s its songs because the big music companies say so, but then they release unlocked CDs (which is a great thing) that you can rip.

And get this — DRM doesn’t, for the most part, do a thing except annoy people.  Pirates have cracked every DRM scheme out there.  Any file with DRM is available on BitTorrent without it.

Help spread awareness:  DRM is bad.

The Big Skinny

The Big Skinny is a wallet specially designed to be really, really thin. It is.

In my quest for a ridiculously thin wallet wallet, I tried duct tape, paper, heat-fused plastic bags, credit cards, and will soon even try one made out of old Big Skinnycomputer keyboard insides. But the thinnest I’ve used thus far is the Big Skinny. My old wallet, one that my grandfather made out of leather, was about 3/4 of an inch think.  The plastic-bag wallet was 1/2 inch think.  The duct tape one was about a centimeter and a half thick.  The credit card one fell apart (my fault, not the design’s). The paper wallet was about a centimeter thick but had to get remade too often..  The Big Skinny is just 5 mm and is very durable.  Each wallet contained approx. the same material:  always 4 cards, 4 pieces of paper, and variable numbers of bills.


The model I have is the Sport, except mine is black.  It comes in black, blue, red, and tan.  I love it.

More Great Authors

Here’s another list of really good books. All of them are, as before, highly recommended.

Also, see up at the top where it says Home and About? There should also be one that says Books. Clicking on it will result in a list of books. Thus far it contains the contents of this post and this older one.

Without further ado, here are the authors, in no particular order:

  • Stephen Hunt, who wrote The Court of the Air, a fantastical steampunk-y adventure to save the world.
  • Orson Scott Card, who is, of course, the author of Ender’s Game and all of its prequels, sequels, and parallels.
  • Neal Stephenson, who wrote Cryptonomicon, a book about adventure and cryptography, Zodiac, an excellent eco-thriller, The Diamond Age, about a nanotech-filled future, and my personal favorite Snow Crash about a katana-weilding hacker named Hiro who is also a pizza deliveryman for the Mafia.
  • Daniel Suarez, the author of Daemon and its sequel FreedomTM, about a computer program that takes over the world in an effort to restore actual democracy. I read both of them in a day; they’re very, very good.
  • Charles Stross, who has written many books. My favorites are Accelerando (about the singularity), Glasshouse (a “loose sequal” to Accelerando; about a group of people trapped in a virtual world), Saturn’s Children (about a group of humanoform robots at the heart of a conspiracy), and The Atrocity Archives (about using math to connect to other universes and bring through entities.
  • Katherine Neville, who wrote The Eight, about a chess set that may hold the secret to the Elixir of Life.

Sorry this post is kinda short, but there’s twelve books there. That should last you for a while. Don’t forget to check out the Books page from time to time to find a new book to read!