sandbox-2
This is another sandbox for new users to test functionality
Mako template for city index
<%inherit file="base.mako" />
<div class="grid="15">
<em> There are ${count} cities in ${state['name'].title()} to browse:</em>
<br />
<% letters = 'abcdefghijklmnopqrstuvwxyz'%>
<div id="index">
% for letter in letters:
% if cities[letter]:
<a href="#${letter}">${letter.upper()}</a>
% else:
${letter.upper()}
% endif
% endfor
</div>
% for letter in letters:
% if cities[letter]:
<a href="#index" id="${letter}" class="letter-link">${letter.upper()}</a>
<ul>
% for city in cities[letter]:
<% city = city.lower() %>
<li><a href="/${state['short'].lower()}/${city.replace(' ','-')}">${city.title()}</a></li>
% endfor
</ul>
% endif
% endfor
</div>
breadcrumb algorithm
class Bread( object ):
"""
Create a list of URL parts or crumbs
----------------------------------------
>>> from bread import Bread
>>> bread = Bread("http://www.foxhop.net/samsung/HL-T5087SA/red-LED-failure")
>>> print bread.crumbs
>>> print bread.links
"""
def __init__( self, url=None ):
if url: self.url = url # invoke url.setter
else: self._url = url # set _url to none
@property
def url( self ):
return self._url
@url.setter
def url( self, url ):
if url.startswith( 'http://' ): url = url[ 7: ] # remove http:// if exists
if url.startswith( 'https://' ): url = url[ 8: ] # remove https:// if exists
self._url = url.rstrip('/')
self.crumbs = self._url.split('/')
@property
def links( self ):
links = []
count = 0
for crumb in self.crumbs:
string = ""
for c in range( count + 1 ):
string = string + self.crumbs[c] + '/'
count += 1
string = string.rstrip('/')
links.append('<a href="http://' + string + '">' + crumb + '</a>')
return linksEXAMPLE OUTPUT
['foxhop.net', 'os', 'linux', 'ubuntu']
['<a href="http://foxhop.net/">foxhop.net</a>', '<a href="http://foxhop.net/os/">os</a>',
'<a href="http://foxhop.net/os/linux/">linux</a>', '<a href="http://foxhop.net/os/linux/ubuntu/">ubuntu</a>']Game DB Schema
CREATE TABLE game (
id VARCHAR(16) NOT NULL,
user1_id VARCHAR(16),
user2_id VARCHAR(16),
token CHAR(1),
turn_id VARCHAR(16),
winner_id VARCHAR(16),
createdate DATETIME,
modifydate DATETIME,
board BLOB NOT NULL,
PRIMARY KEY (id),
FOREIGN KEY(user1_id) REFERENCES user (id),
FOREIGN KEY(user2_id) REFERENCES user (id),
FOREIGN KEY(turn_id) REFERENCES user (id),
FOREIGN KEY(winner_id) REFERENCES user (id)
)
CREATE TABLE user (
id VARCHAR(16) NOT NULL,
name VARCHAR(32),
email VARCHAR(32),
PRIMARY KEY (id)
)Game DB Schema2
CREATE TABLE game (
id VARCHAR(16) NOT NULL,
token CHAR(1),
turn_id VARCHAR(16),
winner_id VARCHAR(16),
createdate DATETIME,
modifydate DATETIME,
board BLOB NOT NULL,
PRIMARY KEY (id),
FOREIGN KEY(turn_id) REFERENCES user (id),
FOREIGN KEY(winner_id) REFERENCES user (id)
)
CREATE TABLE user (
id VARCHAR(16) NOT NULL,
name VARCHAR(32),
email VARCHAR(32),
PRIMARY KEY (id)
)
CREATE TABLE usergame(
id VARCHAR(16) NOT NULL,
user_id VARCHAR(16),
game_id VARCHAR(16),
PRIMARY KEY (id)
FOREIGN KEY(user_id) REFERENCES user (id),
FOREIGN KEY(game_id) REFERENCES game (id),
)Some linux commands for server monitoring
uptime
df
free or free -m
ps -ef
w
tload
like it ?
Remarkbox
Comments
test
export
Another test
export
This is pretty sweet I think, and yes, I like it.
export
Thanks for that
chooper <http://www.foxhop.net/account/chooper>_! I'm sure this will come in handy for somebody.export