Saturday, April 26, 2008

Understand a person from his/her blog comments

What if there exists a system that goes out to all blogs, reads the comments, aggregates them into individual profiles. Each comment often has the name and website. A person shares her opinion at this blog, another one at another blog. Soon enough, you will be able to understand her thoughts. It's a behavioral data mining operation.

Even more powerful, enhancing this with user-provided personal profiles (like from Yahoo, Google, Facebook, or something with individual data). At the end, you get a very powerful and invasive system. This idea would immediately raise a red flag for privacy advocates. Actually, I can't think of any good application beside monitoring "suspicious" people, which already has a vague definition that could be, very well, anyone. Some big organizations, government or commercial, might already be doing this sort of analysis. Google is the prime candidate with sufficient technical capacity to perform such operations.

Wednesday, April 23, 2008

Nested JavaScript inclusions and IE

Consider the following scenario: file.html contains inline JS code to load remote.js and call a function in remote.js And in remote.js You would expect the output in this order and Firefox actually honors this order correctly:
  1. Before loading remote.js
  2. After loading remote.js
  3. In remote function
IE on the other hand will give you an error ("Object Expected") and will call the function prematurely. Meaning that it executes before loading remote.js. This is an unexpected behavior. Fortunately, you can add the attribute defer="defer". This will specifically prevent IE from executing and actually produce proper result. Hmm, it's IE! It has its own style!

Labels:

Thursday, March 27, 2008

Cache Control - Server vs. Client

The server can set Cache-Control as far as it wants but if the client browser (Firefox, IE, etc.) says something else, the client rules. For example: an image with proper server's Cache-control and Expires headers. If the client says "Cache-control: max-age=0" in its request, a conditional GET request will send and HTTP 304 code would return from the server. The expected and best behavior would be no request at all.

It's not the server's fault, it's done its part correctly. The client is now in control and it seems Firefox and IE on my machine don't like caching that much. So 304's instead of zero request for now.

Update: Firefox actually is pretty smart on this. If you click F5, Refresh or a direct reload, it will send cache-control: max-age=0. It means the server will return 304's. But if you move from one page to the next and the page reuse other cached component, Firefox won't make any request at all, which is the expected behavior. Now I can sleep tight knowing that our pages are faster as fewer conditional GET requests are made.

Sunday, March 16, 2008

Writing a persuasive message with AIDA

Writing a persuasive message needs 4 components:
  1. Attention = What? You must get audience attention
  2. Interest = Okay, then what? You continue to build their interest in the subject
  3. Desire = Why? Why should they care, what is in it for them?
  4. Action = How? Okay, I'm sold, what's next?
Characteristics of a good persuasive message:
  • Visual - use story telling, put them into your shoe, your vision
  • Personal - talk to them directly, not as a group but as an individual, one-to-one
  • Creative - use fresh ideas instead of some cliche, which is boring. And this is the hard part because the longer people get exposed to media, the more likely they've seen it before and learn to ignore/skip/forget about it

Labels:

Saturday, March 15, 2008

JavaScript - setTimeout vs. setInterval

If you need to delay execution (like sleep function), use setTimeout. If you need to repeatedly do something (like refresh stats), use setInterval.
  • window.setTimeout("show();",2000); // wait 2 seconds then run show()
  • window.setInterval("show();",3000); // run show() every 3 seconds

Labels: