Archive for January, 2007

In Love with Emacs

Tuesday, January 30th, 2007

Yes, another geek post, but only because I’ve really fallen in love with Emacs.

For those of you who aren’t in the open source loop, emacs (Editor MACroS) is a very popular text editor written by Richard Stallman, the founder of the GNU foundation. It’s also been around longer than I’ve been on this planet, having been written in 1975. It’s evolved through 21 different versions by now. Now you wonder why I would rant and rave about a text editor of all things, especially one that’s really old and “obscure”. Well, I believe it’s the best text editor ever. Ever!

To get a picture of why I love it so much, you’ve gotta understand the dexterity involved when programming. It is in no way like writing a document or letter. Rather, efficient programming is a mix of mental ability as well as hand-eye coordination. Sure, you can get away without learning to type properly and to use notepad or some basic editor. In fact, during my internship I’ve met programmers who type with two fingers while staring at the keys. But learning how to be efficient can really help the job run smoother by 3 or 4 factors.

Anyways, I discovered all this emacs handiness when I was hacking away at my graphics assignment in C++. I discovered my profs emacs configuration file and browsed through it. I discovered a goldmine of shortcuts and efficiencies.

To get a picture of the repetitive process of programming, this is typically what will happen repeatedly over a coding session:

1) Open up a few editor windows as reference. You write code based on other modules, so it’s usually handy to see what’s going on in other code files.

2) Write some code. As mentioned, this isn’t like writing a letter. You don’t write at the bottom of the letter. You make changes all over the place in a file, and across many files at a time even.

3) Compile your code and run it. Basically, when you have a partial or think you’ve finished what you have, you tell the machine to create the program based off of your code. If your code was improperly written or the program doesn’t run as desired, you have to go back and fix it.

4) Go back and fix errors by finding the line it occurred on.

Each of these actions can take quite a while and require a lot of hand-eye coordination and wasted movement.

Take for example switching between opened files on your computer:
1) Grab the mouse.

2) Use your eyes to locate the desired window.

3) Move mouse to select that window.

4) Click the window and locate the location of what you’re looking for in the document.

5) Select the location.

6) Move your hand from your mouse back to your keyboard. Repeat.

What if you could do all this in 2 steps instead, without ever having to lift your hands to switch back and forth between the mouse and keyboard without the need to use your eyes to scan for the documents you’re looking for.

Similarly, the act of compiling, running, and fixing code requires a lot of movements. You have to switch to the console to compile your code. Then you have to enter the command to run your code. Finally, you have to go track down your errors through the various code files, a process that requires a lot of searching and switching between windows (and more importantly, a lot switches between mouse and hand). Even if you use shortcut keys, with a simple text editor you have to let go of the keys to use the arrow keys and the page-up/page-down keys. That in itself is another unnecessary motion.

In emacs, to open a file you simple hit ctrl+x+f and enter in your file name. You can use that to switch between files in one single window. You don’t even have to enter in the entire file name, you just have to enter in a few letters and hit the autocomplete key. This saves you a lot of time in that there’s no scanning for windows and lifting your fingers off of the keyboard to grab the mouse, and to move your hand back to the keyboard to assume the typing position. One emacs window can open as many files as you like simultaneously.

Want to compile, run, and fix errors? Hit Alt+Shift+C to compile your code. If there’re any bugs, you hit F12 to goto the line that caused the bug. F12 again will take you to the next error line. Wanna run some code? Ctrl+Z will bring up the terminal inside of emacs. The compile-run-fix error task is now shrunk into a few keystrokes.

These few shortcuts are among many thousands of handy tricks you can do in emacs.

People who don’t code will think that the whole idea of shortcutting everything is silly. But when you think about it, these actions are done hundreds, if not thousands of times in a span of a few hours. Removing them helps one become a faster coder and puts less strain on doing repetitive motions.

A second catch in doing this is that in programming there’s often a rhythm. Often your mind will move faster than you can physically code. When I’m really into the zone, I can think up algorithms and solutions faster than I can translate them into code. The longer the gap is between what my mind can figure out, and what I can code, the harder it is to keep in rhythm to generate a solution. The more “in the zone” you can be, the faster and better your code will be.

