Friday, September 01, 2006

Some ponderings on email

In the past couple of years personally I have been moving away from mailers and have been viewing email increasingly as a web-based
application.

Because I use a bunch of different machines (currently five: Windoze + Linux, at home and office, plus a laptop) it would be a pain to keep them in sync. It is much easier to just keep the mail on its server and view it on the web.

With my personal mail address, every now and then I will download from the server onto a mailer, and delete from the server. So the mailer has really just become a backup tool. The average mailer "looks and feels" more like a database/information organizer than a communication tool, doesn't it? And I am making use of this aspect of it. I hardly ever send mail from a mailer.

Using a mailer as a backup tool may be akin to the way a cell phone is not really a telephone, but rather a kind of tranceiver device packaged as a telephone.

Perhaps if this kind of usage of email increases then web-based mail interfaces will be equipped with increasingly powerful and customizable options for download, backup and restore in the future.

Wednesday, August 16, 2006

Apache and MySQL at system startup


Here is what I had to do to get MySQL and Apache to startup automatically on a Ubuntu 6.06 Linux system...

MySQL
-----------------------------------------
References Used
-----------------------------------------
http://www.adobe.com/devnet/dreamweaver/articles/lamp.html
http://dev.mysql.com/doc/refman/5.0/en/automatic-start.html
http://dev.mysql.com/doc/refman/5.0/en/mysql-server.html
http://www.debian-administration.org/articles/28

-----------------------------------------
Changed in /etc/my.cnf (From MySQL site)
-----------------------------------------
[mysqld]
user=mysql

-----------------------------------------
Set startup item (From Dreamweaver site)
-----------------------------------------
# sudo cp /usr/local/mysql/share/mysql/mysql.server /etc/init.d/mysql
# sudo update-rc.d mysql defaults

Results of the update-rc.d command were as follows:
Adding system startup for /etc/init.d/mysql ...
/etc/rc0.d/K20mysql -> ../init.d/mysql
/etc/rc1.d/K20mysql -> ../init.d/mysql
/etc/rc6.d/K20mysql -> ../init.d/mysql
/etc/rc2.d/S20mysql -> ../init.d/mysql
/etc/rc3.d/S20mysql -> ../init.d/mysql
/etc/rc4.d/S20mysql -> ../init.d/mysql
/etc/rc5.d/S20mysql -> ../init.d/mysql


Apache
-----------------------------------------
References Used
-----------------------------------------
http://www.adobe.com/devnet/dreamweaver/articles/lamp.html

-----------------------------------------
From Dreamweaver site
-----------------------------------------
# sudo cp /usr/local/apache2/bin/apachectl /etc/init.d/apache
# sudo update-rc.d apache defaults

Results of the update-rc.d command were as follows:
Adding system startup for /etc/init.d/apache ...
/etc/rc0.d/K20apache -> ../init.d/apache
/etc/rc1.d/K20apache -> ../init.d/apache
/etc/rc6.d/K20apache -> ../init.d/apache
/etc/rc2.d/S20apache -> ../init.d/apache
/etc/rc3.d/S20apache -> ../init.d/apache
/etc/rc4.d/S20apache -> ../init.d/apache
/etc/rc5.d/S20apache -> ../init.d/apache

Saturday, August 05, 2006

Perl - Issues

Problems encountered on 2006-07-31:

1. Today, for some reason, we are seeing the variables being passed via GET in URLs. This actually sounds more normal, I guess the question is why it wasn't happening before??!!

Solution
- Started calling CGI scripts using:
exec ( "perl my.cgi @sendArgs" );
instead of:
print "Location:my.cgi?arg1=$val1\n\n";


2. IE during file upload
my $uploadFile = param( 'uploadFile' );
sends the entire path, not just the file name.
C:\path\dreaming.zip

Firefox just sends the filename.

Must support both situations.

Solution
Here is the file spec, which varies from IE to Firefox.
my $uploadFile = param( 'uploadFile' );

