
Monday December 27, 2004
Mozilla hacking
mozilla hacking
One of the cool things about mozilla is the degree to which it can be
customized. Suppose you want to customize mozilla so that
instead of the standard browser logo in the upper right corner, it
displays pictures of a
cute little boy.
All you have to do is unjar and re-jar <mozilla install
directory>/chrome/classic.jar or modern.jar (whatever skin is in
use), dropping in your images in place of
skin/<skin_name>/communicator/brand/throbber-single.jpg and
throbber-anim.jpg. Paths for OS X and firefox versions are slightly different,
but in all cases, you just need to replace the files throbber*gif/png or loading_16/not_loading_16.gif in
one of the jar files.
Another useful Mozilla hack is to change the behaviour of the messenger
searchbar. The default messenger action is to search for the searchbar
term in the "subject or sender" fields of all messages -- except when
viewing the Sent folder, where the term is searched for in the "Subject
or To" fields. Sometimes, though, you may file all messages related to
a topic together, including sent messages. Or sent messages are in a
different folder, because they were filed by some other client. This
makes searchbar usage problematic, because mozilla doesn't understand
that
the folder has some Sent messages. To work around, you can always
search in all of Subject, To/cc and Sender fields. unjar
<chrome>/messenger.jar, and replace the following lines in
content/messenger/searchBar.js:createSearchTerms()
--
// create, fill, and append the sender (or
recipient) term
term = gSearchSession.createTerm();
value = term.value;
value.str = termList[i];
term.value = value;
term.attrib = searchAttrib;
term.op = nsMsgSearchOp.Contains;
term.booleanAnd = false;
searchTermsArray.AppendElement(term);
--
with:
--
// create, fill, and append the Sender term
var term = gSearchSession.createTerm();
var value = term.value;
value.str = termList[i];
term.value = value;
term.attrib = nsMsgSearchAttrib.Sender;
term.op = nsMsgSearchOp.Contains;
term.booleanAnd = false;
searchTermsArray.AppendElement(term);
// create, fill, and append the To-or-CC term
var term = gSearchSession.createTerm();
var value = term.value;
value.str = termList[i];
term.value = value;
term.attrib = nsMsgSearchAttrib.ToOrCC;
term.op = nsMsgSearchOp.Contains;
term.booleanAnd = false;
searchTermsArray.AppendElement(term);
--
The same thing can probably be done much more cleanly using XUL and XPIs or
customizing userChrome.css, but this
was the shortest path for me. (I'm not sure if overlaying Javascript
code for the searchbar is possible though. If you know, please tell me
how.)
(2004-12-27 01:39:08.0)
Permalink

Thursday December 09, 2004
The Bangalore Habba
The city is celebrating Bangalore Habba, its annual arts and culture festival this week. The quality of the events is very good, and they're all free. As usual, there is the occasional naysayer protesting "Not enough Kannada!".
Yesterday, I went to the classical music session in the evening. We started off with Vinayak Torvi singing a competently fierce Maru Bihag for about 50 minutes, followed by 2 shorter pieces: a Kafi thumri and a bhajan. This was followed by a performance by the violin trio of Lalgudi Jayaraman and his children GJR Krishnan and Vijayalakshmi. Two of the ragas were Mohanam and Kirwani, and another one sounded quite close to the Hindustani Bihagda. All in all, an evening well-enjoyed by the packed auditorium.
(2004-12-09 19:59:32.0)
Permalink

