Ads by Google

Sunday, October 25, 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, October 20, 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, October 15, 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, October 10, 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, October 7, 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, October 3, 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.