Warning: session_start(): open(/var/lib/php/sessions/sess_dpu84528i9fg6tobp1iid4m0av, 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
static SimpleLiveValue input = new(S);
static L result;
static NotTooOften notTooOften = onlyEvery10Secs();
static int maxInputLength = 120;
static transient JTable table;
static transient ReliableSingleThread rst;
static JComponent visualize() { table = sexyTable(); rst.trigger(); ret table; }
static void unvisualize2() { table = null; }
p { input.onChange(rst = ReliableSingleThread(r doIt)); }
svoid update {
S s = (S) callOpt(creator(), 'getInterestingString);
if (nempty(s) && l(s) <= maxInputLength) { // TODO: more quality checks
print("Have input: " + s + ", old input: " + input!);
input.set(s);
}
}
static void doIt() {
print("doIt");
if (allowedToGoogleSomething())
calc();
}
static void calc() {
L> l = quickGoogle2(input!);
result = map(l, func(T3 t) -> SS {
litorderedmap("Result" := second(t), "Desc" := third(t), "Link" := first(t))
});
JTable t = table;
if (t != null)
dataToTable_uneditable(calc(), t);
}
sbool allowedToGoogleSomething() {
ret notTooOften.canDoAgain_willDoIfTrue();
}