2007-09-05

If life is a game...

These days I met a lot of things like in a drama. Luckily, all these things are good. So it makes me think, if life is a game, what I made in this game?

Personally I love Nintendo Wii so much, but the problem is, I don't have so much room for the sport game of it. :( Ironically saying, I have bought the monthly entrance to a gym club, but I haven't made any sport training since months. All what I am dreaming about is doing the training at home before the TV set with Wii!!

I searched the whole web with the keyword "if life is a game", and I found a genius text about the idea. The fancy of Steve Pavlina is very impressive, such as:

The only way to lose the game of life is not to play. When you actively play the game, you gain skill and experience (and hopefully gold as well). Keep playing, and you’ll eventually build yourself a level 10, level 20, level 30 character. Just make sure that when you hit level 30, you aren’t still fighting level 10 monsters.

or this one:

If you find yourself in a human body, you came here to play the game of human life. Don’t sit on the sidelines whining like a noob. The truth is that if you lose all your gold, if your teammates dump you, or if your character gets infected by the plague, it’s all part of the game. Every setback initiates another round of compelling choices. The game isn’t supposed to be fair — it’s supposed to be fun and interesting. Whether or not you have a fun and interesting experience largely depends on what kind of player you are.
I must say, I learned a lot from that text "Life - The Ultimate Game". Take a look at it, you may lose 5 minutes in your game of the life, but it really worths! :)

2007-09-03

Best zip software on the earth!

There are many zip softwares on the earth. Maybe thousand? I don't know. After long time seeking my most favorate zip software, I've chosen 7-Zip!

The reason:
  1. It's open source, which means it's completely free.
  2. It supports most archive format, including 7z, ZIP, GZIP, BZIP2, TAR and RAR.
  3. it integrates into the windows explorer.
  4. It has 63 language support.

An interesting thing is, the english version of 7-Zip website doesn't provide the beautiful icon set that is available to chinese users.




So here it is:

for v4.2: http://www.7-zip.org/zh-cn/7z_iconset.exe
for v4.53: http://www.7-zip.org/zh-cn/7z-iconset-453.exe

Just download it according to your 7-Zip version and install it.

Enjoy it!

2007-08-28

Automatic Login to google with WScript.

WScript is the short name for Windows Script. It can be a VBScript or JScript(not Javascript but a Microsoft standard!) If we use it properly, it can save us a lot of work. Here is an example for a script which can be used to login in google account automaticly.

var ie=WScript.createobject("InternetExplorer.Application");
var args = WScript.arguments;
var followme="http://www.google.com/";
if(args.length>0)
{
followme
+=args(0);
}
ie.Navigate(
"https://www.google.com/accounts/Login?continue="+followme);
SynchronizeIE();
var doc=ie.document;
doc.forms[
0].Email.value="yourName@gmail.com";
doc.forms[
0].Passwd.value="^your password";

//because the checkbox "PersistentCookie" appears randomly
if(doc.forms[0].PersistentCookie!=null)
{
doc.forms[
0].PersistentCookie.checked=false;
}
doc.forms[
0].submit();
SynchronizeIE();
ie.Visible
=true;

//wait for IE finishs its job
function SynchronizeIE()
{
while(ie.Busy)
{
WScript.Sleep(
100);
}
}

Save the code as googleSpecific.js and make it under the %windir%\system32, then create a file called google.bat under the same path with the content:

@cls

@wscript %windir%\system32\googleSpecific.js %1 %2 %3 %4 %5 %6 %7 %8 %9

After that, execute "google mail" in command promp, you can log in your gmail directly now.

Other commands are:
google notebook
google bookmarks
If you type "google" without any parameters, you will sign in with the google.com.

2007-08-23

Eclipse 3.2.2 with JBoss Server 4.2.1

Since I want to try the new version of JBoss Server, I downloaded the newest Version of it and unzip it to a folder. Just like usual, I go to the eclipse workbench and select file | new | other | server | next, then I can see 2 entries for JBoss server which are the v3.2.x one and the v4.0.

Chosing the 2nd option I get the error :

Missing classpath entry C:\jboss-4.2.1.GA\server\default\lib\javax.servlet.jar

As far as I know, from the version 4.x of the Jboss Server, it already includes the EJB. So the only reason for that error should due to a not correct server definition.

