Warning: session_start(): open(/var/lib/php/sessions/sess_gbvfcpn1a1u04ggkgcvt9ajlmb, O_RDWR) failed: No space left on device (28) in /var/www/tb-usercake/models/config.php on line 51
Warning: session_start(): Failed to read session data: files (path: /var/lib/php/sessions) in /var/www/tb-usercake/models/config.php on line 51
!7
!include #1001372 // direct nohupJavax for fast program starting
// useful stuff to avoid transpilation
please include function rpcNoArgs.
concept Suggestion {
long date;
S text;
S author;
S actionCode;
}
static Suggestion showing;
static ReliableSingleThread rstUpdate = new(f updateImpl);
static PastValueKeeper past = new(3600.0);
p-subst {
defaultFrameTitle("Suggestion");
autoRestart();
db();
botWithInput("Suggestion Master.",
[=[ me suggests hello with action [[infoBox("hello")]] ]=]);
}
answer {
if "* suggests * with action *" {
cnew(Suggestion, date := now(), text := $2, author := $1, actionCode := $3);
rstUpdate!;
ret "OK";
}
if "show last suggestion" { showLastSuggestion(); ret "OK"; }
}
svoid updateImpl {
final Suggestion s = highestByField(list(Suggestion), 'date);
if (s != showing) {
showing = s;
print("Showing suggestion: " + s.text);
logQuotedWithDate(javaxDataDir("suggestions.log"), "Showing: " + struct(s));
past.add(s);
showSuggestion_master(s.text, r {
printIndent(s.actionCode);
logQuotedWithDate(javaxDataDir("suggestions.log"), "Running: " + struct(s));
optimizedJavaEval(s.actionCode);
});
}
}
svoid showLastSuggestion {
double lookback = 1.0;
print('showLastSuggestion);
Suggestion s = past.valueAt_orFirst(toMS(lookback));
if (s != null)
ccopyFields(s, cnew(Suggestion, date := now()), 'text, 'author, 'actionCode);
rstUpdate!;
}