Look at LSB init scripts for more information.
Copy to /etc/init.d
:
# replace "$YOUR_SERVICE_NAME" with your service's name (whenever it's not enough obvious)
from random import uniform | |
class resample: | |
"""Particle resampler. Assumes that | |
particles is a list of tuples [particle, weight]""" | |
def __init__(self, particles): | |
assert particles, "at least one particle required" | |
self.particles = particles | |
self.total = float(sum(w for p,w in self.particles)) |
Look at LSB init scripts for more information.
Copy to /etc/init.d
:
# replace "$YOUR_SERVICE_NAME" with your service's name (whenever it's not enough obvious)
def pww(batches, detect): | |
t = 1 | |
for _ in range(ceil(log2(max_time))): | |
# Generate sliding windows with half-window step | |
windows = (batches | |
.window(2*t, t) | |
.reduce(lambda a, b: a + b)) | |
# Apply data mining/pattern recognition algorithm | |
detect(windows) |
The BOPP paper needs a way to immediately return result from a query. The easiest way to implement this is to add a kind of return statement. However, imlementing return
literally poses two problems:
return
(not a special form in Clojure).return
inside an Anglican function implemented as a call to result-cont
will not return from the function but rather from the query which calls the function, without any way to intercept.We would like a solution which
<html xmlns="http://www.w3.org/1999/xhtml"><head> | |
<meta http-equiv="content-type" content="text/html; charset=ISO-8859-1"> | |
<!-- $Id: tournament.html,v 1.5 2008/03/10 11:05:35 tolpin Exp $ --> | |
<title>Unreal Tournament</title> | |
<script type="text/javascript"><!-- | |
/* $Id: util.js,v 1.4 2008/03/05 12:02:31 tolpin Exp $ */ | |
var MIN_INT = -0xFFFF, | |
MAX_INT = -MIN_INT; |
<html xmlns="http://www.w3.org/1999/xhtml"><head> | |
<meta http-equiv="content-type" content="text/html; charset=ISO-8859-1"> | |
<!-- $Id: tournament.html,v 1.5 2008/03/10 11:05:35 tolpin Exp $ --> | |
<title>Unreal Tournament</title> | |
<script type="text/javascript"><!-- | |
/* $Id: util.js,v 1.4 2008/03/05 12:02:31 tolpin Exp $ */ | |
var MIN_INT = -0xFFFF, | |
MAX_INT = -MIN_INT; |