July 30, 2009

Blog structure change

Filed under: Blog — krkhan @ 5:45 am

While starting this blog back in 2007, I didn’t care much about the URL being redundantly long in form of Truth be told — being the lazy bum that I am — I didn’t want to go through the administrative troubles of updating the site structure to have something brief. That is, until today. As I was registering this blog as my OpenID at Slashdot I really got fed up with the sub-directory being part of my claimed identity. The result of this major aggravation was a regular Apache nutjob. First of all, I followed the instructions on this page. Then, I put together a quick .htaccess rewrite to ensure that old addresses (e.g. /wordpress/anything) still get permanently redirected to new ones (i.e. /anything):

<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^.*wordpress\/(.*)$ \/$1 [R=301,L]

And just as everything seemed to work perfectly, the fgallery plugin insisted on ignoring the new URL. Digging up a bit, the culprit turned out to be a bug in fgallery‘s implementation which constructed gallery links with the WordPress address instead of the Blog address (the difference is critical in installations such as mine where WP’s core files resides in a subdirectory but the blog uses root directory for friendly URLs). The fix was trivial (had to replace a few get_bloginfo('wpurl') calls with get_bloginfo('url') instead), and lo and behold! Everything’s functional again. I should have done this little exercise a long while ago but well, better late than never. As a sidenote, this does not mean that I am reconsidering my slothful position on other pending tasks for the blog. Since for most of them I adhere to Georgy Shaw’s version of the quote instead, i.e., better never than late.

Tags: , ,

July 23, 2009

Microsoft’s open-source contribution traced back to GPL violation

Filed under: Blog — krkhan @ 11:36 pm

(Or: Things still make sense.)

Last week — just as Wayne Rosso stopped comparing RIAA to Stalin — M$ did its own volte-face and not only stopped calling GPL a “cancer” but decided to release some 20,000 lines of code carrying the plague itself. Pigs started flying. Some of the open-source evangelists started fantasizing about Microsoft as an ally suddenoutbreakofcommonsense and the cautious ones — who suspected some ulterior motive behind the move — were declared by them to be paranoid and rabid haters.

The storm didn’t last long though, as it was later reported that the change of heart was prompted by a GPL violation in Hyper-V. Some see this as a win for GPL. Some see this as a perfect backdrop for FUD against open-source (“it’s so goddamned viral it even infected us when we wanted interoperablity”) while some see this as a failure at M$’ part for not honestly explaining the reasons behind the code release. Whichever category you belong to, it’s nice to know that swine still have their feet firmly on ground.

Tags: , , , ,

July 20, 2009

The final nail in Pirate Bay’s coffin

Filed under: Blog — krkhan @ 10:33 am

The news of Pirate Bay’s change of ownership actually broke out last month, but I was saving a post for it in order to wait for details to emerge about the new “business model”. Now that Wayne Rosso has spelled out his plans, I can finally pay my condolences to fellow pirates. This ship has hit its iceberg.

Wayne Rosso happens to be the guy who — as the title of the linked article pointed out — once compared RIAA to Stalin during his Grokster days. Nowadays he’s busy in getting “friendly with these good guys” since they have been “wonderful” to him. Not only that, he and his new BFFs also conceived a mind-blowing plan to legitimize Pirate Bay’s usage. Mind-blowing in the sense that reading particulars of the failtarded scheme might leave you utterly bewildered as you try to scavenge an ounce of sense in it. Prepare yourself:

As for the new business model, Rosso said The Pirate Bay will offer users all the music they can download for a small monthly fee. Eventually, users can whittle that fee down to nothing by tying their computers to The Pirate Bay’s “cloud” network. For example, a person may dedicate a gig of hardware space to the network and the fee may go from $9 to $5. (Rosso declined to discuss pricing yet so the numbers are made up just for the example).

“The more of your computer resources you contribute to the network, the less you pay down to zero,” Rosso said. “The user is in control.”

To summarize:

  • “We are now a paysite. Either you pay with your money, or you loan your PC to us.”
  • TPB was such a force because its users thrived as a community based on sharing. Paysite: Noone cares.
  • BitTorrent protocol offers no way of tracking payments. Which would probably result in a proprietary client for Windows by TPB for this specific purpose.
  • Not only that, but dedicating storage resources to a cloud is not at all same as dedicating processing power in projects such as Folding@home. When you donate your processor to distributed computing, you’re only losing your CPU cycles and some electricity/heat. On the other hand, with TPB your disks’ life will degrade and your internet bandwidth will get maxed out.
  • Speaking of bandwidth, how on earth is Rosso planning to sell ISPs back their own bandwidth is beyond me. Also, most of the ISPs forbid home users to “resell” their bandwidth. It’ll be interesting to see what they’ll think of this pay-cloud.

