Quinthar

How to execute code whenever Back button is pressed?

So I'd like to execute some JavaScript every time the page loads, regardless of whether it's from a new visitor, or click of Reload, or a click of Back, or whatever.  However, I'm finding Back to be particularly tricky.  Here's the test code:

<html>
<body onload="alert('Hello world!');">
    <a href="link">link</a>
</body>
</html>
Nothing fancy there, should pop an alert box every time right?  Wrong: click on the link and then click Back, and the alert doesn't show.  (At least, not on Ubuntu 8.04 Firefox 3.)  Odd. 

Even stranger, it *does* show if you include a large (~100KB) external script:
<html>
<head>
    <script type="text/javascript" src="jquery.js"> </script>
</head>
<body onload="alert('Hello world!');">
    <a href="link">link</a>
</body>
</html>
But try it with a small (~4KB) external script and it stops working.  The mystery deepens.

The only explanation that makes sense is there must be some kind of delay when the page loads for the Back button to trigger the onload event.  Too small a delay (too small a file to load) and it doesn't work.

Any ideas how to reliably execute code on every load, including Back?  I'll use the jQuery trick for now, but I'm concerned that it won't always be reliable.



Update: Curtis figured it out: It's due to fancy Firefox caching rules. There are several criteria that go into whether the page is reloaded each time, one of which is whether there's an "unload handler". Turns out it wasn't the *size* of including jQuery, it was due to jQuery setting an unload handler. Anyway, of the many solutions, the easiest is to simply set "Cache-Control: no-store" (or "no-cache", if HTTPS). Thanks Curtis, mystery solved!

Review: Everything Bad is Good For You

For reasons I don't understand, people love to hate.  Democrats love to hate Republicans, Christians love to hate Atheists, VI hates Emacs, etc.  But the one thing people of all walks of life seem to jointly hate is how the modern way of life is gradually corrupting the moral and intellectual fiber of their fellow man.

I think Idiocracy gave the most condensed (and entertaining) presentation on the topic, essentially arguing that stupid people reproduce faster than smart people, and because everybody is getting stupider, there's a global "race to the bottom" where the intellectually meek inherit the earth.

But this notion was refined and socially reinforced well before that movie came onto the scene.  For as long as I've known, I've been surrounded by people who make dire predictions and cynical extrapolations of today's trends, with the inevitable conclusion that humanity's end is just a choice between Nevil Shute or Aldus Huxley.  More or less destructive, but with mass stupification taken for granted.

That pessimism, that general hatred of the new and wistful longing for better times, never sat well with me.  After all, the only reason the "new" came to be was because billions of people individually and as a group chose to make it so.  It's hard to believe that generations would labor endlessly to actively worsen the world and squander their mental capacities.

So at risk of engineering my own "scenario fulfillment" I was drawn to Everything Bad is Good For You -- a book making the outrageous claim that, shockingly, humanity's toil is paying off.  Yes, it sounds incredible, but what if people *weren't* getting stupider, and in fact all these brilliant information innovations were in fact contributing to a global rise in intellect?

I expect the top rejection of the book amounts to the carefully researched rebuttal: Sounds too good to be true.  Watching TV doesn't rot your brain?  Playing video games doesn't erode your morals?  You mean education and self improvement could actually be fun?  Heaven forbid!

But that's precisely what the book argues -- quite compellingly.  It's the sort of thing that seems so obvious when you read it, it's truly refreshing.

Indeed, it's such an obvious conclusion, I don't even know what to say about it. 

And perhaps that's its core weakness: it's got no punch.  It has no "call to action".  As a meme, it lacks any sort of virulent property that would convince people to convince others.

Somehow, conventional wisdom has adopted the opposite of this book's conclusion.  But how to turn that around?  Or, is it even necessary?

After all, this "sleeper curve" will continue whether or not people acknowledge it.  And I'm not sure if acknowledging it explicitly will make it happen any better or faster.

Similarly, even after reading it, I'm not sure what advice to take from it.  How do you "learn" from a book that seems so common sense (even if that sense is far from common)?

So it's a bit of an anti-climax for me.  Good stuff, reassuring, but it leaves me with a sorta "ya, so now what?" feeling.

Why are future user interfaces so lame?

What is it with futuristic user interfaces being so pointless?  Whether it's g-Speak or Microsoft Surface (even the spherical one), all the applications are absurd -- after years of touch screen technology, everybody *still* shows off that stupid photo-organization application.

Seriously: when is the last time you dumped a bunch of pictures in a pile and manually sorted them?  I honestly don't know if I've done it once in my life; this isn't solving a problem I have.  Every time I see that application I think "you *still* haven't figured out anything useful to do with that thing?"

Everybody is trying so hard to become the next-generation UI that they've forgotten a critical lesson: *this* generation of UI is really pretty good.  It's refined through thousands of iterations of tweaks and real-world experimentation.

