Gzip and Slimmer optimization anecdote

January 30, 2007
7 comments Zope

I've wanted to Gzip the static content (CSS & Javascript) on my sites for a long time but never found a good enough solution. mod_gzip is out of the question because as far as I've understood it it does a compression on the fly, every time you request the file.

Other solutions have disappointed me because enabling gzip compression has been for all content. I don't want my HTML files gzipped because they're rendered on the fly based on business logic plus by compressing the HTML files. Long story short my yet-to-be-released app now serves the following files from Zope but are only compressed and whitespace slimmed once per server restart:


FILE               ORIG SIZE  NEW SIZE   REDUCTION
screen.css             15224      2738   556%
print.css               2633       885   298%
jquery-latest.js*      57712     18130   318%
jquery-latest.pack.js  20461     10513   195%
common.js               3803      1131   336%
complete-expense.js    18184      2847   639%
Total                 118017     36244   326%

* only used in debug mode

Truncated! Read the rest by clicking the link below.

Canon and Sony Ericsson rule Flickr

January 27, 2007
0 comments Photos

Canon and Sony Ericsson rule Flickr Clearly from watching these stats about cameras used on Flickr Canon and Sony Ericsson rule. Canon is totally dominating the usage of Point & Shoot cameras which doesn't surprise me. Even if I'm a Nikon user I still recommend the Canons for Point & Shoot if people ask me.

By far, the most popular SLR is the Canon EOS Rebel XT as you can see. It doesn't surprise me that much. It is a great camera. I had sort of hoped that my camera, the Nikon D70, would be more popular but perhaps it doesn't really matter.

Another interesting observation is how cool pictures people take with the Sony Ericsson cameras. It's amazing what can be done if you're a bit artistic. Most of those pictures are much better than mine taken with my much more expensive D70. Pictures taken with the Sony Ericsson 750i and the Sony Ericsson K800i

New Google Groups design

January 24, 2007
0 comments Misc. links

New Google Groups design Google Groups has just had a redesign. Maybe this is old news but it's new for me.

I like the new design a lot. It's more welcoming and warmer. Comparing it to the old design you notice that not a great deal has changed except the colour choice and the cuddly icons. I think the icons are great. Icons is a time-tested proven concept and by making the icons large it'll take less milliseconds for users to click on them with the mouse because they're easier to aim at.

I also like the fact that each group or category gets its own icons. It's something I'd like to have for some of my yet-to-be-released projects but I don't have the resources to get a designer to design all the various icons. I guess this is part of what makes the icons so impressive, that they're not just cuddly but damn hard to do.

Good work Google Groups people!

Ugliest site of the month - CSDC

January 22, 2007
1 comment Misc. links

Ugliest logo of the year Maybe the design of csdc.net is just as bad as any other website but what's really unique about this company brochure site is the logo. "We Develop Success" in quotation marks as well. Why? Is that not what you do? Or is it a quote from someone anonymous?

The HTML code stinks of Microsoft-only. There's loads and loads of code like this:


<script language="JavaScript"><!--
if(MSFPhover) { MSFPnav14n=MSFPpreload("_derived/CSAS2 Budget 
Management.htm_cmp_ice174010_vbtn.gif"); MSFPnav14h=MSFPpreload(
"_derived/CSAS2 Budget Management.htm_cmp_ice174010_vbtn_a.gif"); }
// --></script><a href="CSAS2%20Budget%20Management.htm" 
language="JavaScript" onmouseover="if(MSFPhover) 
document['MSFPnav14'].src=MSFPnav14h.src" onmouseout="if(MSFPhover) 
document['MSFPnav14'].src=MSFPnav14n.src"><img 
src="_derived/CSAS2%20Budget%20Management.htm_cmp_ice174010_vbtn.gif" 
width="147" height="31" border="0" alt="Budget Management" 
name="MSFPnav14"></a><br>

You'll get quite a shock when you visit the site with Firefox because the letters "csdc" is shown as <big> to the power of 20!! Here's a screenshot of it in Safari too

Truncated! Read the rest by clicking the link below.

RememberYourFriends.com running jQuery

January 18, 2007
0 comments Web development

I've upgraded RememberYourFriends.com now to run jQuery now instead of tw-sack and my own home-brewed javascript code.

