In The Armchair

Corruption Cake

Posted in India by Armchair Guy on November 21, 2010

It’s been like a layer cake the last few months.  We’ve had one scandal after another and it shows no signs of slowing down.  You’ve probably read about most of the scandals, but the icing on the cake (at least until another scandal breaks, at which point it will become just another layer) may have escaped your notice.  That’s because this latest scandal involves the media themselves, and they’re doing everything they can to cover it up.  Barkha Dutt, Vir Shanghvi, Rajdeep Sardesai and a bunch of other media bigwigs were found to be doing some power-broking between the Congress and its vassal parties.  The story was leaked by outlook magazine here.

I don’t know why anyone should be surprised.  It’s like being surprised that a baboo in an official position in government is taking bribes.  Everybody does it, and everybody knowns that everybody does it, even if no evidence has actually emerged.  I’d guess there are two paths you take to get exclusive interviews with prominent people.

The first path is to dedicate your life to quality journalism until your reputation is so well-established that people want to talk to you.  I think Dan Rather fell into this category — his demise came about because he hadn’t checked the quality of his sources.  His integrity was never in doubt.  But this path takes a long time.

The second path is where you do people favours in return for interviews and inside scoops.  I’m sure the majority of Indian journos don’t do this, but I’m equally sure a lot of them do.  So when this big expose on Barkha and co. came around, I was surprised — not that they were doing it, but that something like this saw the light of day.

But it’s still not easy to find.  The tapes themselves are available online for all to listen to, but the story isn’t getting much prominence.  I hate to agree with anything Arundhati Roy says, but one thing she did get right:

Much of the mainstream media has been captured by a small clique of columnists, editors and TV anchors, an incestuous little coterie with shows on each others’ channels and interviews in each others’ newspapers.

The responses Barkha and her higher-ups have provided are pretty standard: they liberally tossed in phrases like “smear campaign”, “misrepresentation” and “caricature” into boilerplate denials.

Superbugs and Medical Tourism

Posted in India by Armchair Guy on November 19, 2010

A superbug is apparently spreading through Europe.  When a superbug from India was discovered, the Lancet reported it, but gratuitously hinted that people should not go to India for medical care.  Perhaps the Lancet should now gratuitously hint that people should stop going to Europe for medical care as well… 😉

LaTeX Forward PDF Search with Emacs

Posted in Computers by Armchair Guy on November 15, 2010

I wrote a blog post on implementing inverse PDF search with okular and emacs here.  This post is about the reverse: forward search.  That is, with point at any position in the LaTeX source while editing in emacs, a keystroke causes okular to center the corresponding portion of the PDF in its viewable area. A nice overview of LaTeX synchronization can be found here.

In the comments on the inverse search post, B. Slade suggested the procedure at http://www.bleedingmind.com/index.php/2010/06/17/synctex-on-linux-and-mac-os-x-with-emacs for forward search.  However, the instructions there require installation of AuCTeX version 11.86, while the latest version in the Ubuntu 10.04 repositories have is 11.85.

I managed to kludge a solution for the AuCTeX shipping with Ubuntu 10.04 by slightly modifying some emacs code I found here: http://www.mail-archive.com/okular-devel@kde.org/msg04913.html. Most of the work was already done by Mark Altern and earlier authors; the only change was to tell it to use the .pdf instead of the .dvi.

A note of caution.  Forward search with okular is not very convenient.  This is because okular redisplays the PDF document every time you do a forward search — with a side “contents” pane and also repositioning the PDF.  So if you’ve removed the space-hogging contents pane (by pressing F7 twice) and zoomed and positioned the PDF to your liking, doing a forward search will undo all of that.  You’ll have to remove the contents pane again and re-zoom and re-position.  This severely limits the usefulness of forward search.  There doesn’t seem to be a way around this for now.