It’s weird, I know. But I’m now a firm believer in this emacs business. In fact, it’s such a cool editor that my I’ve heard that my prof once dedicated an entire class lecture on the beauties and uses of Emacs.

I only wish that I looked into emacs and read the tutorial in first year. Sure, I’ve been using emacs for years throughout university. But beneath all the “basic” uses of it, I never took a look of how versatile and efficient it is until now. And it only required that I read through a short hour-long text tutorial embedded in the program.

I am grateful that I’ve found it now though, because it will save my precious coding hands from carpal tunnel hell.

Slowing Down Before It Begins

Saturday, January 20th, 2007

Sorry for the lack of updates folks.

There is a reason for this, well, I think there is.

The unfortunate part of visiting the Dominican Republic was that I brought home with me a little guest.  My guest lives in my intestinal tract, and he’s wreaking havoc on me.  I believe I have a parasite called Giardia inside me.  My girlfriend has it quite severe.  The worst part about this is that the doctors don’t know what we have.

We both submitted stool samples to try to identify this thing.  All the symptoms point to some sort of parasite, but the stool samples came back negative. Apparently, false results come back often with stool samples.

So we’re resubmitting more samples, and getting a blood workup to try to pin down what this thing is.

Severe fatigue is one of the many symptoms we have, and it really sucks to feel so lethargic all the time.  I know I’m a lazy bastard, but sometimes this is unreal.

Hopefully we’ll know soon what we have so that we can get rid of the creepy crawlies inside of us.

Metric System = Sexist

Sunday, January 14th, 2007

I came across a site from a slashdot article which expounds the idea that the imperial system is far superior to the metric system, and that using the metric system meant giving up freedom. Obviously the imperial system is more useful and
logical. It’s clearly more easy to use and is infallible.

Not. Know your imperial units? Here’s a rundown on measuring distance.

There are many riddles when it comes to imperial units of measurements. Wtf is a bushel of something? How many quarts are in a gallon? And how many ounces are in a pound? Why 12 inches in a foot? And why are there 7920 inches in a furlong?

A furlong you say?

1 furlong = 10 chains

1 chain = 4 poles

1 pole = 5.5 yards

1 yard = 3 feet

1 foot = 1 and 17/33 links (WTF?!?!?!)

1 link = 7 and 23/25 inches (WTF?!?!?!?)

1 inch = sources are disputed, but apparently an inch is the measure of an average man’s thumb, or 3 barleycorn, or 1/12th of a yard (which is the distance between King Henry 1st’s thumb and nose when his arm is stretched out).

Obviously, the base 10 standard for the metric system is flawed and it makes complete rational sense to use the imperial system. Especially in scientific settings. This will allow NASA to once again send a space probe worth hundreds of millions of dollars in the wrong direction because of poor unit conversions.

The people who created this website seem to think so, check it out for a laugh.

http://www.freedom2measure.org/

Extra hilarity for the part where they write that the metric system is sexist… whereas the imperial system isn’t:

Sexist

The metric system has been almost wholly created and standardized by male scientists and bureaucrats. At the time, during which women were considerably less liberated than today, woman had virtually no say in the creation and, in many countries, the imposition of these units. Perhaps, if they had, the value of the practical units used in those tasks undertaken by woman at the time would have been recognized.”

The Home Stretch

Tuesday, January 9th, 2007

So I’m in my home stretch for school. Yup, my very last term in University. As far as I know, I won’t ever be coming back once I’m done (grad school is the furthest thing from my mind right now).

I want to go out in a bang this term. I want that 4.0 average. It will be quite the feat if I can pull this one off, as my courses look like they’re going to be quite a challenge.

