I often regard programming as an art form in itself. Naturally, that makes
me an artist, but I really do not mind that. The art of writing a good
program demands all the skills a traditional art demands - natural talent
and a lot of practice.
Note: All the programs here are freeware. If any of my code is interesting, you may copy it for private use or as a base to build other applications by substantially modifying the code. I'd appreciate an acknowledgement if you intend to use my code thusly. If you make substantial functional modifications, naturally, the code is all yours. I'm not responsible for any effects of any code you copy from here, but I'll be glad to help out with explanations if you need any.
Palindrome Checker: This is one of the shortest programs to check
whether a given string is a palindrome or not. It takes exactly one line of
executable C-code... and it works!!
Prime Number Generator: This is one of the fastest C programs to generate
prime numbers up to a specified limit. Compile using
gcc. To the
best of my knowledge, this program runs faster than some benchmark programs
that generate prime numbers. The big bottleneck, naturally, is in the
system call to
write made within the
Line Flipper: I have programmed in C-shell's scripting language too,
sad to say. It took me a while to renounce the unwieldy scripting language,
but I finally did. However, I did write a few good scripts like this one.
It is very robust and behaves almost exactly like
flips all the input lines. It's recursive, so don't try it on long input.
Anniversary Reminder: How many of us have forgotten a birthday or
anniversary we should have remembered? All of us, at some time or the
other! With the popularity of organisers that remind one of important
dates, my program seems a bit neanderthal, but it works for me. The
-update <month> option actually generates the
appropriate files for
xcal, a calendar program available under
X. The current program could be modified to send mail reminder too.
/usr/cs/contrib/bin at the Dept. of Computer Science at UVa -
so that lay users can install unsupported software for common use. Nothing
prevents Trojan horses from being installed, of course. My program
differs from a Trojan horse subtly because I do not advertise its use. It
so happens that some common commands such as
more, if misspelt,
invoke my program. All common misspellings invoke the same program which
figures out which misspelling was perpetrated. Many, many
typographical errors have been caught.
lrwxrwxrwx [...] /usr/cs/contrib/bin/ls-l -> mroe lrwxrwxrwx [...] /usr/cs/contrib/bin/ls-la -> mroe lrwxrwxrwx [...] /usr/cs/contrib/bin/mial -> mroe lrwxrwxrwx [...] /usr/cs/contrib/bin/moer -> mroe lrwxrwxrwx [...] /usr/cs/contrib/bin/mor -> mroe -rwxr-xr-x [...] /usr/cs/contrib/bin/mroe lrwxrwxrwx [...] /usr/cs/contrib/bin/tial -> mroe lrwxrwxrwx [...] /usr/cs/contrib/bin/whcih -> mroe
Random Line/Paragraph Selector: Though these look like rudimentary
and early-effort Perl programs, I like these because they are very concise.
They perform the much-used function of picking out a single line and a
single paragraph (separated by one empty line) from an ASCII file
Mail Previewer: This is a simple Perl program that tells you of new
mail in the current text shell. I invoke it within my prompt command in
bash by putting the line
~/.bash_login file. This works like a better
biff, telling me of the person and subject of new mail.
usage program is invoked by another of my Perl programs called
usage.cgi to generate the University of Virginia Computer
Science Department CPU Usage Page via the
0,5,10,15,20,25,30,35,40,45,50,55 * * * * /users/an4m/public_html/cgi-bin/usage.cgi[Source code:
the little doodads on my home page.
tried to write more interesting programs. I try to exploit possible
duplication of a slot game. Programmatically, the
scrolling of the slot windows is an elegant touch. The rewards of winning at
this slot machine are not very satisfying as of now.
[Source code: View Source of
puzzle. The interaction with HTML is very strong. Enjoy your
game! For some reason, I found this game hard to
code. Perhaps it was just a bad few hours. Even as it is, I think the look
and feel can be improved. Projects for when I have the time...
[Source code: View Source of
Tic-Tac-Toe Game: All right, so you have seen enough of these off
However, the look-and-feel of my version is much more elegant than anything
those kids have. Some of them use 9 frames for the 9 cells - such a pain to
load. Some others use CGI to generate the current board - that causes an
annoying clearing-and-redrawing of the screen. Yet others have a
brute-force number of HTML pages that you wade through. Play those, then
check this out. The algorithm behind this version
of tic-tac-toe is a simple (simplistic?) branch-and-bound algorithm with a
branch depth of two moves per player.
[Source code: View Source of
Hindi Music Search Engine: If you are interested in Hindi film
music, then this may be an interesting
tool for you. My search engine allows searches with imperfect queries
on my song database. Also, you can look up songs by singer combination.
[Source Code: unavailable]
tbl? If you do, boy
you've seen some cycles go by, haven't you?
is a front-end process that converts table specifications into
tbl's input format is very succinct, as opposed to
HTML, so I decided to write a convertor from one to the other. My convertor
tbl would have and then changes the rest to
HTML. In the example below, the
tbl file on the left was given to
tbl and then
nroff for the table in the centre. The
table on the right was got by feeding the code through STDIN to
tbl2html to get HTML. Special mention must be made of the fact
that numbers are aligned properly. As an additional feature, row-spanning
can be achieved with capital field specification characters. A
production-quality example of
tbl2html in action is my
currency page. A
fancier example is the result of my stock portfolio
.TS c s s c c s c c c l n n. Household Population Town Households Number Size Bedminster 789 3.26 Bernards Twp. 3087 3.74 Bernardsville 2018 3.30 Bound Brook 3425 3.04 Branchburg 1644 3.49 .TE
Household Population Town Households Number Size Bedminster 789 3.26 Bernards Twp. 3087 3.74 Bernardsville 2018 3.30 Bound Brook 3425 3.04 Branchburg 1644 3.49
# This is a comment. states: 1 2 3 4 5 # enumerate states and alphabet alphabet: a b % # % is the empty string start: 1 # start state of FA final: 3 5 # list of final states 1 % 2 # sample transition 2 a 3 # from, on, to 1 % 4 4 b 5
|The RE for the given FA is (% is empty string, @ is empty set): a+b
Graph Generator: Much time and productivity is expended in massaging
output data into graphs. It sounds like an easy task, but there's so much
to do, that it takes time, effort and work. My tool,
can take input data in a particular format and convert it to graphs quickly.
You can specify what views you want in the morass of data and how you want
to manipulate multiple values as well.
Photograph Display: With digital cameras getting more common, people
often find themselves with "stacks" of digital pictures with no good way to
view them. You could buy expensive software to see them or cart the photos
over to Yahoo or some other site where you'd be bound by their display
formats and their disk usage restrictions. Instead of shipping images to
foreign site, why not let the display code come to your images? Use
photoph to display your photos simply and easily from wherever
you want your data stored. See a sample use with my
Sample output of both