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).

!7

set flag DynModule. // for transpiler

module RemoteJavaEval > DynPrintLog {
  S computerID, expression;
  bool realEval;
  transient O value;
  transient JTextArea taInput;
  transient Throwable error;
  
  start {
    dm_requireModule("#1016578/AllOnlineComputers");
  }
  
  visualize {
    ret withMargin(jvsplit(
      northAndCenterWithMargin(
        withLabel("Computer to evaluate this on:", dm_onlineComputerSelectorComboBox(dm_fieldLiveValue('computerID))),
          centerAndEastWithMarginInbetween(
          onCtrlEnter(taInput = jEnableUndoRedo(typeWriterTextArea(expression)), rThread { evalIt(false) }),
          vstackWithSpacing(
            jbutton("Fresh", rThread { evalIt(true) }),
            jbutton("Eval", rThread { evalIt(false) }),
            withToolTip("Don't interpret", dm_fieldCheckBox("Real", 'realEval))))),
      super.visualize()));
  }
  
  void evalIt(bool fresh) pcall {
    temp enter();
    if (!isComputerID(computerID)) ret;
    S s = gtt(taInput);
    setField(expression := s);
    print("\nEvaluating on " + computerID + ": " + s);
    logQuotedWithDate("expressions.txt", computerID + ": " + s);
    long time = sysNow();
    O value = dm_evalOnOtherMachine_optimizeIfMe(computerID, s, +realEval, +fresh);
    new L<S> info;
    info.add(elapsedMS(time) + " ms");
    addAll(info, quickValueInformation_list(value));
    print("[" + joinWithComma(info) + "]");
    S string = str(value);
    pcall { logStructureWithDate("with-results.txt", ll(s, string)); }
    print(shorten(1000, string));
    if (value cast BufferedImage)
      showImage(value);
  }
}

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: 337 / 22781
Version history: 11 change(s)
Referenced in: