August 1, 2008

Ample reinforcements

Filed under: Open Source, Rants, Technology — krkhan @ 7:46 am

“For the wise man looks into space and he knows there is no limited dimensions.” — Lao Tzu

Western Digital Passport Essential

I’ve always suspected that pornography has a history with mankind but I never guessed that the founder of Taoism had already been downloading enough to foresee virtually limitless data capacity needs. History repeated itself as I logged in yesterday just to notice that the free space on my hard disk was about 400 MB. Panic time, and the only efficient solution I could work out was to buy a Western Digital 320 GB portable hard drive.

Now, these days, buying any digital storage medium which has its capacity advertised in GBs is subject to the 7.2% deficit rule (I just conjured this name so I can’t be held responsible if it doesn’t occupy an entry in Wikipedia yet). The rule is simple: For every digital storage that you buy, you won’t ever see 7.2% of the GBs quoted on the product. Which means, if you buy a 250 GB hard drive, you’ll only be able to use 232 GB. For my 320 GB buy, I lose 320 x 7.2% = 23.04 and end up with 296.96 GB. Unless you’re prepared to tackle the difference between powers of 2 and 10, don’t even bother questioning the origins of this rule.

So, the passport drive came bundled with some software for synchronization and encryption. Did I bother? No. I reformatted it straight away as an Ext3 partition. After that, TrueCrypt and rsync were more than enough to cater for all my needs without any hassle. For the curious, here’s the command that I used to synchronize my home directory:

rsync -r -t -p -o -g -v --progress --delete --exclude=".*" /home/krkhan/ /media/Inspirated/Home/

This would exclude all hidden directories, and synchonize the /media/Inspirated/Home to mirror the exact state of /home/krkhan. The fun part, for those unfamiliar with rsync, is that if I synchronize, let’s say, fortnightly; only the data newer since last backup is copied.

I hope it would be least a couple of years before I get to quote Lao Tzu again.

Tags: , , , , , , , , ,

July 29, 2008

Orkut jumps the shark

Filed under: Rants, Technology — krkhan @ 8:46 pm

Google is obsessed with AJAX.

No, really. It’s starting to get on my nerves now. For those who’re unfamiliar with the term AJAX, it’s a combination of technologies (like Javascript) that, in essence, allow you to navigate on a web-page quickly without reloading the whole thing. The most prominent example people may recall is of Gmail’s interface.

So, why is it such a bad thing? Here’s the answer: it isn’t. When used properly, it can be great. Gmail, once again stands out as one of the leading examples here. Nevertheless, like any other technology, it has the potential of being abused. And, AJAX, when abused, can only be surpassed in terms of pure annoyance by Flash and Java. Quite surprisingly, the most effective example of “what not to do with AJAX” is also provided by Google, with its recent redesign of the social networking website Orkut.

In my opinion, Orkut is already a lost cause. No, not because Facebook is better. When Facebook started taking Orkut’s share, it wasn’t because Facebook was technologically superior to Orkut. And until just yesterday, I considered Orkut to be superior in at least that regard.

But now, Google decides to make all of Orkut’s pages empty. That’s right. Empty. All stuff would be loaded in those pages using AJAX and here’s the insane thing: they’re uniquely identified by anchors. That’s batshit insane. From a browser’s point of view, all of Orkut is a single page now. Stuff is just loaded on it dynamically using identifiable anchors like #Home.aspx. And no, there isn’t any fallback version. You just can’t use Orkut without Javascript now. All CGI-proxy access to Orkut (using sites like KProxy) is also broken now. My Orkut login frequency, thus, has taken a considerable hit and I really don’t think I’ll be using it even on weekly bases.

Aeternum vale, Orkut.

Tags: , , , ,

July 27, 2008

At least I wasn’t even close

Filed under: Open Source, Programming Challenges, Rants — krkhan @ 4:35 pm

“I think I have a problem with that silver medal.
I think, if I was an Olympic athlete, I would rather come in last then win the silver.
If you think about it… if you win the gold, you feel good.
If you win in the bronze, you think: “Well, at least I got something.”
But if you win that silver, it’s like:
“Congratulations! You… almost won.”
“Of all the losers, you came in first of that group.”
“You’re the number one… loser.”
“No one lost… ahead of you.”" — Jerry Seinfeld

