Ads by Google

Friday, December 26, 2008

Thursday, December 25, 2008

Generating Automatic File headers

You know how you get nagged to document your code? What the file does, who created it, when was it last changed and a history log; all that the QC guy insists that you plug in?

Well, you make an attempt at it initially, and then laziness takes over; you start to copy the header from an existing file to a new  one which comes with it's own set of headaches.  You have to correct all the previous references to the correct file name, change the history etc.

There is an Emacs package called header.el that allows you to create the file header and also automatically update certain parts of the header every time you save.  There are templates for common classes of file types and the headers generated are self explanatory.

Download the above file,byte-compile it and put it in a place where Emacs can find it.  Add the following to your .emacs.

(require 'header)
A couple of screenshots should make it clear how useful it can be. Suppose I create a new file called and invoke M-x make-header.

This will create a template for shell scripts as shown below.  Note that the user name is picked up from user-full-name which needs to be set in your .emacs.

The moment I save the file, the "Last Modified" lines and the update count are automatically updated and are done every time the file is saved.

Well, you'd obviously like to put in some revision history and that is done by M-x make-revision which creates a history section as shown

The commentary inside header.el has more information on customising these features, especially copyright notices and header design to suit your organisation's standards.  From the header.el source file

;; Define the individual header elements.  THESE ARE THE BUILDING BLOCKS
;; used to construct a site specific header.  You may add your own
;; functions either in this file or in your .emacs file.  The variable
;; make-header-hooks specifies the functions that will actually be called.

And user customisable options such as

;; This file adds support for the creation and automatic maintenence of file
;; headers such as the one above.
;;  User Commands:
;;   M-x make-header
;;   M-x make-revision
;;   M-x make-divisor
;;   M-x make-box-comment
;; Customizer commands
;;   register-file-header-action
;; Customizer variables
;;   header-copyright-notice
;;   make-header-hooks

It's a good idea to put all the changes into your .emacs instead of editing the source elisp file.

One other note:  The emacswiki site has a section on AutomaticFileHeaders that outlines some improvements over header.el and available as header2.el done by Drew Adams.  You may want to try that too, though I haven't tried the new version.

Sunday, December 21, 2008

Footnote mode

Those familiar with LaTeX will understand footnotes and how they are generated when the LaTeX document is compiled.  Emacs too, comes with a footnote package that sort of imitates the LaTeX style.  This can be used in any text based document whether it is emails or plain articles.

Footnotes mode is bundled with Emacs, so it's invoked by M-x footnote-mode.  It is a minor mode which is really handy especially when you don't want your text to be marred by long urls, lengthy explanations which disrupt the flow of thought.  I find it useful by simply adding the dummy footnotes for key words and the like and then writing the explanation at the bottom as I complete the article.

A screen shot of how it works will  

While this adds some nice professional look to your text based email, there are some minor issues to be borne in mind.  The numbering is not preserved between sessions i.e. when the file is re-opened, numbering will start again from 1.  This might not be ideal though it is easy to work around with, by increasing the sequence till it matches the current valid running number.

Or as the wiki pages go,there is a patch to fix that.  But that is not yet part of the mainline Emacs 23, so it's left to you to remember to upgrade whenever Emacs is upgraded.

Tuesday, December 16, 2008

How to make Gnus behave a little like Pine

This just up on the Emacswiki.  A page describing how to make your Gnus behave more like Pine.

Quite why you'd want to do that is beyond me as they're different as chalk and cheese.  Well, apart from being text based email clients, that is.

Still, whatever floats your boat.

Friday, December 12, 2008

How to get information out of a subshell?

The above topic seems to be a pretty common request on the newsgroup.  It was for me too, when I was learning shell programming.  Sooner or later, as a noob, you run into that code fragment that doesn't store the values you were sure were getting generated.  Heck, look at all the echo statements, you put in!

It seems to take a bit programming experience to figure out these subshells, processes, command substitution and the like.  The more code you write, the more likely you are going to get into situations where such features are absolutely required for your code to work.

This thread here provides several ways to do it by other coders.

Tuesday, December 9, 2008

PDFcomment: A userfriendly interface to \pdfannot

Just saw this new package,PDFcomment on the ctan-ann mailing list.  The \pdfannot command is used to add comments to your PDF file when generated through pdflatex.  This has varying degrees of support depending on the PDF viewer and the version of the viewer i.e. you might not see the comments at all if your viewer does not support it;  Rest assured that the PDF file is still the same.

And this style file is a decent interface (warning PDF file) to the underlying pdfannot command.   Note that while one can add comments through PDFLaTeX, others receiving it cannot add more comments. Unless explicit permissions are set on the PDF file.  Which pdftex does not support and needs to be done using some other external tools.

The last time I checked, there were some legal issues in changing document permissions of an already created PDF file. Unfortunately, can't find where I saw that and I could be completely wrong about it.  I believe this AREnable tool probably would help though I've never used it.

Friday, December 5, 2008

Mouse avoidance mode: addressing minor irritants while working

You know the number of times you have to nudge the mouse, just to get the mouse pointer out of the way?  Irritatingly, right over the last letter and cursor when you have writer's block and staring blankly at the screen?

Well, Emacs has a minor mode to fix that too. erm....the mouse pointer, not the empty thought.

It's invoked as M-x mouse-avoidance-mode and gives you several options of how the mouse should behave when you call the function.  From the doc string

  * banish: Move the mouse to the upper-right corner on any keypress.
 * exile: Move the mouse to the corner only if the cursor gets too close, and allow it to return once the cursor is out of the way.
 * jump: If the cursor gets too close to the mouse, displace the mouse a random distance & direction.
 * animate: As `jump', but shows steps along the way for illusion of motion.
 * cat-and-mouse: Same as `animate'.
 * proteus: As `animate', but changes the shape of the mouse pointer too.

You can repeatedly chose from the different options to see what behaviour you like.  All you have to do is to bring the mouse close to point or where you are typing to see it move away.

Works beautifully without any noticeable disturbance to your typing.


Thursday, December 4, 2008

OXML plugin for Firefox

Not sure where this heading but Microsoft has released an Open XML document viewer plugin for Firefox.

The plugin itself can be downloaded here.

If users don't know that it is a Microsoft standard document format, would they adopt it without reservations?  The plugin is not downloadable from Microsoft's support pages too.  I can't think of a reason why they'd want to release this plugin; it's not that they've cared before that their documents have to be read from different document editors or viewers.

What gives?

Saturday, November 29, 2008

Scoring Down Usenet Spam in Gnus

For some days over the last few weeks, some of the newsgroups that I was following was overrun with spam.  My article counts for some of the newsgroups was in the high hundreds even as I was catching up with the posts regularly.

Fortunately, Gnus offers  a way to score down the spam and even expunge the articles when the score is lower than a threshold.

Here's one way of doing it.

Saturday, November 22, 2008

Converting your Ascii art to PNGs

If you use org mode, in the contrib/scripts folder of the package you'd find a jar file called ditaa.jar. This is a small piece of software which requires Java (drat!) but nevertheless a neat one.

For those of you who know Artist-mode in Emacs, this would be a god send. Instead of the ASCII pictures that you send in your emails, the same ASCII can be converted to PNG images and sent across. Here's a sample of what I did; albeit a nonsensical one.

First I drew this ascii text of 2 rectangles by invoking M-x artist-mode and drawing them using the rectangle option.

I saved the text file and called the program thus

$ java -jar ditaa.jar ../../temp/aa.txt

DiTAA version 0.6b, Copyright (C) 2004 Efstathios Sideris

Using options:

Reading file: ../../temp/aa.txt

Rendering to file: c:\..\..\temp\aa.png

Done in 5sec


I did that in my cygwin emulation shell in Windows, so it should not be too different in Unix OSes or the DOS prompt.

The homepage of the package is ditaa and it has a good intro on how to use the software. So, it all boils down to learning artist-mode in Emacs and then converting that to PNGs. The package is written by Stathis Sideris and you can contact him for any bugs and features you need. In my opinion, this is one handy piece of software when your rough sketch needs to be seen by all and sundry. For simple database sketches, this will be an excellent tool and another reason to do all your work in Emacs!

Wednesday, November 19, 2008

Word count of your LaTeX document

Just saw an announcement on the CTAN-ann mailing list about TeXcount.  The homepage has more details on the feature list and other shortcomings. 

This should be useful for getting the correct word count instead of exporting the DVI/PDF file into a text file and then trying a word count.

Note that it require Perl, as it is basically a perl script.

Saturday, November 15, 2008

Email encryption howto

In a fortuitous coincidence, the Register has published an article on email encryption.   Just following on the heels on my posting about Gnus authinfo encryption.

While it is certainly Windows oriented, it should be useful to get your basic installation right.  Add to that my refrain, that it's always best to install it in folders without spaces in their names.  Sooner or later that tends to cop out somewhere with some program.

If you install it (note the warnings in the Epilogue about trusting public keys), then configure easypg to point to your gnupg exes and other files, you should be done.

Using it with Gnus is not the only reason you need to install easypg and gnupg

Thursday, November 13, 2008

Encrypting your Authinfo file

The authinfo file is used by Gnus to connect to various mail servers.  Putting the connection details, userid and passwords in it lets you login into different mail servers and download or access your mail and News without having to type in your userid and password everytime.

But the data is stored in plain text.  And if you feel uncomfortable with the file have all the details in plain text, encrypt it using EasyPG.

The emacswiki page on GnusEncryptedAuthInfo provides clear instructions on how to configure your EasyPG setup to encrypt your authinfo file.  Do note that you need to have gnupg installed to make it all work.  Of course.

And a little idea about what is a pass phrase, public, provate keys would help you in understanding the instructions better rather than following arcane (seemingly) instructions.

Sunday, November 9, 2008

Closing and Opening server connections in Gnus

When using Gnus, it sometimes happens that the server is flaky or there is a problem with your internet connections and the entire Gnus session sort of hangs.   And you have problems reconnecting.

Perhaps the simplest method is to, close the server connection and open it again as mentioned in this post.  To get to your *Server* buffer, use ^ in your Group buffer.

It's much cleaner than killing your Emacs session and taking other drastic measures.

Saturday, November 8, 2008

Emacs in the NYT

I never thought I'd see a mention of GNU Emacs in the New York Times, albeit in the comments section.

But it is there, mentioned as one of the oldest software around by some knowledgeable commenter.

PSTricks or PGF/Tikz?

Right now, you have a choice of learning PSTricks or PGF/Tikz for all your drawing needs. Both are large pieces of work which require you to read the manual over and over again. At least till you get it.

For myself, while I've known about PSTricks, I've stuck to PGF/Tikz. But if you need to have better plotting and more features than the already extensive one in PGF/Tikz, then PSTricks is the way to go. Again, the choice is dependant on your needs and the level of programming you'd like to get into.

This thread on comp.text.tex might help you decide.

EDIT: As the note in the comments mentioned there is also METAPOST and one other graphical language called Asymptote.

Tuesday, November 4, 2008

An eviscerating review of OpenOffice 3.0

Man, I'd be gutted if something I developed was reviewed and savaged like this.

I'd still use OpenOffice though.  It's not like I use Office suites frequently but when I receive the odd doc and I want to make some changes, save as PDF etc., I use Oo.  I'm anyway going to download and install it in a few days.

Sunday, November 2, 2008

Emacs command equivalents for Vi users

On the newsgroup, there is this thread on Emacs equivalent of some vi commands.  The poster had helpfully created a emacswiki page called ViEmacsTable and listed some of the answers he received.

Well, I've just edited it to add some equivalents that I think are the closest to vi's commands.  Feel free to correct them if they're in error and add anything that you think might be useful.

Friday, October 31, 2008

Determine the greatest depth of subdirectories in a hierarchy

I found this thread on interesting.  And I particularly liked this solution.

$ x=./a/b/c/d/e/f
$ y=${x//[^\/]}
$ echo $y ${#y}
////// 6

Nicely done within the shell itself without calling anything anew.  And the thread itself has other solutions that may be of use to people who need to traverse and check files in directories.

Monday, October 27, 2008

List of packages included in the TeXLive 2008 Distribution

This might be useful information for those using TeXLive 2008.  Apparently, if you need to know the list of the packages, issuing

tlmgr list

will provide such a list.  There is also this link.

From a post on the comp.text.tex newsgroup.

Strange, there is no archive of the posts since the 25th on google groups.  So, when the archives come back, look for a post with the following information

From: Rolf Niepraschk <>
Newsgroups: comp.text.tex
Subject: Re: List of packages in TeXLive 2008
Date: Mon, 27 Oct 2008 12:07:17 +0100
Lines: 16
Message-ID: <>

Let's hope this gets sorted out fast.

Sunday, October 26, 2008

Placing images next to each other by stitching them together

Most people learn that when using LaTeX, that images and figures can move all over the place when used in a document. The standard advice is to make your document final and then try to tweak the placement of the figure.

Good advice.

And it never works for me. I always want to correct a sentence here, clarify a point there and soon the figure drifts to the next page.


So, the other day I was plotting some graphs of financial data using gnuplot and wanted to put all 6 PNGs in 1 A4 page. My first instinct was to generate a LaTeX template and use subfigure (superseded by Subfig) to place the images.

hmmm....this is going to take a long time I thought.

Each PNG image is 480 x 360 pixels in size.
An A4 paper is 210 by 297 mm in size

Got to do some math to figure out placement....

Screw that, I'll just use ImageMagick to do that.

montage `ls $OUTDIR/${base}*.png` -geometry 100x100% -frame 5 -tile 2x3 $OUTDIR/${base}_merged.png
convert -page A4 $OUTDIR/${base}_merged.png $OUTDIR/${base}_merged.pdf

montage and convert are part of the ImageMagick tool suite

So, the above montage command draws a frame around each image and produces a 2 column by 3 row single image of the 6 PNGs. And convert resizes the image to fit into an A4 pdf file.

Obviously there are plenty of drawbacks with my approach, chief among them is lack of flexibility in adding text and such. You can do it over the image though and a bit of captioning with montage but that's about it.

In this case, my needs were simple; all I wanted was all the 6 images in 1 A4 sheet with very little text. montage fits my needs perfectly well.

An example image stitched by montage is

This is then converted to PDF using convert.

Monday, October 20, 2008

Finding the right LaTeX font

If you're new to LaTeX, it is highly possible that you end up having to learn far more than you ever wanted to know about fonts.  Personally, apart from a cursory understanding of fonts, I never bothered learning more about fonts in LaTeX.

Too much to learn and very little benefits.  I mean try talking to your colleagues about Arial and Helvetica differences and watch them edge away with "hey, almost missed my meeting, see you".

I jest.

It's not that you need to know that much into fonts in LaTeX but it helps.  But with all packaging done now by TeXLive and MikTeX, there is very little you need to know.

  1. Ask for a font that fits your specific needs in the comp.text.tex newsgroup.  Read the replies, links and FAQs
  2. Download and install from your distribution through the package manager.
That's it;in most cases.   I haven't installed a single font manually in over 6 or 7 years.  That's how well you can manage with the default installation

OR a sign of my laziness as I have NEVER installed a single font manually

In order to save you sometime over agonizing over font choices, you could always check out the LaTeX font catalogue to see whether you like any of the fonts under different categories.  It also provides the methods of using it in your document when you click on a link.

It would also dispel the notion that there aren't enough font choices in LaTeX.  And if you're a neophyte in font taste like me, pretty soon, your eyes glaze over and everything looks the same to you.  Trust me on that.  10 minutes into all that choices, I'm like "What am I looking for?"

But I digress.  Do take a look there to pick a good font for your posters, reports and special needs.

Saturday, October 18, 2008

New org-mode videos available

From the org-mode mailing list, here's a post about new org-mode videos presented to the Houston Linux User group.

If you're new to org-mode this might be a good thing to view and try out.


Tuesday, October 14, 2008

Lisp50 Schedule Available

Take a look at the schedule for the Lisp50 conference to be held at Nashville.  All the biggies are there.

Saturday, October 11, 2008

Preventing Emacs from wrapping searches

The key C-s allows you to enter some string to search in the current buffer.  By default, it wraps the search and starts again from the top, if you invoke it one too many times.

On comp.emacs newsgroup, this thread outlines how one can turn it off.  Useful, if it is the kind of behaviour you want.  Speaking for myself, I wouldn't change the behaviour as it makes more sense to have wrapped search as the default.  Saves a few keystrokes and rare is the time one would need this feature of NOT wrapping the search.

Wednesday, October 8, 2008

PGF and TikZ examples page moved

Kjell posted on the pgf mailing list that he has relocated the gallery of pgf and TikZ figures to the new location. As mentioned in one of my earlier posts, it is an incredibly useful resource for typesetting graphics and there are numerous examples of different objects that may be of use to you.

Update your bookmarks.

Monday, October 6, 2008

Interesting papers and author bios for OOPSLA 2008

Over at lisp50, Pascal Costanza has several posts about the upcoming lisp conference.  Even if you're not going to learn lisp in depth, it pays to know who the important people are.  Some of them still post on the comp.lang.lisp newsgroup.

And there are photos to put the name to a face.

Go read.

Tuesday, September 30, 2008

My Free Gnus Mug!

Lars recently posted on the Gnus mailing list that he had a few extra mugs and Tshirts and was willing to give them away for free. Well, I took him up on his kind offer and today I received his package.

A fine mug indeed. Now I have to convince my office colleagues of the earth shaking significance of the mug. :-)

Well....I'm not a good photographer.

Friday, September 26, 2008

Plotting tables in Org mode

A new tutorial has been added to Org-tutorials site explaining how to plot your org table data using gnuplot.   Another reason not to step out of emacs.

Saturday, September 20, 2008

A Visual Bookmarks package for Emacs

When you use the default bookmarks feature in Emacs, those used to visual feedback on where the bookmarks are made, are let down.

There is none. Although the text based system is perfectly fine, lots of people would find a visual way to see their bookmarks as a better way to locate where they placed the bookmarks. At this point if you don't know what a bookmark is, it's best to read the manual link above.

Enter bm.el which is about as close you can get to mark up your code in technicolor!

Download and put it somewhere in your load path. Add the following to your init file

(require 'bm)

And a couple of customisations that you should set so that creation and navigation is easy. The author recommends

;; M$ Visual Studio key setup.
;; (global-set-key (kbd "<C-f2>") 'bm-toggle)
;; (global-set-key (kbd "<f2>") 'bm-next)
;; (global-set-key (kbd "<S-f2>") 'bm-previous)
you can also tinker with how you want the bookmarks to look like by using one of the following

(setq bm-highlight-style 'bm-highlight-only-line)
;;default, the last one in the pic

(setq bm-highlight-style 'bm-highlight-only-fringe) ;;middle bookmark

(setq bm-highlight-style 'bm-highlight-line-and-fringe) ;; the first one

You can customise the colours by using M-x customize-group bm and changeing the defaults.

One other function that should be useful is M-x bm-show and M-x bm-show-all; both show all the bookmarks set in the current buffer and in all buffers respectively. If you read the commentary of the elisp package, you'd see options to make the bookmarks persistent, annotate them, controlling the size of the bookmarks file etc.

While the default bookmarks bundled is more than adequate, this package is quite eye pleasing without getting in the way. At least for me, I tend to use this where I don't need persistence of bookmarks and throw it all off after I killed the code buffer.

Friday, September 19, 2008

Dired: Filter file names

If you want to see only files with certain extensions like *.sh, the simplest way to do it is C-x d *.sh to just show shell scripts.  This thread on shows other ways of doing the same.  As you can see there are a number of ways to achieve the same but in my opinion, filtering it by passing the regex to dired is the easiest.

Saturday, September 13, 2008

Changing fonts in your LaTeX document

In this discussion on changing fonts on comp.text.tex newsgroup, the reply might be useful in deciding which font to use where.  That is one of my biggest issues with fonts.  I have no taste. :-)

Given a large number of fonts, I'd unerringly chose the one font that would make folks gouge their eyes out with a blunt pencil, I swear.

Assuming what the author wrote is true and people are in general consensus, I'd take those instructions. Not being an expert in Typography, I'm hard pressed to come up with a good explanation of how, what and where different fonts make a good impression.  I used to compile my paper with different font packages to see which one appears good and by the time I tried my fourth font, I'd promptly forget how the first looked like.  Of course, I could have saved each font type and then opened all of them to compare but being the lazy person I am.....

That said, as the thread mentioned, it's better to use the font packages rather than trying to change the individual fonts for specific parts of the document.

Saturday, September 6, 2008

Emacs 22.3 released

From the mailing list, we have the bug fix release of Emacs 22.3. In a couple of days, the Windows compiled binary should be available here, as I can't see it so far. And then it would be found in your favourite gnu ftp mirror site in a few days from now.

Wednesday, September 3, 2008

Building TeXLive Binaries on Cygwin

A few months ago I had asked about whether there was a cygwin version of the TeXLive system as the TeTeX system was no longer being actively maintained.

Today I received a response that it can be built successfully on cygwin , thanks to Angelo Graziosi. It might be useful for some. Please read the README so that you don't run into surprises. You have to download the lzma file and install it as suggested in the README.

As for me, I'm sticking with MiKTeX as it works without a hassle and the update feature synchronises all the packages I have installed already. If the cygwin maintainers add TeXLive to the official list of maintained packages, I'd change my mind. It's easier to keep everything under one roof than having to get it from ten different places.

So, if you want a cygwin version, it can be done.

Sunday, August 31, 2008

Why I rarely try out other editors

This thread on the sas-l mailing list got me thinking on why I rarely try out other editors these days. Granted it is specific to the product but still, there are lessons worth learning from it.

If you see the litany of complaints in that thread, first off, you'd notice that in a code editor that is pretty much non graphical in its code presentation, you'd have few of the problems listed. Sure, you'd have to do a lot of pagination to paste and read code later on but you don't have to tear your hair out in doing so.

And if you were just that bit script savvy (not necessarily elisp), you'd be that much more productive and less error prone. The complaints listed are the ones that bug me too. I don't seem to know what is happening when the table structures are copied as graphical objects or some sort object is copied in these GUI heavy editors. And the dreaded mouse clicks drudgery in validating whether the structures are being copied correctly?

That'd kill me out of sheer boredom.

Partitioning the code, testing it in little pieces, assembling it in functional pieces are lost with these editors. Sure, you can do it but that comes with experience and I bet that you'd have to do the mappings and flows all over again while assembling it.

If it were left to an editor like vi or Emacs, cloning, copying and modifying large parts of code is easy with a bit of builtin functions or other Unix tools like sed, grep and bash shell. Notice that you are not forced to use the editors themselves if you want to? But with these new editors with their project folders and tracking, you'd have to hack it to figure out data structures and try figuring other means to edit the code. And it all goes awry in the next release of the editor.

The more you use the product editors, the more is the learning involved in relearning doing the same things because the menu options have changed. There is very little in applying what you've already learnt to be productive immediately.

That's partly the reason why people are pretty insane in sticking to Emacs or Vi. Compared to sheer frustration with a "smart" editor, these are plainly functional tools that are general purpose text editing applications that Just Do The Job.

You build on what you've already learnt with Emacs; the core functionality is always available in all the modes and you learn the mode specific behaviour as required. And being text oriented, you've got only yourself to blame for any "mysterious" bug that appears.....well, mostly.

Every new fangled editor comes with some new idea that makes it worthy in some respect but you seem to have to lose out a number of other features that makes you productive to use it.

I threw in the towel a long time.

Now, I just check out whether the same feature is available in Emacs in some form or the other.

Friday, August 29, 2008

Emacs 22.3 Pretest available

The second pretest of Emacs 22.3 is available here, that's for the windows version.

Saturday, August 23, 2008

Understanding Emacs Mark and Point

Another terminology which brings some form of confusion to newbies is the term Mark and Point used in the manual and in descriptions of Emacs editing actions. Truth to be told, I too just had a fuzzy idea what mark was all about when I first started and took point to be where ever the cursor was currently.

Well, point is exactly that; it is the current position of the cursor on your Emacs buffer. And it's there in the Emacs Tutorial too.

The location of the cursor in the text is also called "point". To paraphrase, the cursor shows on the screen where point is located in the text.

So, what is mark, then?

Mark is the equivalent of dropping anchor or "marking" the start of a position in a buffer. One marks a position in the buffer and then moves the cursor to another point, delimiting a region. Thus, mark is primarily used to delineate a contiguous region of text in conjunction with point. The text between the mark and the point is the region where one can operate Emacs commands if needed.

Is there an order to mark and point?

No, from the manual

The ends of the region are always point and the mark. It doesn't matter which of them was put in its current place first, or which one comes earlier in the text--the region starts from point or the mark (whichever comes first), and ends at point or the mark (whichever comes last). Every time you move point, or set the mark in a new place, the region changes.

Now, I suggest you hit the manual link above to know everything one needs to know about mark, mark ring and traversing marks.

Friday, August 15, 2008

Emacs Frames and Windows

For those of you who are new to Emacs and it's terminology, here's something that you need to grasp.

A frame in Emacs is equivalent to your window in normal Windows terminology. Well, sort of. An Emacs invocation can instantiate any number of frames and you'd see it in your taskbar as individual application instances.

A window in Emacs is the one that holds a buffer. An Emacs frame can have any number of windows. At any instant, there will be one window that will have focus or be the "selected window".

In the above picture, there is one frame with three windows. Two of the windows are showing the same help screen and the third is the scratch buffer. So you could open any number of frames using C-x 5 2 and within each create any number of buffers with C-x 2 or C-x 3. Depending on your working style and screen real estate, you could do one file on one frame or one file per window in one frame or combination thereof.

For a more detailed, see the manual sections, frames and windows.

Monday, August 11, 2008

An interesting post on keyboards and use of certain keys

I'm pretty sure, this is going to be a normal thing in a few years if Microsoft disappears from the IT scene. There will be a whole bunch of keys on the keyboard that no one will know what they are for because no one ever heard of Microsoft. The explorer and windows keys will be vestigial artifacts of a different computing era.


Take a look at this interesting thread and take a look at this post. That should keep you thinking on how systems evolve and how people understand them in the long run. From OSes, hardware to application software, we will be saddled with weird artifacts that are from another computing era but have no useful application now. And if the rate of technology change increases, barring a big shift, this will only accelerate.

Wednesday, August 6, 2008

Jpgfdraw: drawing PGF figures

If you find PGF too difficult to learn and use, then Jpgfdraw may be the tool for you. It exports the drawn picture as a file containing a pgfpicture environment which can then be included in your LaTeX document.

The drawback as I see it, it requires java 1.5 or later to run the application. That's way too much HDD storage needed for a bit of laziness in learning pgf. But if you already have it installed, then this should be ideal for those quick drawings that need to included into your LaTeX document.

Monday, August 4, 2008

Latest Builds of the PGF manual

The pgf package which is one of my favourite LaTeX packages for drawing pictures is released rather infrequently. Meaning, you get to wait a pretty long time for new features that are added, tested and then bundled for a release.

In case you want to the latest, you need to check out the CVS code and the prebuilt manual is available from Kjell's site.

Kjell recently posted on the pgf mailing list about the availability of the latest pgf manuals.

Saturday, August 2, 2008

The SPAM's getting better but it's still getting binned

Every once in a while, I check my Spam folder on on my gmail mail account to see whether there has been any legitimate mail binned, as a result of a false positive match. So far I've rarely had any mail flagged apart from the marketing material sent in by the Mutual funds that I buy.

While scanning the folder, I noticed that the social engineering aspect of spam emails are getting better. If it had not been for the spam filter and my lack of interest in the same spam emails, I think there'd been a bunch of saps who'd got infected with malware or some dreck of some sort.

Take a look at the above screen shot. Topical, covering entertainment, Politics, Tech and Business, it should be enough to pique someone's interest. All he has to do is open the email to get infected with the attached payload or get directed to a website that will install some malware.
Spammers seemed to have moved on from the "inadequate body part/function" mails though there are lots of that too, in my spam folder.

Gmail seems to be doing a fairly good job at identifying and binning them, so that's one strike against the spammers.

But these scum will keep trying, you can bet on that. If only they spent their time on more productive enterprise.

Saturday, July 26, 2008

A graphical Tutorial of Emacs Rectangle commands

The Emacs rectangle commands operate on rectangular blocks of text. (Surprise?) This is useful when you're working on columnar text and you need to work on columns of data much like Microsoft Excel. Here, I'm going to show you how to use them using a few contrived examples. Let's say we have following text entered in the scratch buffer.

Mark a rectangular block of text using C-SPC from column 1 to the 4th column in line 3. You should see something like this.

Now, this is a rectangle of 4Cx3R. On this you can operate any rectangle commands. The first is obviously kill-rectangle, bound to C-x r k. Applying that on the above state of the buffer you should see the following.

As you can see, the remaining text has been shifted to the left after killing the rectangular block of text. Since the text was killed as opposed to deleted which is bound C-x r d, the rectangular text is available to be yanked(pasted) in another place if required. C-x r y will yank the rectangular text back at point as shown.

The difference between kill-rectangle and delete-rectangle is that the former stores the killed text in kill rectangle ring while the latter doesn't.

Right, what happens if you don't want to shift the text to the left but just clear out a block of text? Well, that's when you use clear-rectangle bound to C-x r c.

But if you want to push text to the right as opposed to clearing it, you'd use open-rectangle bound C-x r o.

Note how the entire block of text is shifted rightward without anything getting deleted. So, if you wanted to enter text in the space, toggle the Overwrite key(to prevent the existing text from moving further rightward), fill in the text and toggle the key back again.

But, you say, I don't want to enter the same text in the columns over and over again. In fact you just want some standard text to be plugged in. No worries, you have C-x r t STRING to do that for you.
Mark the rectangular region as shown,

press C-x r t zzzz and you should see the above result. Useful for chunks of repeated columnar text when data is sorted by nationality, sex,currency etc. (which is pretty representative of textual data)

Oops, you forgot to insert an x in front of all the lines starting with z's?

No problem, just follow the above instructions, you should see this then.

Notice that even though a 4x3 block was marked, the inserted text was only 1 character and still everything came out correctly? The same happens with text which is more than 4 in this case, the columns shift to the right.

The most common uses of the rectangle commands are those that involve aligning columnar data, inserting and deleting columns of data, applying standard texts and the like.

Hopefully, this tutorial addresses the existence of rectangles in Emacs and how to use them. The Emacs manual has a little bit more on rectangles and how to use them with registers too. The canonical place to refer is the manual when things deviate from what I've mentioned above.

Thursday, July 24, 2008

Using TikZ graphics in Powerpoint

Came across an useful thread on the comp.text.tex newsgroup on how to get your Tikz graphics into Powerpoint. This should be useful to those who are forced to use the Office tools even if the graphics output from Tikz is superior.

So, there are ways to get the pics into Powerpoint. The only drag is of course, editing it if there is a blooper in the picture. You'd have to go through the edit, compile, check, export and paste into Powerpoint every time to fix things.

Which is not exactly ideal.

Saturday, July 19, 2008

Leslie Lamport recepient of 2008 IEEE John von Neumann Medal

Leslie Lamport of LaTeX fame has been awarded the IEEE John von Neumann medal.

Couldn't have happened to a more deserving person.

Maximizing your screen real estate

One thing that you'd notice as you become more proficient in Emacs, is that how rarely you use the menus and tool bars. Depending on how frequently you use Emacs, a lot of the basic commands get hard wired into you.

And after a sufficient level of proficiency you tend to dive into the help system or the info manual to learn about of version control or ediff, say.

Then, it makes sense to use the real estate occupied by the tool bars and menu for editing. You'd get an extra 2 lines of editing text; golden, if you're using a cramped laptop or small desktop screen. On my laptop, I could always use more space,as I tend to use larger fonts in Emacs.


(menu-bar-mode -1)
(tool-bar-mode -1)

to your .emacs will nuke your menu and tool bars. Though, it does appear that Emacs looks a bit naked or like a badly designed application.

Don't worry, you'll get over it.

Monday, July 14, 2008

How not to learn Emacs!

Ever started learning Emacs and gave up?

How many times did you try?


Let me give you some reasons why Emacs learning appears to more difficult than it actually is. Basing your reasoning on one or more of the following, you're only prolonging the agony, stubborn and being ornery about it. In hindsight, it is no more and no less difficult than learning any tool.

It all boils down to, how much are you willing to unlearn and then relearn something basic? The following are all variations of the same theme over and over again.

  1. Emacs doesn't behave like vi or this/that editor. Of course it doesn't. Emacs behaves differently than most others editors in vogue currently. Every aspect of Emacs is pretty much guaranteed to be different from what you've generally used to with respect to your other editor. Obviously, not a modal editor; the GUI is skimpy when compared to the other editors; builtin interpreter; buffers and modes; weird help system; frames and windows et al.
  2. Emacs does not follow the Windows CUA UI standard of editing text. Yes, there is cua mode that provides these features but the default is certainly not one that Windows users are used to. Citing this as a reason has always been a bit puzzling for me. If vi users are way more legion than Emacs and they are willing to train themselves of h,j,k,l keys, there is some disconnect here. Why is Emacs more difficult than that? Yes, it can be incredibly frustrating with the copy paste actions that working on the Windows platform brings but it can be overcome. Trust me on that. I gave up initially because of the very reason. Too lazy to train my hunt-n-peck typing fingers to learn anew. But one day, once I made up my mind to figure out all things Emacs, I did not worry about this at all. Just took it for granted that C-y, M-y are the way to go.
  3. Emacs key-chording is weird. Again, a disconnect, people are willing to learn hotkeys, Windows shortcuts and the ilk but key chords? Emacs takes hotkeys to the extreme. :-)
  4. Emacs terminology is alien. A common complaint but if you're going to learn a new editor you might as well get used what IT is asking you to learn instead of trying to make it fit your world view. Once you learn the emacs terminology, then everything else will start falling into place. And soon you will be modifying Emacs to fit your world view.
  5. The Emacs help system is complex and bewildering to new comers. It only appears so; given time and patience in learning the tutorial and getting stuck, the help system will be a natural extension to working in any editing context. Combined with the info reader, it is simple, effective and gets what you ask for. Compared to other help systems from Borland, Microsoft, it is highly contextual given the way Emacs is crafted.
  6. Emacs use LISP. So? Not a frequent comment but I did hear it once when I remarked about it using Emacs-lisp builtin. And you can get by or defer learning or coming into contact with it as much as possible. The Emacs customize system tries to hide as much as possible for the lay user.

I should have started learning Emacs around 1996 thereabouts but ended up fulling committing to learning it only in 1999. Talk about inertia and excuses! All the above and variations is what I used. I learnt vi, nano, textpad, notepad+ or whatever, pfe or something and other editors. Finally got religion and converted to Emacs. And then when I tried to convert others, I ran into the same issues that I had.

I've noticed that the resistance is incredibly high for Windows users. The CUA stuff and the lack of shiny icons and the key chording makes it incredibly tough for them. But that is a hill that they have to climb themselves and encouragement is only that; encouragement.

If you have any of the hang ups as mentioned above, then it certainly is not the way that will get you proficient in Emacs. It only serves to limit your learning and enjoying the learning process.

Thursday, July 10, 2008

Adding Emacs to your Global Context Menu in Windows

If you are a windows user and want emacs to appear in the context menu, here's one way to do that. It involves tinkering with the registry and it creates a new instance of Emacs on every file you use it on.

Monday, July 7, 2008

Learning to use the Emacs keyboard macro system effectively

The Emacs macro system is probably the least used feature by newbies and intermediate users. Which is a shame as it's a really neat piece of code and the learning overhead is very small.

The latest versions of Emacs has the keys F3 and F4 mapped to start and end of the macro recording. And the next invocation of F4, runs the last created macro.

Recording a macro is easy. Hit F3 and start working. Of course, the idea of a macro is to do repetitive tasks and one needs to record the steps and apply it to the buffer text.

Here's where it is important to get things right.

One,don't worry about efficiency or the least number of keystrokes to achieve the task. Most times, the macros are one off and will rarely be suitable for another task later in the day or week. I've rarely had the chance to reuse any of the macros I've written. And every piece of "similar" text you receive, the odds are better that you do the macro from scratch again.

Second, use the emacs provided line commands instead of counting words, letters and spaces. Your macro is more robust if it is recorded in emacs contextual fragments i.e



Counting characters instead of using Emacs word boundary definition will lead you astray. Your macro will work for some cases and break in case of the others.

Three, once you get the hang of this, you can edit the macro by M-x edit-last-kbd-macro and delete/add additional corrections you want, and make it available by hitting C-c C-c to recompile the macro.

Try it on a couple of lines of text by hitting F4 and see where the point ends. That typically will tell you what happens if the results are not what you expected when you run the macro. You might have to add a C-n or C-j to move or create a newline.

Once you get the hang of simple macros, you can then move on to more difficult versions of the same. I've once used macros to copy stuff across 2 buffers back and forth. The more you use macros, the more natural it will be to use it for any and every repetitive tasks.

You'll find it really useful when editing UNIX shell scripts, data files and configuration files

Friday, July 4, 2008

Quickly Creating LaTeX Tables in Emacs

One of the "that sucks" part of using LaTeX is the part about creating tables. While it is powerful, the idea of all those ampersands, slashes and \hlines makes me go ape. And it takes a couple of edit-compile-view cycles to get into the groove of table writing in LaTeX.

Thankfully Emacs has the table mode as part of the standard distribution. Invoke table-mode as M-x table-insert and create the table. Answer the wizard questions and enter the data for the columns. Once you've written the data into the table, generate the LaTeX table by hitting C-^ and choosing the export format as latex.


Paste that back into your tex file and add the \usepackage{tabular} or \usepackage{tabularx} to the preamble and compile the file. Adjust the spacing by deleting off unwanted table rows.

This beats the earlier method by a large order in terms of productivity if you can't be bothered to learn LaTeX tables.

And one other tip: Create the emacs table in the tex file and comment it out. If you ever want to make extensive changes to the table, do the following.

  1. Uncomment the emacs table
  2. Move point to the table or highlight the region
  3. M-x table-recognize will make it ready to edited as an emacs table
  4. make the changes and export it again as latex
  5. comment out the emacs table
Keeping the emacs table inline saves some time in creating the table again if you ever need to make changes. Of course, you could edit the LaTeX table code but I don't venture there at unless the changes are cosmetic.

Tuesday, July 1, 2008

Jumping to specific line in a buffer

Well, with the previous versions of emacs one had to map the goto-line to some key like C-z; now you can save that binding and hit M-g g to get prompted for the line number.

How good a binding is that? I leave that to you to decide.

Saturday, June 28, 2008

What font is the text in the current buffer?

To know what the font and what the glyph codes are, use C-u C-x = on the current character the point is on. You should see something like

character: i (105, #o151, #x69, U+0069)
charset: ascii (ASCII (ISO646 IRV))
code point: #x69
syntax: w which means: word
category: a:ASCII graphic characters 32-126 (ISO646 IRV:1983[4/0]) l:Latin
buffer code: #x69
file code: #x69 (encoded by coding system windows-1252-unix)
display: by this font (glyph code)
-outline-DejaVu Sans Mono-normal-r-normal-normal-16-120-96-96-c-*-iso8859-1 (#x69)

It can also be invoked as M-x describe-char.

Wednesday, June 25, 2008

pgfplots: Plotting in LaTeX

pgfplots looks like a promising package for getting plots into LaTeX. I should probably give it a spin. The manuals, in PDF, here and here are detailed and extensive. And the plots are lovely; beautiful. (There, I get all nerdy)

One reason that I'd like to learn this package is that the alternate approach is to use gnuplot to generate a jpeg and then include that into LaTeX file. That comes with a whole bunch of issues like fiddling with fonts to match the LaTeX font scheme one uses, scaling the jpeg image to fit page and colours.

Since pgfplots is another package with the TeX system, it should be technically be a case of simpler and smaller dependencies for plots. And it uses the same pgf package that is part of the larger beamer package developed by Till Tantau. If you're a MikTeX user, it is available as a download from the package manager.

Saturday, June 21, 2008

Common Emacs lisp idioms

This page by Xah Lee might be useful if you're into elisp programming.

Wednesday, June 18, 2008

Changing the default mode of the *Scratch* buffer

The default *Scratch* buffer in Emacs starts in fundamental mode which might not be useful for lots of people who either don't know or want to work on elisp.

If text mode makes sense for you as the default, the following addition to the .emacs file should fix it.

(setq initial-major-mode 'text-mode)

Note that you don't lose much if you're trying out a few lisp forms as they can be eval'ed anywhere by hitting C-x C-e that would have the same effect as doing it in lisp mode.

Sunday, June 15, 2008

Creating animations in PDF using LaTeX

If you ever wanted to simple animations of your graphs or pictures in your LaTeX paper then the animate package is the way to go. The documentation and examples are good to get you started.

Wednesday, June 11, 2008

A quick way to open files in Emacs

Emacs users when interacting with the shell have a faster method to open files compared to other editors. Most editors will provide a shell escape through which a listing of a directory can be got; or a find command executed.

That's it.

You still need to highlight the interested file, copy into your "open file" dialog and then open the file. Well, Emacs offers the same feature too and more.

If your point is positioned at the start of the file name /tmp/foo, then M-x ffap which stands "find file at point" opens the file. As usual the excellent documentation of ffap gives you other options. Apart from the name, the way the file is opened is simply intuitive without any fuss. In fact, the documentation lists other options to ffap that might useful for mouse users.

Sunday, June 8, 2008

A better parentheses matching emacs package

For those who find the default parenthesis matching a bit lacking in features, the mic-paren package offers additional features that can be useful. I've been using it for quite some time and frankly, don't recall what I'd miss if I lose it. I mean, I've got used to thinking that this is the default behaviour of Emacs.

An indicative list of features from the package commentary...

  • Both forward and backward parenthesis matching (simultaneously if cursor is between two expressions).
  • Indication of mismatched parentheses.
  • Recognition of "escaped" (also often called "quoted") parentheses.
  • Option to match "escaped" parens too, especially in (La)TeX-mode(e.g., matches expressions like "\(foo bar\)" properly).
  • Offers two functions as replacement for `forward-sexp' and`backward-sexp' which handle properly quoted parens (s.a.). These new functions can automatically be bounded to the original binding of the standard `forward-sexp' and `backward-sexp' functions.
  • Option to activate matching of paired delimiter (i.e., characters withsyntax '$'). This is useful for writing in LaTeX-mode for example.
  • Option to select in which situations (always, never, if match, if mismatch) the entire expression should be highlighted or only the matching parenthesis.
  • Message describing the match when the matching parenthesis is off-screen(vertical and/or horizontal). Message contains either the linenumber orthe number of lines between the two matching parens. Option to select in which cases this message should be displayed.
  • Optional delayed highlighting (useful on slow systems),
  • Functions to activate/deactivate mic-paren.el are provided.
  • Numerous options to control the behaviour and appearance of mic-paren.el.
The package is also actively maintained and the latest version can be either found on the emacswiki site or at Thien's site.

Thursday, June 5, 2008

PDF autorefresh with AucTeX and Sumatra PDF

For users of Emacs on windows, Acrobat Reader does not play well with AucTeX. If the PDF file is open, while compiling the .tex file, Emacs will throw a write error because the reader locks the file for it's own use.

Sumatra PDF seems to have sorted this issue out in it's latest release of the viewer. At least that's what the release notes claim. I haven't tried it so far. But the announcement on the comp.text.tex newsgroup caught my eye and I think it's worth noting.

If it really works as advertised in the release notes, then one does not have to close and reopen the PDF file when generating it through AucTeX. With the autorefresh feature, it should be possible to iteratively add text and compile in a smooth workflow.

I shall have to try this feature and switch the reader if all goes well. The last time I tried the Sumatra PDF viewer I had problems rendering pgf rendered drawings. Maybe things are better this time as I did not fully check what was and was not supported in the earlier releases.

Wednesday, June 4, 2008

Listing code snippets in LaTeX

There are a number of ways and packages that provide for code listings in LaTeX. One that I personally prefer and that has enough options to customise is the listings package. It provides a multitude of options to pretty print code snippets. It has support for a number of languages which is more along the lines of keywords that is just about enough for code listings.

It has features to
  • Number the lines
  • keyword highlighting
  • Ability to add your own keywords
  • provide background colour
  • whitespace identification for languages that need them
  • labeling them for cross reference
One other feature is the ability to reuse the definitions into a style format, so that the same environment can be reused with a minimal of code repetition. And the documentation is excellent with lots of examples and feature setting explanation. For code which is indented, it also allows the verbatim code to be shrunk to fit the page(in the default font size, it does scroll off the page), though it does affect the readability of the page.

Friday, May 30, 2008

Extracting specific pages from PDF files using LaTeX

I frequently receive large PDF files from my colleagues which needs to get reviewed by a number of people. Instead of mailing the whole document, especially if it is large, I mail them the relevant pages.

You don't need any extra software or some external binary. There is the package pdfpages on CTAN which does exactly what is required and more.(If you read the documentation, that is)

A simple example demonstrates the ease by which PDF pages can be extracted.


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

Of course, it can also be merged with the current document that one is writing in LaTeX too. So if someone sends in PDF images that needs to be incorporated in your workflow, just plug in some \includepdfs with the name of the file and compile the document. And it is simply plugged in without any fuss. So, if you're the delegating type, this is a godsend. :-)

Wednesday, May 28, 2008

OOXML, objections raised!

By golly, South Africa seems to have some objections over the document format and the approval process that it has officially lodged a complaint. This is going to delay things even more on a normally staid and slow standards body.

Engaging in a bit of schadenfreude, it will be that once the complaint is registered, more complaints will be lodged by other parties once the approval process document trail is shown.

And it's not going be pretty.

Tuesday, May 27, 2008

Email attachments and Gnus

When you receive files in your email and they're embedded in the mail message, a quick way to save them is to hit K o. With a numerical prefix, it will save the nth inline or MIME attachment.

If the file is large and you want to strip it from the mail message, K O will do the trick. Again, deleting the same can be done via K d, because some mail clients will stupidly resend the attachments when replying without stripping it first as a default behaviour.

More useful commands can be found here.

Friday, May 23, 2008

Make LaTeX emulate Microsoft Word paragraph spacing

This might be useful for someone who needs to make LaTeX behave like Microsoft Word in its paragraph spacing. You know, the one where the words are stretched to fill in the entire text line area. Well, to achieve that, you need to do the following


Hat tip to Donald Arseneau on this thread. Note that, it makes hyphenation of words very,very unlikely.

Wednesday, May 21, 2008

An useful emacs shell setting

This is another useful addition to your .emacs; To prevent that command line from staying at the bottom in your emacs shell. Though this doesn't seem to work on my win32 emacs and cygwin bash shell.


Edit: in the same thread the following suggestion works for win32 Emacs at least.

(setq comint-output-filter-functions '(comint-watch-for-password-prompt))

Now, the prompt is pretty much centred in the middle of the screen

Edit 2: More additions, this seems to be the correct way

(add-hook 'shell-mode-hook
(lambda ()
(remove-hook 'comint-output-filter-functions
t))) ; LOCAL

Monday, May 19, 2008

If ediff highlighting is confusing you....

then there is a simple configuration tweak to fix that. ediff highlights all the differences in a riot of colours and it takes some time to focus on the chunk that is highlighted or active.
A simple tweak that I found when browsing the emacs newsgroup. The settings makes only the current chunk highlighted thus making it simple to see the differences. Another minor change that can be set is the whitespace difference checking. I don't use it as I sometimes deal with data files and I need to see the spaces but otherwise it too is a simple fix when you're just interested in what's changed.

;; only hilight current diff:
(setq-default ediff-highlight-all-diffs 'nil)

;; turn off whitespace checking:
(setq ediff-diff-options "-w")

To know more about ediff, read the documentation here.

Friday, May 16, 2008

USB based Fedora 9?

Saw this here and here and should say that it is really a good idea. Each release of some distribution adds new software and features but it's nice that some thought has gone into...well, getting it distributed.

With USB sticks given out as swag in conferences, this could be an attractive way to get people to try Linux. Of course, only if the boot sequence supports starting from a USB port from your PC. If it is common, I'd say, it's a better method than burning CDs. Only problem I see is that on older PCs, the USB ports are all at the back plane and it's a pain to reach around especially if you keep the PC in a corner like I do.

Even worse, mine is boxed in on 3 sides, so I have to pull out the PC cabinet and then plug it in.

Tuesday, May 13, 2008

Truncating long subject lines of mailing lists

If you subscribe to mailing lists, especially in digest mode, you'd find the subject line having a line like

name-of-list-Digest -date

And if the name is long, you'd see it scrolling to the right. If this is something which has to be remedied,like right now, :-)

you could add the following lines to the Group Parameters of the group.

((total-expire . t)
(gnus-list-identifiers "SAS-L Digest -")
(expiry-wait . 10))

Change the string highlighted to the subject line of the list of yours. In my case, all i now see is the date of the digest mails, which is all that I want.

Saturday, May 10, 2008

Commenting or adding annotations to PDF files

This thread on comp.text.tex has some suggested software that might be of interest.

What I'm interested in is 2 things, a way to enable commenting through pdftex and a PDF viewer/reader that allows commenting or annotations. That way, I'd be able to have a decent document edit-review-fix cycle with non LaTeX users. Without that, there is the tedious job of making a non-LateX file reviewed and then transcribing the same into a tex file. Which I don't like doing.

And if the reviews are exhaustive, I'm forced to use the Office Suites and that drives me batty. I can't use LaTeX, as there are others who don't use it and I'm generally confused by Office suites as it always manages to NOT do what I think it should.

No Joy.

Friday, May 9, 2008

Aligning Text in Emacs Buffers

Surprisingly, I found this a bit hard to do. As an example, I wanted to align

4000 1 2
11 1 44
1 0000 999
4000 1 2
11 1 44
1 0000 999

After checking the documentation, I found that align.el is the built-in library that could be used. Trying it as M-x align on the marked text didn't work nor did the regexp option with [[:space:]]. Then I checked the emacswiki for alignment but didn't find an example there that worked with numbers.

Edited the wiki and posted the question and it was quickly answered. From the look of it, it appears that other methods are slightly easier than the solution provided. Especially table-insert function which can be quite easy to create and edit.

Thursday, May 8, 2008

Open Office 3.0 beta is out

Just saw this on the LWN site and this is pretty timely. If the thunder can be stolen from the OOXML ratification by the ISO and the ODF standard made more popular,it should make a dent somewhere.

The complete feature list is available on the Openoffice website and the only irritating thing is the line New, Fresh-looking Icons. I'd rather a stable, feature rich editor than "fresh" fancy icons on the screens. We've got that from one vendor whose product upgrades are more like new coats of paint hiding the rot within.

Why take that route at all?

To be honest, though I have Openoffice installed, I've fired it up around 10 times to read versions of Microsoft Office files that I receive rarely. Which is about all since I use LaTeX for typing out documents. Other family members don't notice the difference between the office suites that much, so it helps there.

I suppose these days, it's hard to get excited about Office suites when the majority have Microsoft Office suite as the default desktop tool. Pity, it could save them a whole bunch when they use just a fraction of the feature list.

Wednesday, May 7, 2008

A few thoughts on the Sun MySQL backtracking

OK, now that all parts of MySQL is going to be free, there are a couple of things which still stand out.

If you want to do a tiered service of free, Incident support contract, service contract, and variations there of, just don't do it immediately after an Open Source buy. This seems pretty hindsight.

And when you backtrack, you need to generate the same level of notoriety/publicity that caused you to backtrack, so that people know you came to your senses. This is even more difficult in this Internet drive-by visit,10 sec attention span.

This was an Open Source buy, which means proprietary products selling tactics need to be done differently. If the selling had been along the lines of ; upto 4 CPUs no charge, anything higher, support will cost you, it would be a big deal with respect to OTHER Database vendors.

One, the vast majority of LAMP servers are on low end stuff and individuals tinkering with it, so no one will probably complain on the pricing front.

Second, you raise the bar for the other database vendors by cutting out their low end revenue segment (Oracle editions are free on single CPU machines and for personal use). Forced to compete with MySQL on multiprocessor boxes, you drive the database costs lower, cannibalizing prices in the process.

Three, if you benchmark it on your hardware and make it come out on top,(it's your product after all), you make a good TCO case with zero software acquisition cost for the customer but backed by your company support on YOUR hardware. You use the software to drive the hardware sales.

Heck, if Sun's multicore is as good as they claim, benchmarking on lower Mhz chips with more cores should show some results to crow about?

Let's see how this pans out.

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.

\LabelCols=3 %3 columns of labels
\LabelRows=7 % 7 rows of labels
\numberoflabels=21 % number of repeated labels

{\textbf{From:\\ Sivaram} \\Line1\\Line2 \\Bangalore \\Karnataka}

{\textbf{From:\\ John Doe} \\Line1\\Line2,\\ Bangalore \\Karnataka}


%%% 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.