Archive - April 2007

Word count for HTML documents

2007-04-19 13:35

Ok, I’ll have to be careful, so this site doesn’t become a Komodo-only fansite, but I still feel the need to praise the exceptional value of this editor.

I’m currently busy preparing a paper. The thing is, however, that I have to produce an approximate number of words in this paper. Most people would’ve just say “use wc”. Normally, this is a good suggestion, but as the paper I’m writing is HTML, WC isn’t neccesarily accurate. It ends up counting elements surrounded by whitespace as “words”. Which is, according to the tool’s design, entirely correct. It’s correct, but not correct for me, so I needed to roll my own, and this is where Komodo comes in very handy:

Since Komodo is a XUL application, it also conveniently exposes a document object, which we can reuse for this purpose. See below, for a macro that may not qualify as ‘beautiful’, but it’s still extremely handy:

komodo.assertMacroVersion(2);
if (komodo.view) { komodo.view.setFocus() };
var text = (komodo.editor.selText || komodo.editor.text).replace(/<\?.*\?>/,"").replace(/<!.*>/,"");
var doc = document.createElementNS('http://www.w3.org/1999/xhtml','floble'); // implementation.createDocument('http://www.w3.org/1999/xhtml',null,null)
doc.innerHTML = text;
text = doc.textContent.replace(/^\s*/,'').replace(/\s*$/,'').replace(/\s{2,}/igm," ");
textNodes = text.split(/\s+/);
alert("Wordcount: "+textNodes.length);

So, you’re wondering what more you can do? Well, mostly anything you could ever think of doing in a browser.

Opera news: 9.20 and Wii released

2007-04-12 10:45

Ok, several pieces of good news today.

Opera 9.20

I recently blogged about Opera 9.20, beta 1. Yesterday saw the release of the final version of Opera 9.20. The changelogs since beta 1 are here:

Go download now.

Opera on the Wii

Yes, the much anticipated full version of Opera on the Wii is now available. Instead of boring you with a lot of details, here’s the most important stuff to note:

  • The download remains free until June 30th, 2007.
  • Several zoom modes: Automatic or manual.
  • Better use of screen real estate than in the beta.
  • More intuitive scrolling
  • Multiple cursors. You can have a real browser battle with your spouse, kids or friends.
  • My personal killer use of the Wii browser is YouTube on my TV.

If you want to know it, take the feature tour - or just go to the Wii Shop Channel and download it while it lasts.

I cannot begin to express ...

2007-04-02 16:12

… how satisfied I am by this

Now, Steve, here’s my wishlist:

  • As much as you think iTunes rocks, I don’t. Allow me to download the songs directly from the web store. Please. I don’t want to buy a Mac, or have to endure the pains of Windows to be able to buy music. Please.
  • Go and drag more heads out of asses, over at the other major labels. The revolution has come, and it’s time for them to join.
  • Would you mind fixing the same for video? DRM is just as bad for video content.