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)

1  
// default mode = "quick"
2  
static YN<S, S> transpileOnServer2(S snippetID) {
3  
  ret transpileOnServer2(snippetID, "quick");
4  
}
5  
6  
static YN<S, S> transpileOnServer2(long snippetID) {
7  
  ret transpileOnServer2(fsI(snippetID));
8  
}
9  
10  
static YN<S, S> transpileOnServer2(long snippetID, S mode) {
11  
  ret transpileOnServer2(fsI(snippetID), mode);
12  
}
13  
14  
// mode = "quick", "medium", "fresh"
15  
// result = yes(answer) or no(answer)
16  
static YN<S, S> transpileOnServer2(S snippetID, S mode) ctex {
17  
  print("Transpiling " + formatSnippetID(snippetID));
18  
  S user = loadTextFile(new File(userHome(), ".tinybrain/username").getPath(), null);
19  
  S pass = loadTextFile(new File(userHome(), ".tinybrain/userpass").getPath(), null);
20  
21  
  S url = "http://tinybrain.de:8080/tb/transpile.php";
22  
  S modeStr = "&quick=1";
23  
  if (eq(mode, "medium")) modeStr += "&medium=1";
24  
  if (eq(mode, "fresh")) modeStr += "&fresh=1";
25  
  S query = "id=" + parseSnippetID(snippetID) + modeStr + "&_user=" + urlencode(user) + "&_pass=" + urlencode(pass);
26  
  S result = loadPage(url + "?" + query);
27  
  print(result);
28  
  
29  
  Matcher m = regexp("URL=/(dexcompile\\.php.*?)'", result);
30  
  if (!m.find())
31  
    ret no(result);
32  
    
33  
  url = "http://tinybrain.de:8080/" + m.group(1);
34  
  result = loadPage(url);
35  
  ret result.contains("SUCCESS") ? yes(result) : no(result);
36  
}

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: 574 / 601
Referenced in: [show references]