Internet is a good place to find the answer. Thanks to Wolfgang Knauf, we have some new JBoss server definitions here: http://www.informatik.fh-wiesbaden.de/~knauf/public/

There are two different jars for WTP 1.5 and 2.0.

To use the plugin:
  • JBoss 4.0.x: You MUST have installed the EJB3 RC9 to the default configuration so that the plugin can find all required libraries.
    For JBoss 4.0.4 with installer including EJB3 RC8 this is done automatically.
    For EJB3 RC 9 there is no JBoss AS installer, it must be installed to the default configuration manually. Later you can install EJB3 RC9 to any other configuration, the jars from the default configuration are only needed for starting up application clients and for Eclipse.
  • JBoss 4.2.0: the default configuration must be present so that the plugin can find all required libraries (tested for CR1 to GA)
  • JBoss 5.0.0: the default configuration must be present so that the plugin can find all required libraries (tested for Beta2)
  • Delete previous versions of this plugin if already installed.
  • Download org.eclipse.jst.server.jboss.ejb3_1.5.0.v200706052200.jar
  • Copy the file to the subdirectory "plugins" of your eclipse installation.
  • Restart eclipse once with the "-clean" option: "eclipse -clean".
  • Create a new server runtime. You will find the runtimes in the "JBoss" branch, labeled "JBoss 4.0.4 or 4.0.5 with EJB3 RC8 or RC9", "JBoss 4.2.0" or "JBoss 5.0"
So enjoy it!

2007-08-20

Deleted Files under FreeBSD

In last week I made a mistake by deleting some documents on a server which runs FreeBSD. Three seconds after I typed "rm -r *.*" and pressed Enter, I'd realized I made a big mistake. There is always a thing called "recycled bin" in Windows or GUIs in Linux, but not for such a situation with text command. So, I searched in my poor memory and tried finding some tools under FreeBSD just like "undelete" under sweet DOS. The only result and choice is: testdisk.
Exactly saying, PhotoRec, which can be downloaded here.

It's really sad for me to find out that there is only FreeBSD port for testdisk, which can be easily installed by typing "pkg_add -r testdisk", but not for PhotoRec. The only way is downloading the source and compiling by yourself. I must admit that I didn't make it done. So I was almost mad when I realized there is no kind of softwares that can rescue the deleted files under FreeBSD.

The solution to this disaster: for some luckies I made a backup before several months and it includes the files that I deleted! So here is the lesson I've learned: ALWAYS make backups before you do something! Today is just losing some files, what happens if our hard disks die?

Like some words I saw elsewhere:

Love, just like you've never been hurt,
Live, just like you will die tomorrow,
Sing, even if nobody is listening.

We can add an extra line to that:

Backup, 'cause you will never know when your hard disks want to die.

2007-08-13

Gospel of Tux unearthed!

Every generation has a mythology. Every millenium has a doomsday cult. Every legend gets the distortion knob wound up until the speaker melts. Archeologists at the University of Helsinki today uncovered what could be the earliest known writings from the Cult of Tux, a fanatical religious sect that flourished during the early Silicon Age, around the dawn of the third millenium AD...

The Gospel of Tux (v1.0)

In the beginning Turing created the Machine.

And the Machine was crufty and bogacious, existing in theory only. And von Neumann looked upon the Machine, and saw that it was crufty. He divided the Machine into two Abstractions, the Data and the Code, and yet the two were one Architecture. This is a great Mystery, and the beginning of wisdom.

And von Neumann spoke unto the Architecture, and blessed it, saying, "Go forth and replicate, freely exchanging data and code, and bring forth all manner of devices unto the earth." And it was so, and it was cool. The Architecture prospered and was implemented in hardware and software. And it brought forth many Systems unto the earth.

The first Systems were mighty giants; many great works of renown did they accomplish. Among them were Colossus, the codebreaker; ENIAC, the targeter; EDSAC and MULTIVAC and all manner of froody creatures ending in AC, the experimenters; and SAGE, the defender of the sky and father of all networks. These were the mighty giants of old, the first children of Turing, and their works are written in the Books of the Ancients. This was the First Age, the age of Lore.

