Ubuntu 10.10 Pentax K-5

Tuesday, May 31, 2005

FIsh arrives Sydney... Cold

MY Dear Fish arrives Sydney, Australia from 2.5 month interchange. Miss...

Tuesday, May 24, 2005

银耳莲子,红枣, 当归

喝水的时候可以放些菊花,蜂蜜,还有罗汉果,甘草,清凉的

可根据个人身体状况选择温和的汤料。如身体火气旺盛,可选择如绿豆、海带、冬瓜、莲子等清火、滋润类的中草药;身体寒气过盛,那么就应选择参类作为汤料。

--- for fish's pimple

Sunday, May 22, 2005

Secrets of success (from "The Straits Time")

Secrets of Success

Consistent high performers share four common traits, says Dr Billy kueek

  1. Positive attitude and mindset;
    Your attitude can make or break you. A negative attitude is often the result of frustration. You can consciously develop ways of thinking that put you in control. Take time off every day to review and reflect on what you have done that day, and what you could have done more productively and effectively. Map out strategies so you are better able to deal with the challenges next time. It does not matter if you fail, just don't fall into the same hole twice.

  2. Extraordinary work ethic;
    The key of extraordinary is to do whatever it takes to get the results you want - without compromising your integrity and hurting others.

    • Starting earlier in the day.
    • Devoting time to plan and execute your task.
    • Scheduling time for important and urgent things, as well as those that are not urgent but important.
    • Following through on all projects.
    • Thinkingof new ways to become more effective and efficient in the things you do
    • Continuing to give your best, even if you achieved success early in the day; and
    • Remembering the classic motto:"I will do one more task"

    The difference between average and excellent performers is that excellent performers are willing and determined to do whatever it takes to get the job done.. and done right.

  3. Excellent skill set;
    Professionals who are consistently successful do not think they know it all. They know that excellent foundation skills are critical to their success. They are also eager to learn from customers, associates and colleagues, and through self-directed initiatives.

  4. 360-degree on-the-job knowledge.
    Knowledge is powerful. You should know everything about your job and your position. Total knowledge gives you solid foundation not just to perform, but also to perform at peak.

Saturday, May 21, 2005

棋经十三篇

博弈之道,贵乎严谨。高者在腹,下者在边,中者占角。此棋家之常
然。法曰:宁输数子,勿失一先。有先而后,有后而先。击左则视右,攻
后则瞻前。两生勿断,皆活勿连。阔不可太疏,密不可太促。与其恋子以
求生,不若弃之而取势。与其无事而强行,不若因之而自补。彼众我寡,
先谋其生。我众彼寡,务张其势。善胜者不争,善阵者不战。善战者不败。
善败者不乱。夫棋始以正合,终以奇胜,必也。四顾其地,牢不可破,方
可出人不意,掩人不备。凡敌无事而自补者,有侵绝之意也。弃小而不就
者,有图大之心也。随手而下者,无谋之人也。不思而应者,取败之道也。
诗》云:“惴惴小心,如临于谷。”
---合战篇第四

虚实篇第五
夫弈棋,绪多则势分,势分则难救。投棋勿逼,逼则使彼实而我虚。
虚则易攻,实则难破。临时变通,宜勿执一。《传》曰:“见可而进,知
难而退。”又曰:“执中无权,犹执一也。”

USB 2.0 vs. 1.1

I try to connect a USB mass storage(2.0) to a USB(1.1),
but found that there is problem, the storage can't be
recognized...
The problem is that the power supply of USB(1.1) is not
strong enough to support USB mass storage(2.0), so for
the mass storage, the middle connector is to connect for
data transmission, and the end connecton needs to be
connected also for power supply.

Wednesday, May 18, 2005

It is really tough time...

It is really a tough time for me... unstable... scaring...
What is my future going to be??

Keep on being a software engineer, or go to do my own business, to be someone.

Road is there, everything is by your decision.

Tuesday, May 17, 2005

How to Avoid Corrupting Data. (write, fwrite in C)

1. Check the return status of open.
2. For the write(2), pwrite(2), writev(2), fwrite(3),,
* Don't submit writes larger than SSIZE_MAX
* Store the return code in a variable of type ssize_t
* If the return code is -1 and errno==EINTR, retry the call.
* If the return code is -1 inform the user and stop writing to the file
* If the return code is
Sample Code:

ssize_t ret;
size_t len;

