Joshua Lückers Random stuff from a guy who likes Information Technology

7Aug/101

Style links depending on url or file format

While browsing at Forrst I saw this nice piece of CSS.

a[href^="http://"] {
        color: blue;
}
 
a[href^="mailto:"] {
        color: red;
}
 
a[href$=".pdf"] {
        color: green;
}

Styling links depending on their formats.

ajcates said:
For the sake of usability and consistency instead of changing the color on links based on their format I often times use this technique instead to add on little file icons.

Tagged as: , , 1 Comment
14Jun/1012

Performance Showdown

While browsing the internet I came across a nice little script which shows how fast your CPU can calculate the first 5000 decimals of PI.
This is my result (using a laptop) running a 64bit version of Ubuntu 10.04:

model name : Intel(R) Core(TM) i5 CPU M 430 @ 2.27GHz
model name : Intel(R) Core(TM) i5 CPU M 430 @ 2.27GHz
model name : Intel(R) Core(TM) i5 CPU M 430 @ 2.27GHz
model name : Intel(R) Core(TM) i5 CPU M 430 @ 2.27GHz

Calculating the first 5000 decimals of pi using 4 parallel processes
Total time: 57.76 seconds
Average time per calculation: 14.44 seconds

Not bad for a laptop eh?
Today I tested it again with almost no applications open:

model name : Intel(R) Core(TM) i5 CPU M 430 @ 2.27GHz
model name : Intel(R) Core(TM) i5 CPU M 430 @ 2.27GHz
model name : Intel(R) Core(TM) i5 CPU M 430 @ 2.27GHz
model name : Intel(R) Core(TM) i5 CPU M 430 @ 2.27GHz

Calculating the first 5000 decimals of pi using 4 parallel processes
Total time: 55.45 seconds
Average time per calculation: 13.86 seconds

Want to test how fast your CPU can make those calculations? Then use the script below and post your results:

N=`cat /proc/cpuinfo | grep processor | wc -l`
 
cat /proc/cpuinfo | grep "model name"
echo
echo "Calculating the first 5000 decimals of pi using $N parallel processes"
TimeBegin=`date +%s.%N`
 
for ((i=1; i< =$N; i++))
do
        echo "scale=5000; 4*a(1)" | bc -l -q > /dev/null &
done
wait
 
TimeEnd=`date +%s.%N`
DT=`echo "scale=2; ($TimeEnd - $TimeBegin) / 1" | bc`
echo "Total time: $DT seconds"
DTc=`echo "scale=2; ($TimeEnd - $TimeBegin) / $N" | bc`
echo "Average time per calculation: $DTc seconds"

update: some users reported that above script doesn't work. If this is the case try this oneinstead.

Filed under: Uncategorized 12 Comments
3Jun/107

A day without Adobe Flash

With the iPad being released and it not supporting Adobe Flash I thought it would be a good idea to see if I could browse the web for 1 day without flash. Here are the results:

Pros

  • The browser seems to perform much better with Flash disabled when visiting websites who have Flash content. Most of them only use Flash for some fancy stuff. Without Flash installed they use static images instead.
  • Less CPU usage!

Cons

  • It is impossible to view the nice graphical information in your Google Analytics reports, also the calendar in Google Analytics uses Flash. The Google Analytics website is pretty useless without Flash.
  • Youtube.. Most of the videos are available without Flash when you join the HTML5 Beta, but there are still videos who require to have Flash installed (most of them are videos with advertisements in it).
  • Other video sites I visit however do not yet support the HTML5 video tag, so they are pretty unusable to me now.
  • Most of the games online are Flash games..

As you can see the results are clear, the internet is not yet ready to get rid of Flash but I'm sure HTML5 (it isn't even finished yet) and whatever comes after it will replace Flash at some point but till then I just keep Flash installed and enabled.

Tagged as: , 7 Comments