Code & Math

Artificial Life – Simple Math

The following code transforms the struggle for survival into a mathematical equation. A user is asked to enter a number of carnivores to create between 1 – 100. Once the number has been decided, the plants, herbivores and carnivores reproduce contingent on a specific ratio between plants:herbivores:carnivores or 16:6:2.

The program takes 3 separate life forms plants, herbivores and carnivores and increases or decreases their reproduction rate depedent on their ratio in comparison to the other life forms. A ratio of ...

Read more →

Artificial Life Simulation

I have many software projects that I have been working on. One of my favorites is an Artificial Life Simulation. I will be using the blog portion of to keep a running record of my work. The Artificial Life Simulation is being developed in Java.

Artificial Life Simulation Overview

Create a simulation that emulates life and evolution.
The simulation is governed by the same rules that govern our world. Graphic
objects in simulation represent life forms and environmental objects. Life
forms ...

Read more →

Java Script Browser Detection

Java Script Browser Detection & Redirection

Part of the process of web development includes testing to verify if a website
works in different browsers. Once you understand how the site will function in
each browser, you can better understand how to resolve errors. Although I do not
recommend the use of a client side script for detection and redirection for
high-traffic sites and/or web applications, I do recommend this script if you
are on a budget and/or you are in need ...

Read more →

Physics I: Classical Mechanics #1

8.01 Physics I: Classical Mechanics

Lecture #1: This lecture is about units, dimensions, measurements and associated uncertainties, dimensional analysis, and scaling arguments.

Prof. Walter Lewin

View the complete course at:

License: Creative Commons BY-NC-SA

More information at

More courses at

Physics 1: Classical Mechanics Notes

Length = meters
Time = sec
Mass = kg

Profressor references a video entitled “The Powers of Ten” by Charles and Ray
Eames and Pyramid Media. After some searching I found the video, it displays 40
powers of ...

Read more →

Java Exception Handling

Java Exception Handling

Moutain State University Java Study Notes
(Week 1 CIS 220 Computer Science II)

Java exception handling is based in part on Andrew Koenig's and Bjarne
Stroustrup's paper, "Exception Handling for C++ (revised).
(Reference: A. Koenig, and B. Stroustrup, "Exception Handling for C++
(revised)." Proceedings of the Usenix C++ Conference, pp. 149-176, San
Francisco, April 1990.)

Only classes that extend THROWABLE ( dirctly or indirectly
can be used with exception handling.

Error Handling Overview Psuedocode

Perform a task

If the preceeding task did ...

Read more →

Java Math.PI Circle Radius

Mountain State University Java Assisgnment

2.28 (Diameter, Circumference, and Area of a Circle

Write an application that inputs from the user the radius of a circle as an integer and prints the circle’s diameter, circumference, and area using the floating-point 3.14159 for PI.

Java Source Code

import java.util.Scanner;

public class circlePi {

public static void main( String[] args )
Scanner input = new Scanner( );

int cRadius; //radius of circle

System.out.print( "Enter the radius of a circle " ); // prompt for user input
Read more →


Java Palindrome

Mountain State University Java Assignment

3.30 (Palindromes)

Write an application that reads in a five digit integer and determines whether it’s a palindrome. If the number is not five digits long, display an error message and allow the user to enter a new value.

Java Palindrome Source Code

import java.util.Scanner; //initialize scanner

public class palindrome // defines class name

public static void main( String[] args )
// Scanner = new Scanner( );
Scanner input = new Scanner( );

int digit; // enter 5 ...

Read more →

PHP Best Practices

PHP Best Practices & Notes

The following notes are listed for reference to PHP development.


MySql Query Example
// mysql_query(“SELECT * FROM searchengine WHERE keywords LIKE ‘%mike%’ OR keywords LIKE ‘%stratton%'”);



PHP Safe Mode is deprecated.

The following php script can test the connection to your database.
Create a php file with the following code and save as test.php. Upload to your web server and run the script from a browser.
$host = ‘localhost’;
$user = ...

Read more →
Page 7 of 9 «...56789