Monthly Archives: February 2008

Java vs. Groovy vs. JRuby

I was doing some benchmark testing on my robotics programs for vision testing and I got some interesting results. For the most complicated program Java took 5312ms, Groovy took 5453ms, and JRuby took 5531ms.

I was amazed at how close they were given that all the computer shootouts say that Groovy is slow and JRuby is slow, but I am finding that they are all about the same once they are compiled. That of course makes sense, since Groovy and JRuby are both compiled into Java classes, but I was amazed at how fast they were, only 100 milliseconds slower than Java in Eclipse.

This really makes me wonder about what I will use in the robot, Groovy or JRuby???

Goodbye Window XP – For Robots

For sometime I have used Windows XP for my robots, but now that I have been able to get text-to-speech and vision via webcam handled via Linux, I think my days of using Eclipse as an IDE and WindowsXP are coming to a close.

Using WindowsXP has been fine for the most part, but the overhead and licensing of installing a new version and configuring the box was a pain and remote access via RDP took resources and bandwidth. I am confident I will be able to use Ubuntu for the next robot, but I am uncertain as to the resources required to run it.

Stay tuned to ScottsBots.Com for more information…

Finally, An Ubuntu Webcam

Once I got it working I was amazed at how easy it would have been if I had the proper instructions. Even the Ubuntu site does not work well for this but here are the steps I followed to get it working.

Updated /etc/apt/sources.list with:

deb unstable main

sudo apt-get update

sudo apt-get install easycam2 webcam-server

I then selected yes and installed dependencies and ram the program:

sudo webcam-server -p 88

I then went to my browser and typed http://ipaddress:88, and I saw a snap shot.


Getting URL Parameters in JavaScript & PHP

Being a web person I was so use to getting parameters from the URL in Java via the request.getParameter() method. I have found it really cool to use the same functionality in JavaScript and PHP.

Here is a JavaScript function:

function getParameter(name){
 	var out = "";
	var href = window.location.href;
	if ( href.indexOf("?") > -1 ) {
		var qs = href.substr(href.indexOf("?")).toLowerCase();
		var aqs = qs.split("&");
		for ( var i = 0; i < aqs.length; i++ ){
			if (aqs[i].indexOf(name.toLowerCase() + "=") > -1 ){
				var parm = aqs[i].split("=");
				out = parm[1];
	return unescape(out);

Here is a PHP function:

function getParameter($parm) {
	$return = "";
	if (isset ($_REQUEST[$parm])) {
		$return = $_REQUEST[$parm];
	return $return;

I want my FIOS!!!

I just called Verizon and I really want my FIOS. This will allow me to get about 15+MB upload and download, but they said it was not available in Columbus, Ohio.

Web 3.0 – Where's the data?

I have been looking tonight about what people are saying about Web 3.0. I have found one common theme.

  • Web 1.0 – Small number of content providers, large number of readers, data proprietary.
  • Web 2.0 – Users provide content via social network, data proprietary, but available via API, syndication is apart of data delivery to users. Problem if I create a LinkedIn friend and Facebook friend, I need to add the friend twice.
  • Web 3.0 – Web 2.0 plus, content owners share data. Users use and share information via small portable applications, new applications arrive and disappear with no loss of information. Because there will be so much information exchanged, the networks will need to be much much faster than those today.

Just a few thoughts about the future of the web…

Updated (2/14/2008)

I went to a Ruby meeting the other night and head a talk about Amazon's Web Services. It was much along the lines of Web 3.0 in which everything, even server provisioning, is enabled via web services. This gave me an idea, that everything is eventually going to be service, enabled. Imagine this scenario.

I have some software (AppGin) that creates code and it eventually will be able to create code via an API. So let's say you have a program, it creates some code then deploy's it to a server that it provisions on the fly via another web service. This server eventually gets enough knowledge to modify it self, update it's own code via AppGin, and is able to maintain itself, self and adapt to change. Then if it needs to grow to accomidate more usage, it deploys another copy of itself via the server provisioning web service…

Dell D820 only supports 3326 MB of memory.

Contrary to the website and the claims when I purchased this laptop, it DOES NOT support 4 GB of memory. Apparently because they are using an old cheap chipset that only supports 3GB, they make this ridiculous claim that they need 500MB for PCI express, and 250MB for shared video. You can read more about this on the Dell Forums.

As happy as I have been with this laptop, I am going to think again about a DELL, not that there's much choice out there.

Disgruntled Members of TechColumbus

I have had two people email me over the past few weeks because they Googled "TechColumbus Sucks" and my blog popped up as #1. Though I never really talked about how bad they sucked, I have mentioned their organization a few times.

I actually met with one entrepreneur last night that confirmed my opinion that it's just a good-old-boys-club and they really don't care about helping solo entrepreneurs looking for assitance and advice.

Again, I find this really sad, I had so much hope for this organization yet it turned out to be such a let-down.

Oh, well for all those Googling "TechColumbus Sucks" email me if you would like to chat.

Viewing A Web Camera with Java

I used this to test Video For Windows and the Java Media Framework (JMF) for my robotics code. If you install the JMF this should work fine for displaying the image from your webcam.

public class WebCamViewer extends SimpleSwing {

    private Timer timer = new Timer();
	private GetFrame getFrame;
    private ImagePanel imagePanel;
    private int fps = 15;
    public static final String DEFAULT_CAMERA = "vfw://0";
    public static final long serialVersionUID = 1;

    public WebCamViewer() throws Exception {
        init(DEFAULT_CAMERA, GetFrame.RGB_ENCODING,320,240);

    public WebCamViewer(String camera) throws Exception{
        init(camera, GetFrame.RGB_ENCODING,320,240);
    public WebCamViewer(String camera, String encoding, int width, int height) throws Exception{
        init(camera,encoding, width,height);
    private void init(String camera, String encoding, int w, int h) throws Exception{
    	// creates frame grabber
        getFrame = new GetFrame(camera,encoding,w,h);
        imagePanel =  new ImagePanel(w,h);
        // set size of the window
        setSize(w + 8, h+35);

        // add imagePanel
        // make visible

    // start the camera frame capture
    public void start() {

        timer.schedule(new TimerTask() {
            public void run() {
        }, 200, (int)(1000 / fps));

    // stop the camera frame capture
    public void stop() throws Exception{

    // get frame from GetFrame
    public void getPic() {
        try {
            // set to image panel and repaint called from ImagePanel
        } catch (Exception e) {
    // get the framegrabber
    public GetFrame getGetFrame() {
        return getFrame;
    // get frames per second
    public int getFps() {
        return fps;
    //sets frames per second
    public void setFps(int fps) {
        this.fps = fps;

    public static void main(String[] args) {
        try {

            WebCamViewer webcam = new WebCamViewer(WebCamViewer.DEFAULT_CAMERA,GetFrame.RGB_ENCODING,320,240);
        } catch (Exception e) {

Also included is a simple swing class. This will just display a title text and a white background.

public class SimpleSwing extends JFrame {

	public static final long serialVersionUID = 1;
	// constructor
	public SimpleSwing()  {
		// calls JFrame with title
		super("Java Robots Are Cool!");
		// set look & feel
	    // closes
	    addWindowListener(new ExitListener());
	    // sets size
	    setSize(320, 240);
	    // sets pane of content
	    Container content = getContentPane();
	    // sets color to white
	    // shows frame

	  public static void main(String[] args) throws Exception{
	  	SimpleSwing test = new SimpleSwing();