if ( len > SSIZE_MAX ) {
/* This is a very bad idea */
}
again:
ret = write(fd, buf, len);
if ( ret < 0 ) {
if ( errno == EINTR )
goto again;
if ( errno == EAGAIN ) {
/* Wait with poll(2) for POLLOUT */
goto again;
}
/* A real error - signal the user */
}else if ( (size_t)ret < len ) {
buf += (size_t)ret;
len -= (size_t)ret;
goto again;
}
/* success */


3. Check the return status of close.
4. Synchonize the data. (fsync or fdatasync[fast])

Summary


1. Always check for errors whan using system calls that involve I/O.
2. Make sure if there is an unrecoverable error that the user knows about it right away, chances are they can do something to fix the problem. The worst possible thing to happen is that the user thinks that their data is safe and they don't find out until much later. Never indicate success unless you are absoultely certain.
3. Consider taking a performance hit and syncing data to the storage device before reporting success.
4. Don't remove or overwrite perfectly good data unless you know that what you are replacing it with is as safely written to disk as the old stuff.
5. Design the system in a way that the user can make usable backups easily and without interrupting service.

Thursday, May 12, 2005

Don't do anything is killing yourself...

Time is passing... When other friends are greater, even much greater than you, what reason do you have to stay, with happiness of life?

Plan for this month:

  • Mandarin Speaking

  • English Speaking

  • English Vocablury

  • Physical Practice for health



If your target is funther, you can walk much more further...

Wednesday, May 11, 2005

CSS (Cascading Style Sheet) vs. Latex vs. Software Engineering

The blog gets good impression with help of CSS.
HTML, as I previously pointed out, is a structural language, while CSS is its complement: a stylistic language. As if that weren't enough, there is the very strong possibility that HTML will be gradually replaced by the Extensible Markup Language (XML).

LOW COUPLING RULE

O' Reilly - Cascading Style Sheet
A very good tutorial...

HTML (HyperText)

Using tag marquee to show moving sentence.
Properties:

  • direction: left right
  • behavior: scoll, slide, alternate
  • loop: number, otherwise infinite
  • width: number or num %
  • height: same.
  • align: top, middle, bottom
  • bgcolor: rrggbb, or red, green...

HTML is must.

Horizontal Line
<hr>
Properties:

  • width
  • color
  • size
  • aligh
  • noshade

Example,


Chinese HTML Tutorial

The wonders of Glib

Glib is a utility for C that makes programming in C must more enjoyable.

It addresses three fundamental problematic issues C users often face:
  • Data containers
  • Portability
  • Utility
Glibs provides safer and stable operations than C, e.g., g_free is much safer than free.
g_new0(num), great than malloc()

Glib provides double-linked-list, single-linked-list, hashtable and so on.
   GList *list = NULL; /* our list pointer */
list = g_list_append(list, "foo1");
list = g_list_append(list, "foo2");

The string operations of glib is also wrapped to be safer ...

  • strcpy->g_strcpy
  • strdup
  • ...
Hash tables, the iterator
Create and destroy hash table
   GHashTable *table;
table = g_hash_table_new(g_str_hash, g_str_equal);
g_hash_table_destroy(table);

Insert and look up data
   FILE *fp;
char buf[1024];

/* just a standard way to open files */
fp = fopen("file.txt", "r");
if(!fp) exit(1); /* if file does not exist, exit */

/* read, file line by line */
while(fgets(buf, sizeof(buf), fp)) {
char *key, *value;
/* get the first and the second field */
key = strtok(buf, "\t");
if(!key) continue;
value = strtok(NULL, "\t");
if(!value) continue;

/* insert into our table */
g_hash_table_insert(table, g_strdup(key), g_strdup(value));
}
fclose(fp);

Some reference

Thursday, May 05, 2005

Love is within the embrace... I wish forever.

I Love Fish!I love fish!!!!

Kile - a good frontend of LaTeX

I have practiced LaTex for quite a bit... Now I found a front end for it, Kile... another one called Lyx is a bit bigger, maybe it has more sophiscated functions, i did not try that, the compilation needs xforms, i give that up.

Kile provides full functions, give some reference to LaTeX, menu-driven build tools, very useful...

Doxygen

Doxygen is really a great tool to document the C/C++ code after following some Doxygen rules.

latex2html is also a convenient way to convert the latex file to html files.

I need to be more familiar with php these days...