Caching pages on Apache

I don’t use any blogging software for my site. I just hand-wired it some years ago. When doing this, one of the biggest problems was caching. Consider each blog entry page. Each page has the same template, but different content. Both the template and content could be changed. So ideally, blog pages should be served dynamically. That is, every time someone requests the page, I should look up the content, look up the template, and put them together. ...

Bollywood actress jigsaw quiz

I've jumbled up pictures of 10 Bollywood actresses. You can move the jumbled blocks around, like a jigsaw. Can you guess the actresses? Comments sathya 14 Aug 2008 6:52 am: the score says 10/5 for all correct answers. pls check :-) ectp 14 Aug 2008 11:14 am: 10/10 :) Had problems with the spelling in q.8. Can’t complain, as the standard “Don’t worry about the spelling. Just spell it like it sounds, and the box will turn green.” was not there. :) S Anand 15 Aug 2008 12:47 am: Yeah, this quiz is a bit finicky on the names. Sorry about that! Malini 16 Aug 2008 2:36 am: me a fan of urs… crazy abt ur kannada song collection… Neela 20 Aug 2008 1:51 am: 10/10 :). Amazing quiz. Amazing blog. Great job! How do you find the time to do all this? warda 3 Nov 2008 12:11 pm: this quiz sux…all f d actreses were so easy 2 guess….wuff….i sure wasted my time mehru 8 Nov 2008 2:38 am: nice quiz…i dnt agree wid warda d actreses were nt dat easy 2 guess…gud job s,anand Senthilkumar.S 24 Mar 2009 9:19 am: got 9/10. interesting quiz… Nivethetha 11 Sep 2009 3:20 pm: Hi Anand, I got 9/10. Amazing quiz. Keep quizzing Juliet Rosalin Dash 21 May 2010 7:19 am: hey anand i have secured 10/10 keep going and publish this type of quizzes

How often to write

If you look at the number of entries I’ve written every month since 2005, there has been a clear decline. While I was averaging almost an entry a day in 2005 and 2006, that dropped to 2-3 entries a month since mid-2007. This doesn’t bother me. I’ve been lucky to never have lost sight of the purpose of this website. This website is meant for me. Not for you, the reader. For me, the author. ...

A new home page

I have a new home page design. (If you’re reading the RSS feed, check the home page.) One reason is that the old home page’s design sucked. Almost everyone told me that it was drab in black and white. Personally, I think the new home page sucks in terms of colours as well. There’s too many. I suck at picking colours. The only good thing about these colours is that I left it to the judgement of experts. These are the colours in Powerpoint 2007’s “Concourse” theme color, and I’ve just lifted them. ...

Launching applications

Opening programs from the Start - All Programs menu is painful. For many years, I relied on the quick launch bar. But it’s space constrained. There are only so many applications you can place there. I want space enough for frequently used documents as well. Recently, I decided that I need all the space on the screen. So my task bar is on auto hide, and that makes the quick launch bar a little tougher to use as well. And finally, I can’t use the quick launch bar with the keyboard. That’s important. ...

Illegally in Germany

In October 1997, Ram, my manager at IBM, strolled over to my desk and asked if I would like to visit the US. I’d never been there before. The impulse was to say “Yes”. But… I’d written the CAT exam once before. Didn’t get through. Applied once again. But thanks to my diligence, I’d given the wrong residence address, and never got my admission card, and didn’t bother following it up. This would be my third “attempt”. And I didn’t want to goof it up again. (I didn’t get through that one either, as it turned out.) ...

In search of a good editor

It's amazing how hard it is to get a good programming editor. I've played around with more editors/IDEs than I care to remember: e Notepad++ NoteTab SciTE Crimson Editor Komodo Eclipse Aptana ... There are four features that are critical to me. Syntax highlighting. Over time, I've found this to increase readability dramatically. Look at this piece of code with and without syntax highlighting: Doesn't the structure of the document just jump out with syntax highlighting? Anyway, I've gotten used to that. Column editing. I want to be able to do this: Being able to type across rows is incredibly useful. I use it both for programming as well as to complement data-processing on Excel. Unicode support. I often work with non-ASCII files, particularly in Tamil. Unicode support comes in handy when debugging pages for my songs site. Auto-completion. This is 10 times more productive than having to look up the manual for each function. (Oh, and it's got to be free too. Except for e Text Editor, all the others qualify.) ...