Thursday November 25, 2004
Munich and the Netherlands
|
I was on a visit to Munich a few months ago for the ISCA conference,
followed by a personal visit to the Netherlands. Munich is a very nice
city, with excellent public transportation. I took a walking tour (which turned into a drinking tour, because we
got rained upon, so we sat in a biergarten and the guide showed
us pictures of the places we were supposed to see instead). An authentic
biergarten is apparently one with chestnut trees. The bright part
of the rain was that Munich showed off its range of lovely colourful
umbrellas, so I bought three of them.
I've been to Germany a few times before and every time I think of making a
list of the German words which appear frequently, to avoid confusion
(for example, is taffelwasser tap-water or table-water ?) However, I did not
manage to create that list this time either. I found early on that my little Oxford
German<->English dictionary was virtually useless for deciphering
posted instructions or menu cards.
I visited the Dachau concentration camp memorial (remembering the word
gedenkstatte, for memorial), which was quite similar to the
Sakhsenhausen camp near Berlin. Not just the
camp, but also the surroundings: a half-hour train ride away from a major
city; a train station with just a few tracks; a 10 minute bus ride
through desolate streets so quiet that they make it difficult to imagine
the goings-on of the time. Dachau has a few standing barracks, the gravelly
roll-call square, a cemetery, and so on. It also has a rather
chilling gas chamber, which was not used. A documentary film shows
Goebbels on video.
The Munich metro system is, as usual, superb; Marienplatz is the center
of action, and one emerges from the metro station right into the platz.
For the first few days, I was either narrowly making or narrowing
missing the sliding doors, so I couldn't help remembering the Gwynneth
Paltrow movie each time. The Munich central station looks impressive,
especially with a parked fleet of Deutsche Bahn's classy red-and-white
and white-and-red trains. By the way, there is a gap, but no mind the
gap.
I had time to kill on the last day of the conference, so I went to a
German show of an opera (La Traviata) - the singing was quite good, but
I did not have enough time to stay till the end, and I had a cough
which was probably disturbing others, so I chose to leave early. It was
a lovely auditorium in Gartner Platz, but at 16 euros, I had a cheap
seat, the kind where one has to peer between people's heads to get a
glimpse of three quarters of the stage. The overnight train from Munich
to Utrecht was slow, but comfortable; and, these days, one can always
while away time mindlessly pushing buttons to check if one's mobile
phone has coverage in strange lands.
The Netherlands:
First, a few words of Dutch needed by the traveller: Dutch is almost
phonetic, except that 'v' is pronounced as 'f', 'j' as 'y', 'g' as a
throaty 'gh', ij as "aa-e", and tt as a soft t. Weg=way a la rue or
strasse, von=of (William von Orange), voor=for, geen=prohibited,
uur=hour, nieuwe=new, plein=platz, dienst=office, hypothek=realtor, te
huur=rent, etc. English however is well understood, making this one of
the easiest European countries for English-speakers to travel in. It's
hard to think of another country of 15 million people which has had as
much impact as the Netherlands. A third of the Netherlands
is below sea level (hence the name), and large parts of the
countryside are given to what is obviously a highly
mechanized culture of farming - I rarely saw anyone working in the
fields. The public transportation is again excellent, with an elaborate
system of trams supplementing NS, the Dutch railways. A strip of 10
(strippenkarte) is the thing to buy, but you've to be careful about punching the
right number of slots for your destination - ticket checking is very frequent. Rail coaches
made by Alsthom appear to be popular. There are lots of cyclists on the streets.
Amsterdam is a fun city, known best for its canals and museums. I'm not
an art buff, but I was impressed by the 17th century paintings in the
(genuinely) world-famous Rijks museum, so I decided to visit the
impressionists museum next. This turned out to be a disaster -
van Gogh's potatoes left me stone cold.
We drove across most of the country one afternoon to visit the open-air Zuiderzee folk-museum, not unlike the Dakshina Chitra
we have here in South India. It was amusing to see a real semaphore here -
this is what Djikstra must have had in mind. I also noticed large signs
saying P and V (and also S) posted over railway tracks, though I'm not sure
what exactly they mean.
The Netherlands has lots of Chiniz-Indisch (Chinese-Indonesian) restaurants,
since Indonesia was a Dutch colony until 1945. Indian
restaurants appear to be rather expensive (15 euros for a meal ?!) A highlight
is the falafel place just outside Amsterdam Central - it's immediately on the right
after crossing the canal.
There was a nice bookstore in Amsterdam where I managed to pick up the
2003 Let's Go Europe for just 6 euros, and an excellent
"Holland Handbook" for the expatriate posted to the Netherlands. I wish someone
would produce a book like this for India. |

Furnaces at Dachau concentration camp

Marienplatz

With Maurice Wilkes

Amsterdam - a miniature mock-up

A semaphore at the Zuiderzee museum
|
(2004-11-25 03:58:51.0)
Permalink

Thursday October 28, 2004
From here to paternity
Paul Reiser's book on Babyhood
is one of my favourite baby books. It's funny and insightful at the
same time, and written from dad's point of view. Strongly recommended
for fellow to-be dads.
(2004-10-28 06:46:57.0)
Permalink