I had two chances for progressing in Code Jam by qualifying in one of the two sub-rounds assigned to me. Both sub-rounds had three problems A, B & C ordered in increasing difficulty level. Here’s a quick summary of both:

  • For the first sub-round (1A), I did solve problem A and got 15 points. However, I didn’t solve it quick enough. Problem B was left untouched by me. Problem C’s small input contained only 29 cases and could have very well been solved using only a scientific calculator. However, that just didn’t seem the right way of progressing (30 points would have been enough to qualify, but I’d definitely have failed at the subsequent rounds).
  • For the second sub-round (1C), apart from connectivity issues, I couldn’t provide correct output for any of the problems. I did solve problem B but as my solution was recursive, it was taking too much time for calculating the output. I’m not that good with refactoring recursive solutions for yielding iterative ones, so my chances got blown right away.

Overall, Code Jam was pretty fun and having fun was the sole aim of participating this year. Now I’ve got to start reading the Introduction to Algorithms book and get myself formally acquainted with algorithmic problem solving. Good luck to all the gurus who did progress (seeing some of them solve all 3 problems within half the time was amazing). They thoroughly deserve it and I’ll keep monitoring later rounds as a spectator — just reading through their ingenuous solutions is nothing short of a delightful experience.

Tags: , , , ,

July 3, 2008

“Will you bite the hand that feeds?”

Filed under: Rants — krkhan @ 9:23 pm

Today, I woke up to find that my FeedBurner feed for Inspirated has stopped updating because the source feed is timing out. After digging around a little, the source of the problem turned out to be long posts containing (hundreds of lines of) code.

At this point, I could change settings in WordPress to display “summarized” texts instead of full ones in my feeds. The downside of which was the fact that it would require readers to click through their feed aggregators even for posts that weren’t long enough to cause server delays. The better solution was to use the wp-cache plugin so that WordPress wouldn’t have to “process” the feeds at each request. The plugin itseld works like a charm, but getting things working again with FeedBurner was a bit of PITA. Here’s the order of steps that worked:

  • Disable the FeedBurner FeedSmith plugin in WordPress administration panel.
  • Access the original feed to make wp-cache do its magic.
  • Resync the feed in FeedsBurner administration panel.
  • Enable the FeedSmith plugin again.

It took me almost a couple of hours to sort out the whole picture, and ironically, one of the songs in my playlist at the time had lyrics that I’ve quoted in the post-title.

Tags: , , , ,

June 30, 2008

Programming Challenges: The Trip

Filed under: Open Source, Programming Challenges, Rants — krkhan @ 8:31 am

PC/UVa IDs: 110103/10137, Popularity: B, Success rate: average, Level: 1

I have more wrong submissions for this problem than any other one until now. The reason? I was oblivious to the fact that the default rules for type-conversion between double and long in C++ include floor()ing positive values and ceil()ing negative ones.
(more…)

Tags: , , , ,

September 29, 2007

My first GTK+ application

Filed under: Open Source, Rants — krkhan @ 6:24 pm

Ever wondered what’s the equivalent of ‘Hello World’ in the GUI world? (Besides just displaying a ‘Hello World’ label that is.) Here’s the answer: Tic Tac Toe. Now anyone may disagree with the ‘Hello World’ part for a number of reasons but no one can actually deny the fact that building a Tic Tac Toe app is a good introductory GUI exercise for anyone who has never stepped outside the console world (and that does not include TUI’s — if you’re thinking curses). TTT may be a boring game to play, but it’s rather fun for a newbie to develop as means of getting familiar with the basics of GUI programming. Here’s my first attempt, which you can compile using the following command line:

gcc `pkg-config --cflags --libs gtk+-2.0` -o tictactoe tictactoe.c

Of course, the above command assumes that you have the development headers of GTK+ installed on your system (and that you’re somehow interested in compiling an utterly useless application just for the sake of it). Apart from being a good read for other GTK+ newbies, the program doesn’t do much. Nevertheless, if you do decide to analyze the code and find out instances where my programming practices start resembling those of a haywire baboon (or a Microsoft developer — which is actually the same thing anyway), please oblige me by pointing them out using the comments form of this post.

Tags: , ,

July 30, 2007

Harry Potter and the Grown-Up Fan with Dung for Brains

Filed under: Rants, Sarcasm — krkhan @ 9:31 am