So I extract the file name
my @pathArr = split( /\\/, $uploadFile );
my $pathEltCnt = scalar( @pathArr );
my $fileName = $pathArr[$pathEltCnt-1];

Some functions need the file spec as provided by the browser, in whatever form.
my $uploadInfo = uploadInfo( $uploadFile );
my $uploadType = $uploadInfo -> { 'Content-Type' };

Note that for opening I use $fileName, but for actual reading I use the original file spec.
open ( UPFILE, "> $dirName/$fileName" ) || die("Cannot open($fileName): $!");
binmode( UPFILE );
my ( $data, $chunk );
my $fileSize = 0;
while ( $chunk = read ( $uploadFile, $data, 1024 ) ) {
print UPFILE $data;
$fileSize += $chunk;
}
close ( UPFILE ) || die("Cannot close($fileName): $!");


Monday, July 31, 2006

MySQL - Socket error

On my Linux box, MySQL had been working fine.

Then, just a few days ago out of the blue for no apparent reason I started getting the following error.

Can't connect to local MySQL server through socket '/tmp/mysql.sock'

Now, we can't really say it is for no reason, obviously something in my system had changed. I am always messing around with that OS, without really understanding it.

Anyway, I found some great info here.
http://security.linux.com/article.pl?sid=04/08/19/1422204&tid=73&tid=35

I will have to go through all the info there and understand and implement it, but for now I only did the following three lines worth.

chown -R root /usr/local/mysql
chown -R mysql /usr/local/mysql/var
chgrp -R mysql /usr/local/mysql

And it worked! Problem solved for now.

Sunday, July 30, 2006

PHP - Numeric validation from forms

In the case where $quantity is a string like "aaa"
settype( $quantity, "integer" )

returns TRUE and $quantity becomes zero.

It is better to use is_numeric( $quantity )
This returns FALSE if $quantity is a string or blank.

Javascript - NaN

NaN means "not a number".

You cannot perform == or != operations against NaN.

NaN is not a string. And it is not a number either (duh!)

You
must use the function isNaN() to test for it.


In the beginning there was...

... me, and no doubt many others with a nagging feeling that they are constantly reinventing the wheel.

Enough, I say. Time to start enjoying life, not solving the same technical issues over and over.

I will employ this blog as a diary for any tech problems I solve, work-related or otherwise. Software, hardware, networks, settings, the whole shebang, including possibly any issues about the shebang line in Perl. Ha!

Looking back, I have had some modest success over the years solving these kinds of problems but now it just represents too many years of not taking notes.

And the beauty of blogs is that they allow you to write from anywhere and reference from anywhere.

Osaka

I've been making business trips to Osaka this month.

I really like that city, big wide boulevards and generally less crowded than Tokyo.

For some reason it has a bit of a "rough" image, in fact the Kansai area generally has this, but I find the people are very kind and kind of gentle. I like the softly lilting melodic tone of their accent.

Thursday, July 13, 2006

First-aid for net-surfing addiction

If you find yourself surfing to the same sites over and over out of reflexive instinct here is a solution.

Edit your hosts file.

What is the hosts file? It is a local DNS resolution file that your browser looks into first, before actually going out onto the internet to do the DNS resolution. It works the same way on both Windows and Linux.

On Windows it is located here (the file has no extension):
%SystemRoot%\system32\drivers\etc\hosts

On Linux it is simply here:
/etc

Add lines similar to the following, to the bottom of your hosts file.
0.0.0.0 www.siteiamaddictedto.com
0.0.0.0 www.baneofmyexistence.com

The 0.0.0.0 null IP address is an invalid destination. Hence when you try to surf to the site that is responsible for the loss of your last three jobs and your last two divorces your browser will go, yes exactly, nowhere!

Poof! A bright future as a responsible adult is yours at last.

Internet Explorer already has a facility within the browser settings to block sites. However Firefox and other browsers do not have this. The hosts file is used by all browsers so all you have to do is set it here and it will apply to all of them.


Saturday, April 29, 2006

The worst delivery company?

My new Dell laptop finally shipped!

