Default style (Cherry Eve). Switch styles (Capricorn). XML Feed Calendar
All | General
20040916 Thursday September 16, 2004

Mozilla/Gecko Keyboard Navigation Proposal

Finally, we got it published at here. It took me a whole week for writing, discussing, gathering feedback etc. Now it is in the position to get public feedback. Cheers!

This week I'm working on another document that analyzes the advantage and disadvantage of Firefox adoption. This wasn't an interesting job, though it may affect our browser strategy.

In the meantime, I have to work on moving our accessibility site to a new location: http://www.mozilla.org/access/unix/. It's not only about moving file, but also about updating the content, refining the directory structure and file name, recoding the HTML to fit mozilla.org Documentation Style Guide. The coming 2-3 days probably will spend on this :(

I hate writing document.

September 16, 2004 05:52 AM PDT Permalink

20040914 Tuesday September 14, 2004

Get rid of the duplicate entries in your address book

After developed the Firefox extension Show java console, I came up with an idea to develop another extesion for mozilla address book that can remove the duplicate entries (in terms of email address), because there are many duplicate email addresses in my address book, like foo@sun.com, foo@Sun.Com, Foo@sun.com etc. It's very annoying especially when you use the auto-complete feature - the drop-down list is filled with the same guy's name which you don't want to send email to. Manually editing the abook.mab is not an option because that file is in a computer-friendly format.

The extension itself is very straightforward - it goes through every entry in gAbView (card = gAbView.getCardFromRow(i)), then get email address from each card (email = card.primaryEmail.toLowerCase()) and lower case it, compare to existing addresses to see whether it's a dup, if so, select this entry so that user can remove all of them later by just pressing Del key. It's also a good idea to lower case all email address at the mean time, but card.editCardToDatabase(gAbView.URI) must be used for committing the change to database.

BTW, the problem of mozilla not treating foo@sun.com and foo@Sun.Com as the same entry is here. Changing 4th argument from PR_FLASE to PR_TRUE would fix this problem. Any regressions? God knows.

I prepared two packages for the extension and source code, but I can't upload them to this site, sigh...

September 14, 2004 03:43 AM PDT Permalink

20040913 Monday September 13, 2004

Apache

This is the first time I build and configure apache web server from scratch. Thanks to this document, I was able to setup apache with mod_perl and mod_ssl together.

To make .pl files work as cgi scripts, I have to add the following lines into httpd.conf (not sure whether all of them are necessary).

PerlModule Apache::Registry
<Directory "/path/to/cgi-bin">
    SetHandler perl-script
    PerlHandler Apache::Registry
    PerlSendHeader On
    Options +ExecCGI
</Directory>

Authentication, Authorization, and Access Control

Here you can find a very useful document about how to setup authentication, authorization and access control stuff for apache. You can add those directives either in the <Directory> section in httpd.conf or a .htaccess file placed in the directory you want to control. But in order for Apache to pay attention to .htaccess, the directories in question need to be within the scope of a AllowOverride directive that includes the AuthConfig (for voluntary controls) or Limit (for involuntary controls) keywords. For example,

<Directory /secure/dir>
    AllowOverride AuthConfig Limit
</Directory>
September 13, 2004 04:48 AM PDT Permalink

20040911 Saturday September 11, 2004

Wiki software

There are two web pages that list many wiki software for setting up a wiki server (or just application):

I tried UseModWiki which is a perl-based cgi program. It's pretty simple (only 1 perl file) and very easy-to-setup (only need to change the database directory).


Thanks for Brion's reminder, the original article of wiki software is from Wikipedia. September 11, 2004 07:54 PM PDT Permalink

20040909 Thursday September 09, 2004

Connecting to home

I am using a wireless router for my home internet connection, that says, all my home computers will be behind a firewall. To connect my home computers from office, Ineed to:

  • know the ip address of my router (it was allocated by ISP dynamicly);
  • enable router's "port forwarding" function to forward the accessing of special port (say 20, 21 for FTP) to a particular computer.

Firstly, create a perl script in a http server to determine the remote ip address:

#!/usr/bin/perl -w

