2008-01-31

Hide every application in the system tray!

Today I've tried a software called TrayIt! From its name you can see what it is for. ;-)

Yes, it's used normally to hide an application into the system tray.

Usage from the author's website:

TrayIt! runs on Windows 95/98/Me, NT/2000/XP/Vista and does NOT require any installation.

Simply create a new folder and place TrayIt!.exe and TrayIt!.dll there. When started, TrayIt! will show a dialog box with a short explanation how to use it. You may choose to load TrayIt! on system startup by selecting "Option" and checking "Load TrayIt! on StartUp" box.

  1. You can temporarily put any window in the system tray by keeping down the button when minimizing the window.

  2. To always keep window in the system tray when minimized, click with the RIGHT mouse button on the corresponding icon created in the tray in the previous step and check "Place in System Tray" in the popup menu.

  3. Clicking with the right mouse button on the minimize icon will bring TrayIt! context menu for this window. Just check "Place in System Tray" in the popup menu to make window always go to the tray.

  4. Please note that context menu will work only for the standard minimize icon and will not pop-up if the program use skins like MS Media player.


It's really useful because many programs don't provide the funtion of "minimize to the system tray". Currently I use it to hide the opera in my system tray and it works!

Download it!

2008-01-24

HOWTO: Set Up a CVS Repository Server under Linux

Since I want to use CVS as my project version control system, I decide to set up a CVS server on a Linux box.

I try to follow the instruction from [HOW-TO Install and Configure a CVS Repository Server] to get my work done, but there are so many problems happened.

First of all, the Linux is an old SuSE Linux distribution. CVS is already installed on the machine, which can be checked in the graphical config tool "yast" or "yast2".

Since I don't want to specify the passwords for every cvs user, it's better if the cvs server can use the users of the Linux sytem. It can be achieved by adding a line in the /config file.

Assumed that you create a repository in the directory /usr/local/cvsroot with the command:
cvs -d /usr/local/cvsroot init
then CVS will create a directory /CVSROOT under /usr/local/cvsroot. The config file of cvs is right in /usr/local/cvsroot/CVSROOT/. Open it and find a line like:

#SystemAuth=no
change it to

SystemAuth=yes
Then CVS knows you want to use the password of the users from the system.

I intend to use the machine as a CVS Repository Server, that means, the repository should be accessed remotely.

In order to do that, the cvs pserver should listen to the port 2041, which is enabled by inetd or xinetd. Since both are not existed in my system, I download the xinetd from its website.

After extract the downloaded source, you can use the command

tar -xvf xinetd-version.tar.gz
to extract the source codes.

Change your current path to ./xinetd-version, then just execute the following commands to install xinetd:

./configure
make
make install
cp xinetd/sample.conf /etc/xinetd.conf
cp xinetd/xinetd /etc/init.d/
Modify the file /etc/xinetd.conf so that it will run the cvspserver automatically:

service cvspserver
{
socket_type = stream
protocol = tcp
wait = no
user = root
passenv =
server = /usr/bin/cvs
server_args = --allow-root=/usr/local/cvsroot pserver -f
}

Now start xinetd with
/etc/init.d/xinetd
After such a long long process, the CVS server should be running on the machine now. You can verify it by:

cvs -d :pserver:username@localhost:/usr/local/cvsroot login

I must say, it's somehow frustrated to set up such a CVS server if you find there are so much difficult on your way. :(

2008-01-18

Faroe Islands

法罗群岛1

Photo©Marco Paoluzzo


Situated in the heart of the Gulf Stream in the North Atlantic at 62°00’N, the Faroe Islands lie northwest of Scotland and halfway between Iceland and Norway.

Photo©Marco Paoluzzo

The archipelago is composed of 18 islands covering 1399 km2 (545.3 sq.miles) and is 113 km (70 miles) long and 75 km (47 miles) wide, roughly in the shape of an arrowhead. There are 1100 km (687 miles) of coastline and at no time is one more than 5 km (3 miles) away from the ocean. The highest mountain is 882 m (2883 ft) above sea level and the average height above sea level for the country is 300 m (982 ft).

My Dream Place.

2008-01-17

Project management

There are a lot of softwares for project management. Microsoft Project is the most famous one of them. But what if you want to use such kind of softwares under Linux and Mac? VM? Not a good solution.

Now, if you like Open Source Software, OpenProj is a very good substitution. It has not only Windows version, but also Linux and Mac version.

So try it.

免费下载项目管理软件

2008-01-07

Cron job with the log file

Today I need to write a cron job to make some sql queries automatically executed. Also a log file with the date is necessary according to my boss. :-)

So here is the solution:
---------------------------------------------------------------
# Date in Format yyyymmdd_hhmmss:
SQLNAME=/home/sybase/logs/table_`date +%Y%m%d`_`date +%H%M%S`.sql

# Every day at 23 o'clock the sql query will be executed
00 23 * * * root /opt/sybase/SYBSsa9/bin/dbisql -nogui -c "eng=enginename;dbn=dbname;uid=user;pwd=password;" /opt/sybase/SYBSsa9/bin/whatever.sql >> $SQLNAME
---------------------------------------------------------------

Some explainations:
  1. SQLNAME is a variable name. It consist two parts, the normal text and the date. Notice to that, please always enclose the date part in backticks ( ` ) , otherwise it will be not executed. This variable can be used later with the format $SQLNAME
  2. dbisql is the command line tool for Sybase. In whatever.sql you can write the sql queries you need.

2008-01-04

Sybase Anywhere SQL

Sybase Anywhere provides a possibility, which different clients with different date sources can be synchonised with a central DB server. Its manual is here: http://manuals.sybase.com/onlinebooks/group-pbarc/conn5/sqlug/

The SQL of Sybase is a little different from the standard SQL, for example:

>> Clearing a table "dummy"
delete dummy;

>> Output to a file
select * from dummy;
output to 'dummyfile.sql'

More helpful commands can be found at [selectorweb]

2008-01-02

Fatal error: Allowed memory size of xxx bytes exhausted

Happy New Year to all!

2007 is already the past now. I hope I can keep writing in this new year 2008, not so lazy like in 2007. :)

So today's topic is a PHP error.

During a migration of a Drupal site, after I make a 100% copy of the test site to the new site and change every settings for the new one, then the new site shows me the terrible message!
Fatal error: Allowed memory size of 654321 bytes exhausted (tried to allocate 12345 bytes) in /srv/www/user/bla/blub/file.php on line 123
What goes wrong? The test site runs like a charm and the process of migration should be okay.

In PHP, there is a enviroment variable called memory_limit. It varies by your web hosting provider. By default it's 128M, namely 128 MB memory. Since the web hosting provider want to spare some hardware costs and provides more accounts on a shared server, so the value of memory_limit will be changed to 16M sometimes! If you are like me to use some modules in Drupal (that's what makes Drupal attractiver than others!), because every module will eat some memories, so your Drupal installation will reach the memory limit very soon!

Now here is the solution:

  1. Contact your web hosting provider to beg them for a bigger memory_limit, which is hard to be satisfied.
  2. Try to switch off some Drupal modules to save the memory. It can be done only through Database manipulation such as in PHPMyAdmin.

If you have to choose the second way:

Go to the table "system", you will find almost every module has a feld called "status". 0 means not selected, 1 means enabled. Try to set the status of some modules such as statistic, color, etc to 0. After that you should see your new site without the above error. If not, eh.... you must switch more modules off. What a pity!

Most important, after the DB manipulation you should go to administer -> site configuration -> modules to save your configuration and run the update.php, otherwise the Drupal will lose some module-special configuraions.