JPath - XPath for Javascript

XPath is a neat way of navigating deep XML structures. It's like using a directory structure. /table//td gets all the TDs somewhere below TABLE. Usually, you don't need this sort of a thing for data structures, particularly in JavaScript. Something like table.td would already work. But sometimes, it does help to have something like XPath even for data structures, so I built a simple XPath-like processor for Javascript called JPath. Here are some examples of how it would work: ...

Automating Internet Explorer with jQuery

Most of my screen-scraping so far has been through Perl (typically WWW::Mechanize). The big problem is that it doesn't support Javascript, which can often be an issue: The content may be Javascript-based. For example, Amazon.com shows the bestseller book list only if you have Javascript enabled. So if you're scraping the Amazon main page for the books bestseller list, you won't get it from the static HTML. The navigation may require Javascript. Instead of links or buttons in forms, you might have Javascript functions. Many pages use these, and not all of them degrade gracefully into HTML. (Try using Google Video without Javascript.) The login page uses Javascript. It creates some crazy session ID, and you need Javascript to reproduce what it does. You might be testing a Javascript-based web-page. This was my main problem: how do I automate testing my pages, given that I make a lot of mistakes? There are many approaches to overcoming this. The easiest is to use Win32::IE::Mechanize, which uses Internet Explorer in the background to actually load the page and do the scraping. It's a bit slower than scraping just the HTML, but it'll get the job done. ...

Statistically improbable phrases on Google AppEngine update

I’ve added some interactivity to the Statistically improbable phrases application. You can now: Filter out stopwords Dynamically filter infrequent words and commonly used words Dynamically play with the contrast and font size Comments Srikanth 12 Apr 2008 12:00 pm: Dear sir, I was searching for Ilayaraja songs and came across your wonderful compilation of 15 wonderful articles. Good one. Please do write more on music. Collin 12 Apr 2008 12:00 pm: I love this application. Because now, I can create a url to NY Times, and see what is the main subject of the day. :) S Anand 12 Apr 2008 12:00 pm: Thanks, Colin! Spencer 12 Apr 2008 12:00 pm: I was curious as to whether or not I could use this pointed into a specific personal corpus to separate documents from one another.

Statistically improbable phrases on Google AppEngine

I read about Google AppEngine early this morning, and applied for an invite. Google’s issuing beta invites to the first 10,000 users. I was pretty convinced I wasn’t among those, but turns out I was lucky. AppEngine lets you write web apps that Google hosts. People have been highlighting that it give you access to the Google File System and BigTable for the first time. But to me, that isn’t a big deal. (I’m not too worried about reliability, and MySQL / flat files work perfectly well for me as a data store.) ...

Firefox 3 Beta 5 crashes