print "Content-type: text/plain\n\n";
$query_string = $ENV{'REMOTE_ADDR'};
print "$query_string";

Then, use another perl script poking that server to get the real internet address:

#!/usr/bin/perl

use IO::Socket;

$server = 'site';
$port = 80;
$script = '/path/to/cgi/myip.cgi';

$socket = IO::Socket::INET->new(
 Proto => 'tcp',
 PeerAddr => $server,
 PeerPort => $port,
 Timeout => 10,
 );
unless($socket) {
 die("Could not connect to $server:$port");
}
$socket->autoflush(1);
print $socket ("GET $script HTTP/1.0\nHost: $server\nUser-Agent: YY\n\n");

$ip = "";
$off = 1;
while ($line = <$socket>) {
 $off = 0 if ($line =~ /^\s*$/)?
 unless ($off) {
     $ip = $line if (length($line) > 0)?
 }
}

[snip]

Finally, I use blat to send the ip to my office's mailbox:

blat ip.addr -to xxx -cc xxx -s "ip" -u xxx -pw xxx

Now I'm able to do FTP, VNC, etc. from office to my home!

September 09, 2004 11:39 AM PDT Permalink

20040908 Wednesday September 08, 2004

RSS On BBS

Yesterday, I created a RSS feed in our BBS. The template was got form nytimes. It is pretty simple and straight forward (compare to the others using rdf).

Below is the file structure:

<?xml version="1.0" encoding="iso-8859-1" ?>
 <rss version="2.0">
 <channel>
     <title>...</title>
      <link>...</link>
      <description>...</description>
      <copyright>...</copyright>
      <language>...</language>
      <lastBuildDate>...</lastBuildDate>
      <item>
          <title>...</title>
          <link>...</link>
          <description>...</description>
          <author>...</author>
          <pubDate>...</pubDate>
          <guid isPermaLink="false">...</guid>
      </item>
      <item>
          ...
      </item>
  </channel>
</rss>

I hacked into the post.cgi, updated the rss file when a new post coming by

  1. copy the header,
  2. fill in the new item,
  3. remove the oldest item if the total items exceeded 10.

Both lastBuildDate and pubDate need to be a RFC 822 compliant date format, like Tue, 07 Sep 2004 00:00:00 EDT. I spended some time to study how to do it in Perl, and came up with the following code:

use Time::gmtime;

$gm = gmtime(time);
$weekday = (qw(Sun Mon Tue Wed Thu Fri Sat Sun))[$gm->wday()];
$month = (qw(Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec))[$gm->mon()];
$date = sprintf("%s, %02d %s %d %02d:%02d:%02d GMT", $weekday, $gm->mday(),
                $month, $gm->year() + 1900,
                $gm->hour(), $gm->min(), $gm->sec());

The guid field value need to be globally unique. So I combine the site URL and the current time together to make it a really GUID.

I downloaded a RssReader to verify my work. It works very well. I also found a useful site that can verify whether your feed is valid.


RSS 2.0 spec

September 08, 2004 09:29 AM PDT Permalink

20040901 Wednesday September 01, 2004

Open file:// in java applet

One customer reported 4 months ago that she can't do this in java applet (bug 5005607):

URL url = new URL("file:///path/to/file");
applet.getAppletContext().showDocument(url,"_blank");

After some investigation, I found it is controlled by nsScriptSecurityManager::CheckLoadURIWithPrincipal. If the source scheme is http://, the other protocols it can access are controled by this table. The entry for file:// is "PrefControlled", and the pref entry is "security.checkloaduri" which is originally set to true in all.js. That means opening file:// url from http:// is generally disallowed.

This bug does not appear in mozilla 1.2.1 because there was no this kind of security checking at that time. Our problem is since the java applet is signed, it is supposed to do anything it wants. But unfortunately, mozilla does not know what "signed applet" means yet. So...

September 01, 2004 10:05 AM PDT Permalink

Calendar

« September 2004 »
SunMonTueWedThuFriSat
   
2
3
4
5
6
7
10
12
15
17
18
19
20
21
22
23
24
25
26
27
28
29
30
  
       
Today

Links


Navigation


Referers

Today's Page Hits: 18