Warning: session_start(): open(/var/lib/php/sessions/sess_08vlfiq8uel4bjsjqu5om8s3de, 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
import java.util.*;
import java.util.zip.*;
import java.util.List;
import java.util.regex.*;
import java.util.concurrent.*;
import java.util.concurrent.atomic.*;
import java.util.concurrent.locks.*;
import javax.swing.*;
import javax.swing.event.*;
import javax.swing.text.*;
import javax.swing.table.*;
import java.io.*;
import java.net.*;
import java.lang.reflect.*;
import java.lang.ref.*;
import java.lang.management.*;
import java.security.*;
import java.security.spec.*;
import java.awt.*;
import java.awt.event.*;
import java.awt.image.*;
import javax.imageio.*;
import java.math.*;
import java.text.*;
import javax.swing.border.*;
import javax.swing.undo.UndoManager;
import javax.imageio.metadata.*;
import javax.imageio.stream.*;
import java.awt.datatransfer.StringSelection;
import javax.net.ssl.*;
import java.security.SecureRandom;
import java.security.cert.X509Certificate;
import java.text.SimpleDateFormat;
import java.text.NumberFormat;
import javax.swing.event.AncestorListener;
import javax.swing.event.AncestorEvent;
import javax.swing.Timer;
class main {
static class HearMyselfTest extends DynPrintLog {
String text = "I like you", heard;
transient JTextField tfText;
transient JLabel lblCat;
int timeout = 5;
void start() { super.start(); logModuleOutput(); }
JComponent visualize() {
return withCenteredButtons(
northAndCenter(
centerAndEast(
vstack(
jsection("Text to say",
onEnter(runnableThread(new Runnable() { public void run() { try { doIt();
} catch (Exception __e) { throw rethrow(__e); } } public String toString() { return "doIt();"; }}), tfText = jLiveValueTextField_bothWays(dm_fieldLiveValue("text")))),
jsection("What I heard",
disableTextField(jLiveValueTextField(dm_fieldLiveValue("heard"))))),
withMargin(lblCat = jimage("#1101344"))),
super.visualize()),
"Do the test", runnableThread(new Runnable() { public void run() { try { doIt();
} catch (Exception __e) { throw rethrow(__e); } } public String toString() { return "doIt();"; }}));
}
void doIt() { AutoCloseable __0 = enter(); try {
AutoCloseable __1 = dm_tempDisableAllButtons(); try {
String text = getTextTrim(tfText);
if (empty(text)) return;
print("Initiating voice");
Object voiceOutput = dm_getModule(dm_requireModule("#1016614/VoiceOutput"));
print("Initiating ear");
//O katze = dm_getModule(dm_requireModule("#1016461/Katze"));
Object katze = dm_getModule(dm_requireModule("#1018551/SpeechRecognizer"));
call(katze, "startListening");
if (!chromeSpeech_hasRecognizer()) {
do { sleepSeconds(1); }
while (!chromeSpeech_hasRecognizer());
}
sleepSeconds(2); // give time to start
double seconds = this.timeout;
long logLength = fileSize(speechRecognitionLog());
print("Saying & listening for " + seconds + " seconds: " + text);
call(voiceOutput, "say", text);
long timeout = sysTime()+toMS(seconds);
Var vLine = new Var();
ManualTailFile tail = new ManualTailFile(speechRecognitionLog(), vfAppendToLineBuffer(unquotingLineBuffer(vfSetVar(vLine))));
tailFile_newOnly(tail);
while (sysTime() < timeout && !vLine.has()) {
tail.check();
sleep(100);
}
print("Stop listening.");
call(katze, "stopListening");
String s = speechRecognitionLog_extractUtterance(vLine.get());
setField("heard" , s);
print("Got line: " + s);
if (match(text, s)) {
print("Yes, I can hear myself!!");
setModuleName("I can hear myself :)");
setImage(lblCat, "#1101341");
} else if (nempty(s)) {
print("I said: " + quote(text) + ", but I heard: " + quote(s));
setModuleName("I seem to mishear myself");
setImage(lblCat, "#1101343");
} else {
print("I said: " + quote(text) + ", but I heard nothing.");
setModuleName("I can't hear me :(");
setImage(lblCat, "#1101342");
}
} finally { _close(__1); }} finally { _close(__0); }}
void enhanceFrame(Container f) { super.enhanceFrame(f);
dm_intFieldMenuItem(f, "timeout");
}
}
static boolean logModuleOutput_installed;
static void logModuleOutput() {
if (logModuleOutput_installed) return;
logModuleOutput_installed = true;
final File logFile = getProgramFile("output.txt");
final LineBuffer buf = new LineBuffer(new VF1() { public void get(String line) { try {
appendToTextFile(logFile, "[" + localDateWithMilliseconds() + "] " + line + "\n");
} catch (Exception __e) { throw rethrow(__e); } }
public String toString() { return "appendToTextFile(logFile, \"[\" + localDateWithMilliseconds() + \"] \" + line + \"..."; }});
print_forAllThreads(new VF1() { public void get(String s) { try {
buf.append(s);
} catch (Exception __e) { throw rethrow(__e); } }
public String toString() { return "buf.append(s);"; }});
}
static JPanel withCenteredButtons(JComponent center, Object... params) {
return centerAndSouth(center, withMargin(jcenteredbuttons(params)));
}
static JPanel northAndCenter(Component n, Component c) {
return centerAndNorth(c, n);
}
static JPanel centerAndEast(final Component c, final Component e) {
return (JPanel) swing(new F0