Sunday 1 November 2009

A quick way of looking up colours in LaTeX

While making beamer presentations, I generally use dvipsnames or svgnames as an option to beamer. This allows me to use named colours instead of giving some RGB numbers to get the colour I want.

Well, sort of.

I mean you still have to figure out what HoneyDew looks like. I used to google it up and check how the colours actually looked. Now, I've got a simpler way to do it. Just do, M-x list-colors-display in Emacs and it shows about the same list as that of svgnam.def with the visual colours. Saves you a few keystrokes and clickies.


You of course, are using Emacs and AucTeX aren't you? :-)



Sunday 25 October 2009

Carnatic Music Internet Radio/streaming stations?

If anyone knows of a working internet radio station focused on Carnatic Music, could you let me know of them in the comments?  My searches have lead to me only one and the rest seems to be pretty dead.

And the one I found is pretty simple to use too, I have to just plug the url into Windows Media Player and it works.

Tuesday 20 October 2009

JTikZ: A Java library that produces TikZ code

From an email to the pgf mailing list, Evan Sultanik has written a Java Library to create TikZ code.  If you code in Java, then it might be useful even if the code is in early stages of development.  The library can be found here.

Instructions on using the Library can be found in the email.


Thursday 15 October 2009

Using Emacs Regular Expression Builder

Sometimes it's worth using or getting help on the work you're trying to do. For example, in the Unix world, regular expressions are powerful tools to match,print, find or delete text strings. While mostly the regular expressions achieve what we want, it might be good to get some help in identifying whether the regex is doing what we intend it to do.

In Emacs, there is such a feature called re-builder, invoked as M-x re-builder. As you type the regular expression in the minibuffer like prompt within the double quotes, the text buffer gets highlighted with the current regex that has been typed so far. As you keep modifying the regex, the buffer too is highlighted dynamically on what that regex will match. Once you're satisfied with the regex C-c C-w will copy it to the kill ring and use it in, say C-M % which is generally bound to query-replace-regexp.

The following screenshot shows the matched text and the regex entered. I was trying to delete off everything after the 2nd semicolon.


The highlighted portion is due to the regex shown below


Give it a shot. It saves you a lot of time figuring out the correct regex.

Saturday 10 October 2009

Gnuplot tricks blog

If you've done any kind of plotting on the Unix side, you probably would have heard of gnuplot. I've been using it for years on and off and all my learning has been to cadge off the demo scripts on the home page. Those are excellent of and by themselves. To complement that, I saw a post on the gnuplot newsgroup about a blog http://gnuplot-tricks.blogspot.com/ by Zoltán. As mentioned in the post, he also maintains the same examples at this site.

I must say, it is an excellent blog on using gnuplot and I confess, that it does make me want to learn gnuplot to the extent the blog author has done.

Go take a look for the fantastic quality of the graphs.

Wednesday 7 October 2009

Incrementing counters in Emacs macros

If you've used macros in Emacs, sooner or later you'd need to automatically increment as expressed in this thread. If you read the thread, you'd see a number of suggestions but the simplest is to use the builtin Emacs counters. The Emacs manual too mentions how to use them.

The Emacswiki too mentions how to use them and some tricks in getting it to do it the way you want.

Learn it, it saves a tremendous amount of drudgery typing

Saturday 3 October 2009

Passing AWK variables to shell commands for evaluation

For some reason, I never seem to get how to use the shell from within GNU AWK to manipulate the AWK variable and return it. Spending a lot of time with the system and getline command, I still couldn't figure out how to pass a variable to a shell command, evaluate it and then return the value.

After much trial and error and googling, this seems to work.
a=20090601
cat ../data/C_100119.dat | \
awk -v compdate="$a" '{
while ("date --date="$4 " +%Y%m%d"|getline aa)
{
if(aa >= compdate)
print $0
else
exit
}
}'


where I'm extracting records whose 4th column date value is greater than a.

Hope this is useful to others.

Update: Scratch the above code. I got some feedback about the correct ways to use getline.
a=20090601
awk -v compdate="$a" '
{
if (("date --date="$4 " +%Y%m%d"|getline aa) >0){
if(aa >= compdate) {
print
next
}
}
exit
}' ../data/C_100119.dat



is a better way to do it.

Saturday 19 September 2009

Making WinEdt work with MiKTeX 2.8

Apparently people are running into some issues making WinEdt work with the latest version of MiKTeX.   The following post by the WinEdt team might be of use to WinEdt users.  It details how to fix WinEdt to make it call MiKTeX properly.

Friday 11 September 2009

An improved or better Quicksort?

Via reddit, this is an interesting post on using 2 pivots to do quicksort with an attendant savings in swaps and speed.  I wonder how soon this will get into other tools.


Sunday 6 September 2009

Getting Slide or Frame numbers in Beamer Warsaw Theme

While preparing a presentation using Beamer, I decided to get the slide numbers(frame numbers in Beamer parlance) into the presentation just to pace my slides. And it turns out that it's not easy as it sounds. I tried a variety of setbeamertemplate options and even considered editing the template. I believe beamerouterthemesplit.sty is the file to change though I have no idea what I have to do.

A bit of googling got to me to this page and I have no idea why the suggestion works. But it does. I have broken it into 2 lines with a extraneous \ at the end of the first line.

\title[Short Title \hspace{4em} \insertframenumber\ \
of \inserttotalframenumber
]{Full Title}