diff --git a/archives/elknet.py b/archives/elknet.py new file mode 100644 index 0000000..f254845 --- /dev/null +++ b/archives/elknet.py @@ -0,0 +1,46 @@ +import os +import sys +import argparse +import quotes +from bottle import route, run, template, static_file + + +# get current location, set as current location, and append to path +current_dir = os.path.dirname(os.path.abspath(__file__)) +os.chdir(current_dir) +sys.path.append(current_dir) + +# get absolute path of database file +dbfile = current_dir + '/quotes.db' +print(dbfile) + + +@route('/') +def index(): + quote = quotes.get_random_quote(dbfile) + return template('templates/index.tpl', text=quote[0], author=quote[1]) + + +@route('/static/') +def server_static(filename): + return static_file(filename, root=os.path.join(current_dir, 'static')) + + +@route('/contact') +def contact(): + quote = quotes.get_random_quote(dbfile) + return template('templates/contact.tpl', text=quote[0], author=quote[1]) + + +def get_port(): + description = 'A bottle server for the HILT Institute' + parser = argparse.ArgumentParser(description) + parser.add_argument('-p', '--port', type=int, + help="The port number the server will run on") + args = parser.parse_args() + + return args.port if args.port else 8080 + + +if __name__ == '__main__': + run(host='0.0.0.0', port=get_port(), reloader=True, debug=True) diff --git a/archives/old_homepage.php b/archives/old_homepage.php new file mode 100644 index 0000000..a18c645 --- /dev/null +++ b/archives/old_homepage.php @@ -0,0 +1,227 @@ + + + + +Welcome to elkner.net! + + + + +
+ +

Welcome to elkner.net!

+

+I'm *WAY* too busy with all the exciting projects I'm working on to do much +with this page, so let me just include contact information and some links. +Check them out! +

+

+-- Jeff Elkner

+
+ +

+Weblog | +Contact Information | +Resume +

+ +
+ + +
+

NOVA Web Development:

+ +
+
+ +
+ + + +
+ +
+ + +
+

Exits:

+ +
+
+ +

Papers/Articles/Presentations:

+ + +
+

{{text}}

+

-- {{author}}

+
+ + + + + diff --git a/archives/quotes.py b/archives/quotes.py new file mode 100644 index 0000000..da6b89b --- /dev/null +++ b/archives/quotes.py @@ -0,0 +1,77 @@ +import sqlite3 +import random + + +def query(db, stmnt): + con = sqlite3.connect(db) + cur = con.cursor() + cur.execute(stmnt) + results = cur.fetchall() + con.close() + return results + + +def get_authors(db): + return query(db, 'SELECT * FROM Author ORDER BY lname') + + +def get_quotes(db): + stmnt = """SELECT qtext, fname, lname, source, qdate FROM Quote + NATURAL JOIN Author ORDER BY RANDOM()""" + return query(db, stmnt) + + +def format_quote(raw_quote): + """ + Return a tuple containing (text, source) for a quote given a raw quote + containing [text, author first name, author last name, source document, + quote date] where all fields accept text are possibly None values. Source + should be set to "Anonymous" if no other info is provided. + + Examples: + + >>> format_quote(['Quote', 'F', 'L', 'Source', 'Date']) + ('Quote', 'F L, Source, Date') + >>> format_quote(['Quote', 'F', 'L', None, None]) + ('Quote', 'F L') + >>> format_quote(['Quote', 'F', 'L', 'Source', None]) + ('Quote', 'F L, Source') + >>> format_quote(['Quote', 'F', 'L', None, 'Date']) + ('Quote', 'F L, Date') + >>> format_quote(['Quote', None, 'L', None, None]) + ('Quote', 'L') + >>> format_quote(['Quote', None, None, 'Source', None]) + ('Quote', 'Source') + >>> format_quote(['Quote', None, None, None, None]) + ('Quote', 'Anonymous') + """ + text = raw_quote[0] + source = [] + + # append author name (first and last) to source list if provided + if raw_quote[1] and raw_quote[2]: + source.append("%s %s" % (raw_quote[1], raw_quote[2])) + elif raw_quote[2]: # only last name provided + source.append(raw_quote[2]) + + # append source document and date to source list if provided + for item in raw_quote[-2:]: + if item: + source.append(item) + + # join the pieces into a string seperated by comma and space + if source: + source = ", ".join(source) + else: # no source information provided, so make it "Anonymous" + source = "Anonymous" + + return text, source + + +def get_random_quote(db): + return format_quote(get_quotes(db)[0]) + + +if __name__ == '__main__': + import doctest + doctest.testmod() diff --git a/learnphp/HeadFirst/abduction_form.html b/learnphp/HeadFirst/abduction_form.html new file mode 100644 index 0000000..b5d7630 --- /dev/null +++ b/learnphp/HeadFirst/abduction_form.html @@ -0,0 +1,66 @@ + + + + +Abduction Form + + + +

