2008-03-10

Firefox2 and css caching issue - part 2

I have tried out to change settings for expire headers, and figured it that application adds its own headers to dynamic generated css files. Then apache2 mod-expire tries to add own settings.
After tweaking application settings there are resulting headers:

Date: Mon, 1 Mar 2008 06:46:02 GMT
Server: Apache/2
Cache-Control: max-age=600, max-age=604800
Expires: Mon, 6 Mar 2008 06:46:02 GMT
Vary: Accept-Encoding
Content-Encoding: gzip
Content-Length: 18128
Content-Type: text/css


Expire times:

  • max-age=600 - given by apache2 global settings

  • max-age=604800 - given by applications itself



It's ugly - but surprisingly caching works under Firefox with these headers. I haven't checked yet which expiration time is taken by Firefox. I need to clean it and remove one of extra headers anyway.

Below are old headers for the same resource fort comparison - when Firefox caching was not working:


Date: Sat, 01 Mar 2008 07:28:31 GMT
Last-Modified: Sat, 01 Mar 2008 07:26:56 GMT
Expires: Sat, 01 Mar 2008 07:36:56 GMT
Cache-Control: max-age=600
Vary: Accept-Encoding
Content-Encoding: gzip
Content-Length: 18128
Keep-Alive: timeout=10, max=98
Connection: Keep-Alive
Content-Type: text/css


There are removed last-modified and keep-alive headers, but it's hard to understand how it can change Firefox caching.
I have to check difference between 600 and 604800 expire age, that may be solution.

Probably all headers should look like those added by apache mod-expire for static files:


Date: Mon, 1 Mar 2008 06:46:04 GMT
Server: Apache/2
Last-Modified: Thu, 6 May 2007 02:52:18 GMT
Accept-Ranges: bytes
Cache-Control: max-age=604800
Expires: Mon, 6 Mar 2008 06:46:04 GMT
Vary: Accept-Encoding
Content-Encoding: gzip
Content-Length: 3588
Content-Type: application/x-javascript

2008-03-03

Firefox 2 and css caching issue

Last week I had strange issue with Firefox cache. One of web application needed tweaking to be more responsive. After playing with apache configuration I tested page load speed using YSlow.

All files have expiry headers and all text files are deflated. Results are still mediocre. Some of dynamically generated css files aren't cached by Firefox 2. IE works as it supposed to do - any subsequent request is handled blazingly fast. I tried it on different installations of Firefox to exclude my browser optimizations side effects. Still the same.

Below are HTTP response headers of css that isn't going to FF cache:

Date: Sat, 01 Mar 2008 07:28:31 GMT
Last-Modified: Sat, 01 Mar 2008 07:26:56 GMT
Expires: Sat, 01 Mar 2008 07:36:56 GMT
Cache-Control: max-age=600
Vary: Accept-Encoding
Content-Encoding: gzip
Content-Length: 18128
Keep-Alive: timeout=10, max=98
Connection: Keep-Alive
Content-Type: text/css


I can't see anything suspicious. Content type is proper, all expire headers are set. Requested file name is named as css.php - does FF makes some assumptions on file extension? I tried turning off Cache-Control header and leave only Expires, but it doesn't work too.

It must be simple detail. Anybody has any clues?

2008-02-25

Blending scripting languages in modern enterprise environment

Is your company using "enterprisey" technologies like Java or .NET? Do you want to use flexible scripting languages like Python or Ruby?
There are interesting possibilities for popular and "mature" programming languages like those above. Many popular languages has implementations that work under Java or .NET environment, like Jython, JRuby, IronPython, IronRuby and others. It's quite old thing but it still worth mentioning it. The main problem with such solutions is their maturity and completeness, so checking and quick research is needed before doing decision.

You can also find implementations of old veterans like COBOL and REXX for new platforms. There are also single platform languages that have cool features of scripting languages like Groovy or beanshell for JVM.

Additional languages are primarily used in configuration, defining custom and complex business rules, adding Domain Specific Language features etc. Word of warn - do not create local Babel Tower by multiplying number of existing languages in single project. But it's nice to have to have one scripting language blended into main project platform.

Other case is porting applications from scripting to target platform. Constraints are narrow - all used third party libraries have to work on both platforms, so additional work is needed often. Practical example - here is interesting tutorial how to deploy web.py python application under Jython and JVM.

2008-02-18

Polyphasic sleep - sleeping less and better - update 1


Photo author: agoode
I mentioned before that I started polyphasic sleep schedule experiment After few weeks I can say it's quite difficult, but somehow working.
I had one week for trying it without family, but now they are back and are very important part of that experiment.

After transition phase I experimented with two different sleep schedules versions: 3 hours and 4.5 of core sleep version. I must say that best schedule that works for me is 4.5h of core sleep and 3 naps: one before work, one after dinner and additional one at evening. It works probably because of quite long core sleep time only 1.5h shorter than my usual 6h sleep. I maintained that sleep cycle for most all days with some exceptions:
- sometimes I was too tired after whole day or not slept good last night- in that circumstances its possible to miss even an alarm clock
- weekends when my lazy part demands full night sleep
- nightly interruptions caused by my toddler needing nursing

The first two obstacles probably will be gone after better adaptation. Kid is the bigger problem. I managed that by tweaking my sleeping hours and synchronizing with my kid's sleeping cycle. It's still not ideal but seems working. And know I'm logging sleep times for two.

My core sleep isn't equal for every night. Sometimes it fits better my natural rhythm the other time worse. I use precalculated cycle length of about 1.5h. So 4.5 core sleep takes about 3 cycles. If my waking time differs by more than half an hour earlier or later, I feel after that really bad. Grogginess, jet lag effect cumulates together into zombie like state - I need slow warm up to function normally. After first nap things go better. Every nap is crucial for reducing short sleep time effects and I'm usually more energized at the morning. After 2 pm I start to feel worse and I'm slowing till I get next nap after dinner.

But If my sleeping times are in schedule I feel normal, sometimes after naps even more energized than usual . So the key to success is to tune in to natural body rhythm and holding schedule times. As I mentioned before, naps are crucial- every nap missed makes me feel worse till next sleep.

Somebody may ask- is it worth to take such sacrifices? My total sleeping time is shortened from 6.5 to 5.5 hours- so 1 hour gained. It's a small reward if any. My main goal was to redefine my daily sleep cycle to get my works done and have time for my family after work. My family helps me a little so I can get two 20 minutes naps at late afternoon and evening. Everybody gets its goals and is happy. I think its worth to try it making better. Maybe it's weird method, but that's the way I like to try.

2008-02-11

Estimated car expenses - verified

Last week I had some serious car servicing and insurance expenses. I decided to check my total cost of car ownership estimates.

I'm 99% city commuter so before I bought a car, besides well visible costs like car price, insurance etc., I had checked couple of factors like fuel consumption and estimated car servicing cost.After spreading all cost for next 5 years my calculated total was about 2650 euro per year (about 3850 $).

Two years later I have more precise data, like servicing invoices, fuel consumption history etc., excluding occasional fees like parking and other. Simple recalculation in spreadsheet and it looks like my average cost of car ownership will be about 2500 euro/year during last 2 and for next 3 years. It looks like my estimate was quite good. I should include predicted car selling price for example after 5 years, but it's not the point for now.

Here are biggest and most important chunks to consider in calculating car TCO:
- initial car value 47%
- insurance 24%
- fuel 20%

Maybe I should think about rolling car cost calculator based on that experiences. I wish all my budgeting estimates will work with that accuracy.