The year was 2002 and I had only been 13 at the moment when I picked up Harry Potter and the Philosopher’s Stone off the shelf. The hype was prodigious and I had started to feel kind of left behind as conversations like these cropped up consistently:

“Dude how many parts of Harry Potter have you read?”
“Er.. none?”
“Are you like kidding or what? I’ve read all four of ‘em”

Reading Harry Potter wasn’t a choice for kids back then and it isn’t even a choice for kids even today. Honestly speaking, this might actually be a good thing if one assumes that the Harry Potter novels are actually increasing children’s interest in book-reading. Realistically speaking, however, Harry Potter novels don’t contribute that much towards the reading habits of children. The attention span of most of the teenagers who read Harry Potter as their first book is usually depraved by the media-hype surrounding He-Who-Must-Be-Bought. After being done with the wizarding-world, most of them won’t even trouble themselves with reading books that aren’t mundane/controversial enough to get everyone buzzing with ballyhoo à la Da Vinci Code. Consequently, their mental-growth is indentured with that of Harry. Few years later, you’ll see them in the role of adolescents “confessing” their pedophilia love for the Hogwarts’ lot.

Harry Potter novels are good — for kids — period. Nevertheless, I had this irresistible urge to compile a list of seven paramount reasons why the Boy-Who-Lived can suck it for good and why grown-up people who think Harry Potter is thoughtful have dung for brains. Just because Rowling’s publishers crunched out the same kids’ stories in a jacket with real life photos calling them “adult versions” doesn’t mean that the novels don’t retain their puerile themes and narration (sour disappointment for anyone who was wishing for threesomes between Harry, Ron and Hermione while opting for these versions). I limited the number of reasons to seven for obviously pertinent reasons. Without further ado, here they are:

  1. Every Tom and Dicky Harry: Have you ever wondered why the Harry Potter universe is so riddled with stereotypes? You have an antagonist who loves none, cares for none, is uber-1337 when considering power and has a name feared by almost everyone except the protagonist. The protagonist quite facetiously is someone who doesn’t really like all the attention but has a fame of mythic proportions in his own world; who beats the most-powerful-of-them-all wizard despite being a n00b himself time and time again and who, in any possible stretch of imagination, can’t act evil or exhibit characteristics such as narcissism, vanity or megalomania. Moreover, the protagonist isn’t money-conscious either but is somehow left with a crap-load of fortune by his parents. If you have spotted all this, pat yourself on the back. If you haven’t, try contacting Dr. Jack Kevorkian as he might be able to rid this Earth of your ignorant presence and do us all a favor.
  2. Potter Mania: Millions of teenagers spent billions of hours reading and re-reading Harry Potter novels for “clues” about the future happenings during the past decade. Whether it was about Harry’s penis scar feeling itchy after seeing a Voldemort-possessed-Ginny or about a gleam of triumph in Dumbledore’s eyes after hearing Harry recall events of his encounter with Voldemort, you always had a few dozen actively-participated discussions about the future novels in any of the fan forums at a given moment. At the release of final novel, my BBC news feeds started showing quotes from the “waiting fans” and typical examples would include: “I had thought and contemplated about Harry Potter ever since I started reading the book a decade ago. What am I gonna do with my life now?” Speaking of life, Miss Harry-Pooper-Makes-Me-Wet-Junkie, how about getting one, like for real? If you do have any worthy analytical skills at all, aren’t they better honed while studying something boring like History or Political Science for example? But then, if you did have the acute quality of introspective reading, you would have realized anyway that wasting many years of your life speculating about a fictional wizard is well … quite moronic.
  3. The Emo Jo: Ever since the Order of the Phoenix hype started to build up, Rowling would find reasons to mourn for “killing a very-important character which was close to her heart” and sell the story to BBC. Ironically, the story would always top the clicks everywhere and fans would start telling each other: “OMG, did you hear? JKR was crying for the death of one of the important characters. I wonder who will it be?” And then they would go an a reread-the-previous-novels spree to find clues about the one who’s going to die. Her last emo bewailing was a masterstroke, no doubt. All the news sources in the world suddenly deemed that mothers grieving the loss of their children’s lives to war and famine are somewhat less important than Rowling shedding tears over ending of the “saga”. If it wasn’t already disgusting enough, Rowling then made a comment about Charles Dickens. Explicating the fact that the latter was feeling dejected after the two-years’ authoring of the novel David Copperfield had finished; Rowling said: “To which I can only sigh, try seventeen years, Charles.” Excuse me? It just so happens that there are writers (read: Tolkien) in history who had been authoring the same story for about half-a-century but didn’t whine about cessation of the writing process at its end. It doesn’t even appear to be deliberate. Perhaps being emo is a natural outgrowth of her being a woman. Who knows?
  4. Movies: Anything which was remotely appreciable about Harry Potter’s cult following was completely overshadowed by the film adoptions. The virtually inane motion pictures with crammed story-lines and acting deserving of the Golden Raspberry Awards actually managed to sell BIG with a capital B (and I and G). Not only that, but the movies also opened up a whole new dimension for hippies who preferred to waste their time by ruminating about what’s going to be included in the next movies and what’s not. I’m sorry, but my suck-o-scope has just started spinning uncontrollably.
  5. Lord of the Rings comparisons: Anyone who seriously compares the two is decidedly juvenile; and I’m being empathetic enough by not calling him a retard.
  6. Out of proportions universe: I don’t know about you, but I prefer fantasies that at least regard matter and mass as balanced entities. On the other hand, in the Harry Potter world, we have rooms that enlarge themselves at their inhibitors’ wishes, small pouches that can accommodate libraries and methods of traveling which allow you to disappear and appear instantly at anywhere within the country. All this made me feel really uneasy; to an extent where I expected Hermione to conjure a Disneyland anytime, Cartman style. Alright, that last point was intentionally hyperbolic, but it ain’t as far-fetched as it seems either. With the endless supply of Dei Ex Machinis that Rowling seemed to have, I couldn’t convince myself to rule out the possibility of something like that happening.
  7. The Ending [Spoilers! Highlight to read]: As I was progressing through the last book, the darker tone and the implication of Harry’s submissive death really started to sound impressive. My hopes of a cogitative ending emphasizing the nature of sacrifice and anonymity real-life heroes die in were crushed as soon as Harry returned from the King Cross station. The epilogue became Rowling’s waterloo; as she transmuted her storyline into a soap opera where you see all the characters happily playing with their kids after 2 decades. And yeah, it was absolutely despicable.

