A Song of Fire and Ice Gave Way To The Belgariad

November 9, 2008 Leave a comment

I’m new to reading Fantasy.  Last summer on family vacation my brother handed me a book to read – A Game of Thrones by George R.R. Martin, book 1 of the series A Song of Fire and Ice.  Despite being 900 pages and myself not much of a reader, I managed to power through it before returning from vacation.  I enjoyed the book so much I picked up the second – A Clash of Kings -upon returning home.  Unfortunately, I only managed to read a quarter of A Clash of Kings before I drifted away from reading.

Earlier this month I dusted off A Clash of Kings and started over.  I began to do some online investigating of the Fantasy genre; I’ve always liked fantasy, I just haven’t been much of a reader, nonetheless a Fantasy reader.  I kept coming across the same handful of names – Robert Jordan, David Eddings, Terry Goodkind, and David Farland.  After more investigation into the authors and their works I was interested and looking forward to reading some of them.  But, surely, I can’t quit George R.R. Martin‘s A Song of Fire and Ice – I’ve got to finish the series before starting another series!

Well, I failed, I gave in – once again, I put A Clash of Kings back on the bookshelf, still only managing to make it a quarter through the 750 pages.  What did I give it up for? David Eddings’ The Belgariad.  Why?  I was just waiting to finish A Song of Fire and Ice so I could read something else – surely not the right reason to read a series.  I was only a quarter through the second of 4 books, each 800 pages or so – not something I could “wrap up” in a week or so.  At the rate I was reading, it would’ve been…3 or 4 months before I finished A Song of Fire and Ice.  I decided it would be better to read what I wanted to read – after all, reading is supposed to be fun right?

I went over to Borders and grabbed the first book of David Edding’s The Belgariad: Pawn of Prophecy; what a change from George R.R. Martin.  Although there are more books in The Belgariad, each book is less than half the size of a book from A Song of Fire and Ice.  Not that a book should be judged by its page count, but from what others have said it seems that Fantasy series’ can have a tendency to drag on and on (Jordan’s Wheel of Time anybody?).  I’m half way through Pawn of Prophecy and so far the world is definitely more fantastic compared to A Song of Fire and Ice.  There’s real magic (real magic, what the hell!?), not so-skilled-it’s-like-magic magic; there’s more physical combat compared to political combat; and there’s the obvious one-character-of-each-class-from-Dungeons-and-Dragons characteristic.

It’s quite a refreshing change from Martin’s world – there aren’t so many characters that I need to keep note of who’s who, there’s less politics to tangle the story (although allowing for excellent twists), there are fewer side stories, and there’s less pages put into descriptions of the world and its inhabitants.  I’m finding that with less descriptions I’m able to leave the picturing of things to my imagination rather than try and figure out exactly what the description is telling me, allowing me to focus more on the story and less on the environment.

The Belgariad is more simple than A Song of Fire and Ice – probably a good thing since I’m new to the genre.  I certainly plan to finish A Song of Fire and Ice, but perhaps I need a bit more experience with the genre before I can really appreciate Martin’s story.

The Factory Pattern

November 6, 2008 Leave a comment

The Factory Pattern applied:

(From xkcd)

Categories: Miscellaneous Tags:

Watch This

November 4, 2008 Leave a comment

Another odd find – trust me on this one. Check out this awesome video for the new Wario Land: Shake It game for the Wii. It’s only 0:45 seconds, watch it.

Categories: Miscellaneous Tags: , ,

Note-Taking in the Terminal

November 3, 2008 1 comment

Given that the terminal is a productive environment and notes are productive objects, putting the two together can yield productive environment-objects…err, notes in the terminal.  The first day I got my Linux machine I set this handy tool up – since the notes are in a text file and you’re in terminal, you can use all sorts of text-related command-line tools to search your notes.

To begin, you’ll need to make a basic text file somewhere on your machine, preferably in the directory that your terminal opens to.  No need to figure out where that is exactly, simply open your terminal and create the file, i.e.