Abduction Form

+
+

+Share your story of alien abduction: +

+ +
+ +
+ +
+ +
+ +
+ +
+ +
+ +
+ +
+ + Yes + No
+ My abducted cat Tabby
+ +
+ +
+
+ + + + + diff --git a/learnphp/HeadFirst/abduction_list.php b/learnphp/HeadFirst/abduction_list.php new file mode 100644 index 0000000..022b81d --- /dev/null +++ b/learnphp/HeadFirst/abduction_list.php @@ -0,0 +1,45 @@ + + + + + + + + +

+ +
+query($query) as $row) +{ + echo $row[1]; +} +$dbh = null; //This is how you close a PDO connection +?> +
+ + + + + + diff --git a/learnphp/HeadFirst/dbscripts/create_alien_abductions.sql b/learnphp/HeadFirst/dbscripts/create_alien_abductions.sql new file mode 100644 index 0000000..21187bc --- /dev/null +++ b/learnphp/HeadFirst/dbscripts/create_alien_abductions.sql @@ -0,0 +1,15 @@ +DROP TABLE IF EXISTS Abductions; + +CREATE TABLE Abductions( + id INTEGER PRIMARY KEY AUTOINCREMENT, + firstname TEXT NOT NULL, + lastname TEXT NOT NULL, + email TEXT NOT NULL, + occured TEXT NOT NULL, + howlong TEXT NOT NULL, + howmany TEXT NOT NULL, + description TEXT NOT NULL, + whattheydid TEXT NOT NULL, + tabbyspotted INTEGER NOT NULL, + other TEXT NOT NULL +); diff --git a/learnphp/HeadFirst/images/tabby.jpg b/learnphp/HeadFirst/images/tabby.jpg new file mode 100644 index 0000000..d95f14b Binary files /dev/null and b/learnphp/HeadFirst/images/tabby.jpg differ diff --git a/learnphp/HeadFirst/index.php b/learnphp/HeadFirst/index.php new file mode 100644 index 0000000..bef8846 --- /dev/null +++ b/learnphp/HeadFirst/index.php @@ -0,0 +1,46 @@ + + + + +Head First PHP & MySQL + + + +

Head First PHP & MySQL

+ +
+

Projects

+ + +

Who Am I?

+

+ +

+
+ + + + + + diff --git a/learnphp/HeadFirst/report.php b/learnphp/HeadFirst/report.php new file mode 100644 index 0000000..f6908ef --- /dev/null +++ b/learnphp/HeadFirst/report.php @@ -0,0 +1,48 @@ + + + + +Aliens Abducted Me - Abduction Report + + + +

Aliens Abducted Me - Abduction Report

+ +
+Thanks for submitting the form.
'; + echo 'You were abducted ' . $when_it_happened; + echo ' and were gone for ' . $how_long . '
'; + echo 'Describe them: ' . $alien_description . '
'; + echo 'Was Tabby there? '. $tabby_spotted . '
'; + echo 'Your email address is ' . $email . '

