Archive for April, 2005

miracle of perl

Friday, April 29th, 2005

PS. You may not understand if you have never programmed seriously in conventional languages.

Task:

Write a program which reads in a series of text, and create a list of all words in the input text and display its word count in alphabetical order.

Conventional Procedure:

  • Create 2 coresponding arrays, one contains the word name while the other contain the word count.
  • Store the input string into the buffer, extract each word out using string manupulator at the break of a space bar, store in the word name array and increase coresponding word count by one.
  • While extracting each word, check if it was already noted in the array and increase its corresponding word count.
  • Perform a quicksort with the arrays and display the results with iteratives.

Solution:

#!/usr/bin/perl

my %dict;

while (<>) {
    chomp;
    foreach (split) {
        $dict{$_}++;
    }
}

my $i = 0;
foreach (sort keys %dict) {
    print $i++, " $_:", $dict{$_}, "\n";;
}

(Note: No, I didn’t write it. My bf did.)

Toxic Shock Syndrome due to super-absorbent Tampons

Thursday, April 28th, 2005

Toxic Shock Syndrome due to super-absorbent Tampons:

Toxic shock syndrome is a rare, life-threatening bacterial infection that has been most often associated with the use of superabsorbent tampons and occasionally with the use of contraceptive sponges.

In 1980, an outbreak of toxic shock syndrome occurred that mostly involved young women who had been using a particular brand of superabsorbent tampons. The cause of the outbreak seemed to be toxins produced by Staphylococcus aureus (staph) bacteria.
While the infection often occurs in menstruating women, it can also affect men, children and postmenopausal women. Other risk factors for toxic shock syndrome include skin wounds and surgery.

Signs and symptoms of toxic shock syndrome develop suddenly, and the disease can be fatal. You can reduce your chances of getting toxic shock syndrome by changing your tampon frequently.

Sounds scary, eh? It’s one of the weird words in “Environment and communication diseases” under the course “Sustainable Development in the 21th Century”, which they invite external speakers once a twilight with free refreshment (for the reason that I applied the course :P)

Anyway, it was more to that. Legionnaire’s disease.  Peptic ulcer is caused by bateria instead of the conventionally thought stress. Antibiotics-resistant bacteria first identified in Hong Kong. In the transportation of the first AIDs victim in HK 1985, the medics dressed up more protective that those in the movie “outbreak”. My new insight to the medical development, eh.

high table business

Thursday, April 14th, 2005

At the high table dinner tonight the supposedly host I was reassigned to another table. Sat down as the interrupter I introduced myself as a tutor doing research on robotics, while the other 3 guests were a) from JP Morgan b) another big4 which I don’t quite remember c) a PR staff who graduated from a Master of Political Science. One of the guest pop in after my intro, “Whom do you collaborate with?”, while guest (c) elaborated with “I also experienced with research. What kind of universities do you exchange your experimental data with?” after I somehow managed the question.

Stoned. They didn’t even ask me what kind of research I was doing, but my regional exposure. Oh ya, one asked “So you create your design and then build your design and make design and build?”. Huh.

And then guest A and B were sticking to the few BBA students talking about Big 4 news and job market. The 3 engineering students at another corner were talking to themselves, and another 2 computer science girls didn’t know what to say. Guest C could engage herself with another 2 students and it appears that my table was talking well. Unlike the usual me I didn’t utter much but to shut myself up with the on tray food. Not a good host would usually do eh.

Their conversations were intelligent, I suppose. What they asked me was intelligent too, I suppose. None of my templates for my high-table conversation came into any use, and now, I see that why can’t I find a management trainee job.