The whole business plan, the whole corporate speak, the whole “going legit” business is mega-fail. TPB was good while it lasted, and I really liked the crew behind the original website. They knew what they were talking about and expressed their views astutely (see: Steal This Film). Still, as is the custom, named entities — regardless of how efficient they are — can never hold off MPAA and RIAA for long. Fortunately, as is customary too, piracy can never be brought down either. As long as *AA continue taking down individuals and services instead of devising better business models, piracy will thrive. Hosting a tracker is not at all something hard to do and the crowd will move on without breaking a sweat. Demonoid, PeerHub and countless others are waiting in line to take the spot. The golden quote of Ambrose Bierce that’s embedded in the blog header says it all:

“PIRACY, n. Commerce without its folly-swaddles, just as God made it.” — The Devil’s Dictionary

Tags: , , , , , ,

July 16, 2009

Control your web-pages’ typography with @font-face

Filed under: Blog — krkhan @ 11:47 pm

One of the most common mistakes a n00b web-designer makes — and one that took me a long time to figure out back when I started — is to assume that the way their shiny web-pages look in the WYSIWYG editors is actually the way how they’ll be presented to all variety of end-users. That crazy gothic font can totally get you hawt on FrontPage, but to say that it would look crippled on most of your visitors’ screens would probably be an understatement.

The CSS @font-face feature debuted a little while ago to rectify the font mess. To put it simply, it allows authors to “embed” fonts on their web-pages. And I’m a bit late on this, but it has found its way into the newest release of Firefox as well. The example rendered perfectly on version 3.5 using the new font, raising a few points in my head:

  • The rule certainly has considerable space for abuse. But then, which technology on web doesn’t?
  • For the paranoid, Firefox does provide the gfx.downloadable_fonts.enabled in about:config to turn the feature off.
  • Out of curiosity, I checked out IE’s status on @font-face support. Turns out that it also supports font-embedding, albeit using an obscure format called EOT which is basically what one would label as “DRM for fonts“. How surprising.
  • Prior to downloading the new fonts, the demo page gracefully degraded to stock ones.

In a nutshell, intriguing at worst and exciting at best. Also, it’s nice to see that IE 6’s death is prompting a steady progress in CSS and HTML. About time as well.

Tags: , , , ,

July 10, 2009

Semi-annual blog conscience report

Filed under: Blog — krkhan @ 1:17 am

Inspirated Browser Stats (January -- July 2009)

If there ever was an insanely staggering year in terms of unexpected geekological developments, it has to be 2009. Since January I have regularly been taken aback by news such as record labels dropping DRM, Duke Nukem Forever finally bowing out; Microsoft confessing that ActiveX is retarded from security’s point of view, Google Apps moving out of beta, VLC reaching 1.0, Chrome OS’ announcement, XHTML Part Deux’s quiet death, HTML 5 and CSS 3’s adoption in major browsers and well; defying all expectations, Inspirated’s browser hit stats managing to keep their head high even in the half-yearly round-up. It’s been about 136,000 hits on the blog from Firefox alone, markedly more than twice the IE hits. The first time I noticed the vulpine victory I did dedicate a post to the stats. Nevertheless, consistency achieved over six months just gives me another chance to gloat about it.

I don’t know if this is at long last the year of Linux on desktop, but one thing is for sure: only a final release of GNU Hurd now stands between our planet and the apocalypse. If that does happen, however, please make sure that you refer to the calamity by its correct technical term “GNU/Apocalpyse” and not just the ignorant layman’s phrase which totally undermines the FSF’s impact on universe’s evolution.

Tags: , , ,

July 5, 2009

The top 5 worst mistakes on command-line

Filed under: Blog — krkhan @ 10:58 pm

I could start off with an intro paragraph here but I’ll prefer keeping it sweet and simple: command-line is addictive.

For many kinds of tasks — ranging from system administration to organizing folders — I find CLI to be extraordinarily more productive than GUI clicking. For example, vim-ing through a code, if I decide I need to lookup a particular symbol in the current directory, I can quickly do a recursive grep without even taking my hands off the keyboard. Similarly, I find utilities such as mv or cp to be significantly faster than GUI file managers’ equivalent features. The learning curve is definitely steep and I also am not implying that everyone should find it equally productive but for me at least, it works like a charm.

It wouldn’t be an exaggeration to say that CLI provides a terrible amount of power at fingertips of its users. While that power is tremendous fun, it also can be a source of epic fails if not handled with caution. The fact of the matter is, as one grows accustomed to quickly doing work through text-based input, overlooking those cautions almost becomes second nature. It’s not uncommon to find a commandaholic holding his head in his hands while staring at the screen in disbelief. GUI does get credit for being a little more prone to accidental mistakes by consistently providing a visual view of what’s about to happen.