Take the multi-touch fad that has generally fizzled out.  Honestly: how often do you use multi-touch on your iPhone?  At the end of the day, most actions work perfectly fine with one finger: just because you *can* use two fingers doesn't mean doing so adds any value.

So I'm going to go out on a limb and predict that the user interface of tomorrow is going to look a helluva lot like the UI of today.  And that's because the UI of today looks an awful lot like the desktop of yesterday.

The key is continuity: making small, gradual steps from what you know to what you don't.  And all these fancy "next generation operating systems" keep managing to stay in the distant future because everyone else is too busy living in the now.

Which reminds me of a surprising lesson I learned when moving from Windows XP to Ubuntu (Vista was the last straw).  And that lesson was just how awesome the command line is, and how just splitting the window in VI as needed is so much more powerful than managing a bunch of stupid windows.

Indeed, the lesson was all the "advances" in UI technology provided by generations of Windows have actually *reduced* my productivity.  But like the boiling frog, I just never noticed.

At the end of the day, most data is not amazingly beautiful 3d graphics projected in a virtual cave environment.  Most of it is really boring: rows of numbers, to do lists, log files, email.  Most of it is text.  And I don't see that changing anytime soon.

So I'm looking forward to the UI of the future.  But I bet the primary mode of interaction will still be a keyboard, and it's amazing feature will not be sorting piles of random photos, but sorting, processing, and generating text and numbers in amazing ways.

Personally, I'm hoping for LCARS.

-david


When did Agile become so Rigid?

I really dislike the term "agile development".  I'm fine using "agile" to describe people or teams.  But using it to describe a methodology seems to completely miss the point.  You wouldn't say a gymnast uses an "agile technique".  You'd just say the gymnast "is agile".

So articles like "When Agile Projects Go Bad" sorta confuse and grate on me.

You'd never read an article titled "When Agile Gymnasts Fall" because it makes no sense; a gymnast who falls is -- by definition -- not very agile.  Similarly, an agile project that fails due to a lack of agility is rather paradoxical.  (Though there are many other ways to fail than by lacking agility.)

But this isn't just a problem of semantics.  Rather, I think this is symptomatic of a broader problem in the agile movement: it doesn't frickin' work.  To borrow from my good friend Lao Tze:

"The agile that you know is not the true agile."

You can't learn agility by reading and following.  You become agile by doing, failing, changing, and doing again.  The most agile people I know read the fewest books on it.  Similarly, I don't know anybody who's seriously studied the subject of agile development techniques gotten the least bit better.

So here's my advice: if you want to be agile, put down the book and just start making it up as you go.  If what you're doing isn't working, try something different.  If what you're doing works, try cutting out a step and see if it still works -- or even works better.  Repeat.

You're certain to make wrong steps.  You're certain to encounter failure -- indeed, failure will likely be your steady state.

But eventually you'll figure it out, and every once in a while it'll work out great.

Welcome to the world of agility.  No reading required.

- David Barrett

ThePirateBay passes 25M simultaneous peers, leaves iTunes in dust

I know there's a dearth of real-world data on piracy, but here's a dash: the Pirate Bay recently passed the 25M mark in terms of simultaneous peers.  Here's the data itself, from TorrentFreak:

    Date            Peers (M)
    11/01/2006      1
    11/01/2007      6
    09/21/2008      15
    11/01/2008      20
    11/15/2008      25

That's interesting, but it looks much more compelling graphically:



So the rate of real pirates seen by The Pirate Bay has increased by 25x in just over 2 years.  (As for how meaningful this data is, it's suggested that TPB tracks about 50% of all torrents.)

Anybody care to guess whether that 20:1 ratio of illegal to legal downloads ratio is going?  Might it be more like 100:1 today?  The growth of piracy over legal downloads is just staggering.

-david

- Jan 2014 (1) - Mar 2012 (1) - Nov 2011 (1) - Oct 2011 (1) - Apr 2011 (1) - Mar 2011 (3) - Feb 2011 (2) - Jan 2011 (9) - Nov 2010 (1) - May 2010 (1) - Mar 2010 (1) - Feb 2010 (1) - Jan 2010 (1) - Dec 2009 (1) - Nov 2009 (1) - Oct 2009 (1) - Sep 2009 (1) - Aug 2009 (2) - Jul 2009 (1) - Jun 2009 (4) - May 2009 (3) - Apr 2009 (3) - Mar 2009 (10) - Feb 2009 (5) - Jan 2009 (3) - Dec 2008 (5) - Nov 2008 (5) - Oct 2008 (5) - Sep 2008 (4) - Aug 2008 (5) - Jul 2008 (11) - Jun 2008 (8) - Feb 2008 (1) - Aug 2007 (1) -