Will Oller .com

Avatar

Learning to match the beat of the Old World man.

eMusic: “Maths is hard!”

Just got an email from eMusic informing me of their price for the 30/month plan increasing from $9.99 to $11.99. But, because they love me so much, they’ll throw in an additional 10 downloads, making my $11.99 worth 40 downloads.

Less is not more.

Then they show me a nice table and declare “[I] will actually pay less per download.”

Emusic\'s cost comparison

This is a nice gesture, showing me the breakdown and everything. Next time, though, somebody might want to re-check the math and send a slightly modified email: not only is the math wrong (11.99/40 = 0.29975) but the bad math tells me I will be paying more per download. If I wasn’t the kind of guy who carries a calculator around and likes to correct everybody, I’d have thought “You guys are idiots; I’m not paying more for less.”

Before Excel we are all equally wise - and equally foolish

Formulas can be unruly beasts, but this is also a simple matter of proofreading. It reminds me of their ongoing problem with mismatched track names. It would be a shame to lose a customer due to a misapplied Excel formula.

Home from vacation. Photos to …

Home from vacation. Photos to follow!

If you install Myspace Chat or…

If you install Myspace Chat or uTorrent on a public terminal PC, you are a bastard and I hate you.

On vacation in Yellowstone.

On vacation in Yellowstone. Be back to work on Thursday.

Use Firebug to Update A Huge Form

Had a problem recently where I had to update hundreds of input fields within a shopping cart, setting prices of product variants from $200 to $49.

They were named in sequence:

JAVASCRIPT:
  1. ...
  2. <input name="vs[1667][price]" value="200" />
  3. <input name="vs[1668][price]" value="200" />
  4. <input name="vs[1669][price]" value="200" />
  5. ...

So I busted out the command line in Firebug.

JAVASCRIPT:
  1. for (var i=0; i<10000; i++) {
  2.    if(document.productvariantsform.elements["vs[" + i + "][price]"].value) {
  3.       document.productvariantsform.elements["vs[" + i + "][price]"].value = "49.00";
  4.    }
  5. }

but all I got were "has no properties" errors.

I got in touch with my local Javascript guru who helped me come up with some code that did work:

JAVASCRIPT:
  1. var frm = document.productvariantsform;
  2. for (var i=0; i <frm.elements.length; i++) {
  3.    if ((frm.elements[i].name.match(/\[price\]$/)) && (frm.elements[i].value)) {
  4.       frm.elements[i].value = "49.00";
  5.    }
  6. }

This saved literally hours of [TAB][TAB][TAB][TAB][Ctrl+V].
Thank you Firebug!

Continue Next page