Archive for the 'G33k' Category
In Love with Emacs
Tuesday, January 30th, 2007Yes, 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.
Pandora Internet Radio / Google Web Toolkit
Tuesday, December 12th, 2006Pandora
So my brother stumbled onto this really cool internet radio station yesterday. It’s called Pandora Internet Radio and can be found here: www.pandora.com
Now what’s so different about this internet radio station compared to the millions out there? Collaborative Filtering.
Basically Pandora asks you to name a song or an artist, and it will search it’s database to find it for you. It will then play for you songs that resemble your search or songs that it thinks you will like. For each song played, it will let you rate it with a ‘thumbs up’ or a ‘thumbs down’ and from there it will fine tune your profile. The more songs and ratings you give it, the more accurate the profile it will have of you.
Basically it works off of the Collaborative Filtering algorithm. It will try to match your tastes with the tastes of other users. If I happen to like the bands Mogwai, Metric, and Tool and you happen to like Mogwai and Metric, Collaborative Filtering will recommend you some Tool songs.
Pandora also uses metadata to categorize each song. So if you like Mogwai, then it will provide songs that are from the rock genre, with little vocals, and lots of soloing (choosing from many other variables as well).
Coincidentally I learned all of this stuff in one of my Comp Sci classes this semester, so it’s pretty interesting stuff for me. Pandora is a very cool piece of web technology. Check it out!
–
Google Web Toolkit
Yes, another technology post. I read on Slashdot today that Google released another version of its Google Web Toolkit.
Web Toolkit? Well, it’s a spiffy framework that will transform your Java applications into web applications. You heard me. Write a Java application and then run the toolkit and it’ll compile your code into a webapplication using AJAX and Javascript.
Personally, I think this will revolutionize the way we design web-pages. Especially considering that it’s a very fresh and new project, one can only hope that it will become more versatile as newer features are added with each release.
As much fun as it is designing a webpage, it never has the elegance and ease of expression as writing an application. Why bother writing a bazillion select statements and fidgeting with html form buttons when you can pump out a few lines of Java code.
I haven’t played around with the toolkit yet (damn you exams for eating up all my time!), but I definitely will give it a try in the near future. There are a bunch of example sites made with it on the page. I was really impressed with what it could do.
RSS + BitTorrent = Sexy
Thursday, November 9th, 2006Want to watch your favorite TV shows commercial-free, in high definition, and before they’re aired on cable? Find out how the internet provides all!
After the dot com bubble burst a few years ago, the internet has evolved to Web 2.0 (yes, this is the actual technical and accepted term). Instead of using the internet only as a method of publishing content, the internet is now more of a platform of communication between applications. The companies that did survive the burst are ones that developed software to communicate on top of the internet, and not rely solely on publishing.
Users are no longer people but are now also applications. With this comes new and slick uses of the internet, such as BitTorrent and RSS feeds.
RSS: What is RSS? RSS stands for “Really Simple Syndication”, and is a protocol to syndicate data easily. My blog provides this feature. If you’re using a browser that supports RSS feeds, you can add any feed to your browser for it to aggregate your data. In simple terms, your RSS reader (your browser in this case) will notify you whenever new data is available, such as a new blog post on my site.
This helps avoid the nasty hassle of running around and checking all your favorite sites for new posts, as now you can aggregate all the data into one location.
BitTorrent: Remember KaZaa or Napster back in the day? They were peer to peer applications that let you download and share music/movies/etc… with other users on the network. It was great for its time, and without it I definitely wouldn’t have all the music I have today. The only problem with those networks is that downloading large files was slow because you could only download from one source. If wanted to download a movie from someone I could only get it from one source. And unless that source had a blazing fast connection, it was generally pretty slow since it was also distributing to other users.
BitTorrent is another peer to peer protocol but it works differently. Instead, the shared file is chopped up into tiny parts. The uploader uploads these small parts one at a time to different sources, while other downloaders also share their tiny parts with other downloaders. This way, you share the bandwidth of everyone. If you’re downloading you’re also uploading what you have to others, and vice versa. This also means you can download from multiple sources simultaneously (each person giving you their small piece). And like a torrent of bits, you finally get your complete file in the end when the bits are recombined together. BitTorrent has revolutionized the way data is shared on the internet.
You’re no longer restricted by the speed of one single source, but now have the option of retrieving from multiple sources. The combined bandwidth of the whole “swarm” of machines allows for incredible speeds. Huge files, such as movies and TV Shows that were cumbersome to download, are now easily accessible. The BitTorrent community has grown so much that I can now watch my favorite TV shows BEFORE they even air on my television every week.
RSS + BitTorrent????
So what is this RSS + BitTorrent that I talk of? Well, I used to have to hunt every day for my weekly TV shows on BitTorrent. Why watch my favorite shows on TV when I can watch them in high definition and without commercials on my PC?
But I want to be lazy. There’s no denying that turning on the television to a channel is much easier than hunting down and downloading a torrent. I want my cake and to eat it too! I want to sit on my lazy butt… and just hit play. I want my weekly show to be shown in high def, with no commercials and interruptions, and I want to see them as early as I can (at least before it airs on cable).
Well, RSS comes to the rescue. Using a BitTorrent program that supports RSS feeds, I can now download a torrent automatically from an RSS feed. The program (I use uTorrent) sits there and waits for the feed to tell it that a new torrent is up. All I need to do is to give my program a list of shows I like watching, and after that one time setup it will now auto-grab them for me.
So now all my weekly shows auto-download for me. No more searching for torrents, no more waiting and scanning for when they’re released. They come in as soon as their hot off the press, and all I have to do is watch when they’re done.
Who needs cable TV nowadays?
What You Need:
It’s a lot simpler to set this up than it sounds. First of all, grab uTorrent from the net and give the readme a quick glance over. Then, find a good torrent site that supports RSS feeds. Then you’re off to the races!
Depending on the torrent site you use, I usually find that the speed I get my shows is mostly limited by my internet connection. Enjoy!
Vim for VI IMproved
Thursday, July 6th, 2006The Mundane:My bike into work has become easier and easier, and after Saturday’s intense mountain biking ride in the hills my quads can handle the commute to work with ease. The hills that were once killer now pale in comparison to the steep inclines I faced on Saturday.
However, I got suckered into subbing for Wei in his basketball rec league yesterday. I haven’t played basketball in over 2 years, but I fit right into our team of beginners. I have never sweat so hard in a very long time and by the end of the game I could wring out a few glasses of water from my t-shirt. Basketball is a lot more intense than from what I remembered. I had an amazingly fun time playing though, despite the fact that our team got steam rolled.
I’m almost 5′8 and I was the tallest player on our team. It’s a mixed league, and we have 3 guys and 3 girls. Our opponents: 5 guys and a 6 foot tall chick. Every player on the other team except 1 was at least 6 feet tall, and they all were really good at basketball. I think Wei’s team was put in the wrong pool/league because we got absolutely destroyed. Final score: 56-17… and we were playing a point per basket.
I’m happy to say that I haven’t felt this active in many summers. I can definitely feel my cardio improving quite a lot, and my endurance is really starting to increase.
I had fun nontheless. This morning I woke up with my legs dead tired, stiff, and sore. I guess this is a good thing; no pain no gain. My legs are gonna be stacked for this Saturday’s extended mountain biking ride. However, being that they haven’t recovered they got even more worked out today at Ultimate Frisbee practice.
Why did I sign up for Ultimate Frisbee again? Oh yes, because I’m a masochist.
–
I’ve decided to hit up Bluesfest and buy the all week pass. There’s a show almost every day of the week, so this week will be a musical buffet of all sorts. I can’t wait.
–
So my new project is solely Unix based. What’s really annoying though is that the Solaris servers we use have a really poor user interface.
So instead of using the crappy interface made in the 90’s, I interact with the servers purely through the use of the command terminal (essentially similar to a DOS prompt). This is great and all, but what happens when you have to edit a text file from the shell?
You use something called VI (Visual) or it’s evolved incarnation Vim (as in VI Improved). The only problem is that VI is really unintuitive to the beginner user. It’s nothing like Word or Notepad for text editing because there is no mouse, and to boot there’re thousands of commands when hitting the keys. It’s completely daunting and intimidating for a beginner user, and so it turns off most users…such as myself.
My first encounter with VI was in the Computing Science University labs, where I noticed my friend was programming in a shell instead of using a graphical interface like notepad. The keys he was hitting were all weird. To move up he didn’t use the up arrow on the keyboard, and instead he pressed ‘k’, down was ‘j’ and left and right was ‘h’ and ‘l’. Why learn something new when I had a nice notepad-esque text editor… especially something so unintuitive.
However, now that I’m forced to learn how to use VI I don’t think I can turn back. In fact, I’ve installed the Windows version of Vim on my workstation.
Why? No, it’s not because I’m a masochist. It’s because VI and VIM are a lot more efficient and intuitive once you get the hang of it. It took me 90 minutes to walk through the tutorial and practice to use the editor. This sounds weird, because it takes 3 seconds to learn how to use notepad. But upon learning how to use it, I’m completely sold.
All the commands that you would normally use in a text editor are placed effectively in VIM. Need to do a search? Hit the ‘/’ and type in the keyword you want to search. Need to scroll down 4 pages? You can do that in 2 keystrokes by hitting 4 Ctrl N.
Need to shift 5 words right? Hit 5w. Need to scroll to line 455? Press 455 G. Simple, quick, and effective. Now all I have to do is use VIM for the next little while so that it becomes second nature and my geek points will increase.
Give it a try! It’s free and open source.
The Linux Revolution
Wednesday, June 7th, 2006Studying Computing Science implies that I’m quite the computer geek. This also means that I love to tout Linux distributions as the operating system of choice. WinDoze? Not for me, no thanks.
Truthfully though, I had never touched Linux until university, and even to this day I’m not a “power user” and can’t do all the hardcore customizations. However, I still love to tout Linux. Not because I have to uphold the geek stereotype, but because it is superior to WinDoze in so many ways.
My affair with Linux started a few years ago. A school mate introduced me to Mandrake so that I could program more efficiently. Our school has mainly Unix/Linux operating systems installed on the lab machines, so we were accustomed to using them for doing our assignments. For good reason too: if programming was like surgery, using Linux would be like working with a scalpel compared to the rusty butter knife that is Windows.
So it was like a godsend to have a machine at home from which I could work on my projects. At the time, installing it wasn’t so hard, but getting new programs installed was difficult. Compile and configure source code? Missing dependencies? If you don’t understand what I just said, neither did I at the time. Also, there were tons of things I couldn’t do on Linux easily, like watch videos, in which I could do on Windows. So after installing it, it just sat there unused.
Fast forward a few years and I’m back in university after being away for amost two years on internship. With my brand new PC I give Ubuntu a chance. I’d never used it before, but my friends kept on telling me that Ubuntu would revolutionize the Linux experience. For me it did just that.
It’s very user friendly. It’s graphically gorgeous, and it has software to do almost everything that Windoze can do. Not am I happy to ditch Windows, but the software on Linux runs better than the Windows counterparts. It’s seemingly immune to spyware and viruses, and installing new software is even EASIER than in Windows. Not to mention that almost all the software is free. Yes, legally free.
Ever since installing Ubuntu on my machine, I’ve been using Windows a lot less often. There was a bit of adjustment at first, because after years of Windows I’d become accustomed to its interface. But after using Ubuntu for a few short weeks I dreaded ever having to come back into Windows. The only shortcoming is that the Linux distributions out there right now can’t handle the latest and greatest games all that well, so that’s mainly the only reason I boot into Windows nowadays. But that’s to change too over the next little while.
Why am I writing all this? Well, the latest release of Ubuntu, codenamed “Dapper”, has just come out. It’s been 8 months since the last release, and the developers have made a lot of fixes and improvemnts. I have been excitedly anticipating its release, and tonight I’m going to give it a go. At the same time, I just wanted it to be known that there is an alternative to Windows out there that is superior. Why get stuck in the clutches of M$? Give the happy penguin a try, you won’t regret it.

Categories
- Fighting (2)
- G33k (5)
- The Mundane (3)
- Uncategorized (125)
Archives
- July 2009
- May 2009
- March 2009
- February 2009
- January 2009
- December 2008
- November 2008
- October 2008
- September 2008
- July 2008
- June 2008
- May 2008
- April 2008
- March 2008
- January 2008
- December 2007
- November 2007
- October 2007
- September 2007
- August 2007
- July 2007
- June 2007
- May 2007
- April 2007
- March 2007
- February 2007
- January 2007
- December 2006
- November 2006
- October 2006
- September 2006
- August 2006
- July 2006
- June 2006
- May 2006
- April 2006