Monday, June 18, 2007

Internet Explorer CSS Limit

We just came across a bug that makes IE choke when it needs to handle over 30 <style> objects. If you thought of using a single style object and then @import the other files, it won't work either.

You might want to ask why we need over 30 style objects. Well, since each drupal module tends to add it's own CSS (using drupal_add_css) we very quickly got to 22 CSS's being included. From there the road to 30-32 was quite trivial. Guess we'll have to use Drupal's CSS/JS aggragator to solve this.

Sunday, June 10, 2007

Calcualting Average in UNIX Shell Script

I grabbed a piece of code to calculate an average for data in shell. It didn't work so I had to modify it. This is the result.


#!/bin/sh
n=0
sum=0
while read x
do
sum=`echo $sum + $x | bc`
if [ "$?" -eq "0" ]; then
n=`expr $n + 1`
fi
done
echo "scale=2;$sum/$n"| bc

Thursday, June 7, 2007

Server Header in Apache Tomcat

Altough you cannot disable the header, you can change it to anything you like by adding a "server" attribute to the connector tag in server.xml
e.g.

<connector
port="80" address="localhost"
...
server="Undefined"
>

RoundToNearest in Microsoft Excel

This will round the given cells to the nearest number given, pretty neat if you want to produce a repost that is rounded, e.g. to the 0.25.


=IF(C50>0,CEILING(C50,0.25),-CEILING(C50,0.25))