Anyway, here are the steps.

  1. Follow instructions here to set up inverse search.
  2. Source for okular-search.el is at the end of this post.  Copy it and put it in a file called okular-search.el.
  3. In your .emacs file, add the following code:
    
    (add-to-list 'load-path "/path/to/okular-search.el")
    (require 'okular-search)
    (add-hook 'LaTeX-mode-hook (lambda () (local-set-key "\C-x\C-j" 'okular-jump-to-line)))
    (add-hook 'tex-mode-hook (lambda () (local-set-key "\C-x\C-j" 'okular-jump-to-line)))
    

That’s it. Press C-x C-j to open a new okular viewing window. Subsequent presses of C-x C-j will reposition the PDF in that okular window to correspond to whatever’s at point in emacs.

Here’s the code for okular-search.el:


;;; (X)Emacs frontend to forward search with kdvi. See the section on
;;; FORWARD SEARCH in the kdvi manual for more information on forward
;;; search, and for an explanation how to use this script. This script
;;; is a modified version of the script "xdvi-search.el" by Stefan
;;; Ulrich, version 2000/03/13. The
;;; modifications were performed by Stefan Kebekus
;;; . Tested with Emacs 20.7.1 and Xemacs 21.4.
;;;
;;; This program is free software; you can redistribute it and/or
;;; modify it under the terms of the GNU General Public License as
;;; published by the Free Software Foundation; either version 2 of the
;;; License, or (at your option) any later version.
;;;
;;; This program is distributed in the hope that it will be useful,
;;; but WITHOUT ANY WARRANTY; without even the implied warranty of
;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
;;; General Public License for more details.
;;;
;;; You should have received a copy of the GNU General Public License
;;; along with this program; if not, write to the Free Software
;;; Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
;;; 02110-1301, USA.
;;;
;;; Please report bugs or improvements, etc. via the "Report bug"-Menu
;;; of okular.
;;;

(defvar okular-script "okular"
  "*Name of start script for okular.")