That’s all, folks!

Tags: ,

June 20, 2007

KSA: The Kindom of Sacrilegious Authority

Filed under: Rants, Sarcasm — krkhan @ 4:37 am

At about 8:50 PM, I was heading towards the last custom clearance queue. A chubby guy in his late 30’s was scanning the passengers’ baggages and showed the usual signs of aggressiveness which I’ve grown quite accustomed to over the years. As soon as my suit-case went into the scanner, I started praying but I knew that it was just too much to ask for as I heard the dreaded call (which, if possible, was made even more dreadful because of the atrocious accent): “You there, open this suitcase”!

If you’re wondering who I am, let me first clear up some facts. I’m not a drug-dealer and I haven’t ever tried to smuggle anything of that sort either. What bothered me however was the fact that I had about 80 DVDs with me. If you’ve ever traveled to KSA, odds are high that you’ve also experienced the phenomenon which virtually equates n DVDs with n grams of Cocaine. If you’re thinking of bringing DVD movies which contain even the most trivial amount of on-screen romance, think again. It won’t be a walk in the park. Downloading those movies on 56k dial-up connections would be a relatively easier and painless process, and I’m not joking either!

Anyways, as soon as I opened up the suitcase, his eyes spotted the DVD case. He opened it up, and immediately threw a questioning glance at my face. What amused me about his behavior was the vibrant sense of accomplishment that he was radiating. After a moment’s pause, the following conversation ensued:

“What is this?”
“CDs”
“What CDs?”
“Playstation 2 games” (Experience has taught me that these are the most acceptable form of optical media in the kingdom)
“All of them?”
“Most of them” (Quite hesitantly)

At this point, he started flicking through the DVDs. The ones with covers that looked like cartoons were spared any unforeseen trouble, but as soon as he saw a DVD without a cover, he stopped his hands and started staring at me inquisitively for a second time.

“And what is this?”
“A movie”
“What movie?”
“The Lord of the Rings: The Fellowship of the Ring Extended Edition”

Not surprisingly, he was completely oblivious to my last answer so he just pulled out the DVD from the bag and threw it on his desk. At 9:00 PM, he had about 40 more DVDs stacked haphazardly on each other along with my passport. Most of them were declared to be suspicious because they didn’t have any covers on them, but that wasn’t the only ingenious criteria that they had come up. They also short-listed the DVDs which had obscene scenes such as hugging on their respective covers. In other words, anything which doesn’t have cartoon characters on its cover is considered as contraband until thoroughly checked.

