Programming

by

Although it creates bulky AVI files, MATLAB can relatively easily make movies of animated figures. The code below prototypes how this is done. % define the number of frames in your movie numberOfFrames = 1200; % use a loop to generate frames of the movie for ii = 1:numberOfFrames % insert code to update data

by

The following Processing program uses a well-known L-System (see this Wikipedia page for more information) to “grow” a realistic looking plant with fractal structure. Below is a video of the frames generated by the program followed by the code that created it. import java.util.Stack; // I use java Stack objects // written by Jeff –

by

There are several ways to call a javascript function from an HTML form to process user-supplied values and then return the results to the user including onclick, onchange, and onkeyup. Using a simple form that takes an input value and returns the square of this value to the user, I demonstrate these three methods below.

by

The HTML and javascript code below demonstrates how to use a value entered into an HTML form to perform a calculation and return the result. This example simply squares the input value. Some simple checking is performed to ensure that the input value is a number. The following form demonstrates the code in action.  

by

The following Perl script uses regular expressions to parse a text file called myFile.txt and replace any occurrence of the character sequence REPLACE with the string (or number) stored in $NEWTEXT. The modified text file is saved as myNewFile.txt. #!/usr/bin/perl $NEWTEXT = “New Stuff”; # could also be a number open(INPUT, “< myFile.txt") or die