Java Application or Applet

There is a neat way that an application/applet can be written such that it can run as a GUI in a web page or as a GUI application. Create the Test.java code as:
[cc lang="java"]
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
import java.applet.*;

public class Test extends JFrame {

public Test() {
}

public static void main(String args[])
{
JFrame jf = new JFrame();
jf.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
TestApplet app = new TestApplet();
app.init();
jf.getContentPane().add(“Center”, app);
jf.setSize(600,600);
jf.setVisible(true);
jf.repaint();

}
}
[/cc]
and create the TestApplet.java code as:
[cc lang="java"]
import javax.swing.*;
import javax.swing.event.DocumentEvent;
import javax.swing.event.DocumentListener;
import java.awt.GridLayout;
import java.awt.event.*;
import java.awt.Font;

public class TestApplet extends JApplet implements ActionListener, DocumentListener
{
JPanel main_panel = null;

public TestApplet()
{
createTestApplet();

}

public void init()
{
}

private void createTestApplet()
{
// Create the two panels, one for input and the other for gradient
// table output
main_panel = new JPanel(new GridLayout(1,2));
add( main_panel );

}

public void insertUpdate(DocumentEvent e )
{ changedUpdate(e); }

public void removeUpdate(DocumentEvent e )
{ changedUpdate(e); }

public void changedUpdate(DocumentEvent e)
{
}

public void actionPerformed(ActionEvent e)
{

}
}
[/cc]
And then to compile it, just do:
[cc lang="bash"]
$ javac Test.java
[/cc]

And now to run it

You can either run it from the command line:
[cc lang="bash"]
$ java Test
[/cc]
or create a web page:
[cc lang="html"]





[/cc]

Python, Scipy and Numpy

For approximately 16 years I have been using Matlab faithfully.  Back when I started (1993) all it had were 2D matrices and I remember having to use a package someone wrote up to have 3D volume capabilities (which are typically required for processing MRI datasets).  Matlab is great, don’t get me wrong.  There are few things that I don’t like about it.

So, sitting at a conference in Hawaii (tough life, I know) I had some ideas that I wanted to try out and quickly figured out that I could not get to the site license hosts back at my university.  Argh.  So, I started looking around to see if there were other options which would provide me a similar feel and processing capabilities.  There were a few options, but the one that stuck out was to use Python, Scipy and Numpy.  They were almost tailor made for what I wanted.

So, over the last little while I have been using the Python, Scipy, Numpy triad for most of my research and am feeling like I want to shift over completely the triad rather than using Matlab.