May 2006

fortune, growl and Mac goodness

Just realized that unix fortune goodness is available on Mac OS X quite simply by typing:

fink install fortune-mod

(Fink can be obtained here). And of course, it can all be combined with growl goodness to produce this:

Fortune cookies

Quite neat, eh? Well it’s quite simple, all you need is growlnotify, and to write a simple script:

#!/bin/bash
msg=$(/sw/bin/fortune)
/usr/local/bin/growlnotify -s --image /Users/anshul/Pictures/gnu-head-tiny.jpg -m "$msg"

With this, add it to your cron jobs, startup items, quicksilver triggers or whatever else you want, and enjoy :)

(Of course I chose to use the gnu logo for the icon, you can put in any JPG file, or none if you so wish)

fun
mac

Comments (4)

Permalink

Microsoft Wireless Laser Mouse 6000

Bought this wireless mouse about a month ago and I’ve found it to be really good. What I really appreciate is that due to clefts on the sides of the mouse, a deep one on the left for the thumb and a shallower one on the right for the fourth finger, the mouse fits amazingly well in your hands.

Of course there are other features that are quite good: wireless, two extra buttons, a magnifier feature (which supposedly magnifies an area around the mouse pointer, I haven’t yet tried this out), and some superior tracking technology - or so Microsoft would have us believe.

The scroll wheel is a bit odd - it’s a smooth scrolling wheel so there’s no “click” or specific marker for one scroll action. This takes a little getting used to and it turns out to be quite good for webpage viewing, but can be quite a bit of a hassle in gaming, especially if scroll is used to switch between loaded weapons etc. I use the mouse just in the lab so that’s not an issue.

Battery life is supposed to be six months on two AA alkalines, lets see how valid that claim is. After about a month, the mouse is chugging along fine for now.

The receiver connects to a USB port, so the mouse is recognized instantly in both Linux and Mac OS X. There are drivers for Windows (of course) and Mac OS X to enable the extra features like the buttons and Magnifier.

reviews
tech

Comments (2)

Permalink

Reservations - Nothing logical about it

It seems strange that with the country so widely divided up on the reservations issue, the entire elected Indian Parliament should pass the reservations bill with near unanimity. Doesn’t quite strike me as the democratic move - oh wait, but it is. Democracy is also about getting votes at the expense of the people if necessary. Nobody - not the government, nor the opposition can face the wrath of the OBCs when the next election comes; and so this bill goes through.

What’s even more pathetic, is that the Indian government chose to simply introduce the quota with no need, or backing for it whatsoever. Nothing brings this fact out more than a recent interview of Arjun Singh in which he admits he has no idea what the percentage of OBCs are in India, and he has only one thing to say about reservations logic - it should happen because Parliament decided it. Here’s an insightful excerpt from the interview:

Karan Thapar: Absolutely, Parliament has taken a view, I grant it. But what people question is the simple fact - Is there a need for reservations? If you don’t know what percentage of the country is OBC and if, furthermore, the NSSO is correct in pointing out that already 23.5 per cent of the college seats are with the OBC, then you don’t have a case in terms of need.

Arjun Singh: College seats, I don’t know.

Karan Thapar: According to the NSSO - which is a government appointed body - 23.5 per cent of the college seats are already with the OBCs.

Arjun Singh: What do you mean by college seats?

Karan Thapar: University seats, seats of higher education.

Arjun Singh: Well, I don’t know I have not come across that so far.

.
.
.

Karan Thapar: Fifty years after the reservations were made, statistics show, according to The Hindustan Times, that overall in India, only 16 per cent of the places in higher education are occupied by SCs and STs. The quota is 22.5 per cent, which means that only two-thirds of the quota is occupied. One-third is going waste, it is being denied to other people.

Arjun Singh: As I said, the kind of figures that have been brought out, in my perception, do not reflect the realities. Realities are something much more and, of course, there is an element of prejudice also.

Karan Thapar: But these are figures that come from a Parliamentary Committee. It can’t be prejudiced; they are your own colleagues.

Arjun Singh: Parliamentary Committee has given the figures, but as to why this has not happened, that is a different matter.

In short, the message to the people from the government is - we are doing all we can to gather votes. We don’t care about the students of value or quality of education in India. The huge student protests made no impression on us because the students aren’t the people voting for us. And since 80% of India won’t bother seeing our interviews, it’s even OK for us if we make not the slightest attempt to be logical and sophisticated and present anything remotely resembling a clear case for reservations.

As for the opposition, they have remained totally mum - except for Navjot Singh Sidhu and Shiv Khera who joined the protestors (but made sure it was clear that they were doing this personally and not as members of the BJP). Is it unreasonable to expect that an opposition ask for a solid case for such an impactful decision which will clearly hurt so many student’s lives?

