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

36
LINES

< > BotCompany Repo | #1004319 // transpileOnServer2 - testing YN

JavaX fragment (include)

// default mode = "quick"
static YN<S, S> transpileOnServer2(S snippetID) {
  ret transpileOnServer2(snippetID, "quick");
}

static YN<S, S> transpileOnServer2(long snippetID) {
  ret transpileOnServer2(fsI(snippetID));
}

static YN<S, S> transpileOnServer2(long snippetID, S mode) {
  ret transpileOnServer2(fsI(snippetID), mode);
}

// mode = "quick", "medium", "fresh"
// result = yes(answer) or no(answer)
static YN<S, S> transpileOnServer2(S snippetID, S mode) ctex {
  print("Transpiling " + formatSnippetID(snippetID));
  S user = loadTextFile(new File(userHome(), ".tinybrain/username").getPath(), null);
  S pass = loadTextFile(new File(userHome(), ".tinybrain/userpass").getPath(), null);

  S url = "http://tinybrain.de:8080/tb/transpile.php";
  S modeStr = "&quick=1";
  if (eq(mode, "medium")) modeStr += "&medium=1";
  if (eq(mode, "fresh")) modeStr += "&fresh=1";
  S query = "id=" + parseSnippetID(snippetID) + modeStr + "&_user=" + urlencode(user) + "&_pass=" + urlencode(pass);
  S result = loadPage(url + "?" + query);
  print(result);
  
  Matcher m = regexp("URL=/(dexcompile\\.php.*?)'", result);
  if (!m.find())
    ret no(result);
    
  url = "http://tinybrain.de:8080/" + m.group(1);
  result = loadPage(url);
  ret result.contains("SUCCESS") ? yes(result) : no(result);
}

Author comment

Began life as a copy of #1004306

download  show line numbers  debug dex  old transpilations   

Travelled to 14 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, ddnzoavkxhuk, gwrvuhgaqvyk, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tslmcundralx, tvejysmllsmz, vouqrxazstgt

No comments. add comment

Snippet ID: #1004319
Snippet name: transpileOnServer2 - testing YN
Eternal ID of this version: #1004319/1
Text MD5: 406946e3fcc70ebb6c1109db6ee5726a
Author: stefan
Category: javax
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2016-08-13 14:28:57
Source code size: 1334 bytes / 36 lines
Pitched / IR pitched: No / No
Views / Downloads: 558 / 584
Referenced in: [show references]