Wed, 12 Nov 2008

Three Years on a Novafoam Mattress

My post about the first night on my Novafoam mattress still gets the most traffic on this blog (although a homework assignment about the French health care system has been remarkably popular the past month or so). Every couple of months, I get an email asking about the mattress. Dale emailed me this morning to ask how we like the mattress after sleeping on it for over three years:

Hi,
In searching the web, I found your blog ("first night on..." on pinkhamster) on
shopping for a Novafoam mattress - now that your blog is more than three years
old, I'd like to hear an update if you could take a moment to let me know (or
add a posting and point me to it) as my wife and I are in need of a new
mattress and no better source than a longer-term customer...
Thanks,
Dale

I'm happy to report that we are still satisfied with our Novafoam mattress. It hasn't lost its support, and it still very comfortable. One thing that I didn't mention in the original post is that motion isn't transmitted laterally much when your sleeping companion moves. It's much better than the bouncing that happens on when sleeping on a cheaper spring mattress or an air mattress. Having spent two nights on an air mattress a couple weeks ago reminded me how much I like our mattress. I think we'll probably buy a King Novafoam mattress when we move to a larger home.

p.s. This season of Penn & Teller's Bullshit! has an episode on mattresses and sleep aids.

misc | Permanent Link

I'm An Idiot

To cover my state and federal taxes for last year and my estimated payments for this year, as well as my IRA contribution, I scheduled a transfer from my ING Direct account to my regular checking account for Monday. I actually had enough in there to cover the taxes, but not the IRA contribution, so I wrote a check for the contribution and mailed it on Monday so I could be pretty confident that the ING transfer would be complete before the check was presented for settlement. Despite the fact that the government was going to be sucking a bunch of money out of my account, I was relieved to have my taxes done and all the payments worked out.

One small problem: I accidentally scheduled the transfer from my checking account to ING instead of the other way around, so on Monday my checking account was emptied resulting in the rejection of three of the tax withdrawals as well as a scheduled credit card payment, generating four NSF fees, and my taxes not being paid on time.

I called ING to schedule the transfer of the mistaken withdrawal as well as the original deposit I meant to make, and my other bank to ask that they honor payments presented in the mean time. I hope that my IRA contribution check clears or I may have to file an ammended tax return without the contribution and pay more taxes plus penalties. What a disaster.

misc | Permanent Link

Fri, 07 Nov 2008

Convert 15-character Salesforce IDs to 18-characters IDs with PHP

Saleforce uses 15-character IDs as primary keys for every record. When retrieving an ID over the API, 18-character case-insensitive IDs are returned. Generally, this doesn't cause any problems because the 18-character version can be used anywhere the 15-character one is. One problem arises though when you are storing IDs in a text field. In this case, you may need to convert a 15-character ID into its 18-character version. Salesforce provides a description of how to perform this conversion.

Here is a PHP implementation of the algorithm.

function sf15to18($short) {
   $chunks = str_split($short, 5);
   $extra = '';
   foreach ($chunks as $chunk) {
      $chars = str_split($chunk, 1);
      $bits = '';
      foreach ($chars as $char) {
         $bits .= (!is_numeric($char) && $char == strtoupper($char)) ? '1' : '0';
      }
      $map = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ012345';
      $extra .= substr($map, base_convert(strrev($bits), 2, 10), 1);
   }
   return $short . $extra;
}

tech » salesforce | Permanent Link

The state is that great fiction by which everyone tries to live at the expense of everyone else. - Frederic Bastiat