Moving on from the ill-starred mischief that I posted about last week, I thought I should compile a list of all time worst incidents of me cursing my fingers for being so familiar with the CLI. Here they are:

  1. Ctrl-C

    Sometimes, I blame Christopher Sholes for putting the Z and C keys so close on the keyboard. ‘Nuff said.

  2. Deleting the wrong partition in parted

    (parted) help rm                                                          
      rm NUMBER                                delete partition NUMBER
    	NUMBER is the partition number used by Linux.  On MS-DOS disk labels,
            the primary partitions number from 1 to 4, logical partitions from 5

    If you’re wondering why deleting a partition is placed so low on the list, the answer is TestDisk. Mere seconds after I deleted my primary partition containing all my data, I stopped all activities, booted into a rescue mode and used the God-sent utility to restructure my partition table like before with a cumulative data-loss of 0%.

  3. e2fscking e2fucking a mounted file-system

    [root@orthanc ~]# e2fsck /dev/sda2
    e2fsck 1.41.4 (27-Jan-2009)
    /dev/sda2 is mounted.  
    WARNING!!!  Running e2fsck on a mounted filesystem may cause
    SEVERE filesystem damage.
    Do you really want to continue (y/n)? 

    See that SHOUTING WARNING? I did too. But back then, I ignored it as casually as anyone ignores licensing agreements. Needless to say, the results weren’t as inconsequential as clicking “I accept” and moving on without a hint of doing something legally binding.

  4. rm -rfing the wrong directory

           -f, --force
                  ignore nonexistent files, never prompt
           -r, -R, --recursive
                  remove directories and their contents recursively

    If the last tool had the F-word in its title as the warning, this one should be read as rm --recursive-f***. The H-bomb of command-line tools, once you detonate it on a directory you didn’t mean to set it upon, even CTRL-C won’t be able keep you in one piece because of rm‘s ruthless speed and efficiency. The only ray of hope is ext3grep, but depending on numerous factors (partition structure, number of files, file types, alignment of stars etc.) your recovery prospects would range anywhere from ±100% to ±100%. You read that right.

  5. mkfsing the wrong partition

           mkfs  is  used to build a Linux file system on a device, usually a hard
           disk partition.  filesys is either the device  name  (e.g.   /dev/hda1,
           /dev/sdb2).   blocks  is  the  number of blocks to be used for the file

    The granddaddy of all command-line fuckups. If you have confused /dev/sdb for /dev/sda (an easy slip up — as I learned the hard way), it’s time to move on. Sure, you will find people selling tools for recovering data from formatted Ext3 partitions; expecting those tools to work would be a lot like expecting the King of Pop to miraculously pop up from his coffin on Tuesday and perform a ground-breaking reenactment of 83’s Motown performance.

“Blessed are the forgetful; for they get the better even of their blunder.” — Friedrich Nietzsche

Tags: , , , , , ,

July 2, 2009

Workaround for autostarting applications in a particular order on Xfce/GNOME/KDE

Filed under: Blog — krkhan @ 11:04 pm

Among many of’s vital contributions to GUI computing on POSIX platforms, a divine one has been the uniform specification for automatically launching programs at initiation of a desktop session. Informally put (or theoretically at least), it means that you can add programs to startup in the appropriate settings, and they will be launched automatically at initiation of your session regardless of which desktop environment you use.

It’s been about 4 years since I migrated to Xfce for everyday work and it does come with a basic tool for managing startup entries (accessed through Application Menu > Preferences > Session and Startup). Still, if you need anything more than rudimentary addition/deletion of the entries you’re pretty much out of luck. For example, I wanted to start the applications in a particular order. I don’t know whether GNOME or KDE have the feature yet, but Xfce lacked the support for maintaining any such arrangement. The proper way to deal with the issue would have been to code the feature in the session manager myself, but since I barely get time to even read fortune-mod these days I instead had to rely on an ugly workaround. If you’re in the same sticky situation, here it is: Go to the autostart directory (usually ~/.config/autostart), open the startup script you’re concerned with, and edit the Exec line like this:


Exec=bash -c "sleep 3 && awn-autostart"

The ugliness arises from the fact that the new Exec line is merely launching the program with a delay of 3 seconds. Now, you can add another program with a delay of 4 and it will almost be guaranteed to start after the 3 seconds’ one across all desktop environments. I really hope that the specification itself would be revised soon to provide a uniform way of setting the startup order. But until that gets done, I can thank sleep for making my life simpler.

Tags: , , , , , ,