Monday October 25, 2004
V.S. Naipaul in Bangalore
V.S. Naipaul
was in Bangalore for the second time this year, promoting his new book,
Magic Seeds. The Landmark bookstore had arranged a reading last week.
The moment he arrived at the venue, he was mobbed by hordes of
photographers. The last time he was in Bangalore, he seemed to be
enjoying the adulation, but
this time, he just blinked lazily at the cameras, looking a bit like a
fat Wiltshire cat. His hands shook quite a lot, and he was not enjoying
himself. He looked hot and bothered - one wonders why he has to dress
up in hot weather - and he probably just wanted to get the session over
with.
The reading was disastrous. Someone decided to get two other people to
read from the book instead of Naipaul himself. That was disappointing,
for the man speaks almost as well as he writes. He picks his words carefully, and
has a considered manner which, though not condescending, appears to be gently appending to every
sentence, "Do you understand, my child ?"
The reading was followed by a question-and-answer session. Sensibly, no
one wasted time asking him anything about the book. Magic Seeds is
something of a sequel to the already boring Half a Life. I asked
him, having read him complain in his books about the shoddiness of
Indian products, what he thought had effected the creation of the rather
posh mall and bookstore we were in. His take was to the effect that "If
people need things badly enough, they will happen." It's not
clear that people don't need good roads in Bangalore badly enough, though.
Other people asked him how he approached death (with great pleasure),
who he kept in mind as he was writing (often one specific person) and
how difficult writing gets as one grows older (a lot).
(2004-10-25 06:35:55.0)
Permalink

Wednesday October 13, 2004
Roses are red, and so should be warnings
I am always surprised that text-based user interfaces in computers have
not fully utilized the power of colour. Ever tried to scroll through
10,000 lines of history in an xterm trying to locate that particular
error message, or the command you typed ? So why don't shells emit user
input and program output in different colours ? Why don't programs emit
errors and warnings in colours that stand out amid a sea of text ? If
only K&R had provided a colour argument to printf...
Anyway, here's one sample implementation of a "warning printf". It
makes warnings stand out by printing them in red. It's pretty portable
and works on every unix terminal (that I use :-)
// include stdio and stdarg
void wfprintf(FILE *fp, char *format, ...)
{
int is_tty = isatty (fileno(fp));
va_list ap;
va_start(ap, format);
// ANSI escape for the colour
if (is_tty)
fprintf(fp, "%c[31m", 0x1B); // 31 is colour red
/* print out real message */
(void) vfprintf(fp, format, ap);
// reset terminal
if (is_tty)
fprintf (fp, "%c[m", 0x1B);
}
Unfortunately, though, I haven't discovered any way to check isatty() on the Java platform.
(2004-10-13 03:56:32.0)
Permalink

Tuesday October 05, 2004
Forgot a case ?
It was surprising to see that the following compiles without warning using both the Sun C compiler and gcc:
#include <stdio.h>
int main()
{
enum {RED, GREEN} color = RED;
int x = 0;
switch (color)
{
RED: x = 1; break;
GREEN: x = 2; break;
}
printf ("x = %d\n", x);
return 0;
}
Missed the case keyword and it still compiles fine ?!
(You write this kind of code after staring at too much Verilog)
The semantics of such code appears to be that nothing inside the switch
statement is executed. This caused some head-scratching in one of our
programs recently. gcc -Wall does report it though; yet another reason
to always run it with every compile.
Wonder why the C syntax explicitly permits this:
<selection-statement> ::= if ( <expression> ) <statement>
| if ( <expression> ) <statement> else <statement>
| switch ( <expression> ) <statement>
<statement> ::= <labeled-statement>
| <expression-statement>
| ...
<labeled-statement> ::= <identifier> : <statement>
| case <constant-expression> : <statement>
| default : <statement>
And as usual, the Java language does not allow you to write nonsense as easily as C:
<switch-statement> ::= switch ( <expression> ) <switch-block>
<switch-block> ::= { {<switch-block-statement-group>}* {<switch-label>}* }
<switch-block-statement-group> ::= {<switch-label>}+ {<block-statement>}+
<switch-label> ::= case <constant-expression> :
| default :
(2004-10-05 23:59:48.0)
Permalink

Tuesday September 28, 2004
Formal verification for silicon debug
The latest Verification Avenues newsletter from Synopsys has a great article by Catherine
Ahlschlager and Dave Wilkins from Sun. The article describe how they nailed
down a really tricky bug in one of our processors. Using formal verifiers to
root-cause hard-to-debug problems in silicon - that's a neat idea!
(2004-09-28 23:31:04.0)
Permalink