you@your-computer:~$ touch notes

Now you should see an empty file named “notes” in your home directory.

Here are 2 ways to write notes to the file.  The first way is easier if your note is small enough:

you@your-computer:~$ echo “this is a note” >> notes

Your note goes within the quotes, and at the end the text is appended to the end of the notes file.


Be sure to use the double arrows >> instead of a single arrow > or you will erase all your previous notes!

The >> means to append the text to the end, where the > means to replace the entire file with the text.

The second way is more interactive and is best used for entering multiple notes or long notes:

you@your-computer:~$ cat >> notes

This will move your cursor to the next line and wait for input.  Simply start typing the note – hitting Enter will move you to the next line.

  • To save and finish entering notes, hit Ctrl-d
  • To abort, hit Ctrl-c
  • To cut text from cursor to end of line, hit Ctrl-k
  • To paste text at cursor, hit Ctrl-y

It’s a good idea to pre-pend each note with a topic/category/tag name so they’re easy to find with grep.  For example, say you’re entering some notes on terminal keystrokes, then your notes would look like:

terminal keystrokes: Ctrl-d to finish

terminal keystrokes: Ctrl-c to abort

Now to find all of your notes on keystrokes:

you@your-computer:~$ cat notes | grep keystrokes

And the output would be:

terminal keystrokes: Ctrl-d to finish

terminal keystrokes: Ctrl-c to abort

Now remember to use those productive environment-objects!

Got a better way to take notes with the terminal?  Share it in a comment.

Categories: Linux Tags: , ,

Internship In A (Large) Nutshell

October 30, 2008 2 comments

How It Came To Be

This summer (Summer ’08) I had a 3-month internship with Thetus, a semantic knowledge modeling and discovery software company based in Portland, Oregon (my home town).

How I got the internship was amazingly unexpected.  During Winter term last year I had a CIS course in which I made a good impression on my professor.  Towards the end of the term I was looking around at internship opportunities, but unfortunately most I found required someone to be further along in the CIS degree; it was looking like I was going to have another summer of video games (bittersweet, huh?).  I then recieved an email from my professor asking if I was interested in a summer internship in Portland.  How perfect!  He was friends with the founder of the company and they came to him in search of an intern.  As I had made a good impression on him, he thought of me.  Of course I said yes, and he got us in contact.

I then had to make 2 trips up to Portland to meet with my “boss,” or the developer who I would be working directly underneath/with.  During our hour-long meeting at a Portland coffeeshop we ended up talking about music and University of Oregon professors and classes.  As it turns out, my “boss” was a recent graduate of University of Oregon (where I am currently a student) and even has the same major and minor that I do.  So we had a lot in common, we had a comfortable talk and we discussed my skills and knowledge for about 15 minutes total.

It turned out well as they asked me back again a few weeks later for a meeting with one of the founders.  We met at the office so I was able to check the place out and meet some of the other employees.  The meeting wasn’t as smooth as my first, but nonetheless was successful.  A few days later my “boss” called me and told me they were pretty excited about bringing me on board but still had to get the okay from the real boss.  Several days later I recieved another phonecall, this time from the real boss, to tell me congratulations and discuss details.

The Happening

So, summer came along and I immediately went to work for Thetus, from June 23rd to Septemeber 23rd.  Aside from various small things, I spent most of my time writing server-side and client-side applications.

I used Adobe Flex for client-side applications, Java for server-side programming, and JSON for communication between the two.

I wrote these applications to get experience with semantic technologies, abstraction, and ontologies. My applications were mostly for in-house use – not something that would be given to a client. For instance, I spent about 2 months working on an application that displayed a family tree (in a detailed and abstraction-supported way). The company offered several courses on how to use the knowledge and software they provide, and this application was to be used in the demonstration to provide a visual, interactive component. The courses use a family tree as an example, particularly the Kennedy family tree. So for 2 months I learned about the Kennedy family while writing this application.

