Use the Force, Unixuser42!

DISCLAIMER: Don’t get confused by the title. This post won’t teach you any advanced UNIX trickery stuff. If you’re expectation is such, you’ll be pissed after reading the article. You’ve been warned!

I had quite a laugh watching the Volkswagen Superbowl commercial, where this kid dressed up in Darth Vader Ccostume trying to control everything using the Force.

Then I got a (lame)idea! What if the powerful ‘sudo’ command in UNIX, which enables you to perform task as the superuser, was replaced by ‘force’! So you can type things like “force halt” in the terminal and shutdown the system. The Star Wars fan inside me got excited, and the Unix fan set out on a (very short)path to figure out how to achieve that.

The obvious way to do this is create to an alias for command ‘sudo’ and set it to ‘force’. Here’s how this can be done:

  1. Fire up your terminal program
  2. Move to your $HOME directory: cd ~/
  3. Open the .bash_profile file: vi .bash_profile (I’m on OS X. On other systems, like Ubuntu, this file will be .bashrc)
  4. Add this line to the end of the file and save: alias force=’sudo’
  5. Reload .bash_profile: source .bash_profile
  6. Try it: force reboot (System will reboot after authentication)

Don’t worry about ‘sudo’, you’ll still be able to use it. You didn’t exactly ‘replace’ sudo, you just gave it another name.

Also, it’s good idea to check if your system somehow already not using the ‘force’ command. (Type force in the shell to see whether it responds ‘command not found’ message.)

How to piss off a …

I found some really funny posters over the Net. Each one is designed to anger fans of multiple Sci-Fi/Fantasy franchises, be that Star Wars/Trek, Harry Potter or Lord of the Rings.

The first one.

Get it? Picture of Captain Mal from Firefly, next to it the famous line of Spock from Star Trek. Signed by Han Solo of Star Wars?!

The next one will surely irritate a fantasy novel aficionado, and a Star Wars fan.

Gandalf ¬†the wizard, is given credit for a quote by Master Yoda, and he’s signing off as Dumbledor!

Fucking hilarious!

You’ll have to be a programmer to get the next joke.

Did it piss me off? No way. This one was so amusing that finally decided a post a blog after a long time!

You don’t get it? Did you say you’re a programmer?

Now you are pissing me off.

Photo Courtesy: Reddit.

Wikipedia for Star Wars!

I stumbled upon an interesting website last night. It calls itself Wookieepedia, the star wars wiki. It is created by a community of dedicated star wars fans and has over 60 thousand articles on characters, places, equipments and events portrayed on different Star Wars franchises(movies, games, TV episodes, comics etc.).

Apart from the name, the site logo(a picture of the infamous Death Star in battered condition) is also a mock of the Wikipedia. Being a star wars fan, I found the site really helpful. I played the hit game Star Wars: Knights of the Old Republic 2 :The Sith Lords a few years back. I never fully understood the story, even after finishing the game twice(both as a good and bad Jedi). The articles on Wookieepedia were a great help. Now I’m thinking about giving the game another try.

May the force be with you.

Silly SQL query, not-so silly thoughts

I noticed a silly query written by a member of my team today. I was done for the day at work, and got tired of poking my friends on Facebook after a while. So out of boredom, I started going through the log which keeps project-wise record of SQL queries written by the developers, along with their names. And I stumbled upon the following

SELECT username FROM user WHERE username = ?

I couldn’t think of any situation where this query will be of any real use. Then I found another one

SELECT email FROM user WHERE email = ?

I couldn’t help but the ask the writer of these hilarious pair of queries, about their real purpose. Apparently he was involved in building a User Registration system for the project, and these queries were written to check if a user record with a certain username/email already exists in the database. We are writing the software on an MVC framework, so he could simply try loading a Model using the username/email, returned true if it loaded, and false otherwise! The guy wasn’t a newbie programmer, he has been in the company for over a year. This reminded me of a blog post I read very recently. Is the ridiculous simplicity of PHP is a curse rather than gift, as it attracts mostly average level programmers, thus creating a bad reputation for the language itself?