Friday, August 26, 2011

How to have page up and page down in safari iPad

Add these as bookmarklets in your bookmark bar:

javascript:window.scrollBy(0,-window.innerHeight+20)

javascript:window.scrollBy(0,window.innerHeight-20)


They are for page up and page down, respectively.

Thursday, August 11, 2011

How To Optimize

Donald Knuth:


We should forget about small efficiencies, say about 97% of the
time: premature optimization is the root of all evil. Yet we
should not pass up our opportunities in that critical 3%.


(Source is here. See the 2nd paragraph on the right column on page 8.)

Here's the general advice on optimizing:

1. Don't do it
2. Don't do it yet
3. Don't do it until someone complains that it is slow.
4. And when someone complains, find the bottleneck - measure it! Get a feel of how slow it is. Remember:

Don't optimize what you cannot measure because therein lies the road to insanity.

5. Optimize one step at a time and always, always measure the gain. If there's no gain then undo your "optimization".