I got notice of this in the form of a slip from the delivery company Seino saying that they tried to deliver a package from Dell but that I wasn't home.

The next day at work (Friday) I called them to arrange an alternate delivery day. It took a loooong time to get through, the woman I spoke to spoke extremely fast Japanese, in general not a pleasant experience. But I was able to arrage delivery for the following morning.

Anywhoo, Saturday morning segued into noon and the damn thing still hadn't arrived. That is when I began the ordeal of trying to phone them. Man, they must be unbelievably understaffed. I kept trying to phone again and again. This went on for several hours. All the while I tried to keep myself gainfully employed doing other stuff, with limited success.

Finally, I was able to get through! The guy was friendly enough, but wasn't able to accurately promise a delivery time. Now this is pretty rare in Japan, I had a funny feeling of getting into weirdness zone. I then offered to go pick it up myself. He said yes, that is an option.

I am not going to get into a lecture about Japanese addresses here, but suffice it to say that the warehouse address provided on the slip was a little bit weird. I asked the guy if they had a map on their website. He said no, but that I can find it in Yahoo! Maps via the address.

So after hanging up (something that was very painful to do after having worked so hard to connect, weird how the mind works) I checked on Yahoo! Maps and sure enough it was not found. Jaw drops... but part of me wasn't surprised.

I was now in a position where I had no choice but to figure out how to get there. After all I had instructed them NOT to deliver the laptop to my house. So this time Kasumi went through the rigamarole of calling them again and again... she was getting irritated by the inability to connect so I resumed the job of constantly hitting redial. Eventually it connected and I shoved the phone at her. She is better at discussing complicated directions here, truly a Tokyo driving whiz.

I could tell the conversation wasn't going well. At one point she snapped at the other person saying "The delivery didn't come, the phone doesn't connect, your address is unlocateable... what in the world are we supposed to do!".

She got the detailed directions eventually, and we set off to go to the warehouse. On the way we made a stop at Sai Market for a late lunch. After the lunch we drove on, in our quest for that elusive Dell notebook PC. Eventually we found that we were getting seriously off track even though we were scrupulously following the directions given over the phone. We became very suspicious that the directions were full of mistakes.

After much checking against the map we were able to figure out the holes and inconsistencies in the directions provided. On two occasions we were led on a wild goose chase. But we had it figured out and eventually found the God-forsaken warehouse.

It was a huge foreboding place. Even though there was an area to receive customers it was poorly lit and there was nobody around to greet you. The phones were ringing off the hook and guys were just milling around not picking them up. I couldn't help but to feel for the poor souls on the other side of the telephone line: There but for the grace of God go I. Wait a minute, a few hours ago that had been I!

We were able to get the attention of one guy who seemed fairly nice, if not quite a gazelle mentally. He went out back and came back with my computer in a Dell box. I was so happy!

Then Kasumi ripped into him. She recounted what an awful day it had been and how this matter had consumed a good part of it. She pointed at the phones ringing off the hook and how nobody was picking them up. The guy kept nodding and apologizing. As if he even gave a shit.

I wasn't interesting in prolonging the discussion and we got the hell out of the place. On the way home we became a bit paranoid - what if the PC was damaged, or something. In the end it wasn't, it works beautifully, but we walked out of that experience feeling that we can't depend on anything.

Sunday, March 26, 2006

The Rolling Stones at Tokyo Dome, March 22, 2006

Man, I must be a lucky son-of-a-gun. Within a span of four days, the Tommy musical AND a freakin' Stones concert.

Since I have been in Tokyo since 1991, I have managed to catch these fellows on every tour. Always the same venue, and I always go with the same person, a female friend who is quite a Stones fiend. When they first came to Japan in 1990 during the Steel Wheels tour, she saw ALL 10 shows. Nor does the story end there, she
proceeded to follow them to New York and caught three shows at Shea Stadium. Talk about dedication, for better or worse.

My wife never seems to take an interest in the Stones, and insists that I go ahead with my friend. OK...