After a few minutes of apprehensive waiting, he started shouting around for some Abdul Kareem. A porter suddenly came running from the other end of the hall. The custom guy handed him over my DVDs and told me to close my suitcase. After I locked it and turned around to spot the Abdul Kareem guy, a horrible realization dawned upon me: he had disappeared into the blues. Discerning the hopelessness on my face, the custom guy started shouting again for the porter and in a few minutes I was standing in the “testing room” of the airport. For a newcomer, this can be quite an intimidating experience as you’re surrounded with about 8 PCs (running Windows XP in Arabic) and 12 TVs with a DVD player connected to each of them. For the veteran, this is one of the funniest places on earth. If you don’t belong to the latter category, keep on reading and you’ll find out the reason for this facetiousness.

One by one, the DVDs were inserted into the DVD-ROM drives of different PCs. As most of them were PS2 games, they contained strange binary files which weren’t remotely recognizable by Windows Media Player (half of the benchmark for digital-contraband). Looking quite frustrated, he tried all of them in the DVD players. On about the 18th DVD, he hit the jackpot. The DVD started playing ‘The Massage’ episode of Seinfeld. I started feeling a tingling sensation in my spinal cord. Luckily, the massage scene on George passed by without any sexual involvement. The on/off tingling sensation continued for another half hour, at the end of which both of us were left equally embittered. He couldn’t spot anything more sexual than a physiotherapist’s massage while I was constantly checking at the clock. At last, he resorted to figurative questioning once again, which resulted in me explaining for the umpteenth time that I don’t have any “sexy videos” with me. Finally, my passport was handed over back to me at half-past nine. I picked up my suitcase, and the packed CPU that I had brought with me and started walking towards the exit lounge. Apparently, the Saudi custom clearance guys don’t give a damn if any of the following is found in your baggage while entering the kingdom:

  • A 250Gb hard-disk
  • DVDs with cartoon-ish covers
  • DVDs with the Playstation 2 logo

However, the following things can set all the customs personnel on fire:

  • DVDs without proper covers
  • DVDs with females on their covers

If you don’t want to get caught while trying to sneak porn into the kingdom, do not write them as WMV files on DVD-Rs or as standard playable DVDs. You’ve been warned, these guys have an acute observation for spotting suspicious “sexy videos”.

Tags: ,

May 20, 2007

WordPress 2.2 Upgrade

Filed under: Rants — krkhan @ 11:04 am

Upgrading WordPress can be a fluent task if you aren’t bothered by plugin incompatibilities during the process. Quite fortunately, I haven’t been bothered with that mess even once since I started blogging; and while I expected at least a couple of problems to arise after a major version upgrade, I was quite delighted to see that it went as smoothly as the minor version ones.

The new version brings promises some exciting features such as widgets (e.g. sidebar blocks), which I’ll be testing once I escape the tentacles of my university’s various courses. Over the course of next two weeks, I have to design a half-duplex serial modem (which sounds intriguing), implement a BCD Adder circuit and code a Paint application using MFC classes (which sounds something heavily superannuated to be done). I haven’t started properly coding the application yet (immense waves of guilt start hitting me whenever I open up that bloated MS IDE), but I have a feeling that I’m not gonna get an A+ in my programming course if I don’t do this thing properly.

If only I had been studying somewhere where people at least knew that the real programmer’s operating system is Unix, I would’ve been more active on my blog. Until that happens, I’ll just keep waiting for vacations every year to get back to stuff that matters.

May 7, 2007

Bandwidth problems

Filed under: Rants — krkhan @ 3:08 pm

“The only thing worse than being talked about is not being talked about.” — Oscar Wilde

When I was creating the video of various Windows versions running simultaneously on Linux, I didn’t have the slightest idea of the popularity that would ensue from it. As it turned out, the video became quite popular with Argentinean Linux websites and Inspirated consequently went down after 17 GB of data got transferred within first 4 days of the new month.

To compensate for the usage, I’ve bought new bandwidth for my account. Hopefully, this will provide consistent access to the site from now on. However, if I see another surge in bandwidth usage, I’ll try uploading the bigger media files to another server.

Next Page »