Time for changes

My professional live will change. Today I left notice in Hewlett-Packard’s HR department. Starting from December 1st I wont be working for HP anymore. I will change regular job to contractor work as network consultant. Time between contracts I will use to develop some software, there are some ideas bouncing in my head ;-)))

Technorati have put my blog on hold

Somehow it looks like Technorati have put my blog on hold. When I check Technorati, last update to my blog, according to them was on Oct 24th. I could not blame TR since Technoratibot was not seen in webserver logs since Oct 24th, so no wonder they don’t know about all new posts :)) Well, I pinged TR several times, but bot still avoids my server…

Yesterday I made attempt to contact Technorati. To be honest, my customer experience is much better than after my attempts to contact Alexa, but still I would not call it good experience.

Contact us link is not buried and lets You to send real email to TR. Does let You send? I have to believe that it was send since I’ve got no confirmation that email was sent. Standard, blah blah blah from some mindless bot would give me info that my issue was registered. I do not dare to think somebody actually could try solve my issue, but at least this blessed feeling of registered issue. We mere users love this feeling.

Google Mail and counter of doom

You know Gmail. And now how marvelous service it is… A lot space for emails… And even on front page, they assure You how much space there is available Right now it says:

Lots of space

Over 2757.272164 megabytes (and counting) of free storage so you’ll never need to delete another message.

And counter goes on… Great, right? But when You check JavaScript code, it becomes interesting. There is function updateQuota. Go and read it:

function updateQuota() { 
  if (!quota) {
    return;
  }
 
  var now = (new Date()).getTime(); 
  var i;
  for (i = 0; i < CP.length; i++) {
    if (now < CP[i][0]) {
      break;
    }
  }
  if (i == 0) {
    setTimeout(updateQuota, 1000); 
  } else if (i == CP.length) {
    quota.innerHTML = CP[i - 1][1];
  } else {
    var ts = CP[i - 1][0];
    var bs = CP[i - 1][1];
    quota.innerHTML = format(((now-ts) / (CP[i][0]-ts) * (CP[i][1]-bs)) + bs); 
    setTimeout(updateQuota, 1000); 
  } 
} 

What is funny? That quota change is strictly time based function. There is no call to check real available space, it is just plain time based function. To be honest it is limited, when time reach CP[CP.length][0] it will stop ticking.

I do believe, that values are chosen very carefully, and in any given time quota value have its roots in reality. However on first glance You may think “Geeee Google is faking quote data”, when You realize there is no connection to check real quota.

Issue was brought to my attention by Tomek

Does Rails reload all in development mode?

In many places You can find info that Rails in development mode checks whether files with application were modified and in such case reloads them. That way You can test always latest version of application.

This is not correct, when You think Rails reloads whole application. Reloaded can be content from app directory. I did not verified that in Rails code, it is from my observations. In particular there is no such checks for files in lib directory. So when You made some changes in those files (like in my Act As Authentication modification, You have to restart whole application, even in development mode.

JavaScript – no automatic conversion to number

I was surprised when I wrote code to extract values from cookie and using it to set map center. Well it looks like in JS there is no automatic conversion from string to number.

Code looks like:

   if ( res = getCookie("rnsloc").match("(.*)-(.*)-(.*)") ) {
      map.setCenter( new GLatLng(res[1], res[2]), res[3] )
    } else
      map.setCenter( new GLatLng(52.2419, 21.01), 11);

getCookie returns cookie content as a string, so does regexp. Well it works, but not 100% as it was expected.

It sets map center as it should, but zoom level is set to zero, or in other words there is no zoom. After some experiments I have discovered, that res[3] value (string “12”) is not converted to number, so zoom is set as 0. Well so working code should be:

   if ( res = getCookie("rnsloc").match("(.*)-(.*)-(.*)") ) {
      map.setCenter( new GLatLng(res[1], res[2]), Number(res[3]) )
    } else
      map.setCenter( new GLatLng(52.2419, 21.01), 11);

Small difference of direct cast, but it make its day. However I don’t know why GLatLng accepts numeric strings as arguments, and setCenter does not…