Uncategorized

Preventing Software Rot – Part 1

In my years of working with large systems and complicated architectures I have found the following to be true:

any system architecture will eventually become out dated
programmers will continue to extend a system beyond it’s architecture
the system will eventually end up in disarray because it is held together with rubber bands and duct tape
management will scrap [...]

Continue to Struggle with Linux WebCam

I have some measured success. I was able to get a C program to work at capturing a frame from a webcam in both Java and Ruby, the big problem is is memory.
So I went back to JFM (Java Media Framework) but I am having all kinds of inconsistent issues. Sometimes it works with Groovy, [...]

Word Automation with Groovy

I have been working with Ruby and PHP for a bit of automation, but I thought I would give Groovy a shot. It turns out Groovy is just as easy.
First follow the steps at CodeHaus to install Scriptom. Then create a groovy file and paste this in.

package com.scottpreston.groovy.com;

import org.codehaus.groovy.scriptom.*;

def write_word() {

def word = new ActiveXObject(“Word.Application”);
word.Visible [...]

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 [...]

Finally, An Ubuntu Webcam

pre{border-left:2px solid #666666;background-color:#CCCCCC;}
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 http://blognux.free.fr/debian unstable main

sudo apt-get update

sudo apt-get install easycam2 webcam-server
I [...]

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 = [...]

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 [...]

Controlling The Command Line with Java

I wrote this to launch some batch files from within an Java program.

public class CmdExec {

// process invoking program will call
private Process p;

// empty constructor
public CmdExec() { }

// execute command
public [...]

Getting Text and Images from The Web with Java

I used this code to get images and text from the web. First an image:

public static BufferedImage getImage(String urlString)throws Exception {
// construct URL
URL url = new URL(urlString);
// [...]

Creating a Web Spider with PHP

I used this for spidering my site.
function get_links($url) {
$req = new httprequest();
$html = $req->get($url);
$regex = ‘/mhref/m’;
$preg = ‘/<a href=”([^0-9].+?)”/’; // 1 or more
$preg = ‘/<a href=”([^0-9].*?)”/’; // 0 or more
$urls = array ();
preg_match_all($preg, $html, $urls);
$count = 0;
foreach ($urls as $url => $links) {
if ($count == 1) {
foreach ($links as $link) {
echo “link-> ” . $link [...]