Wednesday, June 20

CSS clean-up @ build time

Here is a simple Maven goal to optimize CSS delivery at build time and low cost.

<!-- set path to CSS files -->
<set var="css.cleanup.src.dir" value="path_to_css_files" />

<goal name="cleanup-css" description="Remove comments and blank lines from CSS files">
  <echo message="Removing comments and blank lines from files in ${css.cleanup.src.dir}" />
  <!--
    remove single+multiline comments,
    see docs@
http://ant.apache.org/manual/OptionalTasks/replaceregexp.html
  -->
  <replaceregexp byline="false" flags="gm">
    <regexp pattern="\/\*(.\s)*?\*\/" />
    <substitution expression="" />
    <fileset dir="${css.cleanup.src.dir}">
      <include name="*.css" />
    </fileset>
  </replaceregexp>

  <!-- remove multiple blank lines -->
  <replaceregexp byline="false" flags="gm">
    <regexp pattern="^\r\n^\n" />
    <substitution expression="" />
    <fileset dir="${css.cleanup.src.dir}">
      <include name="*.css" />
    </fileset>
  </replaceregexp>
</goal>


Is it really worth it?
I tested it on 5 CSS files (test1.css, test2.css,test3.css, test4.css, test5.css) of different sizes and obtained a respectable file size reduction. In addition, dev comments are not shipped and exposed to the outside world.

Below is the output of the Python stats scripts I wrote to analyse situations like this (testX_c.css is the compressed version of the original file):

>>> describe(cmpfilesizelist(d, listfiles(d, "*.css")))

file test1.css is 4.57% larger than test1_c.css
file test2.css is 33.40% larger than test2_c.css
file test3.css is 21.93% larger than test3_c.css
file test4.css is 34.55% larger than test4_c.css
file test5.css is 36.54% larger than test5_c.css

('Sample Size: 5', 'Min/Max: ', (4.5725935634192512, 36.543124350536885), 'Mean: 26.20', 'Median: 33.40', 'Std. Dev: 13.37', 'Std. Error: 5.98')

The compressed files also validated on the w3c CSS validator

Monday, June 18

Measuring client-side performance of Web-apps

About 80% of Web-application loading time is spent on the browser. Since users prefer faster web sites, the user experience is affected by what happens on the browser.
Thus, it is possible to improve the user experience by breaking down, measuring, and optimizing the activities on the browser.

Enter Page Detailer, a graphical tool that measures client side performance of Web pages.
Page Detailer assesses performance from the client's perspective by showing how the page was delivered to the browser. It provides detailed graphical and tabular views about the timing, size, data flow, and identity of each item in a page, shown in the order started by the browser.

It has a very simple interface and is very easy to use -it will automatically capture, time, and plot calls made by the browser.

It is very useful to:

  • track number of items requested by page (how many files? From how many different servers?)
  • track response time per request/item
  • track connection time per request/item (loading many small files from too many servers? Requesting too many small files?)
  • check overall page size and load time
  • check page structure and data flow
  • optimize organization of content
  • compare page load time using different transports mechanisms

Caveats
The captured data does not include the browser's rendering time, and does not time separately any intelligent use of lazy loading techniques. Thus, it is not an exact mirror of the end user experience.

There are trade-offs between client-side performance optimization and improvements to the (holistic) user experience, e.g.: uncompressed items 'travel slower' but render faster on the browser and vice-versa.

Download from IBM alphaWorks @ http://www.alphaworks.ibm.com/tech/pagedetailer

Similar tools

  • Web Page Analyzer - Web-based Website performance tool and Web page speed analysis
  • WebWait - simple Web-based website timer: type a URL and see how long it takes to load; useful to benchmark a website or test the speed of a web connection.
  • Pingdom - Web-based monitoring suite which also tests the load time of a web page including all its objects.
  • eValid - testing & analysis suite with recording and playback options.

References

Tuesday, May 29

Superman+Spiderwoman(?!), Bollywood style

This made my day week, gotta love the flying special effects :D

Stumbling on happiness

Daniel Gilbert's fantastic book won the Royal Society prize for science books.
Two other books in the same league for me were:

  1. The Undercover Economist, by Tim Harford
  2. The Paradox of Choice: Why More Is Less, by Barry Schwartz

Tuesday, May 22

Thursday, May 17

Efficient JavaScript talk


Watch it @ the YUI Theater or download for Quicktime

5 lessons to retain from the talk:

  1. Don't modify visible objects: hide, modify, display.
  2. Best way to append multiple elements: remove node from DOM, append elements, re-attach element to DOM.
  3. Beware of the markup maintenance issues caused by the use of innerHTML.
  4. Avoid internal browser reflow (repositioning) by caching element properties.
  5. Rather than binding events to every element inside a container, bind only to the parent container. It is easy to access each of its children by id.

