Archive for December, 2010

Published by Pui-chor on 17 Dec 2010 wipe STDIN read in perl

When CGI is used in any cgi script such as:

use CGI qw(:standard);

If a print header; statement or new CGI is called, the STDIN will be wiped as took over the reading of the STDIN and when a read statement is called, there is no POSTed data left in the pipe.

In order to keep the STDIN POSTed data, the following statement should be called first:

read(STDIN, $data, $ENV{‘CONTENT_LENGTH’});

Then calling param() or new cgi or print header() will not affect the rest of the program.

Published by Pui-chor on 16 Dec 2010

Valentines Cookies

Charlene and I made cookies today:

For 40 small cookies or 20 large cookies -

180 mL shortening
180 mL sugar
2 eggs
6 mL vanilla
500 mL flour or adjust
2 mL salt
10 ML baking powder

1. Preheat oven to 375 F/190 C. Grease cookie sheet
2. In medium bowl cream shortening and sugar.
3. Add egg and vanilla. Beat.
4. In small bowl mix flour, salt and baking power.
5. Add dry ingredients to creamed mixture. Stir.
6. Roll dough and cut with cookie cutters.
7. Place on greased cookie sheet. Bake at 190 C for 10-12 minutes.


85mL shortening
15mL margarine
f.g salt
250mL icing sugar
5mL vanilla
red food colour

1. In bowl, cream shortening and margarine; add salt.
2. Gradually add icing sugar and villa, beating until light and fluffy
3. Add a drop or two of food colour if desired.

Published by Pui-chor on 14 Dec 2010

jQuery’s ready and load

I finally found out the difference between $img.ready and $img.load in jQuery. I have a jQuery slide code determing the width and height of some images embedded in a page. The original code using $img.ready function to get the width and height of the image but the result screwed up the display as the width and height is used to enlarge or shrink the image.

I changed it to $img.load and the correct display is obtained. Hurray!

Next »