Crosstips.org

My fun Crossword solver project. Crosstips.org & Krysstips.se

Kung Fu

Fujian White Crane Kung Fu

Fry-IT

Fry-IT is the company I work for

Photos

Photoalbum, both old and new.

Zope

What I have and am doing with Zope

Receptsamlingen

In Swedish only. About my "Collection of Recipes" website.

Contact me

My contact details and how to contact me.

 

KungFuPeople.com
Do you train Kung Fu?
Or know someone who does?
Then check out KungFuPeople.com


Mobile version of this page Mobile version of this page


 

You searched for keyword:whitespace
 

found 0 photos and 6 blogs in and 0 blog comments in 0.00 seconds



 

Blogs

  Optimized stylesheets - 4th of March 2004

I have been experimenting recently with HTML optimization but haven't applied it yet. But I have applied this now to my stylsheets. The size gain is 33%! (1577 bytes to 1027 bytes) However, the speed gain involves also the time to perform the optimization so the speed gain will obviously be less than 33%. But the optimization takes, on this slow computer, 0.004 seconds so in approximate terms the speed gain is also 33%. This is on a stylesheet file with some but short and few comments.

  Optimize Plone.org with slimmer.py - 15th of February 2005

If you do a speed report on Plone.org you notice that the three biggest files it services are plone.css, plone_javascripts.js and index.html. If you run these through my little slimmer whitespace optimizing program in Python you get the following results:

 $ python slimmer.py --test http://plone.org/plone.css
 Took 0.016 seconds
 Bytes before: 29355
 Bytes after:  20265
 Bytes saved:  9090  (69.0% of original size)

 $ python slimmer.py --test http://plone.org/plone_javascripts.js
 Took 0.057 seconds
 Bytes before: 27251
 Bytes after:  19974
 Bytes saved:  7277  (73.0% of original size)

 $ python slimmer.py --test http://plone.org/ 
 Took 0.029 seconds
 Bytes before: 37186
 Bytes after:  26466
 Bytes saved:  10720 (10K)  (71.0% of original size)

  slim, a new free web service for white space optimisation - 25th of July 2006

If you have some code that you need to optimise, like some Javascript code that is well commented but costs too many bytes of download for your users then you might want to use my slimmer web service. I'll let a Python example speak for itself:

 >>> import xmlrpclib
 >>> s=xmlrpclib.Server('http://www.peterbe.com/')
 >>> css='h1 { font-family: Arial, Verdana; }'
 >>> s.slim(css)
 'h1{font-family:Arial,Verdana}'

  Gzip and Slimmer optimization anecdote - 30th of January 2007

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.

  Automatically strip whitespace in Django forms - 12th of October 2009

The current project I'm working has at the time of writing 20 different forms (90% model forms) instantiated in different scenarios. Django doesn't automatically strip whitespace in text based fields. So instead of doing this:

 class ContactMarketingForm(forms.ModelForm):
    class Meta:
        model = ContactMarketing
        exclude = ('contact',)

    def clean_notes(self):
        return self.cleaned_data['notes'].strip()

    def clean_name(self):
        return self.cleaned_data['name'].strip()