Wednesday, May 16

The Google Mission

I often hear "predictions" about the inevitability of a Google downfall because they are stretching themselves far beyond search. The Economist claims:

"A leapfrog may seem unlikely, given Google's reputation as an innovator, but its diversification into so many fields beyond web-searching might yet cause it to stumble"
from Out-googled, May 10th 2007.

Quoting Google's Corporate Information page:
"Google's mission is to organize the world's information and make it universally accessible and useful."
The word 'search' is not mentioned in the mission statement. Thus, the core search service as we know it is simply a means to an end -an entry point to a much more ambitious goal: "organize the world's information and make it universally accessible and useful".
Docs, apps, email, IM, and the sometimes misunderstood calendar, are all perfectly aligned with the company's strategy (unsurprisingly).
In fact, as an information organizer and management tool, a calendar is closer to their mission statement than a search box.

Tuesday, May 15

Trendspotting

Jia on bubble skirt[click on image to enlarge]

Last Sunday, walking down Portobello Road, a couple of photographers from The Style Scout spotted this young beauty on a very unique and underused bubble skirt. I, of course, had to get out of the way -no room for trend-wasters in the A-list fashion world :)

Monday, May 14

New house, new address

This is a list of the institutions I have notified of my address change, for future reference:

  1. Abbey National (Cash ISA): filled-in paper form in person, confirmed a few days later and address was successfully changed.
  2. Amazon: Added new address to my account and set it as the default one. It was that simple.
  3. Barclays (Personal Banking): Filled-in paper form in person, returned a week later to find old address still on the system. Account manager 'apologised' and changed address on the spot (on the system, no forms needed).
  4. Barclaycard (Credit Card): Filled-in form on the back of statement and sent it on pre-paid envelope. Several weeks later, statement for the following month was still sent to old address. Had to call to confirm address change.
  5. BCP (Personal Banking+Credit Card): Sent letter with copy of tenancy agreement to HQ. No confirmation and old address is still on the system.
  6. BUPA (Private Health Care):
  7. Council: Posted Westminster council tax form. A week later received letter addressed to my name, plus 3 times the same form I had sent before.
  8. DVLA: Posted driver license and paper counterpart to DVLA. Received updated license a week later.
  9. The Economist: Emailed new address and received confirmation. Also used online form @ http://www.economistsubs.com. Address change was only effective in 10 days time -it is a weekly newspaper(!), which says something about their logistics infrastructure.
  10. Electoral Roll: As per instructions on the Electoral Commision, obtained form online and posted to address given. No confirmation yet.
  11. Fidelity (Savings Funds): Setup online account and requested address change online. It was done in less than a week with a pre-paid envelope sent for the account holder's signature.
  12. Invesco Perpetual (Stocks ISA): Called and was sent change-of-address form to new address (account holder's signature is required). Sent form back on pre-paid envelope and address was changed on the system accordingly. Whole process was painless and took about a week.
  13. Inland Revenue: Called and was told that I needed to write a letter. Did so, sent letter, and received no confirmation. Called again and address was changed over the phone.
  14. O2: Updated online form. Unsure if successful since I receive electronic invoices.
  15. PayPal: Added new address to system but it is clumsy and unintuitive to remove old (verified) address.
  16. Scottish Widows (Pension): Changed address online @ http://www.scottishwidows.co.uk/global/log_in_or_register.html. Changes take effect within 3 working days but that is not too bad for a pension fund.
  17. Southampton University:
  18. University College London: Emailed student records and was pointed towards alumni form @ http://www.ucl.ac.uk/alumni/keep-in-touch/update-details. No confirmation yet.
  19. Virgin Media (Ex-Telewest, for TV+broadband): Called to transfer account and change address and a few days later received statement to new address. However, a week later called to proceed with account transfer and old address was still on the system.
  20. Solomon Smith Barney (Stock Options): Faxed address change form. Received no acknowledgment and more than a week later old address still shows on my online account. Called customer services a week later and was informed that new address is already on file and the online system will not be updated. Needless to say, they thought it was pretty normal that I should get no notification nor acknowledgment. Those who can't abandon ship due to some corporate deal already know what Smith Barney is all about -the angry comments from like minded unfortunate users like myself on their own web survey were quite clear. To those undecided, a word of warning: run! Don't come anywhere near this sinking ship.
  21. Work: filled-in online form and emailed HR. System was updated immediately.

Thursday, May 10

The (misguided) pursuit of happiness


TEDTalks, Dan Gilbert

Highlights:

  • In 2 million years the human brain tripled in mass, and not just 3 times bigger in size: it gained new structure, namely the pre-frontal cortex.
  • The pre-frontal cortex is our experience simulator: we can simulate things in our heads without the need to try them out in the world; thus, we can make predictions about the emotional impact of future events based on past experiences.
  • Degree of 'happiness' is reportedly the same for both lottery winners and paraplegics.
  • Research on Impact Bias shows events have far less impact, intensity, and duration than what people expect or anticipate.
  • Synthesis of happiness: we change our views of the world to help feel better about the world. "The one I own is far better than I thought it would be; the one I didn't get sucks."
  • Research with Anterograde Amnesiac patients replicate these findings (synthetic happiness): even though they don't remember they own it, they like it better.
  • We like best what we are stuck with.
  • We are rubbish at making predictions about the emotional impact of future events (there is plenty of evidence of how remembering the past biases forecasts of the future in the finance world too).
  • Bottom line is we don't really know what makes us happy.

Closing words:
"We have the capacity to manufacture the very commodity we are constantly chasing when we choose experience"

Daniel Gilbert is at least as good a speaker as Barry Schwartz. I'm looking forward to read the book.

References:
Dilbert


Wilson, T. D., Meyers, J., & Gilbert, D. T. (2003). "How happy was I, anyway?" A retrospective impact bias.

"People do not learn from experience that positive events are often less impactful than they anticipated, because they recall them as more impactful than they were. One reason for this, we suggest, is that both affective forecasts and affective recollections are subject to the focalism bias, whereby people think about the emotional event in isolation and neglect to consider that other events were influencing their feelings and thoughts."

Lieberman, M. D., Ochsner, K. N., Gilbert, D. T., & Schacter, D. L. (2001). Do amnesics exhibit cognitive dissonance reduction? The role of explicit memory and attention in attitude change.

"The amnesic patients in this experiment showed just as much behavior-induced attitude change as did matched control participants despite the fact that they had no explicit memory for which prints they had chosen and no explicit memory for which prints were involved in the choice."
(Behavior-induced attitude change = 'changing minds': revising attitudes to fit with current circumstances, which is conventionally thought of as self-deception or rationalization.)

Gilbert, D. T., Pinel, E. C., Wilson, T. D., Blumberg, S. J., & Wheatley, T. (1998). Immune neglect: A source of durability bias in affective forecasting.

Affective forecasting is "the ability to predict one's hedonic reactions to future events."

Wilson, T. D., Wheatley, T. P., Meyers, J. M., Gilbert, D. T., & Axsom, D. (2000). Focalism: A source of durability bias in affective forecasting.

"When we're trying to predict how happy we will be in a future that contains Event X, we tend to focus on Event X and forget about all the other events that also populate that future—events that tend to dilute the hedonic impact of Event X."

Wilson, T. D., Meyers, J., & Gilbert, D. T. (2001). Lessons from the past: Do people learn from experience that emotional reactions are short lived?

"People who received positive or negative feedback on a test were not as happy or unhappy as they would have predicted. People in the positive feedback condition did not learn from this experience when making predictions about their reactions to future positive events (Impact bias & Focalism). People in the negative feedback condition moderated their predictions about their reactions to future negative events (Immune neglect), but this may not have been a result of learning. Rather, participants denigrated the test as a way of making themselves feel better and, when predicting future reactions, brought to mind this reconstrual of the test and inferred that doing poorly on it again would not make them very unhappy."

Dunn, E. W., Wilson, T. D., & Gilbert, D. T. (2003). Location, location, location: The misprediction of satisfaction in housing lotteries.

"People tend to overestimate the emotional consequences of future life events, exhibiting an impact bias. The authors replicated the impact bias in a real-life context in which undergraduates were randomly assigned to dormitories (or “houses”). Participants appeared to focus on the wrong factors when imagining their future happiness in the houses. They placed far greater weight on highly variable physical features than on less variable social features in predicting their future happiness in each house, despite accurately recognizing that social features were more important than physical features when asked explicitly about the determinants of happiness."

Saturday, April 21

The Ass-Kisser Project

Jobsintown.de aims to help those whose career path is described by the picture above (via BoingBoing).

Wednesday, March 28

Priceless



From the cool people behind We Make Money Not Art

Wednesday, March 21

Cucurrucucu



The great Caetano singing in Spanish on Almodovar's movie Talk To Her.
Beautiful.

Thursday, March 15

First Kiss


15 years later, on a night out with his mates:
-"Mate, I still remember my first kiss...it was with Allison from 5th grade! What about you?"
-"Me? Hmm, let me see... Well, I spent this weekend on granny's farm, and..."

Wednesday, March 14

London calling

Capital of the World

Now settled 5 minutes away from Primrose Hill, I often recall the glorious London of my first week with The Clash looping constantly in my head: alive, drop-dead gorgeous, intense, truly cosmopolitan, and brimming with possibilities! 9+ years later it still feels that way.

Monday, March 12

My Dilbert Financial Test

  1. Make a will - @TODO
  2. Pay off your credit cards - DONE, never had debt.
  3. Get term life insurance if you have a family to support - @TODO
  4. Fund your 401k Pension to the maximum - DONE
  5. Fund your IRA ISA's to the maximum - @TODO, I'm about 60% done.
  6. Buy a house if you want to live in a house and can afford it - @TODO
  7. Put six months worth of expenses in a money-market account - @TODO, only have 2 months.
  8. Take whatever money is left over and invest 70% in a stock index fund and 30% in a bond fund through any discount broker and never touch it until retirement - DONE
  9. If any of this confuses you, or you have something special going on (retirement, college planning, tax issues), hire a fee-based financial planner, not one who charges a percentage of your portfolio - NO NEED


3 out of 8 is not particularly impressive...

Dilbert's 'Unified Theory of Everything Financial'

Saturday, February 10

Vista Enterprise review

As a bizarre new year resolution, I decided to guinea pig for Microsoft and have been using Windows Vista Enterprise Edition since January. I wanted to see if it addressed the many problems I have with XP Pro, even after SP2. Below is my top 5 list of complaints that I would have liked to see fixed on the new OS:

  1. Need to restart OS after software updates. Enough said.
  2. Fix underlying file copy algorithm and its often absurd time estimates. Raymond has the details.
  3. On my 1.86 GHz Pentium M Processor with 2GB RAM laptop, trying to copy (or simply read) a damaged CD or DVD can cause the whole system to slow down to a halt unless the whole process is killed. Killing the process is sometimes very time consuming and frustrating -the OS just doesn't seem to be in control and I need to repeat the instruction several times. Worse, I sometimes get the dreaded blue screen.
  4. The streaming experience of Windows Media on XP is ghastly. Even on a reasonably fast network the buffering is useless (and clueless, really) and provides an awful user experience. The contrast with Apple's Quicktime is embarrassing for Microsoft's product.
  5. The "Safely Remove Device" feature is often unable to perform the operation, requiring (again) repeating the command multiple times (or changing settings). It often returns the useless message "This device cannot be stopped right now" even though there is nothing else running on the machine that could possibly be accessing the device.
So, how is it with Vista Enterprise?
Well, it certainly looks good.
Also, with the same hardware configuration, it feels faster and more responsive than XP.
However, despite the initial wow with the Aero UI, the harsh reality after only a few weeks of use is that:
  1. I had to restart the system after updates. Not once, not twice. Many, many times. I find this unacceptable and I am not alone.
  2. I had blue screens. I had one (caused by reading a damaged DVD), and a colleague of mine at work already had 2 in 2 weeks of use (he is using Windows Vista Ultimate Edition, though).
  3. The new copy/move dialog is still slow, inaccurate, and just painful to use, especially when moving large numbers of (large) files. I wish I could disable the time estimate feature completely to avoid the annoying "preparing to copy" step that can take a really long time.
  4. Streaming capabilities of Windows Media seem to be improved.
  5. "Safely Remove Device" feature still has the above mentioned mood swings.

1 in 5 is not good. Not good enough.

On top of this, Vista's crises of confidence and personal problems are extremely irritating: UAC? What were they thinking? Raymond writes, back in 2003, that users don't read dialogs. Popping a dialog every minute is a sure way to induce dialog-blindness across the user base. Other people agree: there is too much intrusion breaking activity flows, and there are too many confirmations required.

It also seems Vista, despite its 5 years in development, is somewhat unfinished and unpolished. Underneath the Aero beauty plenty of XP and pre-XP horror creeps in.

2007/03/26 Update: More people noticed the copy/move/delete slowness.

Wednesday, January 3

The Riddler

...though I'd rather be The Joker :)

Your results:

You are The Riddler


Riddle me that, riddle me this, who is obsessed with having a battle of wits??




Take the Supervillain Personality Quiz

Saturday, December 30

Superman

Although it seems I am also (disturbingly) 72% Wonder Woman and 72% Supergirl...

Your results:
You are Superman

























Superman
90%
The Flash
75%
Wonder Woman
72%
Supergirl
72%
Green Lantern
70%
Robin
65%
Spider-Man
65%
Iron Man
65%
Catwoman
55%
Batman
50%
Hulk
40%
You are mild-mannered, good,
strong and you love to help others.


Take the Superhero Personality Test

Wednesday, December 20