For the last month or so, I began working on another application that was to be given to a client as an example of the services provided by Thetus. At one point, I was given a list of features that I needed to implement by the end of the week, and furthermore, the application was going to be demo’d to the client by the boss! That was an incredibly stressful time as I had to work late and come in early, and even after all that I failed – I couldn’t get all the features implemented fast enough! I had to give screen-shots to the boss to demo – man, what a feeling of failure. Apparently the demo went fine anyway, and not having the application working wasn’t as big of a deal as there was already a second demo planned. I wasn’t going to be around for that, so another developer was to pick up my application and finish it.

Aside from those Flex/Java applications, I wrote a couple other programs. One was written in JavaScript and was to be used in tutorials to present code snippets, and another was written in pure Java as a command-line tool to read through a set of (real-world) locations, query a geo-coding service, and write the latitude/longitude to these locations. I also had some experience with Ant for Java build-scripts.

In The End

All-in-all, I learned a wealth of information that I couldn’t while sitting in a classroom and doing homework. Despite being the youngest (both in age and education) intern they’ve had, they were pleased with my performance and asked me back as an intern next summer, or as an employee with a position and salary. Wow, that’s quite a good start to my career. I will definitely be returning in the future. I can’t thank my professor enough for thinking of me.

Relive the Classic! Watch Star Wars Through Your Terminal!

October 28, 2008 Leave a comment

Here’s an odd find – watching Star Wars: A New Hope (the first original) in ASCII art through your command-line terminal.

Yes, ASCII art, like Kirby: <(‘-‘<) (>’-‘)> and my favorites: t(‘-‘ t) (flip-you-off Kirby) and Q(‘-‘Q) (boxing Kirby).

Anyways, to watch the movie you need telnet, so you Cygwin users make sure you’ve got it. Those linux users should already have it.

To start the magic, type in your terminal: telnet towel.blinkenlights.nl

And if you manage to watch the whole thing, come back and let me know how it ends.

Formatting Your Functions

October 27, 2008 Leave a comment

I’ve noticed in a lot of code people tend to write entire functions within an if/else block, particularly when error-checking must be done first-and-foremost in the function (like verifying parameters). I write my code differently; let me explain why.

To show you what I’m talking about, I’ve created a basic example:

public double calculateMass(Object something)
     if(something != null)
          // Perform calculations
     } else {
          // Error

This is poorly formatted for several reasons:

  1. Someone reading this code must scroll past the entire if block to see the else block. It should be clear from the name of the function what the if block does, but it is not clear how the function reacts to errors, which are in the else block.  The reader must skip over the giant if block to see the else block, hidden at the bottom under a giant formula of physical calculations.
  2. This indentation is unnecessary and makes the code harder to read. Anyone who’s written code knows things get messier the more they’re nested in blocks.  In the example, the code is immediately nested, already making further blocks 1-level deep – off to a bad start.
  3. An if-else wrapping the entire function implies the function has 2 calculations. Depending on some condition the function will perform a different calculation; one calculation in the if block and the other in else block.  In the example, this is not the case; the else block contains nothing relevant to the calculation.  The calculateMass function only has 1 calculation: to calculate the mass of a given object – there is no ‘else.’

To better highlight that the function has only 1 purpose, this “main” code should begin in the 0-level indentation of the function, i.e. it should be flush with the left-most indentation of the function. For example,

public double calculateMass(Object something)
     // 0-level
          // 1-level
               // 2-level
                    // 3-level

To handle the error-checking and remove the else block, a simple if block with a negation should be used prior to the “main” code.  For example,

public double calculateMass(Object something)
     // This is the negation of the original condition,
     // 'something != null'
     if(something == null)
          // Error

     // Perform calculation

With this format, it is clear to anyone first viewing the code how the function handles errors. Since they can already assume that the code that follows will calculate mass, there is nothing left unknown to the reader at this point (aside from implementation details).

Got an objection? Got your own formatting you prefer? Share it in a comment.