As has been the pattern so far, the fans seem to be older and older. However this time, I also saw a fair number of kids. I don't mean teenagers or adult children of fans, I mean literally pre-teen children. The Stones have become truly all-ages entertainment. A far cry from their American tours in the seventies when a Stones concert could be truly life-threatening.

In fact, around the area we sat (waaaay up in the rafters), the mood was greatly picked up by the antics of a group of four young Caucasian girls with American accents. Three of them looked around fourteen or so, but one of them was only around 11 or 12. They were hanging out by the railing, dancing and leaping around wildly. The little one was a true whirling dervish, horsing around with any passers-by, and at one point started climbing up on the railing (the drop was only about five feet so it wasn't as if she was on a suicide mission from hell). The security staff nearby kept having to push these girls back or discipline them, but after a few seconds they would be all over the place again.

The show was fabulous as ever. They didn't look or act as if they have aged a minute since the last time I saw them which was three years ago.

Mick's Japanese skills seem to improve on every tour. At one point he asked, in Japanese, "Do you remember this song?"... as Keith sat on a chair and starting plucking out on an acoustic guitar the opening notes to "As Tears Go By". It was a real treat, the first time I saw them play it live.

Another rarity was "Paint it Black", in which Keith very capably handled the duties of the incomparable and long-departed Brian Jones on what may have been a Coral Sitar.

"Sympathy for the Devil" was also very cool, somehow the opening piano sounded funkier than it is on the record, as if it were done by Fatboy Slim.

The key supporting members have also stayed the same for years and years now: Lisa Fisher and Bernard Fowler on backing vocals, Chuck Leavell on keyboards, and of course Bobby Keys on sax. During Mick's introduction of the band members, Bobby received an applause that went on and on.

After the concert I asked my friend, "How many more times do you think we will get to see the Stones?". Her answer: "Dunno. At this pace I'll probably be gone before they are".



One of the entrance gates

















MSN Blimps - Just can't get away from Microsoft, can we?



















Keith and Ronnie on the bi
g screen - ever the reprobates

















Mick


















Tongues - Both the digital and inflatable varieties
















Tuesday, March 21, 2006

Japanese websites

Always being interested in the superlatives of life, I spent a couple of hours - that, as usual, I don't have - goofing around on Alexa. It is always interesting to see the traffic rankings of various websites, both big and small.

Among other things I was curious as to how Japanese websites rank traffic-wise compared to other sites around the world. I found 8 of them in the top 100. Here they are, with rank and a short description (or anti-description) by yours truly.

5: www.yahoo.co.jp - Need you ask? Abbreviated to "NYA?" hereafter.

17: www.google.co.jp - NYA?

35: www.rakuten.co.jp - Japan's biggest shopping site. You can think of it as a digital mall, where individual sellers can set up shop.

41: www.mixi.jp - A social networking site. Similar to myspace, but much broader in terms of age and demographics. Also, it doesn't allow the kind of page customization that myspace does, so generally it is much a neater and more relaxing social surfing experience.

58: www.goo.ne.jp - Portal site. In particular the Japanese <-> English dictionary is popular. Yes, Japanese people are frequenty looking up English words... ranging from kids trying to figure out Nirvana lyrics or studying for an English test, to businessmen struggling with an email from a foreign client to a scientist trying to read an academic paper from abroad.

60: www.msn.co.jp - NYA?

65: www.infoseek.co.jp - Portal site.

76: www.amazon.co.jp - NYA NYA NYA NYA NYAAAA NYA! (imagine me singing it)

(rankings as of today, March 21, 2006)

Sunday, March 19, 2006

Listening to you, I get the music…

Review of The Who’s Tommy Broadway Musical

Yesterday I finally went to my first Broadway musical in my 15 years in Japan. It has made my year, even though it is only March.

Of all people, I went with two others from my tennis class! One of them is a fellow student, a housewife with two kids. She probably around my age and is quite a chic and sexy lady, wearing short skirts and high leather boots. The other is the tennis instructor himself, who is a young guy in his early twenties and into Mod fashion and music. Both of them are Japanese, which is great because The Who was never nearly as big here as it was in the West and I only have a few friends here who share my passion for the band. There was a bit of a Mod explosion here at one time, but astonishingly it may have centered more on The Jam and Paul Weller!

Our plan was to meet at the performance hall in Shinjuku and at first I wasn’t totally confident I found the right place because the building is so nondescript. I was reassured at the sight of a middle-aged Japanese guy with a hairstyle identical to Keith Moon’s pacing around talking on his cell phone. He also had a slight paunch, not unlike The Loon himself in his final years. The attendees were real menagerie: All ages from teenagers to those who are practically segueing out of middle age into something beyond. There were a lot of foreigners; in fact the majority of the older people were such, one example being a feisty group of German executives.

Now I am not a reviewer, and find it difficult to say anything about the show except that it was awesome. I have seen some Broadway musicals in my Canada days, and Tommy was not as glitzy or over-the-top as they tend to be. It was solid and professional and polished, but not produced to death either. Kind of… just right. It was one of those experiences that will likely stay with me.

I first saw the movie version when I was in high school. Some of the parts that were seared into my memory were when Mrs. Walker’s lover killed Captain Walker, Moon’s diabolical portrayal of Uncle Ernie “fiddling about”, and Tina Turner as the Acid Queen, not to mention how hot Ann Margret was as Tommy’s mother.

In the musical version, Captain Walker ends up killing the lover, and the Walkers end up back together, and in love with each other. This made Tommy’s family situation much less sordid than the movie version. Uncle Ernie was portrayed by a less threatening individual and perhaps some of the child abuse scenes may have been watered down because of the times we live in. And needless to say, no Tina Turner or Ann Margret!

The band, playing on a platform above the stage, was terrific. Probably more polished than The Who themselves. They made liberal use of synthesizers which actually works very well with this music and story. The vocalist, who also played the lead character, was able to imitate very well both Roger Daltrey when he sang and Pete Townsend when he played the guitar.

The grand finale of See Me Feel Me, and its thundering conclusion, was enrapturing. Again, glorious, but accomplishes this somehow without being over-the-top. It is the kind of stuff that really emotionally connects. I suspect there may be a lot of subjectivity at play here.

I paid around a hundred dollars for the ticket, but came out of it a much richer man.

Monday, March 13, 2006

Music Map

If you have a net-surfing addiction as I do, this will only make it worse:
http://www.dimvision.com/musicmap/

Tuesday, January 10, 2006

2006 well under way, for better or worse

Well it looks like this year is here for real. After starting work again, we were already into another long weekend that is just ending now. I am partly desolate about that fact, and partly eager to get moving on things.

Working in Ginza is pretty interesting. It is a veritable shopping and entertainment mecca. If I am not careful I could end up spending oodles of money there on the fashionable restaurants and bars. Especially given that I like the Ginza style.

Starting tomorrow I am going to conciously try to pin down my lunch cost to 1000 yen or less.

-----------------------------

Anywhoo...

I spent much of the weekend setting up my Linux environment at home. In fact it is where I type from right now. It is really cool. I can't believe you get all this stuff for free. It makes me worried about the future for software developers.

I am running a Xandros 3.02 distribution. This is Debian Linux with a Kde GUI over it. It was more trouble-free than setting up Windows!

However the real troubles came in setting up my web development tools - MySql, Apache and PHP. One major problem plaguing me was that it was not clear there was even a C compiler on this sucker, and all these installations require a compile! From the perspective of a hard-core Windows user, this is kinda ridiculous. But live and learn. I used the Xandros Network tool and a lot of wild guesses (only a few educated guesses, because I largely have no idea what the hell I am doing) and kept installing this that and the other thing.

For example I had to install this lexical analyzer called Flex. Then there was this thing called LNCurses, which certainly had me cursing. Each of these required the installation of several packages.

Finally, miraculously, everything seems to have fallen into place and is working correctly. Of course, I have no idea why.