The first half of chapter 7 contrasts wisdom and folly in many ways.
7:1-4 reads - "A good name is better than precious ointment, and the day of death than the day of one's birth; better to go to the house of mourning than to go to the house of feasting, for that is the end of all men; and the living will take it to heart. Sorrow is better than laughter, for by a sad countenance the heart is made better. The heart of the wise is in the house of mourning, but the heart of a fool is in the house of mirth." Solomon believed that one's reputation (or good name) is of greater importance than one's appearance. However, how is the "day of death" better than "the day of one's birth"? Death for God's faithful ones is the end of all troubles; it is an escape from the "vanity" of life (cf. Phil. 1:21)! The wise king stated in 7:2 that there was great benefit in going to a house of mourning (i.e., a funeral). It should make one appreciate the value of life and seriously consider his own existence. Once a person has looked death in the face, he will appreciate life more. He will walk away from the funeral glad to be alive. Such sorrow is better than laughter for it brings the soberness of a true sense of what is important. Those who attend a funeral and reflect upon their own lives are wise. Fools don't want to think on such dreary subjects, however. They just want to go party in the house of pleasure.
Solomon continued in 7:5-7 - "It is better to hear the rebuke of the wise than for a man to hear the song of fools. For like the crackling of thorns under a pot, so is the laughter of the fool. This also is vanity. Surely oppression destroys a wise man's reason, and a bribe debases the heart." The "song of fools" is a time-wasting distraction, and it does not improve one's self (as a rebuke from the wise potentially could). The laughter of a fool is compared to a sudden flame in that it comes quickly with a lot of noise but is soon gone.
Ecclesiastes 7:8-10 states - "The end of a thing is better than its beginning; the patient in spirit is better than the proud in spirit. Do not hasten in your spirit to be angry, for anger rests in the bosom of fools. Do not say, 'Why were the former days better than these?' For you do not inquire wisely concerning this." A humble person is typically a patient person. On the other hand, there are some who are very hasty to become enraged; this is an indicator of a fool (cf. Prov. 14:17). Solomon exhorted in Ecclesiastes 7:10 not to fool oneself with the "good old days" philosophy. It is proper to evaluate the past but not to live there. Typically, humans tend to remember the blessings of the past and minimize the struggles (though they often do just the opposite with the present).
Solomon continued - "Wisdom is good with an inheritance, and profitable to those who see the sun. For wisdom is a defense as money is a defense. But the excellence of knowledge is that wisdom gives life to those who have it" (7:11,12). The wise king believed that wisdom plus an inheritance will yield something good. However, the implication is that an inheritance given to one lacking in wisdom will yield something bad. Solomon acknowledged that both wisdom and money can offer a certain form of protection (albeit limited), but wisdom is far superior in that it "gives life" to its possessors.
7:13,14 reads - "Consider the work of God; for who can make straight what He has made crooked? In the day of prosperity be joyful, but in the day of adversity consider: surely God has appointed the one as well as the other, so that man can find out nothing that will come after him." God has set the standard of morality and man cannot alter such (cf. Isa. 5:20). For example, God has always declared homosexuality to be wrong (cf. Lev. 20:13; I Cor. 6:9,10). No matter how much man tries to justify perverted behavior and make it acceptable (i.e., by trying to "straighten" what God has stated is "crooked"), it will always be wrong. Solomon admits that both prosperity and adversity have their purposes in life (cf. James 1:2-4). Let us accept both as divinely appointed for our lives.