Author Topic: random quote+mfunc lib broken  (Read 1775 times)

Offline thecreator

  • Acquaintance
  • *
  • Posts: 6
    • View Profile
random quote+mfunc lib broken
« on: November 03, 2006, 04:43:36 PM »

Here's the code:

#define MIN 60

#define HOUR (60 * MIN)

#define DAY  (24 * HOUR)

#define WEEK ( 7 *DAY)



mixed ParseTime(int tm);

mixed ChooseQuote();



mixed ParseTime(int tm) {

 string str;

int x, tmp;

   str="";

   x=to_int(tm/WEEK);

  tm-=x;

   if (x > 0)    {   

str += x + "w";

tm -= x * WEEK;



 }

   if (x = (tm / DAY))

{

str += " "+x +"d";

tm -= x * DAY;

   }

   if (x = (tm / HOUR))

{

str += " "+x+ "h";

tm -= x * HOUR;

   }

   if (x = (tm / MIN))

{

str += " "+x+"m";

tm -= x * MIN;

   }    

if (tm)

{

str +=" "+tm+"s";

   }

   return str;

}

mixed ChooseQuote()

{

int c;

mixed *rquotes;

rquotes=({"Before you embark on a journey of revenge, dig two graves.-Confucius",

"Ignorance is the night of the mind, but a night without moon and star.-Confucius",

"Men's natures are alike, it is their habits that carry them far apart.-Confucius",

"Study the past if you would define the future.-Confucius",

"To see what is right and not to do it is want of courage.-Confucius",

"What the superior man seeks is in himself,what the small man seeks is in others.-Confucius",

"The first step to getting the things you want out of life is this: Decide what you want.-Ben Stein",

"Life is a foreign language; all men mispronounce it.-Christopher Morley",

"It's not true that life is one damn thing after another; it is one damn thing over and over.-Edna St. Vincent Millay",

"Life is a long lesson in humility.-James M. Barrie",

"A positive attitude may not solve all your problems, but it will annoy enough people to make it worth the effort.-Herm Albright",

"Complaining is good for you as long as you're not complaining to the person you're complaining about.-Lynn Johnston",

"Plans are only good intentions unless they immediately degenerate into hard work.-Peter Drucker",

"Don't ever confuse the two, your life and your work. That's what I have to say. The second is only a part of the first.-Anna Quindlen",

"I enjoy life. I think I'll enjoy death even more.-Cat Stevens",

"In Montana, a policeman will pull you over because he’s lonely.-Rich Hall","I'm always amazed to hear of air crash victims so badly mutilated that they have to be identified by their dental records. What I can't understand is, if they don't know who you are, how do they know who your dentist is?-Paul Merton.",

"First you forget names, then you forget faces. Next you forget to pull your zipper up and finally, you forget to pull it down.-George Burns.",

"The pen is mightier than the sword, and considerably easier to write with.-Marty Feldman.",

"We had gay burglars the other night. They broke in and rearranged the furniture.-Robin Williams.",

"I told my psychiatrist that everyone hates me. He said I was being ridiculous - everyone hasn't met me yet.-Rodney Dangerfield.",

"Have you ever noticed? Anybody going slower than you is an idiot, and anyone going faster than you is a maniac.-George Carlin.",

"Put your hand on a hot stove for a minute, and it seems like an hour. Sit with a pretty girl for an hour, and it seems like a minute. That's relativity.-Albert Einstein",

"Of the delights of this world, man cares most for sexual intercourse, yet he has left it out of his heaven.-Mark Twain",

"A husband is what's left of the lover after the nerve has been extracted.-Helen Rowland",

"A bachelor is a selfish, undeserving guy who has cheated some woman out of a divorce.-Don Quinn",

"Marriage is a great institution, but I'm not ready for an institution yet.-Mae West",

"Girls are like pianos. When they're not upright, they're grand.-Benny Hill",

"Not a shred of evidence exists in favor of the idea that life is serious.-Brendan Gill",

"See, the problem is that God gives men a brain and a penis, and only enough blood to run one at a time.-Robin Williams",

"I'm such a good lover because I practice a lot on my own.-Woody Allen",

"A terrible thing happened to me last night again - Nothing.-Phyllis Diller",

"Sex is one of the most wholesome, beautiful and natural experiences that money can buy.-Steve Martin.",

"Ah, yes, divorce... from the Latin word meaning to rip out a man's genitals through his wallet.-Robin Williams.",

"My wife and I were happy for twenty years. Then we met.-Rodney Dangerfield.",

"A married man should forget his mistakes; no use two people remembering the same thing.-Duane Dewel.",

"Eighty percent of married men cheat in America. The rest cheat in Europe.-Jackie Mason",

"I'm the only man in the world with a marriage licence made out to whom it may concern.-Mickey Rooney.",

"When a woman becomes a scholar there is usually something wrong with her sexual organs.-Friedrich Nietzsche",

"You know you're getting old when you stoop to tie your shoelaces and wonder what else you could do while you're down there.-George Burns.",

"I don't feel old. I don't feel anything until noon. Then it's time for my nap.-Bob Hope",

"I do wish I could tell you my age but it's impossible. It keeps changing all the time.-Greer Garson.",

"I've stopped drinking, but only while I'm asleep.-George Best.",

"She was good at being inarticulately abstracted for the same reason that midgets are good at being short.-Clive James talking about Marilyn Monroe",

"If you would like to know the value of money, go and try to borrow some.-Benjamin Franklin",

"When shit becomes valuable, the poor will be born without assholes.-Henry Miller.",

"The hardest thing in the world to understand is income tax.-Albert Einstein.",

"The only reason I made a commercial for American Express was to pay for my American Express bill.-Peter Ustinov.",

"I was raised in the Jewish tradition, taught never to marry a Gentile woman, shave on a Saturday night and, most especially, never to shave a Gentile woman n a Saturday night.-Woody Allen.",

"And God said, 'Let there be light' and there was light, but the Electricity Board said He would have to wait until Thursday to be connected.-Spike Milligan.",

"Adam was the luckiest man in the world. He had no mother-in-law.-Sholom Aleichem",

"I hear Glenn Hoddle has found God. That must have been one hell of a pass.-Bob Davies.",

"I have four children which is not bad considering I'm not a Catholic.-Peter Ustinov",

"My problems all started with my early education. I went to a school for mentally disturbed teachers.-Woody Allen",

"I speak twelve languages. English is the bestest.-Stefan Bergman",

"My school days were the happiest days of my life; which should give you some indication of the misery I've endured over the past twenty-five years.-Paul Merton.",

"There's nothing as stupid as an educated man, if you can get him off the thing he was educated in.-Will Rogers.",

"Have you ever been in therapy? No? You should try it. It's like a really easy game show where the correct answer to every question is: 'Because of my mother.'-Robin Greenspan",

"After a year in therapy my psychiatrist said to me, 'Maybe life isn't for everyone'.-Larry Brown.",

"As she lay there dozing next to me, one voice inside my head kept saying, 'Relax, you're not the first doctor to sleep with one of his patients', but the another kept reminding me, 'Howard, you are a veterinarian!'-Dick Wilson.",

"My doctor gave me six months to live, but when I couldn't pay the bill he gave me six months more.-Walter Matthau.",

"Politicians are interested in people. Not that this is always a virtue. Fleas are interested in dogs.-PJ O'Rourke",

"Making a speech on economics is a bit like pissing down your leg. It seems hot to you but never to anyone else.-Lyndon B Johnson",

"Blessed are the young, for they shall inherit the National Debt.-Herbert Hoover",

"You can get much further with a kind word and a gun than you can with a kind word alone.-Al Capone.",

"Don't get excited about a tax cut. It's like a mugger giving you back fare for a taxi.-Arnold Glasow",

"If at first you don't succeed; call it version 1.0",

"The Internet: where men are men, women are men, and children are FBI agents.",

"unzip; strip; touch; finger; mount; fsck; more; yes; unmount; sleep-my daily unix command list",

"Life would be so much easier if we only had the source code.",

"Unix is user-friendly. It's just very selective about who its friends are.",

"COBOL programmers understand why women hate periods.",

"Programming is like sex, one mistake and you have to support it for the rest of your life.-Michael Sinz",

"There are 10 types of people in the world: those who understand binary, and those who don't.",

"Microsoft: You've got questions. We've got dancing paperclips.",

"Men are from Mars. Women are from Venus. Computers are from hell.",

"Windows95: It's like upgrading from Reagan to Bush.",

"People say Microsoft paid 14M$ for using the Rolling Stones song 'Start me up' in their commercials. This is wrong. Microsoft payed 14M$ only for a part of the song. For instance, they didn't use the line 'You'll make a grown man cry'.",",

"I'm not anti-social; I'm just not user friendly",

"A printer consists of three main parts: the case, the jammed paper tray and the blinking red light","A computer lets you make more mistakes faster than any invention in human history - with the possible exceptions of handguns  and tequila","To go forward, you must backup.",

"A Windows user spends 1/3 of his life sleeping, 1/3 working, 1/3 waiting.",

"Windows isn't a virus, viruses do something.",

"Difference between a virus and windows ? Viruses rarely fail.",

"The only problem with troubleshooting is that sometimes trouble shoots back.",

"Computers are like air conditioners: they stop working when you open windows.",

"once upon a midnight dreary, while i pron surfed, weak and weary, over many a strange and spurious site of 'hot xxx galore'. While i clicked my fav'rite bookmark, suddenly there came a warning, and my heart was filled with mourning, mourning for my dear amour, 'Tis not possible!, i muttered, \"give me back my free hardcore!\" quoth the server, 404.","Like car accidents, most hardware problems are due to driver error.",

"Dating a girl is just like writing software. Everything's going to work just fine in the testing lab (dating), but as soon as you have contract with a customer (marriage), then your program (life) is going to be facing new situations you never expected. You'll be forced to patch the code (admit you're wrong) and then the code (wife) will just end up all bloated and unmaintainable in the end.","If you give someone a program, you will frustrate them for a day; if you teach them how to program, you will frustrate them for a lifetime.",

"I had a fortune cookie the other day and it said: 'Outlook not so good'. I said: 'Sure, but Microsoft ships it anyway'.",

"Hacking is like sex. You get in, you get out, and hope that you didn't leave something that can be traced back to you."});

c=sizeof(rquotes);

c=random(c);

return rquotes[c];

}


