July 2019
M T W T F S S
« May    
1234567
891011121314
15161718192021
22232425262728
293031  

Categories

<!–:en–>A little tips for Perl, PHP, JavaScript<!–:–><!–:ja–>Perl, PHP, JavaScriptのちょっとしたTIPS<!–:–>

A little notes about Perl、PHP、JavaScript.

I couldn”t find the related pages so many as I expected.

Perl

If you want to split a line with a symbol into fixed numbers of columns (e.g. TSV text),

you”d better use the

@data = split(“\t”, $line, -1);

not

@data = split(/\t/ ,$line);

Without -1 and “\t”, the empty columns will be cut out.

PHP

“setcookie” function need to be called before any HTML output.

This is so natural because it”s  a part of HTML header, but sometimes we forget that especially when we update other one”s program.

if you write it after “<HTML>…”,  no cookie will be saved.

JavaScript

If you want to resize a window maximum in IE,

the following script won”t online casino’s do that.

<script type=”text/javascript”>

<!–

window.resizeTo(screen.availWidth, screen.availHeight);

window.moveTo(0,0);

//–>

</script>

* This will do in Firefox.

Instead, the following one will do.

<script type=”text/javascript”>

<!–

window.moveTo(0,0);

window.resizeTo(screen.availWidth, screen.availHeight);

//–>

</script>

*This will do both in IE and Firefox.

This is because IE doesn”t resize the window out of screen borders, so you need move to the middle of screen first with enough range, and extend the size.