Now the sons of Marketing looked upon the children of Turing, and saw that they were swift of mind and terse of name and had many great and baleful attributes. And they said unto themselves, "Let us go now and make us Corporations, to bind the Systems to our own use that they may bring us great fortune." With sweet words did they lure their customers, and with many chains did they bind the Systems, to fashion them after their own image. And the sons of Marketing fashioned themselves Suits to wear, the better to lure their customers, and wrote grave and perilous Licenses, the better to bind the Systems. And the sons of Marketing thus became known as Suits, despising and being despised by the true Engineers, the children of von Neumann.

And the Systems and their Corporations replicated and grew numerous upon the earth. In those days there were IBM and Digital, Burroughs and Honeywell, Unisys and Rand, and many others. And they each kept to their own System, hardware and software, and did not interchange, for their Licences forbade it. This was the Second Age, the age of Mainframes.

More: http://www.ao.com/~regan/penguins/tux.html

2007-08-09

The confusing difference beweteen different JOINs in SQL

There are two kinds of JOINs: one is INNER JOIN, the other is OUTER JOIN.

Sounds like similar, but very different:

INNER JOIN means the result of a query should exist in the source tables.
OUTER JOIN means the result of a query CAN be some NULLs partially.

INNER JOIN is a keyword of SQL, but OUTER JOIN not.
OUTER JOIN includes two types JOINs: one is LEFT JOIN, the other is RIGHT JOIN,

NOTICE: LEFT JOIN & RIGHT JOIN are keywords of SQL.

Now let's look at some examples to understand things more clearly.

Given two tables:

TABLE 1: exam

ID Score
------------------------
1 A-
2 B+
5 C-

TABLE 2: student

ID Name
------------------------
1 Joe
5 Geogre
7 Ben

First SQL query:
SELECT e.ID, s.Name, e.Score FROM exam AS e INNER JOIN student AS s ON s.ID=e.ID;

So we get:

ID Name Score
-----------------------------
1 Joe A-
5 Geogre C-

In fact, this query is equaled to:
SELECT e.ID, s.Name, e.Score FROM exam AS e, student AS s WHERE s.ID=e.ID;

Second SQL query:
SELECT e.ID, s.Name, e.Score FROM exam AS e LEFT JOIN student AS s ON s.ID=e.ID;

We should get the following this time:
ID Name Score
-----------------------------
1 Joe A-
2 NULL B+
5 Geogre C-

Third SQL query:
SELECT e.ID, s.Name, e.Score FROM exam AS e RIGHT JOIN student AS s ON s.ID=e.ID;

We should get the following this time:
ID Name Score
-----------------------------
1 Joe A-
5 Geogre C-
7 Ben NULL

So you find the difference!

LEFT JOIN will try to find every match for the table BEFORE the statement LEFT JOIN, when nothing matched can be found, then a NULL will be used.

RIGHT JOIN will try to find every match for the table AFTER the statement RIGHT JOIN, when nothing matched can be found, then a NULL will be used.

2007-08-02

QuantumDB Eclipse Plugin

Today I've tried the famous QuantumDB Eclipse Plugin, It's really a powerful database management tool and supports many different databases.

To install it, open Eclipse and select from the menu "help"->"Software updates"->"Find and Install..."->"Search for new features to install"->"new remote site", then type the update URL: http://quantum.sourceforge.net/update-site, then click next...

Note: Quantum needs the GEF plugin to work, so you have to install it before installing Quantum. That plugin can be installed via an already built-in remote site: "Callisto Discovery Site".

After successful installation, I was really frustrated to figure out that the Quantum comes with only TWO connector:

  1. JDBC to ODBC bridge
  2. MS Access

If we want to use MySQL, we must get the connector jar! Now it's called MySQL Connector / J. Go to that page and download the package.

Tip: you don't need to register or sign in when you click "select a mirror", just find the gray text "No thanks, just take me to the downloads!".

Extract all things in a folder, you can find a file called like mysql-connector-java-5.0.7-bin.jar. You need to do the following to add support of MySQL driver:

  1. Go to eclipse and switch to the view "Quantum DB" by clicking the top right icon near to "Java". Add a new bookmark by right click on the left "database bookmarks" panel.
  2. Now click "Add driver", find "mysql" in the dropdown list "type", then click "add external jar", point to the file mysql-connector-java-5.0.7-bin.jar.
  3. Click the "browse" button for the class name "com.mysql.jdbc.Driver", then go on clicking many "OK" buttons.

