HTML : Problem with table tags in IE

The other day was having problem displaying an select option list inside a table cell alongwith cell header in IE whereas the same worked fine in FireFox.

The table was something like ;

<table>

<tr>

<th> Cell Header </th>

<td>

<select name = “name” id=”id”>

<option value=”1″> 1 </option>

……………………………………………..

<option value=”n”> n </option>

</select>

</td>

</tr>

</table>

The string Cell Header ate up all the space and the subsequent drop down list did not show up in IE.


Solution was to specify width for table and cell:

<table style = “width :20%”>

<tr>

<th> Cell Header </th>

<td style = “width :80%”>

<select name = “name” id=”id”>

<option value=”1″> 1 </option>

……………………………………………..

<option value=”n”> n </option>

</select>

</td>

</tr>

</table>

Perl : A foreach loop normally saves time!

Script:

#!/usr/bin/perl

# use Benchmark module
use Benchmark qw (:all);

# time 3 different versions of the same code
cmpthese (1000, {
‘foreach’ => ‘foreach $x (1…5000)
{
sin($x/($x+2));
}’,
‘while’ => ‘$x=1;
while ($x <= 5000)
{
sin ($x/($x+2));
$x++;
}’,
‘for’ => ‘for ($x=1; $x<=5000; $x++)
{
sin ($x/($x+2));
}’,
});
…………………………..
…………………………..

Result:

Rate for while foreach
for 400/s — -2% -17%
while 407/s 2% — -16%
foreach 483/s 21% 19% —

Perl : Checking existing modules in CPAN

perl -MLWP::Simple -e “getprint ‘http://cpan.org/modules/01modules.index.html'&#8221; | perl -pe ‘s/.*<;a//; s/.*?>;(.*?)<;\/a>;.*$/$1/’ | grep Mechanize

……….
……….

Bundle-WWW-Mechanize-Shell-0.29.tar.gz
WWW-Mechanize-Shell-0.44.tar.gz
Mozilla-Mechanize-GUITester-0.15.tar.gz
Mozilla-Mechanize-0.05.tar.gz
……….

Sybase :: forcing index in a SQL query

Sometimes, it becomes necessary to force an index in a query when optimizer does not follow indexing structure goes for a full table scan.

Supposing Indx I1 is indexed on columns EMP_NAME, EMP_PHONE from EMPLOYEE table.

Now the following types of query would go for full table scan:

1. select * from EMPLOYEE where EMP_NAME=<SOMENAME>;
2. select * from EMPLOYEE where EMP_PHONE=<SOMEPHONE>;

3. select * from EMPLOYEE where EMP_NAME in (SOMERANGE) and EMP_PHONE=<SOMEPHONE>;

4. select * from EMPLOYEE where EMP_NAME =<SOMENAME> and EMP_PHONE in (SOMERANGE)

In the above queries if with tablename we specify the index to follow, queries avoid the full table scan.
eg.
select * from EMPLOYEE(index I1) where EMP_NAME =<SOMENAME> and EMP_PHONE in (SOMERANGE).
OR
select * from EMPLOYEE(1) where EMP_NAME =<SOMENAME> and EMP_PHONE in (SOMERANGE).

where 1 is the index no. of I1 for EMPLOYEE table.

But am not aware of any flipside of this approach……