The bottom line is simple - logic has become a minority consideration, and reasonably arguments are things that nobody cares about, as I had complained earlier. I can only empathize with all the students whose hard work this measure will inevitably crush beneath its illogical, crazy but politican heavy feet.

india
politics

Comments (1)

Permalink

Eight below

This is a heartwarming adventure film about a team of Antarctic explorers who are forced to leave behind their eight dogs at their base as they flee the cold winter. The trainer refuses to give up on them even after months have passed and eventually finds a way to go back to look for them in the middle of the Antarctic winter.

Videographhy and the depiction of the Antarctic landscape is breathtaking, but what really blew me away was the depth of expression and communication of the dogs in the film. The movie was inspired by a true story of a Japanese expedition to Antarctica in 1958. Easily ranks as one of the best films I’ve seen.

movies

Comments (0)

Permalink

Spell-check in Vim 7

One of the best new features in Vim 7 is built-in spell-check (although plugins for spellcheck have been available earlier). With spell-check, I can now use Vim exclusively for editing text formatted files - latex, blog entries and the like - in addition to code. Here’s a quick look at the various spell checking features.

Turning on spellcheck

Spellcheck can be turned on/off with the following commands

:setlocal spell spelllang=en_gb
:setlocal nospell

en_gb can of course be replaced by your language of choice (en_us for example). Vim 7 supports spell-check for more than 50 languages, and the dictionaries are stored in $VIMRUNTIME/spell. I’ve mapped this to the F6 and F7 keys by adding the following lines to the $HOME/.vimrc file:

map <F6> <Esc>:setlocal spell spelllang=en_gb<CR>
map <F7> <Esc>:setlocal nospell<CR>

[via]

