JosephHermens.com

print

Programming Experience

This page is a quick attempt to describe some of the programming work I've done. I started programming my freshmen year (2002) of college and I've been facinated by it ever since. I did my first web programming my sophmore year and decided to stick primarily to that field.

My first sites were written in PHP using MySQL to store data. In 2006 I switched to programming primarily in JavaScript using AJAX technology to transfer data from the server (Artist's Circle, SAU Book Trade, and SNID are three examples). A site implemented with a strong HTML/CSS base enhanced with AJAX technology is my goal. More recently, I've been working on declaritive based frameworks to generate either server-side (PHP/HTML) or client-side (JavaScript) code, the goal being to eliminate much of the tedium of creating web sites.

Web programming is an art that never ceases to challenge my abilities. Each new project is another chance to refine my technique and build a better web site. I beleive that an iterative development process is the best approach to web development; let's get to work.

.text .globl __start __start: la $s0, float_a addi $s1, $s0, 16 # number of elements in float_a * 4 + the address of the array add $s2, $s0, $zero # starting point for loop i fori: slt $t0, $s2, $s1 beq $t0, $zero, endi # s2 is the loop index of i * 4, breaks when loop gets to the end of the array addi $s3, $s2, 4 # s3 is the loop index of j * 4 def transfer(inputPath, outputFolder, exclude = []): tempPath = outputFolder+splitdrive(inputPath)[1] if(exists(tempPath) == False): os.makedirs(tempPath) filePath = join(outputFolder, splitdrive(inputPath)[1][1:].replace('/', '_').replace('\', '_')) /^[\w-]+(\.[\w-]+)*@[\w-]+(\.[\w-]+)+$/ class Lexer def initialize() @tokens = Hash.new() end def classify(token) if(@tokens[token] == nil) if(token =~/\A[a-zA-Z][a-zA-Z0-9]*\z/) @tokens[token] = "Identifier" elsif(token =~/\A[0-9]+\z/) @tokens[token] = "Integer" elsif(token =~/\A[0-9]*\.[0-9]+\z/) @tokens[token] = "Real" else @tokens[token] = "Error" end else puts "dupliacte token: "+token end end def displayAll() puts "Tokens:" @tokens.each { | key, value | puts key+" is "+value } end end VAR width = 100% VAR height = 100% TAG body { width:[width]; height:[height]; overflow:hidden; } TAG html : body; // html inherits all of the properties assigned to body TAG div; // an empty declaration that can be inherited by a Class or Id to add a tag type to the declaration ID content : div { TAG div { border:solid 1px rgb(0,0,10%); } CLASS first : div { padding:5px; background-color:#FFF; margin:5px; } CLASS second : first { // inherits all of the properties assigned in `first` margin:5px; border:none; TAG h3 { margin:{top:0; right:0; bottom:5px; left:0;} } TAG a { padding:2px 5px; } ACTION hover : a { background-color:#DDD; } // actions are applied to the element they are nested inside } ID abs { position:absolute; background-color:#0F0; text-align:center; padding:10px 0; TAG div { width:200px; left:350px; top:35px; z-index:2; } TAG span { width:200px; left:500px; top:60px; z-index:1; display:block; } } } (deftemplate ask(slot title) (multislot question)) (deftemplate response(slot title) (slot answer)) (deftemplate info(slot title) (slot true)) (deftemplate solution(slot animal)) (deffacts start-program (ask (title flies) (question Does it fly)) (ask (title lays_eggs) (question Does the animal lay eggs)) (start)) (defrule init ?start <- (start) => (retract ?start) (printout t 'Animal Identification Program' crlf crlf)) for num as int, element in zip(range(10), fib()): print "${num + 1} => ${element}"; print ''; gen = i * i for i in range(5); for item in gen: print item print ''; arr = array(gen); for item in arr: print item function onLoad() { var elements1 = [ {n:'linkHandle_div',a:'left'}, {n:'link_div',a:'width',p:'left'}, {n:'content_div',a:'left'}]; initResize('linkHandle_div', elements1); } function getOffsetHTML() { var doc = (document.compatMode && document.compatMode != 'BackCompat') ? document.documentElement : document.body; var style = getStyle(doc); return (temp = parseInt(style.width)) ? Math.round((getWidth() - temp) / 2) : 0; } #include <conio.h> #include <stdio.h> #include <stdlib.h> #include <time.h> #define ICON_SIZE 5 #define MAX_NAME 7 /* Max Length of an icons name */ #define NUM_ICONS 5 /* Max Number of icons that can be read */ #define PAUSE_TIME 1000 typedef struct /* structure that holds an icon */ { int x, y; /* location on the console where icon will be dsiplayed */ char name[MAX_NAME]; int fcolor, bcolor; char pixels[ICON_SIZE][ICON_SIZE]; } icon_t; void animate(icon_t *icons, int num_icons); void display_icons(icon_t *icons, int num_icons); void move_rocket(icon_t *rocket); void move_tic(icon_t *tic, int state); void move_wink(icon_t *wink, int state); void pause(int delat); int read_icon(FILE *file_p, icon_t *icon); LIBRARY ieee; USE ieee.std_logic_1164.all; USE ieee.std_logic_arith.all; USE ieee.std_logic_signed.all; ENTITY alu IS PORT(inputA, inputB : IN STD_LOGIC_VECTOR(31 DOWNTO 0); aluOp : IN STD_LOGIC_VECTOR(2 DOWNTO 0); result : OUT STD_LOGIC_VECTOR(31 DOWNTO 0); zero : OUT STD_LOGIC); END alu; ARCHITECTURE arch OF alu IS SIGNAL result_temp, result_and, result_or, result_add, result_sub, result_slt : STD_LOGIC_VECTOR(31 DOWNTO 0); BEGIN result_and <= inputA AND inputB; result_or <= inputA OR inputB; result_add <= inputA + inputB; result_sub <= inputA - inputB; result_slt <= "0000000000000000000000000000000" & result_sub(31); WITH aluOp SELECT result_temp <= result_and WHEN "000", result_or WHEN "001", result_add WHEN "010", result_sub WHEN "110", result_slt WHEN "111", X"00000000" WHEN OTHERS; zero <= '1' WHEN (result_temp = 0) ELSE '0'; result <= result_temp; END arch; package astroids; import java.awt.Color; import java.awt.Polygon; import java.awt.Point; import java.awt.Graphics2D; public class Astroid { int direction, radius, speed, spin, spinTotal; double scale; Point center; } digit = '0' | '1' | '2' | '3' | '4' | '5' | '6' | '7' | '8' | '9'. hex = 'a' | 'b' | 'c' | 'd' | 'e' | 'f' | digit. number = integer | decimal. integer = digit, {digit}. decimal = digit,{digit},'.',{digit}. word = letter,{letter}. try { $data = new HTMLData(); $db = new Database(DB_SERVER, DB_USERNAME, DB_PASSWORD, DB_NAME); include 'data/'.$service.'.data.php'; if(function_exists('serviceMain')) call_user_func('serviceMain', $action); else if(function_exists($action)) call_user_func($action); else throw new ScriptException('undefined action \"'.$action.'\"'); $data->execute(); } catch(UserException $e) { echo $e->toClient(true); // ClientInfo::AddError($e->file, $e->line, 'UserException', $e->message, $e->toString(true)); } catch(Exception $e) { echo $e->toString(true); // ClientInfo::AddError($e->file, $e->line, 'ConnectionException', $e->message, $e->toString(true)); } <body onresize="window.onResize();" onload="window.init();"> <a href="./" id="home_a"> <img id="logoText_img" src="images/logo_text.png" alt="Artist's Circle" /> <img id="logoBack_img" src="images/logo_back.png" alt="Logo" /> </a> </body> LCtrl & Up:: Send {PgUp} LCtrl & Down:: Send {PgDn} LCtrl & Left:: Send {Home} LCtrl & Right::Send {End} ^h:: IfWinNotExist WinHugs { Run C:\Program Files\WinHugs\winhugs.exe WinWait WinHugs WinActivate WinHugs Send :cd c:/code/Haskell{Enter} Send :l } else WinActivate WinHugs return _number::Parser Float _number = (_neg <|> (try _float) <|> _int) where _neg = do { char '-' ; v <- (try _float <|> _int) ; return (-v) } _float = do { a <- option "0" (many1 digit) ; char '.' ; b <- many1 digit ; return $ read $ a ++ "." ++ b } _int = do { x <- many1 digit ; return $ read $ x } _digits::Parser String _digits = many1 $ satisfy isNumber bag_to_set([], []). bag_to_set([Head | Tail], Set) :- member(Head, Tail), bag_to_set(Tail, Set), !. bag_to_set([Head | Tail], [Head | Set]) :- bag_to_set(Tail, Set), !. #include<list> #include<iostream> #include<vector> using namespace std; const int HUMAN = 1; const int COMPUTER = 2; class Nim { public: Nim(int numTokens, int playFirst); ~Nim(); void displayTokens(); bool isOver(); bool find(int token); void makeMove(int token, int newToken1, int newToken2); void undoMove(int addToken, int removeToken1, int removeToken2); int chooseMove(int player, int & bestPile, int & newPile1, int & newPile2); void runComputer(); void runHuman(); int currentPlayer; private: list<int> tokens; }; delimiter $ CREATE FUNCTION get_keyword_id(_keyword CHAR(16)) RETURNS INT UNSIGNED DETERMINISTIC BEGIN DECLARE _id INT UNSIGNED DEFAULT 0; SELECT id INTO _id FROM words WHERE keyword LIKE _keyword; if _id = 0 then INSERT INTO words(keyword) VALUES(_keyword); SELECT id INTO _id FROM words WHERE keyword LIKE _keyword; RETURN _id; else return _id; end if; END; $ if(char >= '0' && char <= '9' || char == '.' || char == '-' || char == '+') { temp = char; while(next() && (char >= '0' && char <= '9' || char == '.')) temp += char; if(/^(\+|\-)?[\d]+$/.test(temp)) addValue(parseInt(temp)); else if(/^(\+|\-)?[\d]*\.[\d]+$/.test(temp)) addValue(parseFloat(temp)); else throw new Error('Invalid number: '+temp); } (DEFINE (Count numbers) (COND ((NULL? numbers) 0) ((= (CAR numbers) 0) (+ 1 (Count (CDR numbers)))) (ELSE (Count (CDR numbers))) ) ) namespace NetScan { public delegate void ErrorEventHandler(object sender, Error error); // delegate used by OnMessage event public delegate void MessageEventHandler(object sender, Message message); // delegate used by OnMessage event public delegate void UpdateDisplayHandler(object state); // used by update event to tell GUI to refresh stats // main class used to start the application class Run { static void Main(string[] args) { new Run(); } public Run() // constructor { Application.Run(new GUI()); } } } table { border:solid 1px #000; } th { background-color:#EEE; text-align:left; padding:3px 5px 3px 5px; vertical-align:top; white-space:nowrap; empty-cells:show; } td { padding:3px 5px 3px 5px; vertical-align:top; empty-cells:show; } tr.e td { background-color:#FFF; } tr.o td { background-color:#EEE; } tr.h { font-size:20px; } td.c { text-align:center; } td.r { text-align:right; } td.n { white-space:nowrap; } td.m { vertical-align:middle; } table.list_table thead th, table.list_table thead td { font-weight:bold; text-align:left; border-bottom:solid 1px #DDD; } table.form_table tfoot th, table.form_table tfoot td { text-align:center; border-top:solid 1px #DDD; padding-top:10px; } table.form_table tfoot a { padding:2px 5px; font-weight:bold; } .text .globl __start __start: la $s0, float_a addi $s1, $s0, 16 # number of elements in float_a * 4 + the address of the array add $s2, $s0, $zero # starting point for loop i fori: slt $t0, $s2, $s1 beq $t0, $zero, endi # s2 is the loop index of i * 4, breaks when loop gets to the end of the array addi $s3, $s2, 4 # s3 is the loop index of j * 4 def transfer(inputPath, outputFolder, exclude = []): tempPath = outputFolder+splitdrive(inputPath)[1] if(exists(tempPath) == False): os.makedirs(tempPath) filePath = join(outputFolder, splitdrive(inputPath)[1][1:].replace('/', '_').replace('\', '_')) /^[\w-]+(\.[\w-]+)*@[\w-]+(\.[\w-]+)+$/ class Lexer def initialize() @tokens = Hash.new() end def classify(token) if(@tokens[token] == nil) if(token =~/\A[a-zA-Z][a-zA-Z0-9]*\z/) @tokens[token] = "Identifier" elsif(token =~/\A[0-9]+\z/) @tokens[token] = "Integer" elsif(token =~/\A[0-9]*\.[0-9]+\z/) @tokens[token] = "Real" else @tokens[token] = "Error" end else puts "dupliacte token: "+token end end def displayAll() puts "Tokens:" @tokens.each { | key, value | puts key+" is "+value } end end VAR width = 100% VAR height = 100% TAG body { width:[width]; height:[height]; overflow:hidden; } TAG html : body; // html inherits all of the properties assigned to body TAG div; // an empty declaration that can be inherited by a Class or Id to add a tag type to the declaration ID content : div { TAG div { border:solid 1px rgb(0,0,10%); } CLASS first : div { padding:5px; background-color:#FFF; margin:5px; } CLASS second : first { // inherits all of the properties assigned in `first` margin:5px; border:none; TAG h3 { margin:{top:0; right:0; bottom:5px; left:0;} } TAG a { padding:2px 5px; } ACTION hover : a { background-color:#DDD; } // actions are applied to the element they are nested inside } ID abs { position:absolute; background-color:#0F0; text-align:center; padding:10px 0; TAG div { width:200px; left:350px; top:35px; z-index:2; } TAG span { width:200px; left:500px; top:60px; z-index:1; display:block; } } } (deftemplate ask(slot title) (multislot question)) (deftemplate response(slot title) (slot answer)) (deftemplate info(slot title) (slot true)) (deftemplate solution(slot animal)) (deffacts start-program (ask (title flies) (question Does it fly)) (ask (title lays_eggs) (question Does the animal lay eggs)) (start)) (defrule init ?start <- (start) => (retract ?start) (printout t 'Animal Identification Program' crlf crlf)) for num as int, element in zip(range(10), fib()): print "${num + 1} => ${element}"; print ''; gen = i * i for i in range(5); for item in gen: print item print ''; arr = array(gen); for item in arr: print item function onLoad() { var elements1 = [ {n:'linkHandle_div',a:'left'}, {n:'link_div',a:'width',p:'left'}, {n:'content_div',a:'left'}]; initResize('linkHandle_div', elements1); } function getOffsetHTML() { var doc = (document.compatMode && document.compatMode != 'BackCompat') ? document.documentElement : document.body; var style = getStyle(doc); return (temp = parseInt(style.width)) ? Math.round((getWidth() - temp) / 2) : 0; } #include <conio.h> #include <stdio.h> #include <stdlib.h> #include <time.h> #define ICON_SIZE 5 #define MAX_NAME 7 /* Max Length of an icons name */ #define NUM_ICONS 5 /* Max Number of icons that can be read */ #define PAUSE_TIME 1000 typedef struct /* structure that holds an icon */ { int x, y; /* location on the console where icon will be dsiplayed */ char name[MAX_NAME]; int fcolor, bcolor; char pixels[ICON_SIZE][ICON_SIZE]; } icon_t; void animate(icon_t *icons, int num_icons); void display_icons(icon_t *icons, int num_icons); void move_rocket(icon_t *rocket); void move_tic(icon_t *tic, int state); void move_wink(icon_t *wink, int state); void pause(int delat); int read_icon(FILE *file_p, icon_t *icon); LIBRARY ieee; USE ieee.std_logic_1164.all; USE ieee.std_logic_arith.all; USE ieee.std_logic_signed.all; ENTITY alu IS PORT(inputA, inputB : IN STD_LOGIC_VECTOR(31 DOWNTO 0); aluOp : IN STD_LOGIC_VECTOR(2 DOWNTO 0); result : OUT STD_LOGIC_VECTOR(31 DOWNTO 0); zero : OUT STD_LOGIC); END alu; ARCHITECTURE arch OF alu IS SIGNAL result_temp, result_and, result_or, result_add, result_sub, result_slt : STD_LOGIC_VECTOR(31 DOWNTO 0); BEGIN result_and <= inputA AND inputB; result_or <= inputA OR inputB; result_add <= inputA + inputB; result_sub <= inputA - inputB; result_slt <= "0000000000000000000000000000000" & result_sub(31); WITH aluOp SELECT result_temp <= result_and WHEN "000", result_or WHEN "001", result_add WHEN "010", result_sub WHEN "110", result_slt WHEN "111", X"00000000" WHEN OTHERS; zero <= '1' WHEN (result_temp = 0) ELSE '0'; result <= result_temp; END arch; package astroids; import java.awt.Color; import java.awt.Polygon; import java.awt.Point; import java.awt.Graphics2D; public class Astroid { int direction, radius, speed, spin, spinTotal; double scale; Point center; } digit = '0' | '1' | '2' | '3' | '4' | '5' | '6' | '7' | '8' | '9'. hex = 'a' | 'b' | 'c' | 'd' | 'e' | 'f' | digit. number = integer | decimal. integer = digit, {digit}. decimal = digit,{digit},'.',{digit}. word = letter,{letter}. try { $data = new HTMLData(); $db = new Database(DB_SERVER, DB_USERNAME, DB_PASSWORD, DB_NAME); include 'data/'.$service.'.data.php'; if(function_exists('serviceMain')) call_user_func('serviceMain', $action); else if(function_exists($action)) call_user_func($action); else throw new ScriptException('undefined action \"'.$action.'\"'); $data->execute(); } catch(UserException $e) { echo $e->toClient(true); // ClientInfo::AddError($e->file, $e->line, 'UserException', $e->message, $e->toString(true)); } catch(Exception $e) { echo $e->toString(true); // ClientInfo::AddError($e->file, $e->line, 'ConnectionException', $e->message, $e->toString(true)); } <body onresize="window.onResize();" onload="window.init();"> <a href="./" id="home_a"> <img id="logoText_img" src="images/logo_text.png" alt="Artist's Circle" /> <img id="logoBack_img" src="images/logo_back.png" alt="Logo" /> </a> </body> LCtrl & Up:: Send {PgUp} LCtrl & Down:: Send {PgDn} LCtrl & Left:: Send {Home} LCtrl & Right::Send {End} ^h:: IfWinNotExist WinHugs { Run C:\Program Files\WinHugs\winhugs.exe WinWait WinHugs WinActivate WinHugs Send :cd c:/code/Haskell{Enter} Send :l } else WinActivate WinHugs return _number::Parser Float _number = (_neg <|> (try _float) <|> _int) where _neg = do { char '-' ; v <- (try _float <|> _int) ; return (-v) } _float = do { a <- option "0" (many1 digit) ; char '.' ; b <- many1 digit ; return $ read $ a ++ "." ++ b } _int = do { x <- many1 digit ; return $ read $ x } _digits::Parser String _digits = many1 $ satisfy isNumber bag_to_set([], []). bag_to_set([Head | Tail], Set) :- member(Head, Tail), bag_to_set(Tail, Set), !. bag_to_set([Head | Tail], [Head | Set]) :- bag_to_set(Tail, Set), !. #include<list> #include<iostream> #include<vector> using namespace std; const int HUMAN = 1; const int COMPUTER = 2; class Nim { public: Nim(int numTokens, int playFirst); ~Nim(); void displayTokens(); bool isOver(); bool find(int token); void makeMove(int token, int newToken1, int newToken2); void undoMove(int addToken, int removeToken1, int removeToken2); int chooseMove(int player, int & bestPile, int & newPile1, int & newPile2); void runComputer(); void runHuman(); int currentPlayer; private: list<int> tokens; }; delimiter $ CREATE FUNCTION get_keyword_id(_keyword CHAR(16)) RETURNS INT UNSIGNED DETERMINISTIC BEGIN DECLARE _id INT UNSIGNED DEFAULT 0; SELECT id INTO _id FROM words WHERE keyword LIKE _keyword; if _id = 0 then INSERT INTO words(keyword) VALUES(_keyword); SELECT id INTO _id FROM words WHERE keyword LIKE _keyword; RETURN _id; else return _id; end if; END; $ if(char >= '0' && char <= '9' || char == '.' || char == '-' || char == '+') { temp = char; while(next() && (char >= '0' && char <= '9' || char == '.')) temp += char; if(/^(\+|\-)?[\d]+$/.test(temp)) addValue(parseInt(temp)); else if(/^(\+|\-)?[\d]*\.[\d]+$/.test(temp)) addValue(parseFloat(temp)); else throw new Error('Invalid number: '+temp); } (DEFINE (Count numbers) (COND ((NULL? numbers) 0) ((= (CAR numbers) 0) (+ 1 (Count (CDR numbers)))) (ELSE (Count (CDR numbers))) ) ) namespace NetScan { public delegate void ErrorEventHandler(object sender, Error error); // delegate used by OnMessage event public delegate void MessageEventHandler(object sender, Message message); // delegate used by OnMessage event public delegate void UpdateDisplayHandler(object state); // used by update event to tell GUI to refresh stats // main class used to start the application class Run { static void Main(string[] args) { new Run(); } public Run() // constructor { Application.Run(new GUI()); } } } table { border:solid 1px #000; } th { background-color:#EEE; text-align:left; padding:3px 5px 3px 5px; vertical-align:top; white-space:nowrap; empty-cells:show; } td { padding:3px 5px 3px 5px; vertical-align:top; empty-cells:show; } tr.e td { background-color:#FFF; } tr.o td { background-color:#EEE; } tr.h { font-size:20px; } td.c { text-align:center; } td.r { text-align:right; } td.n { white-space:nowrap; } td.m { vertical-align:middle; } table.list_table thead th, table.list_table thead td { font-weight:bold; text-align:left; border-bottom:solid 1px #DDD; } table.form_table tfoot th, table.form_table tfoot td { text-align:center; border-top:solid 1px #DDD; padding-top:10px; } table.form_table tfoot a { padding:2px 5px; font-weight:bold; }