Add archives

main
Jeff Elkner 2 years ago
parent 03aa36f4ce
commit 0544c26c6f

@ -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/<filename:path>')
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)

@ -0,0 +1,227 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Welcome to elkner.net!</title>
<style>
@import url(static/elknernet.css);
</style>
</head>
<body>
<header>
<div id="logo">
<img src="static/images/debian_gnu_linux.png" alt="Debian GNU/Linux">
</div>
<h1>Welcome to elkner.net!</h1>
<p>
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!
</p>
<p class="author" style="text-align: right; padding-right: 360px;">
-- Jeff Elkner</p>
</header>
<h2>
<a href="http://weblog.elkner.net">Weblog</a> |
<a href="contact">Contact Information</a> |
<a href="static/resume.html">Resume</a>
</h2>
<div class="split">
<div class="left">
<h2>Current Activities/Projects:</h2>
<ul>
<li><a href="https://novawebdevelopment.org/">NOVA Web Development</a></li>
<li><a href="https://libreorganize.org/">LibreOrganize</a></li>
<li><a href="https://novalaciro.org/">NOVALACIRO</a></li>
<li><a href="http://openbookproject.net/">The Open Book Project</a></li>
<li><a href="http://ict.gctaa.net">CS /Web Development Program @ ACC</a></li>
</ul>
</div>
<div class="right">
<h2>NOVA Web Development:</h2>
<ul>
<li><a href="static/NOVAWebLimitedLiabilityCompanyOperatingAgreement.pdf">
Operating Agreement</a></li>
<li><a href="https://wordsbynana.com/">Words by Nana</a>: Natalia Cerna's
Weblog</li>
<li><a href="static/dj4e1/index.html">First DJ4E Study Session Notes</a>
(using (<a href="https://github.com/regebro/hovercraft">Hovercraft!</a>)</li>
<li><a href="static/DJ4Enotes/index.html">First DJ4E Study Session Notes</a>
(using <a href="https://github.com/hakimel/reveal.js">reveal.js</a>)</li>
</ul>
</div>
</div>
<div class="split">
<div class="left">
<h2>Papers for University of the People MBA Program:</h2>
<ul>
<li><a href="static/UofPeople/MarketingManagementReflections.pdf">
Marketing Management Reflections (2020-06-01)</a></li>
<li><a href="static/UofPeople/ShouldLibreOrganizeBeCalledAnOMS.pdf">
Should LibreOrganize Be Called an OMS? (2020-05-31)</a></li>
<li><a href="static/UofPeople/MarketingChannelsForNOVAWebDevelopment.pdf">
Marketing Channels for NOVA Web Development (2020-05-27)</a></li>
<li><a href="static/UofPeople/WhenIsMarketingEthical.pdf">
When is Marketing Ethical? (2020-05-27)</a></li>
<li><a href="static/UofPeople/EstablishingAnIntegratedMarketingCommunicationsStrategy.pdf">
Establishing an Integrated Marketing Communications Strategy (2020-05-20)</a>
</li>
<li><a href="static/UofPeople/MarketingAndSalesForNOVAWebDevelopment.pdf">
Marketing and Sales for NOVA Web Development (2020-05-16)</a></li>
<li><a href="static/UofPeople/DeterminingPriceWithoutSacrificingValues.pdf">
Determining Price without Sacrificing Values (2020-05-13)</a></li>
<li><a href="static/UofPeople/PricingGoodsThatImpactLives.pdf">
Asking the Wrong Question: Pricing of Goods that Impact People's Lives
(2020-05-12)</a></li>
<li><a href="static/UofPeople/DrugPricesAndTheBigLie.pdf">
Drug Prices and the Big Lie about the "Free Market" in U.S. Economic Relations
(2020-05-09)</a></li>
<li><a href="static/UofPeople/OnTheShouldersOfGiants.pdf">Invention vs.
Innovation in New Product Development: On the Shoulders of Giants
(2020-05-06)</a></li>
<li><a href="static/UofPeople/TheLifeCycleOfOpenSourceSoftware.pdf">
The Life Cycle of Open Source Software (2020-05-03)</a></li>
<li><a href="static/UofPeople/BrandingStrategyForLibreOrganize.pdf">
Possible Benefits of a Global Branding Strategy for LibreOrganize (2020-04-29)
</a></li>
<li><a href="static/UofPeople/BrandingArlingtonVirginiaREIT.pdf">
Branding in an Arlington, Virginia REIT (2020-04-26)</a></li>
<li><a href="static/UofPeople/User_BuyerModelForActionNetworkAndTheArgumentForSoftwareFreedom.pdf">
User/Buyer Model for Action Network and the Argument for Software Freedom
(2020-04-22)</a></li>
<li><a href="static/UofPeople/YouthAndBernieSanders.pdf">
Youth and Bernie Sanders: A Look at the Role of Demographics in Market Behavior
(2020-04-19)</a></li>
<li><a href="static/UofPeople/MarketingComponentsAndValuePropositionOfNationBuilder.pdf">
Marketing Components and Value Proposition of NationBuilder (2020-04-15)</a>
</li>
<li><a href="static/UofPeople/QualitativeFactorsAndTheWorldWeWantToLiveIn.pdf">
Qualitative Factors and the World We Want to Live In (2020-02-26)</a></li>
<li><a href="static/UofPeople/TycoCorruptionCaseStudy.pdf">
Tyco Corruption Case Study: Targeting the Wrong Victim (2019-10-23)</a></li>
</ul>
</div>
<div class="right">
<h2>Other Stuff:</h2>
<ul>
<li><a href="static/Illustrious_American_and_Other_Verses_Lewis_A_Young.pdf">
Illustrious American and Other Verses by Lewis A. Young</a>
(plain text version
<a href="static/Illustrious_American_and_Other_Verses_Lewis_A_Young.txt">
here</a>)</li>
<li><a href="static/presentations/CP4E2004/index.html">CP4E Presentation</a>
</li>
<li><a href="static/photos/march21_2010_march.jpg">Immigration Rights March</a>
</li>
<li><a href="static/venezuela/index.html">Photographs from Venezuela</a></li>
</ul>
</div>
</div>
<div class="split">
<div class="left">
<h2>Books:</h2>
<ul>
<li><a href="http://openbookproject.net/thinkcs/python/english2e">How to
Think Like a Computer Scientist: Learning with Python</a> 2nd Ed.</li>
</ul>
</div>
<div class="right">
<h2>Exits:</h2>
<ul>
<li><a href="http://ibiblio.org/">ibiblio</a></li>
<li><a href="http://launchpad.net/">Launchpad</a></li>
</ul>
</div>
</div>
<h2>Papers/Articles/Presentations:</h2>
<ul>
<li><a href="https://www.peoplesworld.org/article/public-tools-for-public-schools-stopping-tech-giants-online-education-takeover/">
Public Tools for Public Schools: Stopping tech giants online education
takeover</a> (<a href="https://www.peoplesworld.org">People's World</a>
article June 29, 2020).</li>
<li><a href="static/VCCSPeerGroupPresentationFeb2017.pdf">Connecting
VCCS Courses to to a Project Based Dual-enrolled High School IT / CS
Program</a></li>
<li><a href="static/papers/hidden_curriculum.pdf">
Challenging the Hidden Curriculum of Inequity: Full-Time Students at the
Arlington Career Center</a></li>
<li><a href="static/papers/gmu_ctch601_final_paper.pdf">
Dual Enrollment in a High School Career and Technical Center as a
Strategy to Address the Achievement Gap</a></li>
<li><a href="static/FromTeacherToCrusader.pdf">
From teacher to crusader: Confessions of an open source educator</a></li>
<li><a href="static/testFirst/index.html">
Using Test Driven Development in a Computer Science Classroom:
A First Experience</a></li>
<li><a href="static/frank_wilson_interview.html">
Frank Wilson Interview</a></li>
<li><a href="https://www.linux.com/news/portrait-jeff-elkner-free-software-activist-and-teacher"><!-- static/linuxdotcom_portrait/index.html -->
Linux.com Article</a></li>
<li><a href="static/pyYHS/year01/pyYHS.html">
Using Python in a High School Computer Science Program</a></li>
<li><a href="static/pyYHS/year02/pyYHS2.html">
Using Python in a High School Computer Science Program - Year 2</a></li>
<li><a href="static/articles/caseStudy.html">
How to Think Like a Computer Scientist: Learning with Python
A Copyleft Case Study</a></li>
<li><a href="static/articles/mainstream.html">
LTSP: Moving into the Mainstream</a></li>
</ul>
<blockquote>
<p>{{text}}</p>
<p class="author">-- {{author}}</p>
</blockquote>
<footer>
<p>copyright © 2020 Jeffrey Elkner</p>
<a href="http://validator.w3.org/check/referer">
<strong> HTML </strong> Valid! </a>
<a href="http://jigsaw.w3.org/css-validator/check/referer?profile=css3">
<strong> CSS </strong> Valid! </a>
</footer>
</body>
</html>

@ -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()
Loading…
Cancel
Save