Google

Saturday, April 02, 2005

Uncultured Perl

To circumvent the lack of sendmail on my desktop running Microsoft Windows, I learned to use Net::SMTP; :-$ I remain a novice Perl speaker despite many years of self-teaching. Anyhow, the result is my third Perl script for blogging:

$ ./blog.pl
Usage: blog.pl -p message -t subject 
$ ./blog.pl -t "   unCultured        peRL   " -p post.html
I aspire to speak Perl fluently. Here is a snippet of what I said in blog.pl (with the able help of Perltidy) to publish this post. :-D I'm particularly proud of the regex herein.
#! /usr/bin/env perl
use strict;
use warnings;
use Getopt::Std;
use Net::SMTP;
my %opt;
0 < @ARGV and getopts('p:t:', \%opt)
  or die "Usage: blog.pl -p message -t subject\n";
my $subject = localtime;
exists $opt{p} and -e (my $message = $opt{p})
  or die "nonexistent post\n";
if (exists $opt{t}) {
  # Properly capitalize all words in a title
  # (i.e., 'cApiTALiZe' becomes 'Capitalize'),
  # and trim intermediate whitespaces
  # (i.e., 'I    write  ' becomes 'I write ').
  ($subject = $opt{t}) =~ s/(\w+)\s+/\u\L$1 /go;
  $subject =~ s/^\s+//; # Remove leading whitespaces.
  $subject =~ s/\s+$//; # Remove trailing whitespaces.
}
# Code to email…
:-# Along the way, I also learned today why it's so easy to spam: unsuspecting servers abound in cyberspace.

Friday, April 01, 2005

Poisson d'avril!

Where're the Office CDs? I've known all along that the automatic Windows Update is fishy.

Alarmed by this joint advisory from CDC and NSF, I am wearing rubber gloves today to protect against the Malwarlaria.B virus.

I doubt that I am cool enough to gulp smart drinks. Just water, please.

Imagine all the international ramifications of the Encyclopædia Britannica takeover. Unthinkable!

I hope that RIAA will not complain about this revolutionary P2P technology.

Thursday, March 31, 2005

Random News

:-O Ted Koppel is leaving ABC; I will miss his Nightline. 2005 has already bid farewell to two iconic anchormen: Tom Brokaw and Dan Rather. I wonder when Peter Jennings will quit.

(Y) Google offers another reason to switch to Firefox, as if this discouraging advisory were not a strong enough incentive already. BTW, as promised, I tried FireTune for Firefox but found no tangible difference in performance.

(8) I savor this story about a Chinese directing Europeans how to play their music. Bravo!

8-D More on the petition against an unrepentant Japan's UNSC bid. I hope that the West will hear the East because the world shall never forget the Rape of Nanjing or the Manila Massacre.

Up My Sleeves

Today is (#); however, I feel :-( that March 2005 is leaving forever in stealth.

(N) Blogger misbehaved again in the morning. I am :-) that my approach proves useful. (Y) I have also enhanced my Perl script to enable smilies. Now I can type ;) in XEmacs but view ;-) in Firefox after the following pipeline:
  $ ./smiley.pl post.html | tee msg.txt | ./preview.pl -
msg.txt is optional. It lets me quickly execute
  $ mail author@blogger.com < msg.txt -s "Up My Sleeves"
instead of abusing the CPU (unless without a preview) with:
  $ ./smiley.pl post.html | mail author@blogger.com -s "Up My Sleeves"

I'm :-| that Tag-Board.com delivers annoying pop-up and pop-under ads (enabled by the Flash plugin?) on my individual post. I am considering an ad-free alternative. Meanwhile, being a 8-|, I apply a deft (and highly effective, I might add) trick to block pesky popups. According to this Firefox FAQ, I can simply assign an integer value of 2 to privacy.popups.disable_from_plugins to block popups from plugins.

Wednesday, March 30, 2005

A Tour de Force

Blogger's been acting crazy today again. Another downgrade?! Lesson: thoroughly test an upgrade/release candidate before deployment.

Today is Vincent van Gogh's birthday. I used to hang on the wall a poster reproduction of his magnificent

Starry Night
One of my favorite moments was to reflect deep emotions richly expressed through its intense colors and wild brushstrokes on a rainy night in summer.

A Nightcap

Penned by a seasoned professional, this shrewd observation highlights the key lesson behind many failed start-ups: technology is not a necessary but a sufficient condition for commercial success.

I usually agree with the Times editorials but not this ill-considered one. The marketplace will always find an answer to any side effect of technology. The creator of technology should not be held responsible for its subsequent misuses, for the same reason(s) that we should not blame the founders of quantum physics for nuclear weapons.

