• About Me!!!
  • Its Me!!!

Mani's Weblog

~ Naangalum Sindhippomla!!!

Mani's Weblog

Monthly Archives: November 2005

Cache-Busting with Javascript

24 Thursday Nov 2005

Posted by Mani in Technical

≈ Leave a comment

Got an opportunity to work with Javascript. On reading, got this information.

What it is?

As we all know, when we are browsing the pages fetched by the browser will be stored in the browser’s cache. If we want to get the page from the server and not from the cache, using Javascript, it is very simple. Just add a random key-value pair to the URL. This should be unique for each request.

How to do?
Set your request URL as :
URL +”?rand=” + (Math.random() * 99999999);

How it works?

I assume that, the browser MAY maintain a key-value pair (Something like a HashTable), that contains the “URL of the requested page” as the key and the “contents of the page” as its value. So when a request is made, it first checks its cache and if it finds a page it returns it, else fetches from the server. In our case, since random() generates different values for each call, the browser will assume that this is a new request for a page and fetches it from the server. This in no way affect the server. Since the server may not know about the additional parameter, it will discard the variable.

printf(_”string”) – What does that “_” mean?

10 Thursday Nov 2005

Posted by Mani in Technical

≈ 1 Comment

Most of us might have encountered a code like the one mentioned above. What does this mean? Goooogling gave me its meaning.

Actually, a macro by name _(str) will be defined as follows:
#define _(str) gettext(str)

What gettext() does?
The gettext function translates the “str” from the natural language message into the user’s language by looking up the translation in a message catalog.
From this, what I understand is, suppose I am using Latin language in my machine. And the string “str” is in English. So whenever printing, the gettext() translates English to Latin gives it to printf(). So I’ll be seeing the messages in Latin.

Hope Microsoft also uses a similar kind of macro “_T” for displaying strings in multi-byte format.

Subscribe

  • Entries (RSS)
  • Comments (RSS)

Archives

  • January 2017
  • November 2016
  • November 2015
  • October 2015
  • June 2015
  • May 2015
  • March 2015
  • January 2015
  • December 2014
  • November 2014
  • October 2014
  • September 2014
  • August 2014
  • July 2014
  • May 2014
  • January 2014
  • November 2013
  • October 2013
  • September 2013
  • August 2013
  • May 2013
  • December 2012
  • March 2012
  • January 2012
  • May 2011
  • April 2011
  • October 2010
  • August 2010
  • July 2010
  • June 2010
  • April 2010
  • February 2010
  • January 2010
  • December 2009
  • August 2009
  • June 2009
  • May 2009
  • March 2009
  • December 2008
  • September 2008
  • July 2008
  • June 2008
  • January 2008
  • November 2007
  • October 2007
  • September 2007
  • July 2007
  • May 2007
  • February 2007
  • December 2006
  • November 2006
  • October 2006
  • July 2006
  • June 2006
  • May 2006
  • March 2006
  • February 2006
  • January 2006
  • November 2005
  • October 2005
  • September 2005

Categories

  • Computers
  • Games
    • Candycrush
  • Personal
  • Review
    • Book
    • Movie
    • Software
  • Science
  • Social
    • Culture
  • Sports
    • Cricket
    • Tennis
  • Tamil
  • Technical
    • Android
    • Linux
  • Technology
  • Uncategorized

Meta

  • Register
  • Log in

Blog at WordPress.com.

Privacy & Cookies: This site uses cookies. By continuing to use this website, you agree to their use.
To find out more, including how to control cookies, see here: Cookie Policy