Showing posts with label recreational. Show all posts
Showing posts with label recreational. Show all posts

Monday, August 20, 2007

Programming in and for Devanagari

Programming for Devenagari has been largely supported by mordern languages like Java.
However, I have never tried before to program in devanagari. Using the Google's Indic transliteration tool (http://www.google.com/transliterate/indic) and a modified BeanShell editor for MeTA Studio I had some fun (http://tovganesh.googlepages.com/ganak.bsh):


गणक(अ, ब) { print(अ + " और " + ब + " की गणना " + (अ + ब) + " है!"); }


now the function can be called as:

bsh% गणक(5, 6);

the result being:

5 और 6 की गणना 11 है

which was cool. I tried the same trick in JavaFX Pad with the following code (http://tovganesh.googlepages.com/om.fx):


import javafx.ui.*;

var नमो = "ॐ नमो भगवते वासुदेवाय";

Frame {
title: "Hello World JavaFX"
width: 200
height: 50
content: Label {
text: नमो
font: new Font("sans", "PLAIN", 22)
}
visible: true
}



and WOW it worked :)


now finally I used a unicode capable editor to key in the following Java snippet:

public class हेलो {
public static void main(String [] args) {
System.out.println("भो विशव \n");
}
}

and compiled and ran it as shown in the screen shot:


and as u see, this too worked . Only the output is a bit problematic because of some font problem with my Indic font installation on FC6. However, the same is not the case when the code is written in the modified BeanShell editor in MeTA Studio.

In any case I enjoyed this experiment and hope that one day I can write a whole useful software in Sanskrit :)

Monday, July 30, 2007

MeTA update and recreational programming ;)

New MeTA Studio updates are available at: http://code.google.com/p/metastudio/

Features include:
a) subvolume generation and saving
b) Support for Fuzzy Volume generation
c) function value interpolation APIs
d) lots of improvements to UI and standard set of bug fixes..


To get a break of what i generally do, i am (re) learning a bit of windows programming and with it am writing a small set of C++ APIs for doing windows programming on my old Win98 machine. Its called weon and is downloadable from http://tovganesh.googlepages.com/weon.tar.gz

To create and open a window its as simple as:

include "weon.h"

CWeonApp app;

WEON_APP_MAP(app)


weon is under development and right now you cant do much with it. but i promise to make it simple to read and use :)

And with the help of APR and RK we have written a small set of APIs for doing MPI style programming purely using Python. Called pimpi its available from: http://tovganesh.googlepages.com/pimpi.tar.gz


A small test program that uses pimpi looks like this:

import pimpi
import sys

pimpi.init(sys.argv)
noOfProcessors = pimpi.size()
myRank = pimpi.rank()

print "Total number of processors: ", noOfProcessors
print "My rank: ", myRank

if (myRank == 0):
for i in range(1, noOfProcessors):
pimpi.send(i, "hi")
else:
print pimpi.recv()

data = pimpi.bcast(0, "bhello")

print data, myRank

data = pimpi.bcast(0, repr((1,2,3)))

print data, myRank

pimpi.finalize()


To run the above code you use:
python pimpiboot.py test.py

Note that pimpiboot.py reads a file called "node.list" that contains the nodes which you want to use in parallel. You need to setup your cluster environment for password less rsh/ssh access for pimpi to work correctly.

... look back here for more updates on these codes :)