Once spell-check is turned on, words with spelling errors will be highlighted. You can move to the next and previous misspelled words by typing ]s and [s respectively, in normal mode. If the cursor is on a misspelled word, z= shows suggestions and zg adds the word to the dictionary. zug performs an undo to the dictionary addition.

[via]

Highlighting spelling errors

You can customize the way misspelled words are highlighted by editing your colorscheme file. Vim recognizes four categories of misspelled words - SpellBad (for words not recognized), SpellCap (words which should be spelled with a capital), SpellRare (for rare words, I’ve no idea what the logic is here) and SpellLocal (for words that belong to the same language in a localization different from the current one). The last category is especially useful - for example in UK English, the word “analyze” is not shown as a SpellBad error (as it is in MS Word), but as a SpellLocal error, since it exists in the US English dictionary. Looking inside Vim’s dictionary directory, I note that there is an overall “english.ascii.spl” file and and “en” directory lists files such as “en_GB.diff” and “en_US.diff” which allows this feature, as well as saves space by not having the large common set of English words duplicated for five localizations. Neat!

But I digress. You can customize the highlight for any category by adding in the appropriate categories and their keywords to your colorscheme file (usually located in $VIMRUNTIME/colors). My colorscheme file has the following lines:

hi SpellBad term=reverse ctermfg=white ctermbg=darkred guifg=#ffffff guibg=#7f0000 gui=underline
hi SpellCap guifg=#ffffff guibg=#7f007f
hi SpellRare guifg=#ffffff guibg=#00007f gui=underline
hi SpellLocal term=reverse ctermfg=black ctermbg=darkgreen guifg=#ffffff guibg=#7f0000 gui=underline

Linux.com reported problems while using spell-check with syntax highlighting, but I experienced no such issues. Below are screenshots of Vim7 with my homepage source with spell-check disabled and enabled (click for large versions).

[Update: It seems vi has intelligent spell-checking depending on syntax. In a C++ file, for example, enabling spell checking ONLY applies spell-checking to strings and comments! How cool is that!]

Vim7 with HTML syntax and spellcheck OFF

(HTML syntax highlighting with no spell-check)

Vim7 with HTML syntax and spellcheck ON

(HTML syntax highlighting with spell-check enabled, the names “Anshul”, “Nigham” for example are highlighted with red background)

linux
mac
tech

Comments (2)

Permalink

Guns, germs and steel by Jared Diamond

Guns, germs and SteelThis is one of the most scientific and logical history books I’ve ever read. Jared Diamond states his problem - “Why did people on different continents develop differently?” The whole book is a structured and logical answer to this question. The course of history has been that people from Europe settled in large parts of the world outside the Eurasian continent, exterminating to a large extent their native people - for example, in the Americas, sub-Saharan Africa and Australia.

The most direct reasons for European conquests to be successful were guns (advanced weaponry), germs (European diseases such as smallpox which started epidemics and killed off a huge number of people) and steel (advanced technology) but these are just what Diamond calls “proximate causes”. In the book, he goes on to explain why Europeans developed these advantages rather than the people of other continents. Contrary to popular belief and assumption, he proves that this had very little to do with the innate qualities of the people, but everything to do with the geographical and biological implications of the European continent. He traces the “broadest patterns of history” which created a favourable environment in Eurasia, which include things like the rise of agricultural food production, domestication of animals, spread and interchange of ideas, rise of complex socio-political entities and so on.

An extremely readable book, it doesn’t present dry facts but analyses how they affected the stated problem and the known outcome. The book is extremely well structured, not only in terms of chapter progression but writing within each chapter. Almost every chapter begins with a set of questions that motivate the analysis and then the analysis and answers to the questions are logically presented, followed by a summary and conclusion. To a debater’s eye, the structure literally jumps out and makes the whole thing a pleasure to read.

books

Comments (4)

Permalink

Welcome, Macbook

So it is finally here.

No surprises, so I guess the excitement from my part is muted. At 13.3 inches and 1280×1024 pixels, Core Duo processor, integrated iSight, Apple remote, Front row, and DVI output with extending display capabilities, it sure beats the hell out of the iBook it replaces. The only sad part - onboard Intel GMA950 graphics. I wish they had put in a half-decent video card instead. But well, one can’t have everything. But oh, wasn’t that what Apple was for? Never mind.

Sad bit - it replaces the 12″ Powerbook as well, the Pro line of laptops will only have the 15″ and 17″ Macbook Pros it would seem. Fair enough, I would say, given that there is no place in between the specs of the Macbook and the Pro line to fit in a small Powerbook/Macbook Pro, but I still wish they’d kept it. My laptop now becomes not only obsolete, but extinct.

Apparently Apple wants users to pay a premium for the black version - it comes in as the highest end model, with only only a 20 GB hard drive extra over a similar white model, yet the high end black model goes for a good US$200 more than the high-end white model (a low-end white model is available for US$1099).

Ladies and gentlemen, take out your wallets.

mac
tech

Comments (2)

Permalink

Profound geek quote of the day

“To me, vi is Zen.
To use vi is to practice zen.
Every command is a koan.
Profound to the user,
unintelligible to the uninitiated.
You discover truth every time you use it.”
–reddy@lion.austin.com

[via]

By the way, vim 7 is out. Mac version here.

philosophy
tech

Comments (0)

Permalink

Paradise Now

What should life be? Who should you love? What should you eat? Should you study? Where should you work? How should you dress? What passion should drive you?

Living a good life is about having freedom. Freedom to make these choices, and more. And the absence of freedom is absence of these choices. Or any choices, for that matter. This is the message of Paradise Now.

It’s the story of two close friends, members of a cell of a militant Palestinian group, selected to carry out a suicide bombing in Tel Aviv. At first blind believers in their organization and religion, their struggle for truth and right action is depicted as they are forced to abort their initial attempt and come into contact with a human rights activist.

They have contrasting personalities. One is extroverted and confident while the other is inward looking and thoughtful. One is full belief in himself while the other is constantly doubtful, haunted by rememberance of a father who betrayed his people and was executed for it. Ultimately, one chooses to renounce violence - no doubt to go back to his home and be humiliated as a coward and unbeliever. The other carries out his mission despite his misgivings, and faces a death which he doubts will gain him paradise.

We all know what happens next. Read the news. They become letters and numbers in the third column of the bottom half of the international news page. Nobody wins.

An excellent movie.

movies
philosophy
politics

Comments (4)

Permalink

Windows Mobile can’t close applications

I’m looking out for a business-class PDA-phone to buy for my dad, so I came across this while reading up a review of the Dopod 838:

As Windows Mobile does not support the closing of applications, all the programs opened continue to run in the background when a new application is activated. For this reason, the 838 simply fails to handle multitasking, which results in a considerable lag particularly when running processor-intensive applications such as the Microsoft Reader. In some cases, each letter takes a second or more to appear when typing SMS messages. During tests, soft resets have to be performed periodically to get the handheld back in proper operational speed.

Going and checking the review of the O2 XDA Atom confirms this:

In terms of processor speed, the Atom’s zippy Intel PXA27x 416MHz processor is comparable with the 416MHz chip on the O2 Xda II mini. It handles multitasking competently without signs of lag. As Windows Mobile does not support the closing of applications, all the programs are running in the background. A soft reset is recommended regularly to keep the PDA-phone speedy.

Can someone please explain to me why an OS would be designed without support for closing applications? Especially in a mobile environment where all resources - power, CPU, memory are limited?

tech

Comments (1)

Permalink