I've also joined the jQuery documentation team to be able to include my little baby site on Sites Using jQuery

Currently it's using jQuery 1.0.4 but I'll upgrade to 1.1 soon. I'm also working on a Swedish version of RememberYourFriends.com but I've only translated 60% of the strings so far.

Best youtube.com clip of the year?

January 16, 2007
8 comments Politics

Best youtube.com clip of the year? This has to be one of the best youtube.com clip of the year. It's funny, scary and just outright amazing.

"What currency do they have in the United Kingdom" the report asks.
"I don know. American money?" answers the Texan man.

Sure, there are a lot of people in USA and not all of them are rednecks but those that are scare me more than insurgents in the middle east.

The scariest part of this clip is towards the end when they ask people if the support president Bush on Kyrgyzstan being a threat and whether the United States should invade it.

Disclaimer: I know a lot of Americans and they're lovely people. I do understand that this clip selects only few exceptional cases but that doesn't make the clip any less fun

Flash 9 on Ubuntu Edgy Eft

January 10, 2007
4 comments Linux

My Ubuntu Linux on my work laptop works great but since I've strayed far away from the default options (own kernel, own window manager etc) some things sometimes don't work as expected. Such as Flash9. The problem I had was that there some some package in there that was broken for some reason: libswfdecmozilla.so

Here's what I did:


# cd /usr/lib/mozilla/plugins
# rm libswfdecmozilla.so
# wget http://download.macromedia.com/pub/labs/flashplayer9_\
update/FP9_plugin_beta_101806.tar.gz
# aunpack FP9_plugin_beta_101806.tar.gz
# mv flash-player-plugin-9.0.21.55/libflashplayer.so .
# chmod +x libflashplayer.so

Start firefox and enter about:plugins and this is what you should see

That worked for me. Hopefully this will help somebody. The help I got from this page which might also help people with a broken Java in Firefox but they don't say that you should delete the libswfdecmozilla.so driver.

UPDATE

There's a slightly more recent beta now. The November 2006 beta

UPDATE 2

Now there's a final release on adobe.com

setAttribute('style', ...) workaround for IE

January 8, 2007
41 comments JavaScript

I knew had I heard it before but I must have completely missed it anyway and forgotten to test my new Javascript widget in IE. None of the stylesheet worked in IE and it didn't make any sense. Here's how I did it first:


var closer = document.createElement('a');
a.setAttribute('style', 'float:left; font-weight:bold');
a.onclick = function() { ...

That worked in Firefox of course but not in IE. The reason is that apparently IE doesn't support this. This brilliant page says that IE is "incomplete" on setAttribute(). Microsoft sucked again! Let's now focus on the workaround I put in place.

First I created a function to would take "font-weight:bold;..." as input and convert that to "element.style.fontWeight='bold'" etc:


function rzCC(s){
  // thanks http://www.ruzee.com/blog/2006/07/\
  // retrieving-css-styles-via-javascript/
  for(var exp=/-([a-z])/; 
      exp.test(s); 
      s=s.replace(exp,RegExp.$1.toUpperCase()));
  return s;
}

function _setStyle(element, declaration) {
  if (declaration.charAt(declaration.length-1)==';')
    declaration = declaration.slice(0, -1);
  var k, v;
  var splitted = declaration.split(';');
  for (var i=0, len=splitted.length; i<len; i++) {
     k = rzCC(splitted[i].split(':')[0]);
     v = splitted[i].split(':')[1];
     eval("element.style."+k+"='"+v+"'");

  }
}

I hate having to use eval() but I couldn't think of another way of doing it. Anybody?

Anyhow, now using it is done like this:


var closer = document.createElement('a');
//a.setAttribute('style', 'float:left; font-weight:bold');
_setStyle(a, 'float:left; font-weight:bold');
a.onclick = function() { ...

and it works in IE!

Thuas Trägubbar

January 4, 2007
1 comment Family

Thuas Trägubbar My sister, my mom and I just launched a new website for my mom and her wood carving hobby. It's called Thuas Trägubbar (which literally translates to "Thua's wood figurines". The site it unfortunately only in Swedish but hopefully people will appreciate the pictures anyway. Most of the faces done are of course only local or national celebrities but there are some international ones too.

There's even one of me.

UPDATE

It's now www.thuasgubbar.se