~~TheCreator~~

Offline cratylus

  • Your favorite and best
  • Administrator
  • ***
  • Posts: 1020
  • Cratylus@Dead Souls <ds> np
    • View Profile
    • About Cratylus
random quote+mfunc lib broken
« Reply #1 on: November 03, 2006, 04:51:30 PM »
I'm not sure exactly what, but it looks like line 121 contains
an syntax error of some kind. I commented it out, and now
the code compiles just fine on 2.1.1:

code:
#define MIN 60
#define HOUR (60 * MIN)
#define DAY (24 * HOUR)
#define WEEK ( 7 *DAY)

mixed ParseTime(int tm);
mixed ChooseQuote();

mixed ParseTime(int tm) {
    string str;
    int x, tmp;
    str="";
    x=to_int(tm/WEEK);
    tm-=x;
    if (x > 0) {
   str += x + "w";
   tm -= x * WEEK;

    }
    if (x = (tm / DAY))
    {
   str += " "+x +"d";
   tm -= x * DAY;
    }
    if (x = (tm / HOUR))
    {
   str += " "+x+ "h";
   tm -= x * HOUR;
    }
    if (x = (tm / MIN))
    {
   str += " "+x+"m";
   tm -= x * MIN;
    }
    if (tm)
    {
   str +=" "+tm+"s";
    }
    return str;
}
mixed ChooseQuote()
{
    int c;
    mixed *rquotes;
    rquotes=({"Before you embark on a journey of revenge, dig two graves.-Confucius",
      "Ignorance is the night of the mind, but a night without moon and star.-Confucius",
      "Men's natures are alike, it is their habits that carry them far apart.-Confucius",
      "Study the past if you would define the future.-Confucius",
      "To see what is right and not to do it is want of courage.-Confucius",
      "What the superior man seeks is in himself,what the small man seeks is in others.-Confucius",
      "The first step to getting the things you want out of life is this: Decide what you want.-Ben Stein",
      "Life is a foreign language; all men mispronounce it.-Christopher Morley",
      "It's not true that life is one damn thing after another; it is one damn thing over and over.-Edna St. Vincent Millay",
      "Life is a long lesson in humility.-James M. Barrie",
      "A positive attitude may not solve all your problems, but it will annoy enough people to make it worth the effort.-Herm Albright",
      "Complaining is good for you as long as you're not complaining to the person you're complaining about.-Lynn Johnston",
      "Plans are only good intentions unless they immediately degenerate into hard work.-Peter Drucker",
      "Don't ever confuse the two, your life and your work. That's what I have to say. The second is only a part of the first.-Anna Quindlen",
      "I enjoy life. I think I'll enjoy death even more.-Cat Stevens",
      "In Montana, a policeman will pull you over because he?s lonely.-Rich Hall","I'm always amazed to hear of air crash victims so badly mutilated that they have to be identified by their dental records. What I can't understand is, if they don't know who you are, how do they know who your dentist is?-Paul Merton.",
      "First you forget names, then you forget faces. Next you forget to pull your zipper up and finally, you forget to pull it down.-George Burns.",
      "The pen is mightier than the sword, and considerably easier to write with.-Marty Feldman.",
      "We had gay burglars the other night. They broke in and rearranged the furniture.-Robin Williams.",
      "I told my psychiatrist that everyone hates me. He said I was being ridiculous - everyone hasn't met me yet.-Rodney Dangerfield.",
      "Have you ever noticed? Anybody going slower than you is an idiot, and anyone going faster than you is a maniac.-George Carlin.",
      "Put your hand on a hot stove for a minute, and it seems like an hour. Sit with a pretty girl for an hour, and it seems like a minute. That's relativity.-Albert Einstein",
      "Of the delights of this world, man cares most for sexual intercourse, yet he has left it out of his heaven.-Mark Twain",
      "A husband is what's left of the lover after the nerve has been extracted.-Helen Rowland",
      "A bachelor is a selfish, undeserving guy who has cheated some woman out of a divorce.-Don Quinn",
      "Marriage is a great institution, but I'm not ready for an institution yet.-Mae West",
      "Girls are like pianos. When they're not upright, they're grand.-Benny Hill",
      "Not a shred of evidence exists in favor of the idea that life is serious.-Brendan Gill",
      "See, the problem is that God gives men a brain and a penis, and only enough blood to run one at a time.-Robin Williams",
      "I'm such a good lover because I practice a lot on my own.-Woody Allen",
      "A terrible thing happened to me last night again - Nothing.-Phyllis Diller",
      "Sex is one of the most wholesome, beautiful and natural experiences that money can buy.-Steve Martin.",
      "Ah, yes, divorce... from the Latin word meaning to rip out a man's genitals through his wallet.-Robin Williams.",
      "My wife and I were happy for twenty years. Then we met.-Rodney Dangerfield.",
      "A married man should forget his mistakes; no use two people remembering the same thing.-Duane Dewel.",
      "Eighty percent of married men cheat in America. The rest cheat in Europe.-Jackie Mason",
      "I'm the only man in the world with a marriage licence made out to whom it may concern.-Mickey Rooney.",
      "When a woman becomes a scholar there is usually something wrong with her sexual organs.-Friedrich Nietzsche",
      "You know you're getting old when you stoop to tie your shoelaces and wonder what else you could do while you're down there.-George Burns.",
      "I don't feel old. I don't feel anything until noon. Then it's time for my nap.-Bob Hope",
      "I do wish I could tell you my age but it's impossible. It keeps changing all the time.-Greer Garson.",
      "I've stopped drinking, but only while I'm asleep.-George Best.",
      "She was good at being inarticulately abstracted for the same reason that midgets are good at being short.-Clive James talking about Marilyn Monroe",
      "If you would like to know the value of money, go and try to borrow some.-Benjamin Franklin",
      "When shit becomes valuable, the poor will be born without assholes.-Henry Miller.",
      "The hardest thing in the world to understand is income tax.-Albert Einstein.",
      "The only reason I made a commercial for American Express was to pay for my American Express bill.-Peter Ustinov.",
      "I was raised in the Jewish tradition, taught never to marry a Gentile woman, shave on a Saturday night and, most especially, never to shave a Gentile woman n a Saturday night.-Woody Allen.",
      "And God said, 'Let there be light' and there was light, but the Electricity Board said He would have to wait until Thursday to be connected.-Spike Milligan.",
      "Adam was the luckiest man in the world. He had no mother-in-law.-Sholom Aleichem",
      "I hear Glenn Hoddle has found God. That must have been one hell of a pass.-Bob Davies.",
      "I have four children which is not bad considering I'm not a Catholic.-Peter Ustinov",
      "My problems all started with my early education. I went to a school for mentally disturbed teachers.-Woody Allen",
      "I speak twelve languages. English is the bestest.-Stefan Bergman",
      "My school days were the happiest days of my life; which should give you some indication of the misery I've endured over the past twenty-five years.-Paul Merton.",
      "There's nothing as stupid as an educated man, if you can get him off the thing he was educated in.-Will Rogers.",
      "Have you ever been in therapy? No? You should try it. It's like a really easy game show where the correct answer to every question is: 'Because of my mother.'-Robin Greenspan",
      "After a year in therapy my psychiatrist said to me, 'Maybe life isn't for everyone'.-Larry Brown.",
      "As she lay there dozing next to me, one voice inside my head kept saying, 'Relax, you're not the first doctor to sleep with one of his patients', but the another kept reminding me, 'Howard, you are a veterinarian!'-Dick Wilson.",
      "My doctor gave me six months to live, but when I couldn't pay the bill he gave me six months more.-Walter Matthau.",
      "Politicians are interested in people. Not that this is always a virtue. Fleas are interested in dogs.-PJ O'Rourke",
      "Making a speech on economics is a bit like pissing down your leg. It seems hot to you but never to anyone else.-Lyndon B Johnson",
      "Blessed are the young, for they shall inherit the National Debt.-Herbert Hoover",
      "You can get much further with a kind word and a gun than you can with a kind word alone.-Al Capone.",
      "Don't get excited about a tax cut. It's like a mugger giving you back fare for a taxi.-Arnold Glasow",
      "If at first you don't succeed; call it version 1.0",
      "The Internet: where men are men, women are men, and children are FBI agents.",
      "unzip; strip; touch; finger; mount; fsck; more; yes; unmount; sleep-my daily unix command list",
      "Life would be so much easier if we only had the source code.",
      "Unix is user-friendly. It's just very selective about who its friends are.",
      "COBOL programmers understand why women hate periods.",
      "Programming is like sex, one mistake and you have to support it for the rest of your life.-Michael Sinz",
      "There are 10 types of people in the world: those who understand binary, and those who don't.",
      "Microsoft: You've got questions. We've got dancing paperclips.",
      "Men are from Mars. Women are from Venus. Computers are from hell.",
      "Windows95: It's like upgrading from Reagan to Bush.",
      //"People say Microsoft paid 14M$ for using the Rolling Stones song 'Start me up' in their commercials. This is wrong. Microsoft payed 14M$ only for a part of the song. For instance, they didn't use the line 'You'll make a grown man cry'.",",
      "I'm not anti-social; I'm just not user friendly",
      "A printer consists of three main parts: the case, the jammed paper tray and the blinking red light","A computer lets you make more mistakes faster than any invention in human history - with the possible exceptions of handguns and tequila","To go forward, you must backup.",
      "A Windows user spends 1/3 of his life sleeping, 1/3 working, 1/3 waiting.",
      "Windows isn't a virus, viruses do something.",
      "Difference between a virus and windows ? Viruses rarely fail.",
      "The only problem with troubleshooting is that sometimes trouble shoots back.",
      "Computers are like air conditioners: they stop working when you open windows.",
      "once upon a midnight dreary, while i pron surfed, weak and weary, over many a strange and spurious site of 'hot xxx galore'. While i clicked my fav'rite bookmark, suddenly there came a warning, and my heart was filled with mourning, mourning for my dear amour, 'Tis not possible!, i muttered, \"give me back my free hardcore!\" quoth the server, 404.","Like car accidents, most hardware problems are due to driver error.",
      "Dating a girl is just like writing software. Everything's going to work just fine in the testing lab (dating), but as soon as you have contract with a customer (marriage), then your program (life) is going to be facing new situations you never expected. You'll be forced to patch the code (admit you're wrong) and then the code (wife) will just end up all bloated and unmaintainable in the end.","If you give someone a program, you will frustrate them for a day; if you teach them how to program, you will frustrate them for a lifetime.",
      "I had a fortune cookie the other day and it said: 'Outlook not so good'. I said: 'Sure, but Microsoft ships it anyway'.",
      "Hacking is like sex. You get in, you get out, and hope that you didn't leave something that can be traced back to you."});
    c=sizeof(rquotes);
    c=random(c);
    return rquotes[c];
}


Offline Aransus

  • Acquaintance
  • *
  • Posts: 2
    • View Profile
random quote+mfunc lib broken
« Reply #2 on: November 03, 2006, 05:31:18 PM »
Line 121 has an extra ", at the end. The file updates fine with that taken out.