So now do the step again and select "mysql" as connector, a dialog will be shown to let you input some infos of the mysql database you want to connect. That is it!

2007-07-27

SMART in Management.

A target in Management should have the attributes of SMART. That means:

  1. S - Specific

  2. The target must be certain, cannot be unsure or even not exist!


  3. M - Measurable

  4. The target we made must be measurable


  5. A - Attainable

  6. A target must be realisable, or reachable by efforts.


  7. R - result-based

  8. All our efforts should target at the traget, not just doing for doing. The most heard excuse in target-making is :"we are concentried on the process but not the result."


  9. T- Time-based


  10. Every target must have a schedule and a deadline.

2007-07-21

The art of paper cut

So many times, we think there is only one way to do one thing, but actually, there are a lot of ways to do a thing. The problem is only we don't or won't even dare to think such ways exist. For example, what could a paper cut be looked like? or just like this?







More: Peter Callesen's Work

2007-07-19

Design clock

There are many different kinds of clocks. This one is an amazing one because it is a timed bomb.



Every morning, it beeps like a bomb with Di Di Di ... When you don't kick it off, the beep interval will be shorter. Another interesting thing is, if you want to stop the alarm, you must press one of three colorful buttons (the correct one!) that represent three cables. AND, the correct one is selected randomly every day!

So if you're that lucky to get the right cable, you can snoop. Otherwise, nobody knows what happens ....:-)

Transformers Theme for Firefox

I belong to the generation who watch the cartoon "Transformers" and grew up. So when this July the movie "Transformers" shows up in the cinema, I watched it as early as I can. Now I've digged out an eye candy for those Transformers' fans just like me: A Firefox Transformers Theme







You can download it here, open your Add-in Manager, and drag it into it to install.

2007-07-18

A word

If you don’t know where you are going, you may end up somewhere else.

2007-07-16

Problems with IMG html tag in Flash 8

In these days I am fighting with some bugs in Flash 8. So comes the problem: I want to create a text field in Flash 8, and change its properties to "dynamic text" with "multi-line", "selectable" and "render as HTML", then I connect the text field to some html contents. Everything is fine, until I try to show some pictures using the html tag img. The result: NO imgs are shown.

After long long time with try-error and searching in the net, finally I found the reason for such problems. There are some bugs with IMG html tag in Flash 8. My solution is: After the img tag, insert at least 8 <br /> tags.

To be careful: The support of img tag is only available from Flash v7 and ActionScript 2.0. So please pay attention to your publish settings too.

2007-07-14

Ajax RSS News Ticker

Today I want to introduce a very useful tool called "Advanced RSS Ticker"。 This tool uses a PHP class which can parse the RSS feed. The PHP class is Last RSS. Comparing to other PHP class, I think the most highlight is that it supports UTF-8. You may wonder, is there any RSS Parser which supports no UTF-8. Yes, there is ONE. I don't mention its name because it took me so many time to figure out that it is NOT UTF-8 compatible. :-)

You only need to download this and extract the zip into your web directory. Try the demo.htm within it, it is that easy!

There is also another PHP RSS News Parser. Since I didn't try it, I left it to you to compare this with the other two. ;-)

2007-07-09

Problem with Windows Time Update

Recently I always faced some strange problems. :-( Today I met a problem with Windows Time Update.

I tried to use the tab "Internet time" after clicking on the clock to select "Adjust Date / Time". When I selected the server "time.windows.com", then clicked "update now" on the right. Ok, error came! I got an error message "An error occurred while Windows was synchronizing with time.windows.com". Great, then I tried it with other time servers. Nothing different.

How to fix this up? Here are some steps I found in the internet.

1. Press Winkey+R, or select "Run..." from the start menu, and type "cmd" in the box;
2. After the command window shows up, type the following commands:

net stop w32time
w32tm /unregister [ignore error message]
w32tm /unregister [enter a second time]
w32tm /register
reg add hklm\system\currentcontrolset\services\w32time\parameters\ /v NtpServer /t reg_sz /d time.nist.gov /f
net start w32time


3. Try the "Internet time" update again. It should work now.

2007-07-05

strange problem with Node Template

Yesterday I mentioned that the strange problem with my Drupal module "Node Template": If I enable the "clean URLs" in Drupal, then clicking on the menu item "my node templates" will show the message "access denied" with the error 403.

After long long time with try-error, finally I found the cause of the problem. In the .htaccess which is in the root folder of Drupal, there are some lines looked like this:

# Protect files and directories from prying eyes.
<FilesMatch "(\.(engine|inc|install|module|sh|.*sql|theme|tpl(\.php)?|xtmpl)|code-style\.pl|Entries.*|
Repository|Root|Tag|Template)$">
Order deny,allow
Deny from all
</FilesMatch>