I just upgraded from Firefox 3 Beta 4 to Beta 5. It’s amazing how unstable Beta 5 is compared to the earlier version. Gmail crashes. Google maps crashes. Almost every other site I visit crashes. And looks like I’m not alone: doing a Google search for “Firefox 3 beta x crash” shows a consistently increasing number of results. ![Number of Google search results for Firefox 3 Beta crashes, by Beta version](https://quickchart.io/chart?cht=bvs&chs=300x200&chd=t:12300,17200,24400,48700,151000&chds=0,150000&chtt="Firefox 3 Beta x crashes": Google results&chco=dbdbff&chg=20,33,1,5&chbh=40,10,10&chxt=x,y&chxl=0:|Beta 1|Beta 2|Beta 3|Beta 4|Beta 5|1:|0|50,000|100,000|150,000) ...

Time management

Some years ago, a friend asked me to write about how I manage my time. It seemed to him I was doing a good job of it, given that I had time to pursue my interests. It’s something I tried to do consciously. Every few years, I used to go down the route of “time management”. I’d read stuff and try it out. But over time, I’ve come to believe that “time” is not really “manageable”. Think about it: are most of your actions planned? Me, I just react out of habit, no matter how well planned I try to be. What I do is largely driven by what I’m in the habit of doing. ...

Reading books on a laptop

I have the habit of reading books on the screen. It’s something that started from the early 90s, when I got a copy of The MIT Guide to Lockpicking. Since I didn’t have access to a printer, I’d spent hours poring over the document on the screen. And then I discovered Project Gutenburg… I’ve heard many people ask if I have a problem with this. Personally, no. I’ve been staring at screens from the age of 12, and I’m quite used to it. My job requires me to stare at a screen for most of the day anyway. (I’m not saying there’s no a strain on the eye. My eyes are red at the end of the day. I don’t know if they would be less red if I’d been staring at paper instead of a screen. But my glasses have remained roughly the same power over ~15 years, so it’s probably not ruining my eyesight much.) For those who are like me who reads all the time and spends a lot of more time facing their laptops, you might want to check this sd card, a very good quality card that can be handy in the future. ...

Chaining functions in Javascript

One of the coolest features of jQuery is the ability to chain functions. The output of a function is the calling object. So instead of writing: var a = $("<div></div>"); a.appendTo($("#id")); a.hide(); … I can instead write: $("<div></div>").appendTo($("#id")).hide(); A reasonable number of predefined Javascript functions can be used this way. I make extensive use of it with the String.replace function. But where this feature is not available, you an create it in a fairly unobstrusive way. Just add this code to your script: ...

Taare Zameen Par lyrics

The songs were moving enough. The lyrics turn out to be beautiful too. The beauty of the language really comes out with songs like these. Taare Zameen Par (lyrics) Kholo Kholo (lyrics) Bum Bum Bole (lyrics) Jame Raho (lyrics) Maa (lyrics) Bheja Kum (lyrics) Mera Jahan (lyrics) Happy Valentine’s Day. Comments Chitra 14 Feb 2008 12:00 pm: I agree ! Esp ‘Kholo kholo’….. Amit Chakradeo 14 Feb 2008 12:00 pm: Bheja Kum link is wrong…

Less is more

The hours in consulting are pretty long. 65 hours a week used to be my norm, and that’s ignoring the travel time to and from work. So there wasn’t too much life outside of work. (I’ve come to realise, though, that what you do outside of work doesn’t change that much with more free time. What does change is that you just enjoy it more – both in and out of work.) ...

Lazy bargain hunting

I’m thinking of buying a digital keyboard with touch sensitive keys and MIDI support. (The one other thing that I thought off – a pitch bend – puts the keyboards out of my budget.) I’d like a good deal. (Who doesn’t?) But I don’t like to spend time searching for one. (Who does?) So here’s the plan. Firstly, I’ll restrict my search to Amazon.co.uk. For electronics items, I haven’t found anyone consistently cheaper. Tesco has some pretty low prices, but not the range. eBuyer is pretty good, but not often enough. Google Products is the only other one that gets me consistent lower prices, but I’ve had my credit card identity stolen once before while shopping online, so I’d rather not pick any random seller listed on Google. ...

Implicit information

From what I’ve seen, puzzles and exam questions share two un-real-worldly characteristics. Firstly, you are guaranteed that a solution exists. Secondly, you are given that all the information provided to you is relevant. (Well, not always. Some case studies I’ve seen have had their share of contrived irrelevance. But that’s often what it is, I think. People fill in the relevant stuff, and then try and distract by adding irrelevant material in the hope of making it more real-world-like. But that’s just a guess). ...

Web lookup using Google Spreadsheets

I’d written earlier about Web lookup in Excel. I showed an example how you could create a movie wishlist that showed the links to the torrents from Mininova. You can do that even easier on Google Spreadsheets. It has 4 functions that let you import external data: =importData(“URL of CSV or TSV file”). Imports a comma-separated or tab-separated file. =importFeed(URL).vLets you import any Atom or RSS feed. =importHtml(URL, “list” | “table”, index). Imports a table or list from any web page. =importXML(“URL”,“query”). Imports anything from any web page using XPath. Firstly, you can see straight off why it’s easy to view RSS feeds in Google Spreadsheets. Just use the importFeed function straight away. So, for example, if I wanted to track all 8GB iPods on Google Base, I can import its feed in Google Spreadsheets. ...