(defun okular-jump-to-line ()
  "Call okular-script to perform a `forward search' for current file and line number.
See contents of okular-script for details.
If AucTeX is used, the value of TeX-master-file is used as filename
for the master .dvi file; else, the return value of okular-master-file-name
is used (which see)."
  (interactive)
  (save-excursion
    (save-restriction
      (widen)
      (beginning-of-line 1)
      (let* (;;; current line in file, as found in the documentation
	     ;;; of emacs. Slightly non-intuitive.
	     (current-line (format "%d" (+ 1 (count-lines (point-min) (point)))))
	     ;;; name of the `main' .tex file, which is also used as .dvi basename:
	     (master-file (expand-file-name (if (fboundp 'TeX-master-file)
					     (TeX-master-file t)
					   (okular-get-masterfile (okular-master-file-name)))))
	     ;;; .dvi file name:
	     (pdf-file (concat (file-name-sans-extension master-file) ".pdf"))
	     ;;; current source file name.
	     (filename (expand-file-name (buffer-file-name))))
	(start-process "okular"
		       "okular-output" "okular" ;;; src-args
		      ;;; args for -sourceposition:
		       "--unique" (concat "file:" pdf-file "#src:" current-line filename)
		       )))))

(defun okular-get-masterfile (file)
  "Small helper function for AucTeX compatibility.
Converts the special value t that TeX-master might be set to
into a real file name."
  (if (eq file t)
      (buffer-file-name)
    file))

(defun okular-master-file-name ()
  "Emulate AucTeX's TeX-master-file function.
Partly copied from tex.el's TeX-master-file and TeX-add-local-master."
  (if (boundp 'TeX-master)
      TeX-master
    (let ((master-file (read-file-name "Master file (default this file): ")))
      (if (y-or-n-p "Save info as local variable? ")
	  (progn
	    (goto-char (point-max))
	    (if (re-search-backward "^\\([^\n]+\\)Local Variables:" nil t)
		(let* ((prefix (if (match-beginning 1)
				   (buffer-substring (match-beginning 1) (match-end 1))
				 ""))
		      (start (point)))
		  (re-search-forward (regexp-quote (concat prefix "End:")) nil t)
		  (if (re-search-backward (regexp-quote (concat prefix "TeX-master")) start t)
		      ;;; if TeX-master line exists already, replace it
		      (progn
			(beginning-of-line 1)
			(kill-line 1))
		    (beginning-of-line 1))
		  (insert prefix "TeX-master: " (prin1-to-string master-file) "\n"))
	      (insert "\n%%% Local Variables: "
;;; mode is of little use without AucTeX ...
;;;		      "\n%%% mode: " (substring (symbol-name major-mode) 0 -5)
		      "\n%%% TeX-master: " (prin1-to-string master-file)
		      "\n%%% End: \n"))
	    (save-buffer)
	    (message "(local variables written.)"))
	(message "(nothing written.)"))
      (set (make-local-variable 'TeX-master) master-file))))

(provide 'okular-search)

How Much Did Enthiran Cost??

Posted in Movies and Entertainment by Armchair Guy on November 15, 2010

Enthiran, the Rajnikanth movie, was released to huge publicity and an incredible public reception.  In Boston, the initial ticket prices were double the usual movie ticket prices, and people still went.  They came down to normal around week three or four. That’s when I went and saw the movie.  It was an ok movie.  Somewhat silly in places, but it had its entertaining moments.

According to Wikipedia, Enthiran cost Indian rupee162 crore.  This is quite amazing to me.  Indian rupee162 crore equals $32.4 million.  In comparison, Jurassic Park cost $63 million in 1993 and The Matrix cost $63 million in 1999.  The special effects in Enthiran are pretty good, and somewhat innovative, but the amount of screen time they get is minuscule compared to the effects in Jurassic Park and the Matrix.  Plus, they’re far poorer in quality than —  not as as detailed or spectacular as — the effects in those films.  I presume the cost of CGI special effects has also declined.

According to the Indian Express, a major reason for the cost was the special effects which alone cost 40% of the entire budget.  Even accounting for inflation, I can’t understand why Enthiran cost so much. Did they simply get ripped off by the special-effects-wallahs?

Ramachandra Guha on Dynastocracy

Posted in India by Armchair Guy on November 9, 2010

I’ve long been incensed at the way in which Congressmen in general, and Sonia and Rahul Gandhi in particular, have attempted to wipe out the memory of P. V. Narasimha Rao and his tremendous achievements.  I don’t find it surprising that they have done so; to acknowledge Rao would be to admit that almost all the positive developments the Congress can lay claim to in the last 20 years were initiated by an Outsider.  It’s possible Rahul and Sonia now believe their own hype — that they are no longer capable of understanding that non-Dynasty members may have made major contributions.

I have mixed feelings towards Manmohan Singh on this topic.  On the one hand, I feel angry at his silence.  But mostly, I just feel bad for him.  He seems to have sold his soul to Sonia and Rahul in exchange for his gaddi.  But  I don’t believe Manmohan lusts after power — I think he just wants to be rescued from the utter obscurity that awaits a leader with no political network of his own.  Perhaps he’s not strong enough to embrace that obscurity.  Perhaps he feels that, puppet though he may be, he can do more good than his putative replacement.  It doesn’t matter. What feelings bubble up behind that weak smile, I wonder, when he hears Sonia and Rahul giving Rajiv credit for everything that his original mentor did?  Has age and time numbed his conscience?

These points are nothing new.  They have been standard talking points on blogs and online discussion fora for at least half a decade.  I said it too: here and here.  But Ramachandra Guha collects them all at one place here, and fleshes out the story with a little bit of history.  He says:

Our leaders … do resemble Stalin … in their vanity and insecurity. They cannot purge or kill former colleagues, but they can at least disparage their contributions, while magnifying their own.

And then he asks:

In the 125 years of its existence, the party has produced a series of impressive and important leaders. … will its historians and propagandists recall the great women leaders of the past, such as Sarojini Naidu, Kamaladevi Chattopadhyay, and Sucheta Kripalani? … Will … such charismatic and greatly influential individuals as J.B. Kripalani, C. Rajagopalachari, Jayaprakash Narayan and Rammanohar Lohia be mentioned at all …? Will … its most outstanding president, K. Kamaraj, and its brilliant prime minister who died early, Lal Bahadur Shastri?

Let’s keep dreaming.  Ram Guha addresses this topic from time to time, see also for example here.