Friday, 12 October 2007

make and Makefile in Linux

Well, now that you're learned how to use lots of source files, objects, and libraries to build large programs, how are you ever going to manage them all? How will you remember all the commands and options you'll need to remember to build it? Fortunately, you don't have to. DJGPP (and most development systems) include a program that manages your projects for you. If you are using RHIDE, this is the project definition, which is managed through RHIDE's menus (and is documented in RHIDE's documentation). There is also a stand-alone program called make that keeps track of how to make your program from the sources (hence the name). The file that contains the instructions for make is called a makefile (and is usually called makefile).

The syntax of a makefile is deceptively simple (GNU make includes a lot of extensions, functions, and tricks that can make makefiles almost as complex as your source). You can have two kinds of commands (besides comments) - variable definitions and rules. A variable definition can be a simple thing, like this:

OBJECTS = main.o foo.o bar.o math3d.o graphics.o
They can get pretty complicated also (see the make reference manual) but for now we'll stick to the simple cases.

The more interesting command is a rule, which tells make what it's making, what it's made from, and how to make it. Consider this example:

main.o : main.c
gcc -c main.c

Note that the line with gcc is prefixed by a tab - a real tab character, not eight spaces! Many DOS editors will insert eight spaces when you hit the TAB key, instead of just inserting a tab. If you get a "missing separator" error, that's what happened to you.

Anyway, in this example rule there are three parts: The target, the dependencies, and the commands (well, command). The target is the thing that we want to make. In this case, we want to make the file main.o. Next, after the target (and the colon, which separates targets from dependencies), we list the depenencies - the files that the target depends on. In this case, main.o needs to be rebuilt whenever main.c changes, so we list main.c as a dependency. The last part of the rule is the command that make should run in order to make the target from the depenencies. In this case, we list the gcc command to compile main.c into main.o. Note that you may list as many commands as required, as long as you don't leave a blank line and all commands start with a tab.

Makefiles may (and often do) contain many variables and rules. Here's a Makefile we'd use for our sample program:

main.exe : main.o foo.o
gcc main.o foo.o -o main.exe

main.o : main.c
gcc -c main.c

foo.o : foo.c
gcc -c foo.c

To use this makefile, you run the make program, like this:

C:\SRC> make

Pretty simple, yes? The make program knows to look for a file called Makefile or makefile. If you used a different name, run it like this: "make -f makefile.djg".

Note that make always starts with the first rule it sees, in this case the one for main.exe, and tries to build that first. As it find dependencies, it checks to see if those need to be updated. Based on the makefile above, make will run these three commands the first time you call it:

gcc -c main.c
gcc -c foo.c
gcc main.o foo.o -o main.exe

However, if you then edit foo.c and run make again, it will only run these commands:

gcc -c foo.c
gcc main.o foo.o -o main.exe

It doesn't recompile main.c because it knows that it doesn't have to. In a big project, that could save you a lot of time.

Our example makefile didn't use any variables. Let's include some, to see if it help us out:

CC = gcc
CFLAGS = -g -O2
OBJECTS = main.o foo.o

main.exe : $(OBJECTS)
$(CC) $(CFLAGS) $(OBJECTS) -o main.exe

main.o : main.c
$(CC) $(CFLAGS) -c main.c

foo.o : foo.c
$(CC) $(CFLAGS) -c foo.c

This makefile looks a lot like the old makefile, except that a lot of the commands have been replaced with variable substitutions. What make does is replace the variables with their variables in the target, dependency, and command sections of the rules. That lets you specify some things in one place to make it easier to maintain. In our example, we use $(CC) to specify the compiler, so we could set it to something else if we wanted to without having to change the whole makefile.

Here's another trick that GNU make can let you do. In the above makefile, we had to include the rule for compiling sources into objects twice - once for each source file. That could get tiresome when we have dozens of sources, so let's define a pattern instead. This pattern will be used whenever make needs to compile any source:

%.o : %.c
$(CC) $(CFLAGS) -c $<

Here, we have used the percent (%) character to denote that part of the target and dependency that matches whatever the pattern is used for, and the $< is a special variable (imaging it like $(<)) that means "whatever the depencies are". Another useful variable is $@, which means "the target". Our Makefile now looks like this:

CC = gcc
CFLAGS = -g -O2
OBJECTS = main.o foo.o

main.exe : $(OBJECTS)
$(CC) $(CFLAGS) $(OBJECTS) -o main.exe

%.o : %.c
$(CC) $(CFLAGS) -c $<

Now, if we need to add more source files, we only have to update the line that defines the OBJECTS variable!

Note that make is pretty smart about a lot of things already, like how to build object files. In our above example, we could have left out the last rule completely! The fact that we chose CC and CFLAGS as names was no coincidence, since those are the variables that make's built-in rules use. To see a list of all the built-in rules, consult the make documentation or run "make -p"

The reference manual for make (run "info make") contains many more examples and nifty tricks for building makefiles, but this section covered the bare minimum that you'll need to know to manage your projects with make.

Saturday, 6 October 2007

Eclipse Setting for C/C++


Eclipse for C/C++ enables a lot of features personalized.

I am quite used to use STANDARD MAKE Project, within which I can decide when and how to compile the C/C++ code.

The fig. is what favorite setting for C/C++ make project, the essential is:

g++ ${resource_name} -g -o ${project_name}.

Here, -g for g++ is debug information option, it can be omitted. I prefer Cygwin as default provider of compilers, when you finish Cygwin, everything is done, much convenient for use compared with Mingw.
Right click in the code file you are working on, select "Create Make Target", you will find that everything is there, you don't need to modify anything in the setting. Just run the new created Build command by double click from the view of Make Project from Windows>Show View, here we are, your executable comes out.

The amazing thing is not only for C/C++, even more, it can be used in composing latex stuff. When you create the new project, latex one but you want to make it in the C/C++ Standard Make environment, modify the setting command to:

latex ${resource_name}
or pdflatex ${resource_name}

Now when you create new Build patch from your file, you can decide when and how your compile the latex files. Very personalized.

Thursday, 27 September 2007

美国人挂在嘴边的200句子---其文化和价值观(完整版)

1-----You can't argue with success

Though you may tell someone they are doing something in a wrong way, you have to stop criticizing them if their method works.


2-----Nothing succeeds like success

Like money in a savings account, success seems to compound itself. A person who has a small success expects it to be followed by a bigger one.


3-----The end justifies the means

It does not matter how you succeed. Any method is all right if it works for you. This proverb is not always accepted. Often one hears the opposite, " the end doesn't justifies the means."


4-----If you can't beat them, join them

If you cannot compete successfully with a person or a group, stop competing and go join them. Then you can share in their success.


5-----Always a day late and a dollar short

A criticism of a person who never succeeds. The failures may not be drastic but the pattern of small failures is annoying to others, especially in two areas that Americans value as highly as time and money.


6-----One thing at a time

Concentration leads to success. The person who tires to do too many things at once may fail at all of them.


7-----We'll cross that bridge when we come to it

We will not discuss or worry about a future problem. If and when the problem becomes urgent, we will deal with it.


8-----Don't put the cart before the hourse

Do things in a sensible order. For example, do something to impress your boss before you ask for a raise in pay. Don't ask for the raise first.


9-----All's fair in love and war

Do not trust a rival or an enemy at all. His or her desire to succeed will overrule everything else. Such a people may lie, cheat, attack or do many other things far more terrible than he or she would normally do.


10-----When in Rome do as the romans do

Flexibility leads to success in unfamiliar circumstances. People may changes their normal way of doing things in order to fit in better with those they are visiting.


11------Easy does it

Some things require gentleness for success. One should not push too hard. Force may cause damage

12-----The bigger they are, the harder they fall

Do not be discouraged by the size of your problem or the fame of your competitor. (the saying is traced to a boxer preparing to fight an opponent much larger than he was.)


13-----All is well that ends well

If we can come to a successful conclusion, let us forget about the pain and mistakes along the way.


14-----Go for it

Go ahead and try to achieve your goal. Don't worry about failing. Similar to this proverb--God provides food to every bird, but he won't cast to its nest, you got to earn it.


15-----Every little bit helps

If someone apologizes for giving only a small gift, the recipient may encourage the giver by quoting this proverb. This is especially true if there is a huge job to do or a huge amount of money to be raised from many people.


16-----Look before you leap

Don't jump into a situation carelessly. You may land in difficulty.


17-----All that glitters is not gold

Do not be fooled by worthless things that seem valuable or look attractive.

"Fool's gold " is the popular name for a kind of stone that glitters like gold but contains no gold at all.


18------Curiosity killed the cat

Do not ask too many questions or become too curious about things. You may get yourself into trouble like a cat that does not see the danger in a new situation.


19-----Don't put all your eggs in one basket

Do not risk everything in one place or on one project. Divide your sources that one failure will not ruin you. Similar to this proverb---Do not use both feet to test the depth of the river.


20-----Don't bite off more than you can chew

Do not attempt something too large for you to handle.


21-----Too good to be ture

This is often used to warn about advertising. An offer looks good but turns out to be misleading.


22-----Flattery will get you nowhere

If flattery (insincere praise) is recognized, it will not succeed. One sometimes hears the opposite, Flattery will get you everywhere.


23-----There is no such thing as a free lunch

If someone you do not know offers you a free lunch or other gift, watch out. The gift may be a method of getting something from you.


24------Pride goes before a fall

Do not be over-confident and careless. Your circumstances may change quickly and the emptiness of your bragging will be exposed.


25------Better safe than sorry

It is better not to take a risk than to take a risk foolishly.


26-----Winning isn't everything

One may enjoy the process of playing a game whether one wins or not. This traditional proverb is now often heard in the opposite form, Winning isn't everything. It's the only thing!


27------Time will tell

Wait and see how something will work out. Don't trust a person or thing too much right now.


28-----The burned child shuns fire

Some of life's lessons are learned the hard way. The person who has had to pay for a mistake will be careful not to make that mistake again.


29-----There are other fish in the sea

There are opportunities! For example, this may be used to encourage someone who has just broken off a relationship with a sweetheart.


30-----Don't count your chickens before they are hatched

Do not become too confident of success before you can see that progress is happening.


31-----Rome wasn't built in a day

Do not be discouraged if your goal still seems far away. On a big project, success takes time!


32-----There is more here than meets the eye

Be careful. People are hiding something in order to protect themselves or take advantage of you.


33-----The customer is always right

Businesses instruct their clerks not to do anything that might threaten a customer's self-esteem, no matter how unreasonable the customer is. Any complaint of any customer must be carefully and politely heard by any employee. The customer must not be made to feel ignorant.


34-----Be true to yourself

Do not compromise yourself or your beliefs in order to please other people or fit in with a system. Know who you are. Let other people know what you stand for. Do not give in to pressure to conform or to do things you do not agree with.


35-----Once bitten, twice shy

This may be used to explain the behavior of a person who is overly cautious about something. The wise person makes mistakes but does not usually make the same mistake twice.


36-----It isn't over till the fat lady sings

I refuse to admit defeat yet. Though right now it looks like I may fall, there is still time for things to change. (The "fat lady" is an insulting reference to an opera soloist, opera often end with a female solo.)


37-----To each his own

Each individual should be allowed to have his or her own preferences. people will naturally choose different activities, goals, life-s, etc.


38-----Looking out for number one

Looking out for one's own personal welfare more than anything else. This is sometimes used to criticize a person who has abused or taken advantage of someone else, "All he was doing was looking out for number one." Or it may be used to defend himself or herself, "There is nothing wrong with what I did. I was just looking out for number one."


39-----When the going gets tough, the tough get going

When situation is difficult, only the determined people can handle it. They don't give up!


40-----Times flies when you are having fun

A day seems shot when it is full of enjoyable things but it seems like an eternity if one is idle or stuck with a boring job.


41-----If it feels good, do it

Live according to your desires at the moment. Forget about rules, regulations or consequences. Just have fun.


42-----Live and let live

Do not be judgmental. Do not try to control or punish other people.

You live as you like and let others live as they like.

43-----Variety is the spice of life

Variety is what makes life pleasureable. Boredom is seen as a threat and monotony is the surest route to boredom.

44------Money talks

Wealth has influence. People who make big contributions to political candidates are "talking" to the candidates and expecting them to listen.

45-----All work and no play makes Jack a dull boy

This is used to criticize someone who takes work too seriously. It affirms that play is as an essential part of human life.


46-----The more the merrier

This is a way of welcoming someone to participate. It means, the bigger the group, the bigger the party.


47------A bird in the hand is worth two in the bush

A thing you already have is worth twice as much as a thing you might get in the future.


48-----You can't have your cake and eat it too

Make up your mind. Sometimes one must choose between two very desirable things, giving up one thing in order to enjoy the other.


49-----There is more than one way to skin a cat

Any of several methods may bring about the desired result. Each person may choose the method that best suits her. If one method does not work, choose a different one and try again.


50-----One man's meat is another man's poison

Since the same thing may affect different people in different ways, each person must choose the things that will work in his or her particular case.

51-----Love finds a way

Love is considered one of the most powerful and determined forces in the world. Two people in love will "find a way" to get together.


52-----Absence makes the heart grow fonder

When lovers are separated, they may think about each other constantly. their love may deepen.


53-----Out of sight, out of mind

This is said of someone not considered important or worthy of loyalty. One forgets about that person as soon as he or she is out of sight.


54------Love makes the world go around

Love is the driving force in all of life. Love makes life worth living. If you understand love,you understand everything about life.


55-----Marry in haste and repent at leisure

Do not rush into any long-term commitment. In the past this meant, "take your time before you commit yourself to a marriage partner." Now it means, "Do not commit yourself to anyone you will be sorry." or it may mean, "Live with a person for a while before marrying him or her." It may also apply to any long-term partnership, such as a joint business venture.


56------Talk is cheap

Talking is not doing, It is easy to talk about a plan, but this gets little respect untill one takes a risk and puts the plan into action.


57-----Love is blind

When people are in love, they do not see each other's faults.


58-----Time is money

Time can be converted to money, that is, wages are often paid per hour of work. Managers want employees to do things quickly because "time is money." If employees waste time, the company loses money.


59-----If you're so smart, why ain't you rich

This question implies that intelligence, like time, can be converted into money. It is used to cut down an ordinary person (not a rich one) who has expressed an opinion as if it is the final word on the subject.


60-----Beggars can't be choosers

Beggars have to accept whatever they get. A poor person has very few choices in life. This harsh reply may be used if people complain about the size or quality of a gift.


61-----The love of money is the root of all evil

Greed will lead a person into many other evils such as cheating, oppression and violence. (one also hears, money is the root of all evil, which places the blame more on money than on greed.)


62-----A fool and his money are soon parted

Folly will always show up in the way a fool handles money. Wise people are the ones smart enough to guard money once they have it.


63-----It isn't whether you win or lose, it's how you play the game

Playing well and fairly is more important than succeeding. This saying is sometimes used to console someone who has lost a game. The ideas is that in spite of losing, one may still feel like a success if one has played as well as possible.


64-----Money can't buy happiness

There are some things money just can't buy. This reminds people that money is not an ultimate value although it often is treated as one. The saying may be used as a comment when a wealthy but lonely and wretched person commits suicide.


65-----Nice guys finish last

Success is valued more highly than kindness and politeness. If unkindness and impoliteness contribute to one's success, they are sometimes excused as "toughness" or "what it takes." This is more often applied to men than woman.


66-----The one who dies with the most toys wins

This recent, cynical saying makes fun of three common American desires-- competing, accumulating property, and having fun.


67-----Just do it

This proverb is actually a recently invented advertising slogan for the Nike Shoe company. It may also be the best three-word summary of American cultural values. It means, "quit being indecisive, Don't bother consulting a lot of people. Don't waste much times on planning. Just do it and do it now.


68-----You only go around once in life

Enjoy life, do what you want to do, experience everything you can.


69-----Put your money where your mouth is

Get serious about what you are saying. When you have spoken in favor of something, prove that you mean it by risking some money on it in a bet or an investment.


70-----The best defense is a good offense

Be pro-active and goal-oriented, not timid or conservative. Aim to conquer, not merely to protect yourself.


71-----The road to hell is paved with good intentions

Like talking, intending is not doing. Actions matter far more than intentions. Actions determine where a person ends up.


72-----Never put off till tomorrow what you can do today

Doing is better than waiting. If you wait, you might lose your opportunity


73-----Action speak louder than words

To know people's hearts, pay more attention to what they do than what they say.


74-----Idle hands are the devil's workshop

When people have nothing constructive to do, they get into mischief. The child who is bored may pick up a crayon and color on the wall, something that would not happen if the child were happily occupied in some other activity.


75-----You've got to take the bull by the horns

Grab directly and fearlessly for the toughnest part of a problem. Don't look for an easy way out.


76-----Money doesn't grow on trees

You have to work for things. Success does not come on its own.


77-----Easy come, easy go

If you have received something without working for it, it may soon be gone. You will not be as careful with it as you will be with something you earned.


78-----Too many cooks spoil the broth

Individual action or action by the smallest group possible is better than consulting a lot of people. Too much consultation will waste time and create problems.


79-----Stand on your own two feet

Grow up; act like an adult. Don't ask me to do something for you. This may be said to a young or immature person who depends too much on others. It is like a cow kicking a grown calf that wants to suckle.


80------If you want something done right, do it yourself

This discourages people from trusting anyone except themselves. It maybe said to someone who ask another person to do a job for him/her and then complains about it was done.


81------Necessity is the mother of invention

When a person really needs something, he or she figures out some new way to get it. This creative initiative to change one's situation is considered much better than giving up and accepting things as they are.


82------First come, first served.

This saying is used when there is a limited supply of something such as tickets to an event or food at a picnic. The idea is that no matter what your status, if you want some of what is being given away or sold, you must present yourself in person and in good time.


83-----No pain no gain

one must put forth an effort in order to succeed. This saying comes from physical fitness instructors. They say that if you do not exercise hard enough to make your muscles hurt, the exercise is not doing you much good.


84-----Give him an inch and he'll take a mile

Be careful of presumptuous people who take more initiative than they should. If you do someone a small favor or delegate a little permission or a little power, he or she may take advantage of you.


85-----If it isn't broke, don't fix it

Do not bother trying to improve something if it is already working satisfactorily. That is a waste of time and you run the risk of breaking the thing while you are trying to improve it.


86-----There is no harm in trying

A person expects to be respected for making an effort even if it does not succeed.


87-----The cure is worse than the disease

While trying to solve one problem, we create an even bigger problem. We would have been better off if we had done nothing.


88-----Count to ten before you lose your temper

Do not instantly let your feelings control your actions. Slow down. Think before you react.


89-----All things come to him who waits

Sometimes patience is better than initiative.


90-----There is many a slip between the cup and the lip

This refers to a plan that has gone wrong. When one is drinking from a cup, one intends to get all the drink into the mouth, but this does not always happen. The plan is good but it can still fail.


91-----Boys will be boys

People will act according to their nature, including some mischief. This is sometimes used to describe irresponsible but not too seriously wrong behavior by men. In other words, grown men will sometimes act like little boys.


92------One bad apple can spoil the whole barrel

Do not associate with bad people. They may spoil you as a rotting apple spoils the apples next to it in the barrel.


93-----Better the devil you know than the devil you don't

People are generally not trustworthy. It is therefore better to deal with a familiar person or situation than an unknown one. That way you know what to watch out for and you can protect yourself better.

94-----Nobody is perfect

Everyone has shortcomings. This is used as an excuse for a minor Mistake that has been made.


95------The grass is always greener on the other side of the fence

People are never satisfied with what they have. They always want what someone else has.


96-----A man is only as old as he feels

A person's energy level is more important than age.


97-----A man's home is his castle

At home a man is like a king, completely free to do as he wishes.


98-----Clothes make the man

The way a man dresses will affect the way he sees himself and the way other people see him. The implication is that if you want to succeed, dress for success.


99-----Two heads are better than one

Two people are more likely to succeed than one working or thinking alone. It is better to consult than to act alone.


100-----Beauty is only skin deep

One should admire a person, particularly a woman, for her deep, inner character and not simply for her superficial beauty.

101-----Many hands make light work

Cooperation makes a job much easier.


102-----There is safety in numbers

Do not take large risks all by yourself. Do not walk alone on a dangerous street at night.


103-----Charity begins at home

One should be kind to close relatives before doing good to the community in general.


104-----There is no place like home

Home is the best place in the world. The most relaxing and enjoyable place.


105-----Silence is consent

Do not stay silent when you see a problem or an injustice. Speak out against it. Say, "Enough is enough." or people will think you do not mind the situation.


106-----What goes around comes around

What you do to others, especially if it is bad, will eventually be done to you. As you seek your own success, do not treat other people badly. They may take revenge and spoil your success.


107-----Honesty is the best policy

When one is tempted to cheat, this proverb serves as a reminder of the importance of good character. Honesty brings trust and trust leads to success.


108-----If the shoe fits, wear it

If an accusation is true, accept the blame. This saying can also mean, " if a suitable opportunity comes to you, take it!"


109-----You can lead a horse to water, but you can't make him drink

Even when given an opportunity, some people will not use it. In that case the blame is all on him.


110-----You made the bed, you lie in it

You created a certain situation so you are now responsible to take the consequences.


111-----The pot calling the kettle black

Since the pot and the kettle are equally black from the cooking fire, the pot has not right to criticize the kettle. This might be used if someone known to be a gossip criticizes someone else for gossiping.


112-----Don't get mad, get even

When someone treats you badly, do not just get angry, express your anger in action.


113-----Get a life

Do not be so unreasonably critical about tiny things. Find something better to do with your time.


114-----My country, right or wrong

I am absolutely loyal to my country whether or not I agree with its policy in a certain area.


115------There are two sides to everything

Never assume that all the blame for a conflict lies on one side, especially if you have heard only one side of the story.


116-----Forgive and forget

Conflicts should be resolved and ended, not left alone to cause years of regret, bitterness and pain.


117------Business and pleasure don't mix

When you work, work. When you play, play. It is inefficient and therefore unwise to try to mix the two.


118-----Let a sleeping dog lie

Do not meddle in something that will cause you no trouble if you leave it alone. If you wake up the "dog," it may bite you.


119------No man can serve two masters

Divided loyalty will break down sooner or later.


120-----Make it short and sweet

Speak briefly and to the point. We don't have time for the details


121-----What will be will be

Some things cannot be changed or avoided.


122-----A friend in need is a friend indeed

My true friend is the one who show loyalty to me by helping me when I am in need.


123-----People who live in glass house should not throw stones

Do not attact anyone if you have no way to defend yourself when they attact you in the same way.

124-----Opposites attract

As positive and negative magnets attract each other, so people of very different types attract each other. For example, a quiet woman marries a very outgoing man. These differences have a mixed effect on the couple, partly making them interested in each other but also leading to miscommunication and conflict.


125-----The early bird catches the worm

Punctuality is important. If you want to succeed, arrive early, like the bird that hunts worms at dawn before they go into hiding for the day.


126-----Blood is thicker than water

Blood relationship is stronger than voluntarily chosen friendship. Brothers will stick up for each other against their own friends if they have to. This proverb is not quoted much anymore because kinship is not as highly valued as it used to be.


127-----You can't teach an old dog new tricks

Once habits are learned, it is very hard to change them.


128-----To err is human

It is normal for humans to make mistakes and it is godly (or God-like) to forgive them.


129-----Haste makes waste

Through acting quickly is generally a good thing, acting too quickly may cause troulbe. This proverb is used when someone has done a job carelessly and wrongly. For example, a carpenter in a hurry may cut a board too short and have to throw it away.


130-----Make hay while the sun shines

If you do not seize the opportunity, rain may come and spoil the hay before you get into the barn.


131-----If you can't stand the heat, get out of the kitchen

Withdraw from an activity if you don't like the conflict and criticism it brings. Let other people do it without you.


132-----Everyone puts their pants on one leg at a time

This is to tell us that we are all equal.


133-----Life is a pie

It's dished out in large and small pieces and when's gone, it's gone. If we ask for more than our share, we're just begging to be disappointed.


134-----Making every minute count

Doing something productive all the time, not letting any time "slip away."

135-----A pen is mightier than the sword

A conflict maybe resolved more deeply and effectively by writing the truth than by resorting to violence.


136-----A new broom sweeps clean

A new person in power will change many things and improve the situation. change is better than leaving things as they are.


137-----Tomorrow is another day (or, Tomorrow is a new day.)

No matter how bad things are right now, a person may hope for better prospects in the morning. New opportunities will come.


138-----Opportunity only knocks once

Opportunity is like an unexpected stranger passing by. It knocks on someone's door. If the person fails to answer the door, opportunity goes away and knocks on someone else's door. It does not return to the same person.


139-----Business is business

Do business with strangers as if they were brothers and with brothers as if they were strangers.


140-----History repeats itself

There are patterns in history. Nations rise and fall for similar reasons. Nations do not change their ways or learn from the mistakes of others. They repeat them.


141-----People are people

Their human nature is predictable. They respond to stimulus and incentives.


142-----Keep your friends close, keep your enemies closer

A man without enemy is a man without quality. Think not? Even Jesus Christ had many, many enemies.


143-----Better late than never

Though being on time is better than being late, doing something late is better than giving up or doing nothing.


144-----Punish one, teach a hundred

People problems sometimes must be dealt with harshly. When you make an example of someone, make sure that everyone knows what the lesson is.


145-----Attitude is everything

A pessimist sees a glass half-empty, An optimist sees it half-full.


146-----Like father, like son

A son will be like his father. This may be quoted whenever the son has done something that reminds people of the father. Whether it is good or bad.


147-----When the cat's away the mice will play

People will take advantage of a situation if they can. Employees will get lazy if the supervisor is not keeping an eye on them. A teenage son or daughter might hold a wild party at home during a weekend when the parents have gone out of town.


148-----Praise when praise is due (sometimes even when it isn't)

Do not criticise beyond necessity and seldom in public. And always precede criticism with a few words of praise.


149-----Turnabout is fair play

If a person is taking advantage of someone else, the situation may change. The one on top may end up on the bottom. Then the one who has turned the tables will say, "I am only doing to you what you did to me.


150-----Here today, gone tomorrow

Things may change quickly. This is said as a criticism of a person who changes quickly for no good reason. It may also be said of a thing or situation which does not last. Change is not good when it indicates unreliability.

151-----Will wonders never cease?

Said when someone has done something untypical of him or her and much better than was expected. It may also be used of a technological breakthrough.


152-----Do not stand out, fit in

Make no long-term, close friendships with any colleague., but be cordial to all.


153-----There is no morality in struggles for power

In struggles for power, your judgements should be based entirely on self-interest and finding as direct and economical a route to your goal as possible.


154-----Natural law is blind

Just like water, cleaness and refreshes without any distinction, and without any judgement either.


155-----The more things change, the more they stay the same

Said when an apparent change is only superficial.


156-----Happiness is a choice and misery is optional

The way we choose to see the world creates the world we see.


157-----The leopard cannot change his spots

Some people are not willing or able to change their chartacter. This is said when a notoriously bad person tries to change but fails into the same mistake all over again.


158-----Man proposes, God disposes

Human beings make their plans but God determines whether they succeed or not.


159-----A live dog is better than a dead lion

It may be better to run away like a scared dog with its tail between its legs than to stand and fight to the death like a courageous lion.


160-----It's a woman's prerogative to change her mind

Since women are often considered more emotional and less logical than men, and since emotions are more changeable than reasons, women are allowed to change their minds.


161-----Spare the rod and spoil the child

An undisciplined child will turn out to be a rotten person. Many parents think that any physical punishment of children is abusive, while many others think that without it, children grow up to be morally retarded.


162-----Sticks and stones may break my bones but words will never hurt me

A taunt used by people claiming that an insult did not affect them.


163-----The worm turns

Everything chnages. Do not expect situations or people to stay the same for very long.


164-----You are what you eat

A nation's diet can be more revealing than it's art or literature.


165-----Marriages are made in heaven

God is the source of human love and the one who destines two individuals to be married. This proverb is going out of fashion since it goes against individual freedom.


166-----If you scratch my back, I'll scratch yours

If you do something good for me, I should do something good for you.


167-----Office politics are secret and dirty and there is never an end to it

To survive, be patient--watch, listen and say little; to win, be patient--survive, plan and then strike swiftly.


168-----Work smarter, not harder

Get others to do as much as they can for you.


169-----Time heals all wounds

The damage done by a conflict is like a wound that will heal naturally over time if it is not re-injured.


170-----No news is good news

If a friend is travelling and one does not hear from him/her, one may assume that everything is going well. As another proverb says, Bad news travels fast.


171-----Time marches on

Time is marching to its own drumbeat. It does not slow down or stop for anyone.


172-----Keeping up with Joneses

This means buying things that you see your neighbors buying. That way you look like just as much a success as they do.


173-----A man may work from sun to sun, but woman's work is never done

Men may have to work long days but they can go home to rest in the evening. Women can never get away from what used to be called "women's work," such as cooking and cleaning.


174-----The sooner the better

A wish for quick action or quick change. Once a decision has been made, there is no point in waiting to carry it out.


175-----A good captain goes down with his ship

The captain remains on board his ship even when all hope to save it is lost.


176-----Every cloud has a silver lining

Even bad situations will contain something good if we look for it. Clouds are considered symbols of undersirable things. The bright edge of a dark clouds is like something good that can cheer us up.


177-----The exception proves the rule

Though we are making an exception and breaking the rule in this one case, we do it only becasue the circumstances are so unusual.


178-----Shop till you drop

Shopping is a form of considering options. People think this is fun so they keep doing it untill they are worn out.


179-----The devil can quote scripture

A quotation from an authoritative book or person cannot always be trusted. The quote may be distorted or incorrectly applied.


180-----Hindsight is always 20/20

Looking back on the past, it is easy for anyone to see what should have been done even though it was impossible for anyone to see it at the time. ("20/20 vision" is an eye doctor's term for eyes that see perfectly.)


181-----The good die young

Life is not always fair. Some very fine people die at a young age though it seems they were so good they deserved to live longer.


182-----Power corrupts

When people are put into positions of power, they gradually forget what life is like for ordinary people. They become more likely to abuse their power, perhaps without even realizing it.


183-----Half a loaf is better than no bread at all

Sometimes we will not be able to get all we want or hope for. As such times of only partial success, we should look on bright side and be glad for what we got.


184-----A house divided against itself cannot stand

Unity is the strength that preserves a family or a nation.


185-----Easy said than done

We promise according to our hope but we perform according to our fear.


186-----A dog is a man's best friend

Dogs are know for their loyalty. Their friendship is more reliable than the friendship of people.


187-----Practice makes perfect

Effort brings improvement and success.


188-----Where there is a will, there's a way

Any problem can be solved if one is determined enough.


189-----He who laughs last, laughs best

If a person does wrong to someone and laughs at him or her, the victim will look for a way to get revenge. When revenge is taken, the victim gets the last laugh, defeating the other person.


190-----It takes two to make a quarrel

Avoid a fight if you can. An insult does not become a fight unless it is answered by an insult.


191-----Let bygones be bygones

Do not bring up an old problem. Pretent it never happened.


192-----Two wrongs don't make a right

If someone does a wrong to you, react with justice, not by doing something vicious. (He did wrong to you, but you do right in response.


193-----Crime does not pay

Though crime appears to have benefits, this is an illusion. for example, shoplifting seems like an easy way to get things one wants, but crime always puts the criminal in danger of punishment.


194-----So far so good

Said by or to someone who is carrying out a plan taking one step at a time. Confidence increases with each step.


195-----Two is company and three is a crowd

This may be used when two people are talking and a third, unwanted person approaches.


196-----Innocent untill proven guilty

In a court of law, the accused person is presumed innocent at the start. The burden of proof always rests on the accuser, not the accused. The jury will not convict the person unless the proof is clear.


197-----The devil made me do it

I am not to blame for what I did. I could not help it. Some power outside of me was forcing me to act in that way. This is playfully used as an excuse by people who know they have done something wrong but want to avoid the penalty.


198-----Home is where the heart is

Home is wherever ones loved ones are. The size or appearance of a house does not make it a home or keep it from being a home.


199-----Time and tide wait for no man

When something's time has come, it will happen and nothing can stop it. It is like an ocean tide coming in to the shore.


200-----Home, sweet home

This phrase reminds people of the ideal home--It should be a place of warmth, love and joy.



Powered by ScribeFire.

Tuesday, 25 September 2007

GMail Drive

clipped from en.wikipedia.org

GMail Drive

GMail Drive is a free third-party namespace extension ("add-on") for Microsoft Windows. It allows a user to access a virtual drive stored in a Gmail e-mail account by causing the contents of the Gmail account to appear as a new network share on the user's workstation. In order to use this add-on, the user needs a Gmail e-mail account. The add-on enables the user to use the standard Windows desktop file copy and paste commands to transfer files to and from the Gmail account as if it was a drive on the user's computer.

GMail Drive in Windows XP

Thursday, 13 September 2007

K800镜子小技巧

K800I 前面有个摄象头 大家有时想看看自己,估计都是进入视频电话看吧 显示小的可怜,忽忽而且不能全屏 很郁闷吧

今天有个小技巧告诉大家 可以弄全屏的 。。方法是进入手机工程模式。。*右*左左*左*
有个服务测试,,进入 看到个视频电话相机 ,就是这个了
哈哈 是不是全屏的吧。虽然不能照相
不过,靠前面的10万像素效果也不可能怎么样,还是当镜子实用。。。。。

Powered by ScribeFire.

Friday, 7 September 2007

意大利面

锅烧热,放油,多放点没所谓,想吃辣得可以放点干辣椒,肉馅在油5分热的时候倒进锅里,
用锅铲把肉馅尽量弄碎,越小越好,差不多8、9分熟就装出来,多余的油留在锅里。

洋葱一只,切丝,筷子后面那么宽,不要太细。

锅里倒油,烧热,8分差不多,洋葱大火爆炒,直到出香味,发软,

倒入酱,想吃辣得可以放点干辣椒,小火,慢慢熬,如果喜欢,可以加入切好的蘑菇片和少量红酒,倒入肉馅,等到酱差不多粘稠了,

加糖,(1 tea spoon),盐随意(略咸,因为还有面),可以少量鸡精(optional),出锅,



煮好面以后,多余的水倒掉一半再接一半.


浇在煮好的意大利面上,功成。


Powered by ScribeFire.

O2 setting up

delivery report
----------------------------
Compose "*0# " (star 0 hash space) before the content, then you will get report showing if your message has arrived successfully or not.

You can prepare a template using such letters, then when you need report, insert the template.

This method looks like a way to save the "tele environment". ha


Alert service
----------------------------
O2CallAlert is a simple easy to use alternative to Voicemail 901 giving you missed call information free of charge. If you're on another call, your mobile's switched off, you're out of coverage or you just don't get to it in time, Call Alert will tell you your caller's number and the last time they called so you can call them back.


If you miss a call, callers will hear a message telling them that their number will be sent to you via text message to let you know they called. If callers withhold their number you won't be sent a text and they'll be told to call again later.


If you miss more than one call, Call Alert will send you details of up to four callers with the date and time of their last call to your mobile.


How do I switch on Call Alert?

You can switch on O2CallAlert at any time by calling 1710 free from your mobile.

And if you want to switch if off, just call 1760 free.


THIS SERVICE IS FREE AND WORKS EVEN WHEN YOU HAVE NO CREDIT.


o2 @ carephone warehouse
----------------------------

08701117200
= 0800 0490049 Option 2, 2, 1 - O2 services



Thursday, 30 August 2007

vnc x11vnc

x11vnc is an vnc server program to replace vnc4server/vncserver

-no any setting
-completely same syntax with vncserver:
x11vnc---start vnc server:0.....
x11vnc -kill :0---switch the display off.

Cygwin

Cygwin越用越好用,不仅可以作为windows上的unix like系统,还可以作为x server for windows,而且还可以在其中添加MingW的gcc,g++,装了个这东西基本其他都不用装了就能玩转linux,eclipse东西.

比我聪明太多了

多年以来一直的遗憾,不知道怎么玩魔方,改天谁要送我礼物,就这玩意让我益益智吧.哈


vmware server console

There is a bug with VMware Server 1.03:
https://bugs.launchpad.net/ubuntu/+source/app-install-data-commercial/+bug/115295


change /etc/pam.d/vmware-auth to read as follows:

#%PAM-1.0
auth required pam_unix_auth.so shadow nullok
account required pam_unix_acct.so



##########################
Confirmed 8/1/07 on a fresh install on Feisty (7.04) server. VMWare Server 1.0.3 will not allow a remote login until the change to vmware-auth above is implemented
##########################

In this case, host and client all can work well and smoothly with low memory usage.Amazing.



Powered by ScribeFire.

vmware server

The ability of VMware Server to run virtual machines
"behind-the-scenes" is a great boon. This means you no longer have to
have the GUI screen open on your desktop, taking up valuable screen
real-estate. It also means that you can switch your virtual machines to another
machine that is constantly up and have your virtual machines available to you
at any time, keeping them up and running around the clock. Running the server
without a GUI interface makes it more difficult to control the machines, but
with a little effort, you can get the same functionality via the command line. You
will still want the GUI in order to change configuration options and create new
machines, however.



The vmware-cmd
program is your gateway to controlling virtual machines. The general syntax of the
vmware-cmd for use with a VMware
Server instance on the same machine is:



$ vmware-cmd [config] [option] ...


Assume you have a virtual machine of Mandriva in /var/lib/vmware/Virtual Machines/Mandriva.
To get the status of the machine—whether it's on or off—you would use:



$ vmware-cmd /var/lib/vmware/Virtual\ Machines/Mandriva/Mandriva.vmx getstate
VMControl: use vnc for unifiedDraw
getstate() = off


As you can see, the virtual machine is turned off. To start
this virtual machine you would use:



$ vmware-cmd /var/lib/vmware/Virtual\ Machines/Mandriva/Mandriva.vmx start
VMControl: use vnc for unifiedDraw
start() = 1


If you have the vmware-console running at the same time, you
would see the virtual machine start. This is an easy way to start virtual
machines at boot: simply call vmware-cmd
with the configuration of each virtual machine that you want to start and the start command in a script like /etc/rc.d/rc.local.



Prior to shutting down your machine, you can signal the
virtual machines in a similar manner by using the suspend command. This will suspend each virtual machine to disk,
allowing you to issue the start
command later to resume the machine from where you left off. Obviously,
suspending a machine will make starting it up much faster than doing a full
shutdown and start each time you have to restart the host system.



Looking at the output of vmware-cmd
-h
will give you a lot of other options that you can play with to
manipulate virtual machines. The ability to start, suspend, and stop virtual
machines from the command line (or a script) is perhaps vmware-cmd's most useful feature.



Delivered each Tuesday, TechRepublic's free Linux NetNote
provides tips, articles, and other resources to help you hone your
Linux skills.


Powered by ScribeFire.

Tuesday, 28 August 2007

x server on windows

Thursday, 23 August 2007

辣白菜制作原料

白菜,盐,葱,洋葱,大蒜,酱油,糖;
辣粉,糯米粉,鱼露


Powered by ScribeFire.

Monday, 20 August 2007

ubuntu's runlevel

Ubuntu default init setting:
/etc/event.d/rc-default:
Modify the 3rd line from bottom to the default runlevel you like.

Here, to modify rcX.d to configure how different runlevel behaves.

########################
Linux run levels are numbered 0 through 6. Run levels stop at six for practical and historical reasons, but it is entirely possible to have more if desired.

The following table summarizes the User Linux run levels:

* 0 System Halt
* 1 Single user
* 2 Full multi-user mode (Default)
* 3-5 Same as 2
* 6 System Reboot

Special Run Levels

Run level 0 is the system halt condition. Nearly all modern X86 computers will power off automatically when run level 0 is reached. Older X86 computers, and various different architectures will remain powered on and display a message referring to the halt condition.

Run Level 1 is known as ’single user’ mode. A more apt description would be ‘rescue’, or ‘trouble-shooting’ mode. In run level 1, no daemons (services) are started. Hopefully single user mode will allow you to fix whatever made the transition to rescue mode necessary.

(You can boot into single user mode typically by using your boot loader, lilo or grub, to add the word ’single’ to the end of the kernel command line).

Run levels 2 through 5 are full multi-user mode and are the same in a default User Linux (Debian) system. It is a common practice in other Linux distributions to use run level 3 for a text console login and run level 5 for a graphical login.

Run level 6 is used to signal system reboot. This is just like run level 0 except a reboot is issued at the end of the sequence instead of a power off.

In the interests of completeness, there is also a runlevel ‘S’ that the system uses on it’s way to another runlevel. Read the man page for the init command (”For manpage click here”) for more information, but you can safely skip this for all practical purposes.

Run Levels Location

Like everything else in a Linux system, run levels are defined by files in the file system. All the run level files are found in the /etc directory according to the following table:

/etc/rc0.d Run level 0
/etc/rc1.d Run level 1
/etc/rc2.d Run level 2
/etc/rc3.d Run level 3
/etc/rc4.d Run level 4
/etc/rc5.d Run level 5
/etc/rc6.d Run level 6

Each defined run level should have an rcX.d directory where X is the run level number. The contents of the rcX.d directory determines what happens at that run level.

Change run levels in Debian and Ubuntu Linux

Before we change run levels it might help to find out which run level is current. Use the ‘runlevel’ command to tell you two things: The last run level, and the current run level. Here is the command and the output shown together due to the sparsity of the output:

# runlevel N 2

The ‘N’ stands for none, meaning there has been no run level change since powering up.

The init system controls run levels, but then again, the init system pretty much controls everything. The init system will be looked at in detail in a future article.

The primary command used to change run levels is ‘telinit’.

#telinit 3

telinit takes one argument on the command line. As always, see the man page for full details. Normally the argument will be one of: 0,1,2,3,4,5,6, or the letter ‘S’. As you may have guessed, the numbers correspond to the run level you wish to move to. Using the ‘S’, for single-user, is the same as the number 1, but don’t do it; the ‘S’ runlevel is intended for use by the UserLinux (Debian)system.

A note of caution is warranted here. You can easily use the telinit command to reboot (run level 6), or shutdown (run level 0) the system, but it is not recommended. Certain programs need special processing for an orderly shutdown. Bypassing the expected shutdown sequence can have dire effects on your data. Older _Unix_ systems are especially sensitive to shutdown/bootup operations.

The preferred method for a serious runlevel change is ’shutdown’. There are easier mnemonics, but in a running system they all point to the ’shutdown’ command. You can use the ‘halt’, or ‘poweroff’ command to stop a system and the ‘reboot’ command to restart your system. In each case they call the ’shutdown’ command with different parameters.

If you wanted runlevel 3 to be the default, then you need to edit /etc/inittab.

# The default runlevel.

id:2:initdefault:

You’d change the ‘2′ to a ‘3′. Next time you reboot, your system will start in runlevel 3. There will be no display manager running in runlevel 3, because you turned it off. Therefore, runlevel 3 will become text only, and it will be the default. If that’s what you want to do.

Adding a new service

You can only add a new service to the boot sequence if a script in /etc/init.d exists. In that case the following command will install it with default settings (foo being the name of a script in /etc/init.d).

#update-rc.d foo default

Removing a service

A service may only be removed after the script in /etc/init.d as deleted already. If so, the following command will remove its references (foo being the name of a script in /etc/init.d).

#update-rc.d foo remove

If you want to remove a service without removing the start/stop script as well, you may consider using the file-rc package and editing the runlevel configuration file /etc/runlevel.conf. When using the SysV method you should rename the start/stop script, then call update-rc.d and then rename the start/stop script back to its old name.

Some of the content for this article source from here

Thursday, 16 August 2007

VMware fusion, amazing. similar to Xming.

最近又安装Mac OS X来玩,这次主要是为了试试VMware Fusion这个东西.以前大费周折地用VMware+rdesktop才在Ubuntu运行起了Windows的原生程序,据说在Fusion下只是点几下鼠标而已.

这次一试,果然不同凡响.请看我的图文解说:


系统概况:Mac OS X 10.4.9+VMware Fusion with Deepin XP


每张图均可点击看1280×800的大图:


要使Fusion里的虚拟Windows XP运行在原生模式下,必须让虚拟机切换到“Unity”模式,这样虚拟机就在后台工作了,你根本不用理会它的存在。


你可以直接点Applications,它会调用Windows XP的开始菜单,用这个可以方便打开Windows程序。


但是有些程序开始菜单没有怎么办?那你可以打开资源管理器,自己去开启,凡是启动过一次的exe文件,以后就会出现在Applications──Lauch这里,可谓十分智能!


图为Windows的资源管理器和Mac的Finder和谐共处:



这张图就是Windows的IE打开LDCN的样子,后面还有腾讯的广告也跳出来了。因为我在后台开着QQ。哈哈。


注意到IE的图标,在dock上与其他Mac程序无异吧。



这次开起来了Windows Media Player,没什么好讲的,效果还是不错。


这次把 QQ开起来了,再注意到右侧,就是Lauch工具了,好像只要是exe和指向exe的快捷方式都会出现在这里,方便启动相关程序。


还有很多图就不放了,Windows程序与Mac的结合性非常好,无论是平铺还是dock上的操作、缩小都与原生Mac程序没什么区别。



回顾LDCN以前的相关文章,那种方法好麻烦啊,期待VMware Fusion登陆Linux平台。



LDCN供稿,LDCN(即LinuxDesktop.cn的缩写),中文名──“Linux桌面中文网”,是一个由在校大学生发起的,旨在让所有Linuxer一起参与、更新的Linux资讯、应用互动型社区站点.



Powered by ScribeFire.

intitle:"index.of"(mp3)anythingyouwant

intitle:"index.of"(mp3)anythingyouwant

search mp3 or some document with intitle is so efficient.


Powered by ScribeFire.

sonicstage: non_unicode program sucks

For me, the sonicstage is absolutely a piece of junk.

1.v3.x doesn't support NW-S series.
2.v4.0 big bug about errors "selected music file cannot be played back sonicstage", which always happen when you restart sonicstage.
the Chinese Characters can not be shown properly in sonicstage, but on player, no problem. this is what I can stand for, and I have to, because Sonicstage can import *.m3u playlist files, so even in sonicstage can not recognize Chinese correctly, it doesn't matter.
3.v4.2 and 4.3, Chinese character can be shown correctly, but on Player, all are rubbish codes.
4. All the version can not import files including Chinese.

Conclusion, have to use Chinese Windows OS.

========================================

http://en.wikipedia.org/wiki/Sonicstage
从这里找到一个完全可以替换sonicstage的软件:SWex.它是unicode的程序,所以可以任意文件名drag and drop;并且可以同时在软件和player里显示中文。

但是奇怪的是:mp3的tag,最好只用一个程序去修改,或者是Explorer或者是foobar,如果混用,结果就会使得mp3的size变大一些,这样的mp3 copy到player里就会使得音调改变。
我试过当在foobar修改过,然后再用windows的property里修改,在album内容中如果修改7次(比如每次加一个字母a,下次b。。。到g),重新查看这个mp3的property,其size就变化了,如果单独用Explorer或者foobar修改多少次都无所谓。

而且,当传输完毕后,不要立刻plug off,看player上的显示,体质了accesss图示,再plug off,否则很容易出现no data的error on player。

Powered by ScribeFire.

Wednesday, 8 August 2007

c program with input and output argument

main()主函数


每一C 程序都必须有一main()函数, 可以根据自己的爱好把它放在程序的某个地方。有些程序员把它放在最前面,
而另一些程序员把它放在最后面, 无论放在哪个地方,以下几点说明都是适合的。


1. main() 参数

在Turbo C2.0启动过程中, 传递main()函数三个参数: argc, argv和env。

* argc: 整数, 为传给main()的命令行参数个数。
* argv: 字符串数组。

在DOS 3.X 版本中, argv[0] 为程序运行的全路径名; 对DOS 3.0

以下的版本, argv[0]为空串("") 。 argv[1] 为在DOS命令行中执行程序名后的第一个字符串;argv[2] 为执行程序名后的第二个字符串; argv[argc]为NULL。
*env: 安符串数组。env[] 的每一个元素都包含ENVVAR=value形式的字符串。其中ENVVAR为环境变量如PATH或87。value为ENVVAR的对应值如C:\DOS, C:\TURBOC(对于PATH)或YES(对于87)。

Turbo C2.0启动时总是把这三个参数传递给main()函数, 可以在用户程序中说明(或不说明)它们,如果说明了部分(或全部)参数, 它们就成为main()子程序的局部变量。

请注意: 一旦想说明这些参数, 则必须按argc, argv, env 的顺序, 如以下的例子:

main()
main(int argc)
main(int argc, char *argv[])
main(int argc, char *argv[], char *env[])

其中第二种情况是合法的, 但不常见, 因为在程序中很少有只用argc, 而不用argv[]的情况。以下提供一样例程序EXAMPLE.EXE, 演示如何在main()函数中使用三个参数:

/*program name EXAMPLE.EXE*/

#include;
#include;
main(int argc, char *argv[], char *env[])
{

int i;

printf("These are the %d command- line arguments passed to main:\n\n", argc);

for(i=0; i&lt;=argc; i++)

printf("argv[%d]:%s\n", i, argv[i]);

printf("\nThe environment string(s)on this system are:\n\n");

for(i=0; env[i]!=NULL; i++)

printf(" env[%d]:%s\n", i, env[i]);
}
如果在DOS 提示符下, 按以下方式运行EXAMPLE.EXE:

C:\example first_argument "argument with blanks" 3 4 "last but one"
stop!


注意: 可以用双引号括起内含空格的参数, 如本例中的: " argument with blanks"和"Last but one")。


结果是这样的:

The value of argc is 7


These are the 7 command-linearguments passed to main:

argv[0]:C:\TURBO\EXAMPLE.EXE

argv[1]:first_argument

argv[2]:argument with blanks

argv[3]:3

argv[4]:4

argv[5]:last but one

argv[6]:stop!

argv[7]:(NULL)


The environment string(s) on this system are:

env[0]: COMSPEC=C:\COMMAND.COM
env[1]: PROMPT=$P$G

/*视具体设置而定*/

env[2]: PATH=C:\DOS;C:\TC /*视具体设置而定*/

应该提醒的是: 传送main() 函数的命令行参数的最大长度为128 个字符 (包括参数间的空格),

这是由DOS 限制的。


latex template

\documentclass{report}%\documentclass[12pt]{report}%seems only 12pt is an option for the class of report, others do not work, so not every number is meaningful and useful for the whole article.

\setlength{\parindent}{0pt} % indent of paragraph

\setlength{\parskip}{10pt} % distance between paragraphs

\setlength{\itemsep}{-5pt}

%\usepackage[top=1in,bottom=1in,left=1.25in,right=1.25in]{geometry}

%% Because here macro:geometry is used, so the following 4 setting is invalid

%\setlength{\topmargin}{0pt}%

%\setlength{\leftmargin}{0pt}%

%\setlength{\rightmargin}{0pt}%

\usepackage{setspace} %linespace

\onehalfspacing % or \doublespacing \setstretch{3}

\usepackage{graphicx}

\title{The Template of Latex Report}

\author{Cross Zheng\\

PhotoPhysics Research Centre\\

London South Bank University\\

\texttt{zhengx@lsbu.ac.uk}

}

% \date{17 Apr 1984}

\begin{document}

\large

%\fontsize{10}{15}%12pt type, with 15pt leading; compared with \large, the latter is easier.

%% the number for size of font is depending on the 'large','huge',etc,. Not each number is meaningful and useful.

% \maketitle%The title of the ``article'' with date, not suitable for report,
%% only \title,\author,\thanks,\date are the optional parameters.
%% for report, \titlepage is suitable.


\begin{quote}

Here I just list the commands I always use to decorate my reports...\emph{Cross Zheng}

\end{quote}

\begin{abstract}

without DOUBLE SLASH only emptyline

without emptyline only DOUBLE SLASH \\

DOUBLE SLASH plus emptyline\\

From above we know that DOUBLE SLASH is for newline within a paragrah,

while emptyline is for new paragraph.\\

aaaaaaaaaaaaaaaaaaaa

bbbbbbbbbbbbbbbbbbbb

cccccccccccccccccccc

aaaaaaaaaaaaaaaaaaaa

bbbbbbbbbbbbbbbbbbbb

cccccccccccccccccccc\\

aaaaaaaaaaaaaaaaaaaa\\

bbbbbbbbbbbbbbbbbbbb\\

cccccccccccccccccccc\\

\emph{ So DOUBLE SLASH is for new line and an empty line is for new paragraph}\\

above sentence is emphasized.

\end{abstract}

\tableofcontents

\newpage

\chapter{First Chapter}

\section{Some Formats can be used in paragraph}

\label{someformat}

You may want to write things \textsf{in a sans-serif font},

or \texttt{in a typewriter font}, or \textsl{in a slanted font}

(which is \emph{slightly different} than italics).

Sometimes it pays \textsc{to write things in small capitals}.

You can next go to \textbf{bold and then \textsl{bold and slanted} and

then back to just bold} again.

\subsection{Three ways to emphasize the words}

{\em emphasize Part 1}\\%\\ + emptyline makes a new paragraph, only \\ just newline,andempty line

\emph{emphasize Part 2}\\

\begin{em}

emphasize Part 3

\end{em}

%\indent % Empty line between paragraphs

\subsection{Itemize and enumerate}

\label{itemandenum}

The following is itemize

\begin{itemize} %\setlength{\itemsep}{-\itemsep} %here is for modification of distance between items

\item some days where nothing goes right?

\item times when you just cannot get a decent telephone connection?

\item years when drought follows drought?

\item long periods when gusts of wind come thick and fast?

\end{itemize}

The following is enumerate

\begin{enumerate}

\item start with a bar of some length;

\item then remove its middle third to leave two separate thirds;

\item then remove the middle thirds of these to leave four separate ninths;

\item then remove the middle thirds of these to obtain eight separate twenty-sevenths;

\item and so on.

\end{enumerate}

\subsection{Figure and Table}

\begin{figure}[htp]%[htp] is for absolute position where the figure should appear. otherwize the figure will be on the top of the page.

\centering

\includegraphics[width=0.5\textwidth]{figu.jpg} %%for pdflatex,JPEG is ok. but for dvi, EPS works.

\caption{steps in the construction of a Cantor set.}

\label{F:fig1}

\end{figure}

Construct the tabular set in the following manner:

\begin{table}[htp]%[htp] is for absolute position where the figure should appear. otherwize the figure will be on the top of the page.

\begin{center}

\begin{tabular}[t]{|c|c|} %\begin{tabular}[t]{|l|ccccc|c|} here [t] is vertical alignment,{|l|ccccc|c|} is column alignment.

%\multicolumn{2}{c}{USAMTS Scores Round 1}\\ % some kind of same with previous line,just caption here.

\hline

Object & Dimension \\

\hline

point & 0 \\

The item and enum, \S\ref{itemandenum} & AAAAAAA \\

line & 1 \\

Math and Equation, \S\ref{me} & BBBBBB \\

plane & 2 \\

How to quote, \S\ref{reftoqutote} & CCCCCCC \\

solid & 3 \\

\hline

\end{tabular}

\caption{common Euclidean and fractal objects and their fractal

dimension.}

\label{T:tab1}

\end{center}

\end{table}

\section{Math and Equation}

\label{me}

Here will list some different style of the maths:

\subsection{Embedded Math}

\label{embeded}

\(3\times 3\times 3 + math display style\) \\% \( and \) for math display

alternatively,it can be like this

\begin{math}

3\times 3\times 3

\end{math}

\( N\propto d^{-2} \) a math in para. also it can be embedded in para like this

\begin{displaymath}

\frac{4A}{\pi d^2}

\end{displaymath}

\subsection{Various Equations}

\label{vequ}

The followings are equations:\\

the relation between \(N \) and \( d \) involves a fractional exponent \( D \):

\begin{equation}

N\propto d^{-D}.

\label{eqf}

\end{equation}

Such an object of the fraction \( D \). Here D is math style.

\begin{equation}

s = \frac{\delta+\theta^{2}_{3}}{\left(a+b\right)}

% s = \left(a+b\right)/\deta

\label{equ:a}

\end{equation}

\begin{equation}

s = (\delta+\theta)/\left(a+b\right)*

% s = \left(a+b\right)/\deta

\label{equ:b}

\end{equation}

If any format is unclear, one way is to use TeXnicCenter to generate the codes,

the other way is just to google.

\section{Ref to quote}

\label{reftoqutote}

The Ref mechanism is very powerful. Even section can be quoted in another

para or table easily, no matter the appearing sequence.

In the table~\ref{T:tab1}, three sections are quoted from different

positions\footnote{The sequence is disorder, but the quote still works

properly}.\\

Here I used footnote as another reference style.\\

Of course, the Figure~\ref{F:fig1} and Table~\ref{T:tab1} can be quoted as

normal functions. But Reference is quoted in another way by ``cite'', here~\cite{ref2}.

\newpage

\begin{thebibliography}{99}% The thebibliography environment produces a bibliography or reference list. In the article style, this reference list is labeled "References"; in the report style, it is labeled "Bibliography".

\addcontentsline{toc}{section}{References}% Add a chapter title to the contents page.

\bibitem{ref1} B.~B.~Mandelbrot, \emph{The fractal geometry of

nature}, 1983 .

\bibitem{ref2} H.~Kornberg, \emph{J.\ Irreducible Results}.

\bibitem{ref3} L.~F.~Richardson, somewhere and sometime in the

1920s..

\end{thebibliography}

\end{document}


Monday, 6 August 2007

what's latex

  • TeX 是什么?

    TeX 是一个排版系统。用 TeX,你可以把你的文章做成书那种效
    果。你可以把它打印出来,或者送到出版社投稿。TeX 非常适合用来
    写学术论文和书籍。

  • 排版 Word 也可以啊!TeX 跟 Word, WordPerfect 有什么不一
    样?

    Word 和 WordPerfect 是“字处理程序”(word processor),它
    们是“所见即所得(WYSIWYG)”的,你直接修改字体,颜色,用鼠标
    画出表格…… 马上就可以看到效果。屏幕上显示出来是什么效果,
    印出来基本上就是那个效果。而 TeX 不是,你输入的都是文本文件,
    需要一个程序(当然就是tex了)处理之后才能得到一个排版后的结果。

  • 那样的话 TeX 还不如 Word 呢!

    Word 这样所见即所得的程序写科技论文是很累的。这会使你的脑
    子总是想着专业排版人员考虑的问题,比如 “这个单词使用什
    么字体呢?”,“这行应该缩进多少呢?” 这样就没有什么时
    间用来思考语言和内容了。所以 TeX 被设计为“WYTIWYG (所
    想即所得)”。

    用TeX写文章,他想的是 “这一段是否应该属于上一节呢?”,
    “这句话跟我这章的主题符合吗?”,“是否应该开始新的一章
    呢?”,“这个概念读者是否容易理解呢?”…… 你告诉 TeX 的
    是:“这是一章开始”,“这个单词应该强调”, “这里是一段
    诗”……就像在对他的秘书口授机宜。而不是告诉她:“这是第3章,
    应该用黑体三号字,开头有一个‘双S',……”,“这个单词用斜
    体楷体小四”, “左右缩进各一英寸,右边不要对齐,换用小一号
    花体”……这些是秘书的事情,不用你操心。

    TeX 就是你优雅而聪明的秘书。你写论文的时候,能专注于逻辑
    思维。她排出的数学公式是无与伦比的漂亮,所以数学家最喜欢这个
    东西。

  • 你比较一下 Word 和 LaTeX 生成的的PDF文档就可以发现:

  • 远远看去,LaTeX 文档格式更加均称,黑白程度均匀,而
    Word 文档是黑一块的白一块,字符密度不均匀。
  • 仔细看看,你就知道原因了。 Word 文档里上下两行经常有
    这种情况,上一行的单词间距很宽,而下面一行却很窄。这在排
    版美学上是非常不好的。相临行的单词间据应该尽量相同。
  • Chelsea VS Manchester United



    Powered by ScribeFire.

    Thursday, 2 August 2007

    茶叶蛋做法

    clipped from cdcd.scol.com.cn

    材料:
    A 鸡蛋 10个
    盐 15克
    乌龙茶1杯(240ml)
    B 五香粉 1大匙(15ml)
    八角 12克
    花椒 7.5克
    干姜 12克
    丁香4克
    盐15克
    调味料
    酱油 120ml
    冰糖 1大匙

    做法:
    1、蛋洗净放入锅中,加水盖过鸡蛋,再加入盐拌一下,大火烧至沸腾后,中火煮
    10分钟,捞起鸡蛋放入冷水中浸泡一下,再将蛋壳用汤匙均匀敲裂。
    (若煮的过程中鸡蛋破裂,放入的盐可使蛋白较快地凝固。)
    2、砂锅加入适量水,倒入材料B以中火煮至开后加入调味料,然后放入鸡蛋及乌
    龙茶叶,水火煮40分钟后熄火,浸泡约1小时入味,美味的茶叶蛋就做好罗

    Blogger Icon changing

    Have you wondered how these little icons appear next to the web addresses, like the one you see above? When you visit the sites or bookmark them, these icons will make these URLs stand out. These are “Favicons” or “Favorite Icons”.

    You would first need to have an icon which you would like to use, bearing the extension .ico format. If you search your hard disk, you might find some icons which are generic. I would suggest that you create one to represent your own unique identity. There are quite a number of free icon editor software which you can download from the net.

    As for myself, I went to Download.com site, and downloaded a very small program called Imagicon which can transform images into .ico format. I created an image using Photoshop. You can use any image or pictures if you do not wish to create one. Next, run the program. It is rather simple to use. While you can create icons in 2 sizes – 16x16 and 32x32 – I would think a 16x16 icon is preferable since it is readable in most older browsers.

    If you do not wish to download any software, you may also try creating an icon online. Just enter the keywords “online icon generator” into your Google search bar, and you should be able to find several programs that you can try.

    Once you have created an icon, save it into your hard disk. The next step of attaching the icon is a little tricky. Ideally, all you need to do is to save it in the root directory of your blog site. Nevertheless, there is no way this can be done. For one, if you try to upload an icon image, Blogger will reject it. Two, any file that is uploaded will not go into the Blogger root directory.

    The only method to use will be to upload the icon into some web folder, and create a link. A lot of us do not have personal websites. I created one using Google Page Creator. You can also use the free Google Groups to host your file. For more information on how you can upload files on either of these 2 platforms, you may read the article on Using Google Page Creator and Google Groups.

    Once you have done that, take note of the URL of your icon. If you are using Google Page Creator, hovering your mouse over the link, you will see that the file is stored under a directory which looks like this http://yourname.googlepages.com/iconname.ico
    where “yourname” is your Gmail account name, and “iconname” is the file name. Copy this URL.

    Go back to your Blogger dashboard and under the Template tab, go to “Edit HTML”. Near the top you will see a line like this:-
    <#title#><#data:blog.pageTitle/#><#/title#>


    Copy and insert the following code below the above line:-

    <#link rel="shortcut icon" href="URL of your icon file"/#>


    p.s. # should be deleted when you put the codes in your HTML CODES.

    Remember to type in the “URL of your icon file”.

    Save the template. When you refresh your blog site, you should see your nice little Favicon next to the blog address.

    From site: http://tips-for-new-bloggers.blogspot.com/2007/02/adding-favicon-icon-to-blogger-url.html

    My photo
    London, United Kingdom
    twitter.com/zhengxin

    Facebook & Twitter