This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python2.7 | |
import json | |
import random | |
from tornado import websocket, web, ioloop | |
import datetime | |
from time import time | |
# Random number generator | |
r = lambda: random.randint(0,255) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class WebSocketHandler(websocket.WebSocketHandler): | |
def open(self): | |
print 'Connection established.' | |
#close connection | |
def on_close(self): | |
print 'Connection closed.' | |
# Our function to send new (random) data for charts |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import time | |
import random | |
import json | |
import datetime | |
from tornado import websocket, web, ioloop | |
from datetime import timedelta | |
from random import randint | |
paymentTypes = ["cash", "tab", "visa","mastercard","bitcoin"] | |
namesArray = ['Ben', 'Jarrod', 'Vijay', 'Aziz'] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<html> | |
<head> | |
<meta charset="utf-8"> | |
<title>Dimensional Charting</title> | |
<link rel="stylesheet" type="text/css" href="http://dc-js.github.io/dc.js/css/dc.css"/> | |
<script type="text/javascript" src="http://dc-js.github.io/dc.js/js/d3.js"></script> | |
<script type="text/javascript" src="http://dc-js.github.io/dc.js/js/crossfilter.js"></script> | |
<script type="text/javascript" src="http://dc-js.github.io/dc.js/js/dc.js"></script> | |
</head> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html> | |
<head> | |
<meta charset="utf-8"> | |
<title>Dimensional Charting</title> | |
<link rel="stylesheet" type="text/css" href="http://dc-js.github.io/dc.js/css/dc.css"/> | |
<script type="text/javascript" src="http://dc-js.github.io/dc.js/js/d3.js"></script> | |
<script type="text/javascript" src="http://dc-js.github.io/dc.js/js/crossfilter.js"></script> | |
<script type="text/javascript" src="http://dc-js.github.io/dc.js/js/dc.js"></script> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html> | |
<head> | |
<meta charset="utf-8"> | |
<title>Dimensional Charting</title> | |
<link rel="stylesheet" type="text/css" href="http://dc-js.github.io/dc.js/css/dc.css"/> | |
<script type="text/javascript" src="http://dc-js.github.io/dc.js/js/d3.js"></script> | |
<script type="text/javascript" src="http://dc-js.github.io/dc.js/js/crossfilter.js"></script> | |
<script type="text/javascript" src="http://dc-js.github.io/dc.js/js/dc.js"></script> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html> | |
<head> | |
<meta charset="utf-8"> | |
<title>Dimensional Charting</title> | |
<link rel="stylesheet" type="text/css" href="http://dc-js.github.io/dc.js/css/dc.css"/> | |
<script type="text/javascript" src="http://dc-js.github.io/dc.js/js/d3.js"></script> | |
<script type="text/javascript" src="http://dc-js.github.io/dc.js/js/crossfilter.js"></script> | |
<script type="text/javascript" src="http://dc-js.github.io/dc.js/js/dc.js"></script> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function render_plots(){ | |
yearRingChart | |
.width(200).height(200) | |
.dimension(yearDim) | |
.group(spendPerYear) | |
.innerRadius(50); | |
spenderRowChart | |
.width(250).height(200) | |
.dimension(nameDim) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
connection.onmessage = function(event) { | |
var newData = JSON.parse(event.data); | |
var updateObject =[{ | |
"Name": newData.Name, | |
"Year": newData.Year, | |
"Spent": newData.Spent, | |
"payType": newData.payType | |
}] | |
//resetData(ndx, [yearDim, spendDim, nameDim]); | |
xfilter.add(updateObject); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#pseudo code for simple non-blocking I/O with polling loop (busy-wait) | |
resources = [socketA, socketB, pipeA]; | |
while(!resources.isEmpty()){ | |
for(i = 0; i< resources.length; i++){ | |
resource = resources[i]; | |
//attempt to read resource | |
var data = resource.read(); | |
if(data === NO_DATA_AVAILABLE) | |
continue |
OlderNewer