'; +?> +
+ + + + + + diff --git a/learnphp/HeadFirst/style.css b/learnphp/HeadFirst/style.css new file mode 100644 index 0000000..ecdc6c8 --- /dev/null +++ b/learnphp/HeadFirst/style.css @@ -0,0 +1,16 @@ +main { + margin: 30px; + padding: 30px; + border: 1px dotted #555; +} +h1 { + text-align: center; +} +a, a:visited { + text-decoration: none; + color: #555; +} +footer { + text-align: center; + margin-top: 20px; +} diff --git a/learnphp/acclib/book_list.php b/learnphp/acclib/book_list.php new file mode 100644 index 0000000..e611430 --- /dev/null +++ b/learnphp/acclib/book_list.php @@ -0,0 +1,53 @@ + + + + +Book List + + + +
+

Book List

+ +
+ +
+query($query) as $row) +{ + echo $row[1]; +} +$dbh = null; //This is how you close a PDO connection +?> +
+ + + + + + diff --git a/learnphp/acclib/dbscripts/list_books.sql b/learnphp/acclib/dbscripts/list_books.sql new file mode 100644 index 0000000..17738ec --- /dev/null +++ b/learnphp/acclib/dbscripts/list_books.sql @@ -0,0 +1,12 @@ +.mode column +.headers on + +SELECT + title, class, subclass, cutter, suppl +FROM + Books +ORDER BY + class ASC, + subclass ASC, + cutter ASC, + suppl ASC; diff --git a/learnphp/acclib/dbscripts/load_books.sql b/learnphp/acclib/dbscripts/load_books.sql new file mode 100644 index 0000000..6569302 --- /dev/null +++ b/learnphp/acclib/dbscripts/load_books.sql @@ -0,0 +1,501 @@ +INSERT INTO Books VALUES( + 1, + 'Good Faith Collaboration: The Culture of Wikipedia', + 'AE', + 100, + 'R43', + '2010', + '9780262014472', + 'shelf' +); +INSERT INTO Books VALUES( + 2, + 'Algorithms to Live By: The Computer Science of Human Decisions', + 'BF', + 39, + 'C4885', + '2016', + '9781627790369', + 'shelf' +); +INSERT INTO Books VALUES( + 3, + 'Ours to Hack and to Own: The Rise of Platform Cooperativism, A New Vision for the Future of Work and a Fairer Internet', + 'HM', + 851, + 'O973', + '2016', + '9781944869335', + 'shelf' +); +INSERT INTO Books VALUES( + 4, + 'The Mathematics of Elections and Voting', + 'JF', + 1001, + 'W35', + '2014', + '9783319098098', + 'shelf' +); +INSERT INTO Books VALUES( + 5, + 'Beyond Transparency: Open Data and the Future of Civic Innovation', + 'JK', + 468, + 'T7 B49', + '2013', + '9780615889085', + 'shelf' +); +INSERT INTO Books VALUES( + 6, + 'Trusting Teachers with School Success: What Happens when Teachers Call the Shots', + 'LB', + 2806.45, + 'F36', + '2013', + '9781610485104', + 'shelf' +); +INSERT INTO Books VALUES( + 7, + 'Murphy''s Law and Other Reasons Why Things Go Wrong', + 'PN', + 6231, + 'M82 B57', + '', + '0843104287', + 'shelf' +); +INSERT INTO Books VALUES( + 8, + 'The Annotated Alice: Alice''s Adventures in Wonderland & Through the Looking Glass', + 'PR', + 4611, + 'A7', + '1960', + '9780452010413', + 'shelf' +); +INSERT INTO Books VALUES( + 9, + 'Gödel, Escher, Bach: An Eternal Golden Braid', + 'QA', + 9.8, + 'H63', + '1980', + '0394745027', + 'shelf' +); +INSERT INTO Books VALUES( + 10, + 'Doing Math with Python: Use Programming to Explore Algebra, Statistics, Calculus, and More!', + 'QA', + 20, + 'C65 S24', + '2015', + '9781593276409', + 'shelf' +); +INSERT INTO Books VALUES( + 11, + 'Rethinking Mathematics: Teaching Social Justice by the Numbers', + 'QA', + 22.3, + 'R478', + '2013', + '9780942961553', + 'shelf' +); +INSERT INTO Books VALUES( + 12, + 'Unlocking the Clubhouse: Women in Computing', + 'QA', + 76.25, + 'M35', + '2001', + '9780262632690', + 'shelf' +); +INSERT INTO Books VALUES( + 13, + 'Stuck in the Shallow End: Education, Race, and Computing', + 'QA', + 76.27, + 'M347', + '2008eb', + '9780262514040', + 'shelf' +); +INSERT INTO Books VALUES( + 14, + 'Turtles, Termites, and Traffic Jams: Explorations in Massively Parallel Microworlds', + 'QA', + 76.58, + 'R47', + '1994', + '9780262680936', + 'shelf' +); +INSERT INTO Books VALUES( + 15, + 'The C Trilogy: A Complete Library for C Programmers', + 'QA', + 76.73, + 'C15 B56', + '1987', + '0830628908', + 'shelf' +); +INSERT INTO Books VALUES( + 16, + 'The C Programming Language', + 'QA', + 76.73, + 'C15 K47', + '1988', + '9780131103702', + 'shelf' +); +INSERT INTO Books VALUES( + 17, + 'The C Answer Book: Solutions to the Exercises in The C Programming Language, Second Edition, by Brian W. Kernighan and Dennis M. Ritchie', + 'QA', + 76.73, + 'C15 K47', + '1988 suppl', + '9780131096530', + 'shelf' +); +INSERT INTO Books VALUES( + 18, + 'C Programming: A Complete Guide to Mastering the C Language', + 'QA', + 76.73, + 'C15 H364', + '1989', + '9780201194449', + 'shelf' +); + +INSERT INTO Books VALUES( + 19, + 'Data Structures Using C', + 'QA', + 76.73, + 'C15 T46', + '1990', + '9780131997462', + 'shelf' +); +INSERT INTO Books VALUES( + 20, + 'C: A Reference Manual', + 'QA', + 76.73, + 'C15 H38', + '1991', + '9780131109339', + 'shelf' +); +INSERT INTO Books VALUES( + 21, + 'The Beginner''s Guide to C', + 'QA', + 76.73, + 'C15 H668', + '1994', + '9781874416159', + 'shelf' +); +INSERT INTO Books VALUES( + 22, + 'C Primer Plus', + 'QA', + 76.73, + 'C15 P733', + '1988', + '0672225824', + 'shelf' +); +INSERT INTO Books VALUES( + 23, + 'C: The Complete Reference', + 'QA', + 76.73, + 'C15 S353', + '1995', + '9780078821011', + 'shelf' +); +INSERT INTO Books VALUES( + 24, + 'Eloquent JavaScript, 3rd Edition: A Modern Introduction to Programming', + 'QA', + 76.73, + 'J39 H38', + '2019', + '9781593279509', + 'shelf' +); +INSERT INTO Books VALUES( + 25, + 'Head First JavaScript Programming', + 'QA', + 76.73, + 'J39 F735', + '2014', + '9781449340131', + 'shelf' +); +INSERT INTO Books VALUES( + 26, + 'Javascript: The Good Parts', + 'QA', + 76.73, + 'J39 C763', + '2008', + '9780596517748', + 'shelf' +); +INSERT INTO Books VALUES( + 27, + 'Python Testing Beginner''s Guide: An Easy and Convenient Approach to Testing Your Python Projects', + 'QA', + 76.73, + 'P98 A73', + '2010eb', + '9781847198846', + 'shelf' +); +INSERT INTO Books VALUES( + 28, + 'Data Structures and Algorithms in Python', + 'QA', + 76.73, + 'P98 G66', + '2013', + '9788126562176', + 'shelf' +); +INSERT INTO Books VALUES( + 29, + 'Python Algorithms: Mastering Basic Algorithms in the Python Language', + 'QA', + 76.73, + 'P98 H485', + '2010', + '9781430232377', + 'shelf' +); +INSERT INTO Books VALUES( + 30, + 'Python for Data Analysis', + 'QA', + 76.73, + 'P98 M42', + '2013', + '9781449319793', + 'shelf' +); +INSERT INTO Books VALUES( + 31, + 'Introduction to Computer Science Using Python: A Computational Problem-Solving Focus', + 'QA', + 76.73, + 'P98 D547', + '2013', + '9780470555156', + 'shelf' +); +INSERT INTO Books VALUES( + 32, + 'Think Python', + 'QA', + 76.73, + 'P98 D694', + '2012', + '9781449330729', + 'shelf' +); +INSERT INTO Books VALUES( + 33, + 'Problem Solving with Algorithms and Data Structures Using Python', + 'QA', + 76.73, + 'P98 M54', + '2011', + '9781590282571', + 'shelf' +); +INSERT INTO Books VALUES( + 34, + 'Python Testing Beginner''s Guide: An Easy and Convenient Approach to Testing Your Python Projects', + 'QA', + 76.73, + 'P98 A73', + '2010', + '9781847198846', + 'shelf' +); +INSERT INTO Books VALUES( + 35, + 'Mathematics for the Digital Age and Programming in Python', + 'QA', + 76.73, + 'P98 L58', + '2010', + '9780982477540', + 'shelf' +); +INSERT INTO Books VALUES( + 36, + 'Python Testing Cookbook over 70 Simple but Incredibly Effective Recipes for Taking Control of Automated Testing Using Powerful Python Testing Tools', + 'QA', + 76.73, + 'P98 T87', + '2011', + '9781849514668', + 'shelf' +); +INSERT INTO Books VALUES( + 37, + 'The SQL Guide to SQLite', + 'QA', + 76.73, + 'S67 L3617', + '2009', + '9780557076765', + 'shelf' +); +INSERT INTO Books VALUES( + 38, + 'The Definitive Guide to Sqlite, Second Edition', + 'QA', + 76.73, + 'S67 A45', + '2010eb', + '9781430232254', + 'shelf' +); +INSERT INTO Books VALUES( + 39, + 'Test-Driven Development: A Practical Guide', + 'QA', + 76.76, + 'D47 A783', + '2003', + '9780131016491', + 'shelf' +); +INSERT INTO Books VALUES( + 40, + 'Clean Code: A Handbook of Agile Software Craftsmanship', + 'QA', + 76.76, + 'D47 C583', + '2009', + '9780132350884', + 'shelf' +); +INSERT INTO Books VALUES( + 41, + 'Learning the Vi Editor', + 'QA', + 76.76, + 'O63 L355', + '1990', + '9780937175675', + 'shelf' +); +INSERT INTO Books VALUES( + 42, + 'The UNIX-Haters Handbook', + 'QA', + 76.76, + 'O63 U54518', + '1994', + '9781568842035', + 'shelf' +); +INSERT INTO Books VALUES( + 43, + 'Test-Driven Development: By Example', + 'QA', + 76.76, + 'T48 B43', + '2003', + '9780321146533', + 'shelf' +); +INSERT INTO Books VALUES( + 44, + 'Assembly Language for x86 Processors: Sixth Edition', + 'QA', + 76.8, + 'I77', + '2011', + '9780136022121', + 'shelf' +); +INSERT INTO Books VALUES( + 45, + 'Data Structure and Algorithmic Thinking with Python', + 'QA', + 76.9, + 'A43 K368', + '2016', + '9788192107592', + 'shelf' +); +INSERT INTO Books VALUES( + 46, + 'Data Structures and Algorithms with Python', + 'QA', + 76.9, + 'D35', + '', + '9783319130712', + 'shelf' +); +INSERT INTO Books VALUES( + 47, + 'Data Structures and Algorithms', + 'QA', + 76.9, + 'D35 A38', + '1982', + '0201000237', + 'shelf' +); +INSERT INTO Books VALUES( + 48, + 'Discrete Mathematics', + 'QA', + 76.9, + 'M35 R67', + '1988', + '0132154277', + 'shelf' +); +INSERT INTO Books VALUES( + 49, + 'Think Stats', + 'QA', + 276.4, + 'D69', + '2014', + '9781491907337', + 'shelf' +); +INSERT INTO Books VALUES( + 50, + 'Think Bayes', + 'QA', + 279.5, + 'D69', + '2013', + '9781449370787', + 'shelf' +); diff --git a/learnphp/acclib/dbscripts/load_books_table.sql b/learnphp/acclib/dbscripts/load_books_table.sql new file mode 100644 index 0000000..8578bd1 --- /dev/null +++ b/learnphp/acclib/dbscripts/load_books_table.sql @@ -0,0 +1,12 @@ +DROP TABLE IF EXISTS Books; + +CREATE TABLE Books ( + id INTEGER PRIMARY KEY AUTOINCREMENT, + title TEXT NOT NULL, + class TEXT NOT NULL, + subclass REAL NOT NULL, + cutter TEXT, + suppl TEXT, + isbn TEXT, + stat TEXT NOT NULL +); diff --git a/learnphp/acclib/index.php b/learnphp/acclib/index.php new file mode 100644 index 0000000..65aab40 --- /dev/null +++ b/learnphp/acclib/index.php @@ -0,0 +1,38 @@ + + + + +Arlington Career Center CS / ICT Library + + + +