To my dismay, Google no longer searches my blog. Must I resort to Google bombing?

Tuesday, March 29, 2005

Verbal Diarrhea

This story surprised me a bit. It clearly shows that market economy is truly working in China. My take, however, is that modern communication hasn't reached the vast hinterland because there surely remain millions of unskilled labor west of 京广铁路 in poverty.

I cannot agree with this commentary more:

Japan's failure to atone for its militaristic past hovers over just about every aspect of economic and business ties in Asia.

Tens of millions of Chinese (and Korean) netizens have already protested to strongly oppose Japan's aspirations for a permanent UNSC seat. Mr. Annan, do you still want to support a notoriously irresponsible nation to sit on the sacred UN Security Council?

It appears that my blog has earned a sufficient PageRank score for Google to notice (since yesterday). However, to my great disappointment, Google hasn't indexed the entire web site. Wanted: loyal readers.

FireTune sounds like a neat utility. I'm going to give it a try. Stay tuned for my review.

When the Network Behaves Badly

I am picky when it comes to computing. Still, I think that Blogger currently places too many restrictions on users. For example,

  • I'd like to separate how my blog looks (its style) from what it says (its content). But Blogger forbids
    <LINK REL="stylesheet" TYPE="text/css" HREF="foo.css">
    
    Hence, I am stuck with a huge template with embedded CSS.
  • I'd like to use JavaScript in my post. However, it's possible for JavaScript to appear only in the template (within its header section) right now, making it very inconvenient to offer DHTML functionalities (because Blogger doesn't allow SSI either).
  • Blogger's post editor is too primitive for my taste. When the network is mischievous (which is quite often lately), it's absolutely a torture to create/edit a post.

However, Blogger is free and I appreciate how challenging it is to address these limitations. So I shouldn't complain. Instead, I have worked around the last issue using freeware and Blogger's post-via-email feature (it must have been already enabled). I think that my simple implementation might be useful to other frustrated users too.

Tired of network instability, I first use WinHTTrack to mirror my blog on my dependable PC. This step is not strictly necessary though highly recommended because Blogger doesn't offer any feature to backup a blog. Then I create a placeholder file (foo.html) by duplicating any existing post (and stripping away all its JavaScript stuff) and change these lines near its bottom
  <div class="post-body">
    <p><$BlogItemBody$></p>
  </div>

to
  <div class="post-body">
    <p><object type="text/html" data="bar.html"></object></p>
  </div>

A skeleton, foo.html thus retains all the layout information, giving it a WYSIWYG capability. Now, I can edit a post in bar.html with the much superior (my default) editor XEmacs and locally preview the post in (conveniently bookmarked) foo.html using Firefox. When I finish writing, I open Thunderbird in which I have created a template to email Blogger. The template automatically addresses a recipient (author@blogger.com). All I need to do is to fill in the "Subject:" field with a post title (e.g., "When the Network Behaves Badly"), load bar.html in the message body, and click "Send". That's it.

Since I am an avid cygwin user, I can take full advantage of CLI to further simplify the above process (i.e., less keystrokes). For example, I use cron and httrack to schedule a mirror job every night. On a Linux desktop, I can also alias most of the line below
mail author@blogger.com < bar.html -s "When the Network Behaves Badly"
Of course, XEmacs can do it all for a Lisp expert.

Monday, March 28, 2005

无惊无险,又过一天

In addition to my previous Writing Aids post, I also find Word Play (an annotated list of web sites on the light side of English, similar to the awfully banner-ad infested Fun with Words) entertaining.

These posters brings back much nostalgia for an almost surreal era of idealism. I used to pass one giant (standing over three stories tall) billboard at the 淮海中路/襄阳南路 intersection several times daily on my way to school.

Bertie and Elizabeth gives a rare glimpse of the royal duty, therefore forcefully shattering the romantic idolization of King Edward VIII.

Writing Aids

A wordsmith needs handy tools too:

Cliché Finder
A clever cliché adds wit. This search engine indexes over 3,300 clichés. Type a specific word below and find just the right cliché. Or an empty query will display the whole list.
Word Quests
There're many English words derived from Latin and Greek sources. This online dictionary organizes the English vocabulary into thematic units by word origin. Enter a subject or word below (an empty query will yield an error) and study its etymology.
Word Spy
Neologisms constantly appear in the media. This web site documents the latest coinages. Look up a new word or phrase below (an empty query will yield an error) and be voguish.

Sunday, March 27, 2005

Easter Eggs

The Easter Bunny delivered some humorous goodies:

Intermission

Will this original experiment in mass communication become the future of TV broadcast?