Not logged in.  Login/Logout/Register | List snippets | | Create snippet | Upload image | Upload data

48
LINES

< > BotCompany Repo | #1020215 // Multi-Line Java Eval On Other Machine [Execute Java Code Remotely]

JavaX source code (Dynamic Module) [tags: use-pretranspiled] - run with: Stefan's OS

Uses 108K of libraries. Click here for Pure Java version (17699L/135K).

1  
!7
2  
3  
set flag DynModule. // for transpiler
4  
5  
module RemoteJavaEval > DynPrintLog {
6  
  S computerID, expression;
7  
  bool realEval;
8  
  transient O value;
9  
  transient JTextArea taInput;
10  
  transient Throwable error;
11  
  
12  
  start {
13  
    dm_requireModule("#1016578/AllOnlineComputers");
14  
  }
15  
  
16  
  visualize {
17  
    ret withMargin(jvsplit(
18  
      northAndCenterWithMargin(
19  
        withLabel("Computer to evaluate this on:", dm_onlineComputerSelectorComboBox(dm_fieldLiveValue('computerID))),
20  
          centerAndEastWithMarginInbetween(
21  
          onCtrlEnter(taInput = jEnableUndoRedo(typeWriterTextArea(expression)), rThread { evalIt(false) }),
22  
          vstackWithSpacing(
23  
            jbutton("Fresh", rThread { evalIt(true) }),
24  
            jbutton("Eval", rThread { evalIt(false) }),
25  
            withToolTip("Don't interpret", dm_fieldCheckBox("Real", 'realEval))))),
26  
      super.visualize()));
27  
  }
28  
  
29  
  void evalIt(bool fresh) pcall {
30  
    temp enter();
31  
    if (!isComputerID(computerID)) ret;
32  
    S s = gtt(taInput);
33  
    setField(expression := s);
34  
    print("\nEvaluating on " + computerID + ": " + s);
35  
    logQuotedWithDate("expressions.txt", computerID + ": " + s);
36  
    long time = sysNow();
37  
    O value = dm_evalOnOtherMachine_optimizeIfMe(computerID, s, +realEval, +fresh);
38  
    new L<S> info;
39  
    info.add(elapsedMS(time) + " ms");
40  
    addAll(info, quickValueInformation_list(value));
41  
    print("[" + joinWithComma(info) + "]");
42  
    S string = str(value);
43  
    pcall { logStructureWithDate("with-results.txt", ll(s, string)); }
44  
    print(shorten(1000, string));
45  
    if (value cast BufferedImage)
46  
      showImage(value);
47  
  }
48  
}

Author comment

Began life as a copy of #1017551

download  show line numbers  debug dex  old transpilations   

Travelled to 8 computer(s): bhatertpkbcr, cfunsshuasjs, gwrvuhgaqvyk, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tvejysmllsmz, vouqrxazstgt

No comments. add comment

Snippet ID: #1020215
Snippet name: Multi-Line Java Eval On Other Machine [Execute Java Code Remotely]
Eternal ID of this version: #1020215/12
Text MD5: 6e2971967b5c4e60aad2940ed8454539
Transpilation MD5: 860204f4e482acdaeab1c35b51eff9be
Author: stefan
Category: javax / stefan's os
Type: JavaX source code (Dynamic Module)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2019-09-03 13:57:22
Source code size: 1659 bytes / 48 lines
Pitched / IR pitched: No / No
Views / Downloads: 249 / 22646
Version history: 11 change(s)
Referenced in: [show references]