Saturday September 25, 2004
Random walks
Aishwarya Rai struck a seemingly professional note in her recent episode of Walk the Talk on NDTV.
Shekhar Gupta is a respected journalist and an informed interviewer,
but the walking during the talking, which is meant to a convey an air of
informality, appears artificial and needlessly contrived.
I recall a show with Manmohan Singh (before he was
Prime Minister) - Shekhar dragged him all over
the Delhi School of Economics campus, before ending up
walking and talking in the library, no doubt distracting
everyone else around. Shekhar, if you read this, working the outdoor
locations is a good idea, but don't overdo the walking part.
Especially not with 90-year old politicians. I liked
the episode with Ratan Tata, though,
where you drove through the Tata motors campus in their new car, as also the interview with Vishy Anand.
The worst example of a TV show trying to live up to its silly name
has got to be the BBC's Business Bites. Ronnie Screwvala invites
2 businessmen each week for a chat over a meal, but the invitees are
inevitably - and understandably - reluctant to eat. I mean, who seriously
wants to be seen eating a meal on TV ? It's a bad idea. Give it up.
In contrast to these trendy settings, a plain black studio background adorns
Prabhu Chawla, one of the best interviewers on Indian TV. He never misses
a hard question, but unlike the stern Tim Sebastian, smiles genially even
as he dissects his victim.
All in all, though, I like this set of interviewers better than American talk show
hosts, even the classy Terry Gross.
(2004-09-25 23:48:35.0)
Permalink

Sunday September 05, 2004
Pankaj Mishra on Mashobra
Tehelka has a nice little piece by Pankaj Mishra
about his relationship with the town of Mashobra in Himachal Pradesh, where he
spent several years in his twenties. He acknowledges "the impatient and frequently intolerant"
tone of his
Butter Chicken in Ludhiana, a book I dislike.
(2004-09-05 21:28:05.0)
Permalink

Saturday September 04, 2004
"There must be something wrong with Amdahl's Law"
The Economic Times recently carried a conversation
between 2 unlikely people: Danny Hillis and
N.R.Narayanamurthy.
Among other things, Hillis talks about building his first computer in Calcutta, and his
Long Now project. An interesting read.
(2004-09-04 20:54:26.0)
Permalink

Tuesday August 31, 2004
Solutions for problems or problems for solutions ?
I've always found it easier to discover problems that fit
a known non-trivial solution methodology than to find a solution
for a fixed problem. If you know some cool way of doing stuff,
keep your eyes and ears open and find a good problem which can use
it: it's unlikely people have tried to apply the same technique to the
problem. On the other hand, if you start with a fixed problem, the
obvious approaches have already been tried and the problem has either
been solved or is very hard.
Carver Mead says the same thing in this interview
(2004-08-31 07:05:10.0)
Permalink

Thursday August 19, 2004
W-by-Al ratio
here's a puzzle I asked our TSOtool team a few months ago:
Let there be 2 contestants in an election, say W and Al, and Al wins by getting n votes to W's m votes (n > m). What is the probability that as each vote is counted, Al is always ahead of W ? i.e. after every step of the counting, Al has to have more votes than W. Assume votes are counted in random order. Never mind that W becomes president instead.
(2004-08-19 23:26:24.0)
Permalink

Saturday August 14, 2004
Henri Cartier-Bresson
I was not aware of Henri Cartier-Bresson before his death, but
read about him afterwards. The Hindu last week carried a
beautiful picture by him on page 1, showing Nehru announcing
Gandhi's death at Birla house in 1948.
Thanks to Tim Foster for this blog entry pointing to a
photograph collection by Cartier-Bresson. The Nehru picture
is on page 12, along with several other pictures from India
around this time.
(2004-08-14 00:07:34.0)
Permalink

Wednesday July 28, 2004
June 8th 1994
June 8th 2004 was the 10 year anniversary of the Intel-HP
announcement about what would turn out to be Itanium.
I still remember reading this
"Intel and HP announce hi-end co-operation"
post on comp.arch 10 years ago, and thinking
this was the end of the road for all other architectures.
How the mighty have fallen!
Up until a couple of years ago, I believed Itanium could and would
still make it. I saw the trusty old Stanford mail server xenon.stanford.edu
which used to be a Sun server (motd: "A gift from Sun Microsystems") turn
into an Itanium box (motd: "A gift from Intel Corporation"). But, unbelievably,
the Itanium machine was so unstable that it had to be replaced. Xenon is
now a Linux/x86 box and its motd as of August 11th 2004 reads:
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
Welcome to Xenon.Stanford.EDU!
The Itanium is dead! Long live Xenon!
Please report Xenon problems to: action@xenon
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
(2004-07-28 09:03:07.0)
Permalink
|
|
| archives |
|
|
| « November 2009 | | Sun | Mon | Tue | Wed | Thu | Fri | Sat |
|---|
1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | | | | | | | | | | | | | | | Today |
|
|
|
|
|
| links |
|
|
|
|
|
|
|
|