Ads by Google

Tuesday, May 6, 2008

Blue Screen of.....never mind

A little macabre thought over this article. Would you want that in your car?

:)

Sunday, May 4, 2008

Printing address labels using LaTeX

One of the best things about CTAN is that it has all the software for your everyday needs. For the last couple of weeks, I'd been sending out some large number of snail mails to a lot of organisations. And my handwriting is pretty much crap; even I can't decipher it after a few days. The return address looked like I had an epileptic seizure when writing it. And the solution was to print out my return address on labels. I could spent half an hour, doing it on my own (which would have been crappy too) but why reinvent the wheel? I was pretty confident that it had been done before.

Since I had MikTeX installed, I fired up the package manager and soon enough, located the labels package. Installing through the package manager was a breeze. And the documentation is excellent. Here's what you need to type to print a A4 sheet of your own address labels.

\documentclass[a4paper,12pt]{article}
\usepackage[newdimens]{labels}
\LabelCols=3 %3 columns of labels
\LabelRows=7 % 7 rows of labels
\numberoflabels=21 % number of repeated labels

\begin{document}
\boxedaddresslabel[\fboxsep=3pt]
{\textbf{From:\\ Sivaram} \\Line1\\Line2 \\Bangalore \\Karnataka}

\boxedaddresslabel[\fboxsep=3pt]
{\textbf{From:\\ John Doe} \\Line1\\Line2,\\ Bangalore \\Karnataka}

\end{document}

%%% Local Variables:
%%% mode: latex
%%% TeX-master: t
%%% End:

Save and run PDFLaTeX on the file and you should get a 2 page PDF that has 21 address labels on each.

Locate a paper cutter and chop the paper and you have your address labels ready. That's it. It took me half an hour to do this. Which is the same time to do it on my own, :-) but at least this is definitely much better than the trial and error method of trying out fonts with different sizes and boldness.

Friday, May 2, 2008

Shell backticks deprecated!

I didn't know that till I saw this post on comp.unix.shell. For someone who still works on old Solaris boxes that is a shocker. In the nicest possible way.

But if you look at the thread, it appears that it is applicable only to the bash shell and more modern variants. For a minute, I thought it was something which was always there for older shells and only I didn't know about it.

At least, now that I know about it, I can safely use the new idiom with the Linux boxes that I get my hands on. But almost all my work environment is with customer's UNIX boxes which come with the default bourne shell which I cannot change.

So, while good to know, I think I shall have little use for it in my work environment

Thursday, May 1, 2008

Trying out various blogger bits

The more I use blogger, the more i want to make my blog similar to the gazillion blogs out there on the Internet. :-)

So, the first thing I did was a bit of vanity stroking by hooking up with sitemeter.

Then I saw Clustrmaps and I wanted that. So installed that too.

Soon, my blog is going to be exactly identical to everyone else's.

That's a comforting thought, isn't it?

Tuesday, April 29, 2008

How to start a massive flamewar!

When you make a blog posting like this. Armageddon time. :-)

Sunday, April 27, 2008

Binding Keys in Emacs

In Emacs, the keys can be rebound to call any function one desires.One of the many uses of rebinding is to call frequent functions that are operated on the buffer one is working on. And the key bindings can be local or global depending upon whether the functionality makes sense across all buffers or only to the type of buffers worked on (text, tex etc.)

Here for example is what I have mapped for TeX mode. I have outline-mode enabled by default for LaTeX files.
(add-hook 'LaTeX-mode-hook
(function (lambda ()
(setq fill-column 68)
(auto-fill-mode t)
(flyspell-mode 1)
(TeX-PDF-mode 1) ;;turn on PDF mode.
(outline-minor-mode t)
(ruler-mode t)
(local-set-key "\C-cf" 'beamer-template-frame)
(setq ispell-extra-args '("--mode=tex"))
(paren-toggle-matching-quoted-paren 1)
(paren-toggle-matching-paired-delimiter 1))))
Now, this puts an outline-mode menu on the menu-bar whose keybindings
are atrocious! :-)

Now in outline-mode, the most frequently used functions are

Show All
Show Entry
Hide Body
Hide Entry

at least by me.

Now, I'd like to map the keys as follows

Hide Body F7

Show All S-F7 shift F7
Hide Entry F8

Show Entry S-F8 shift F8

Next, open a LaTeX file and enable outline-mode, if it has not been done so. Then, M-x local-set-key RET f7 hide-body. Test it by hitting F7. If it works, then do C-x ESC ESC, you should see the following form in the minibuffer. Copy it to the scratch buffer. Repeat the above M-x local-set-key with S-F7 to bind it to show-all and copy the form to the scratch buffer.

You should have something like this in your scratch buffer.
(local-set-key (quote [f7]) (quote hide-body))
(local-set-key (quote [S-f7]) (quote show-all))
Repeat the above actions for hide-entry and show-entry to use F8. Of course you can bind it to any other key than the suggested F7 & F8 function keys. If you're happy with it, you could add it to the LaTeX-mode-hook function after the outline-mode is enabled.

Note that the idea of C-x ESC ESC ( repeat-complex-command) to get the key bindings is got from here. As the post suggests, it's far easier to let Emacs generate the correct key binding forms instead of doing it by hand.

And it might be a good idea to associate some logic to the key bindings. I use the key and shift key to toggle between two opposite actions. At least that sounds logical to me.

Friday, April 25, 2008

Proved Right!

Back then, I speculated that the reason Sun bought out MySQL was probably due to its spat with Oracle over pricing multicore chips.

Well, this story sort of confirms that.

Pricing on a processor based system is now more complex with cores more than 1. and it's going to sock the first guy with more cores per chip, from their trusted partners.

Wednesday, April 23, 2008

What did they have in mind....

when a variable called track-eol is created which you can set as

(setq track-eol t) ?
Apparently if you set this to a non-nil value and if you're at the end of a line, C-n and C-p will track up or down to the end of the line you just moved to.

I've enabled it in the past and I can't say I found it tremendously useful and wondering if anyone has ever seen some good use for it. It's mentioned in the manual. Drop me a line if you ever think of a good use for it. I have a nebulous thought it might be useful for fixed width data files?

*shrug*

Copy it to the scratch buffer, eval it and open a few text files and see whether you like it all.

Monday, April 21, 2008

Increase your productivity with Minor Modes

One of the features that increases your productivity are the minor modes that can be enabled to help your work. Abbreviation mode, Foot note mode, flyspell mode are some of the minor modes that allow you to correct typos, add footnotes and do spell check.

In addition there are lots of other minor modes have been added to the main branch of Emacs that can complement the existing ones.

Like Table, that allows you to create ASCII tables to align text and also create spiffy text based tables. It also provides a LaTeX export function that helps in creating a LaTeX table. Frankly, I've been using the table-insert function to create all my LaTeX tables. Saves me the repetitive edit-view-correct cycle by a huge margin.

Another simple one is ruler-mode that puts a ruler on top of the text area. If you do a M-x find-file RET ruler-mode, the commentary will explain what are the features you can use enabling the minor mode. Tremendously useful when working with fixed width data; slightly better than following the mode line for the column position, I dare say.

And one other under appreciated mode for newbies and intermediate Emacs users is outline-mode. Found in org-mode and one that can be set in LaTeX mode (with AucTeX), the showing and hiding of the sections allows one to navigate large documents quite easily. Instead of scrolling up and down the document, it's easier to fold the arbitrary sections to focus on the section at hand.