2006/11/14

Soap

SOAP (Simple Object Access Protocol) is a way to make function calls upon classes and objects, which exist on a remote server.

2006/11/10

Using return + Multithread

There is a 'join' function in Perl when using threads module.


use threads;
use threads::shared;

my @t;
for my $i (1..$num)
{
push @t, threads->new(\&ajxss_wt, $i, $name[$i]);
}
for (@t) { $_->join;}

print "something";


Without 'join' here, "something" will be print immediately, but with 'join', print function will hold until every thread ends.

How to know if thread ends? It will check the return value from 'ajxss_wt' function.
So return 1 must have at the end of 'ajxss_wt' function.

As I found, it is better to make ajxss_wt simple.

Note: For a large number of threads, this code does not work well in cgi-bin. But we can embed this piece of code into system call.

Update: Just found firefox may not be able to support multithread in my case, but IE works fine.

2006/11/06

Some UNIX commands

Create a symbolic link:

ln -s phpMyAdmin-2.9.0.3-all-languages phpmyadmin


Change MySql user's PASSWORD:

mysql> SET PASSWORD FOR
    -> some_user@some_host = OLD_PASSWORD('newpwd');

2006/10/24

Add favorite icon for your web page

Simply put your favorite icon (16 x 16 or 32 x 32 ico file named favicon.ico) on the server into the same directory as the web page. Depending on browser and configuration, the favicon.ico is not always rendered, even if it is in one of the above locations, unless the web page explicitly declares its presence. To declare that your web page has an icon, you add the following 2 lines into the <head> section of your page:

<link rel="icon" href="favicon.ico" type="image/x-icon">
<link rel="shortcut icon" href="favicon.ico" type="image/x-icon">

2006/10/19

Tricky substitute


$original = "lib p($library)";
$original =~ s/$library/mylibrary/;
print "$original\n";

$original did not change at all, because $library is variable and it is undef in our case, so you cannot find the undef string in $orinial to change it to new string. What we can do is

$original =~ s/\$library/mylibrary/;

2006/10/10

First touch with PHP

I decieded to learn PHP. I installed PHP rpm from my company's repository, and then made it work by editing httpd.conf as below. The process is quite smooth!

vi /etc/httpd/conf/httpd.conf


Find the AddType application section and add the following line;

AddType application/x-httpd-php .php


Restart Appache by

apachectl graceful

2006/10/09

Premature end of script headers

Sigh! Just because I set permission of cgi-bin to 775 instead of 755.