I’m only taking 3 courses this term, so that should help. But hidden from the number of courses is the weight of my coursework. So here it is, the breakdown of what I’ll be cramming in my brain for the next 4 months:

  1. CMPUT 340: Numerical Methods (Continuous Computing)
    Yes, this course is about as badass as it sounds. This is probably the most feared courses in any Computing Science University program. It’s the marriage of mathematics and Computing Science, and the devilspawn that the two have so far seems quite scary. In today’s class my prof threw up some crazy linear algebra on the whiteboard to explain how the Google search engine works. I looked around at my colleagues, and we were all like “wtf… I have no clue what he’s talking about”.Putting off this course to the end might not have been the brightest thing for me to do, as I have heard horror stories of CS students failing this course in their final term and having their graduation delayed.
  2. CMPUT 411: Introduction to Computer Graphics
    A course on OpenGL and 3D graphics. No, this is not a course on how to use OpenGL but a course that explains how to write OpenGL from scratch if need be. My prof mentioned that this course will most likely be the heaviest CMPUT elective that we could take, and that it will eat a ridiculous amount of time. It is the black hole of time for all us undergrads in CS. Luckily, the prof decided to take pity on us and cut out the term project. This will give us enough time to bathe and eat 3 square meals every so often. He is merciful!
  3. Religious Studies 344: Buddhisms in Tibet and the Himalayans
    I took this course cause I needed an elective to fill and also because I’m a Buddhist and it’d be interesting to study from a secular point of view.  How hard will this be?  Not overly hard, but time consuming due to the amount of text required to be read (a total of 4 textbooks).  What does scare me though is that that mark cutoffs are extremely high.  Getting an 85% as a final mark would get me a B grade.  A 93% mark would be an A-.  I think that’s pretty high for grade cutoffs… but we’ll see how he marks.

Well, that’s what’s on my plate so far.  Hopefully I can pull something for the win this term.
Also, I’m getting into the internet porno business.  No, I won’t be making porn, but I’ll be a webmaster of sorts.  Hopefully that won’t take up too much of my time. Still debating whether or not I should post the link to this project on my blog :-p.

Happy New Year!

Wednesday, January 3rd, 2007

How quickly things change!

The year whirs right by me and it feels surreal that I have to do a “year in review” recap on my life again. I think I may be onto something when I think time is accelerating as I get older. Maybe it’s as simple as my memory becoming less efficient. Whatever it is, I still haven’t come to terms that it’s no longer 2006… although, it is only a number anyways.

This year for me is marked by:

  • The passing of my dear friend Chelsy in a freak car accident. My mind still plays tricks on me and I always think I see her wherever I go. Her life and death have changed who I am for the better.  I still think of her often, and wonder what the world would be like with her still in it. I hope she’s well wherever she may be.
  • Finally an academic year that I’m not fully ashamed of. My marks came in for the fall term, and I’ve hit roughly an A- average once again. Though I still wish I pushed harder in school, I’ve turned the last few terms of my university experience into a best showing I’ve had so far. It definitely isn’t the best I could do, and I know I could do better (I’m hoping to push harder in my last upcoming term), but it’s nice to finally be focused on my schooling and to be rewarded by it.
  • This year I found my wonderful girlfriend Renata. So far it’s been the longest relationship I’ve ever had (a whole 6 months!), but time cannot account for how close we are. I really have no fears of moving in with her in the summer for a permanent stay, as things work out so beautifully between us.  Unless something crazy happens, like me going crazy (probably with schizophrenia), I won’t be single for a long time if ever again.  Renata’s everything I could ask for in a woman.
  • I have never been more confident in my skills as a Computing Scientist.  Having worked on so many interesting projects, and having real work experience, this year really cements my belief that I chose the right career and that it’s cool to be geek.
  • Travel! I’ve visited some new and old places. It was nice to have the freedom to travel again and not be tied down (in 2005 it was my internship). Some memorable trips were to California for Coachella, a tour and backpacking trip through the Rockies, and a trip down to the Dominican Republic. This year (2007) doesn’t look like it’ll be a slouchy year for travel either! Renata wants to do a gruelling 10-day, 175 km hike through the Rockies. We’re also deciding between a trip to either Botswana in Africa or to visit Sweden. My close friend Mylore also wants to do a scrambling trip in the Rockies as well where we’ll spend a week or two trying to summit as many peaks as we can. Sally forth!

I guess I’ll end it here before it gets too long-winded. Expect some trip reports of the Dominican as well as some general blogging on here for the next few days to come.

Happy New Year to all, and I hope the year has been good to you as it has been to me.