class engine_flot:
def GET( self, argv ):
print "[d] engine flot, argv(%s)" % argv
interface = argv
ipv4db = eq_db_ipv4.IPv4Database()
# check if interface is in LISTENERS, if yes, return
response = {}
response[ 'data' ] = ipv4db.g_interface_statistics( interface, 43 )
response[ 'label' ] = interface
web.header('Content-Type', 'application/json')
return json.dumps( response )
[ add comment ] ( 1 view ) | [ 0 trackbacks ] | permalink
This project is a heavily modified version of jVectorMap. I chose to start fresh rather than fork their project as my intentions were to take it in such a different direction that it would become incompatibale with the original source, rendering it near impossible to merge our projects together without extreme complications.
[ add comment ] ( 2 views ) | [ 0 trackbacks ] | permalink | related link
Example of loading data dynamically with AJAX. Percentage change in GDP (source: Eurostat). Click the buttons below.
The data is fetched over HTTP, in this case directly from text files. Usually the URL would point to some web server handler (e.g. a PHP page or Java/.NET/Python/Ruby on Rails handler) that extracts it from a database and serializes it to JSON.
If you tell Flot that an axis represents time, the data will be interpreted as timestamps and the ticks adjusted and formatted accordingly.
The timestamps must be specified as Javascript timestamps, as milliseconds since January 1, 1970 00:00. This is like Unix timestamps, but in milliseconds instead of seconds (remember to multiply with 1000!).
[ add comment ] ( 1 view ) | [ 0 trackbacks ] | permalink | related link
import web
#import json
import simplejson as json #RHEL5/EPEL
class index:
def GET(self):
pyDict = {'one':1,'two':2}
web.header('Content-Type', 'application/json')
return json.dumps(pyDict)
[ add comment ] ( 1 view ) | [ 0 trackbacks ] | permalink | related link
SB Admin 2 A Free Bootstrap Admin Theme
[ add comment ] ( 2 views ) | [ 0 trackbacks ] | permalink | related link
chronoline.js is a library for making a chronology timeline out of events on a horizontal timescale.
[ add comment ] ( 1 view ) | [ 0 trackbacks ] | permalink | related link
Rickshaw is a JavaScript toolkit for creating interactive time series graphs.
[ add comment ] ( 1 view ) | [ 0 trackbacks ] | permalink | related link
http://www.freeformatter.com/
http://jsonlint.com/
http://jsbeautifier.org/
[ add comment ] ( 1 view ) | [ 0 trackbacks ] | permalink
#!/usr/bin/python
import sys
import simplejson as json
import web
urls = (
'/(.*)', 'index'
)
recursion = 0
recursion_max = 10
# template nesting function
def nestor( page ):
page = 'templates/' + page
global recursion
recursion += 1
if recursion > recursion_max:
print "[d] nestor reached max recursion limit"
print "[d] fatal error, givin' up..."
sys.exit(1)
print "[d] rendering inline template %s, recursion %s" % ( page, recursion )
try:
render = web.template.frender( page, globals = { 'nestor': nestor } )
except IOError:
print "[d] can't find page template %s" % page
print "[d] rendered content is\n%s" % render()
recursion -= 1
return render()
# define application
app = web.application( urls, globals() )
render = web.template.render( 'templates', globals = { 'nestor': nestor } )
class index:
def GET( self, argv ):
print "[d] in index function, rootdir"
return render.eq_index()
if __name__ == "__main__":
app.run()
templates/eq_index.html
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Equal-Layers</title>
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no">
<link type="text/css" rel="stylesheet" href="/static/theme/css/bootstrap.min.css">
<link type="text/css" rel="stylesheet" href="/static/theme/css/font-awesome.min.css">
<link type="text/css" rel="stylesheet" href="/static/theme/css/ionicons.min.css">
<link type="text/css" rel="stylesheet" href="/static/theme/css/AdminLTE.css">
</head>
<body class="skin-blue">
<!-- body content -->
$:nestor( 'eq_body.html' )
</body>
</html>
templates/eq_body.html
<h1>Hello world!</h1>
[ add comment ] ( 1 view ) | [ 0 trackbacks ] | permalink
wget --recursive --no-parent http://ftp.fi.muni.cz/pub/linux/fedora/
[ add comment ] ( 1 view ) | [ 0 trackbacks ] | permalink | related link