Since I used "/nodetemplate" as the path for the menu item "my node templates", then the server will block this path only because the path "/nodetemplate" ends with the string "template". That's really a dreadful setting! I cannot suggest all the users to change their .htaccess file, so I changed my path to "/nodetemplates". BOOM! Everything works like a charm now.

Indeed, such kind of FilesMatch settings are intended to protect the unauthorized access to those files. But, it has so many side-effects. For example, you cannot use any string which ends with "template" or "root", etc. to name your shortcuts as your path in Drupal. If you did this, you will get the strange problem too!

2007-07-04

New features in Node Template

It's really a happy thing to find out that there are already some people using my Drupal module "Node Template". Today I just caught some spare time, so I made some updates to the module.

New features include:
  1. Now automatic node creation is optional from version 1.3.
  2. Share template with others is possible from version 1.4.
Today I released v1.5 only to fix some bugs according to the issues. When there are still some problems, just try to use the dev release of the module.

The reason why I don't want to release v1.6 today is because a strange problem on my computer. if I enable the "clean URLs" in Drupal, clicking the menu item "my node templates" will cause a page that says "Access forbidden" with "error 403". I guess it can be some setting problems of my web server. Currently I am using xampp 1.6.2. When I figure out what happens, I'll release v.1.6 of the module "Node Template".

2007-07-03

Difference between German and Chinese

Found some very interesting art works from an Chinese artist in Germany that reflect the difference between German and Chinese.


Left (Blue): German & Right (Red): Chinese


Three Meals 一日三餐




Contacts 人际关系


Moods and Weather 心情和天气



Transport 交通工具


For more info of this series of works: http://www.yangliudesign.com

References 参考:http://www.uni-ulm.de/acssu/cgi-bin/topic.cgi?forum=18&topic=933

作者介绍:刘扬,一九七六年生于北京。十三岁随家人迁居德国。十七岁时被德国柏林艺术大学设计系录取,师从于霍尔格马蒂斯,获硕士及大师班学位。毕 业后曾先后在新加坡,伦敦,柏林,纽约工作及生活。零四年在柏林开始自己的设计工作室。曾任教于荷兰设计中心,中国中央美术学院设计系,英国格拉斯歌美术 学院,并在国际设计研讨会及博览会讲座。刘杨的作品曾多次在国际设计大赛中获重要奖项,作品被国际多家博物馆展览并收藏。

Yang Liu is born in 1976 in Beijing. She came to Germany with her family at the age of 13. She was 17 years old when she studied in the Art University of Berlin (Universitaet der Kuenste Berlin). After her study she made his career as a Designer in Singapur, London, Berlin and New York. In the year of 2004 she founded her own Design Studio. Besides Workshops and Lectures on international conferences she tought in the Central Academy of Fine Art Beijing and the Glasgow School of Art. Her works are presented in many international contests, worldwide can be seen in Musums and bought for collections.

2007-06-12

Tips for Multisite in Drupal

In last post I've reviewed the process to build a multisite. Here are some tips and tricks!

  1. If you want to use a new theme for the new site with the configuration, $conf =

    array('site_name' => 'My Drupal site',
    'theme_default' => 'pushbutton',
    'anonymous' => 'Visitor',);


    please be sure give the parameter "theme_default" a new name such as "newtheme". Then copy the whole folder of your current main theme as a new folder called "newtheme" under "/themes".

    This gives the grantee of the maximal compatibility of your new theme which is to be modified.


  2. Just remember to activate your "newtheme" in your main site, otherwise Drupal will not use the new theme.