Arlington Career Center CS / ICT Library

+ +
+ +
+ + + + + + diff --git a/learnphp/acclib/listbooks.php b/learnphp/acclib/listbooks.php new file mode 100644 index 0000000..8787d93 --- /dev/null +++ b/learnphp/acclib/listbooks.php @@ -0,0 +1,9 @@ +query($query) as $row) +{ + echo $row[0] . ' ' . substr($row[1], 0, 75) . "\n"; +} +$dbh = null; //This is how you close a PDO connection diff --git a/learnphp/acclib/phpinfo.php b/learnphp/acclib/phpinfo.php new file mode 100644 index 0000000..61ace19 --- /dev/null +++ b/learnphp/acclib/phpinfo.php @@ -0,0 +1,2 @@ + + + + diff --git a/learnphp/index.php b/learnphp/index.php new file mode 100644 index 0000000..0072064 --- /dev/null +++ b/learnphp/index.php @@ -0,0 +1,40 @@ + + + + +Learning PHP with TDD + + + +

Learning PHP with TDD

+ +
+

Projects

+ +
+ + + + + + diff --git a/learnphp/main.css b/learnphp/main.css new file mode 100644 index 0000000..7f95875 --- /dev/null +++ b/learnphp/main.css @@ -0,0 +1,15 @@ +main { + margin: 30px; + padding: 30px; + border: 1px dotted #555; +} +h1 { + text-align: center; +} +a, a:visited { + text-decoration: none; + color: #555; +} +footer { + text-align: center; +} diff --git a/learnphp/min.html b/learnphp/min.html new file mode 100644 index 0000000..90e8c7b --- /dev/null +++ b/learnphp/min.html @@ -0,0 +1,34 @@ + + + + + + + + +

+ +
+
+ + + + + +