1 | static S ntUpload(S title, S text) { |
2 | ret ntUpload(programID(), title, text); |
3 | } |
4 | |
5 | static String ntUpload(String gummipw, String title, String text) { |
6 | ret ntUpload(gummipw, title, text, ""); |
7 | } |
8 | |
9 | static String ntUpload(String gummipw, String title, String text, String comment) ctex { |
10 | if (gummipw == null || gummipw.length() == 0) |
11 | throw new RuntimeException("Need gummi password."); |
12 | |
13 | System.out.println("Uploading:"); |
14 | System.out.println(" " + gummipw + " (" + text.length() + " chars)"); |
15 | System.out.println(" " + title); |
16 | int displayLength = 40; |
17 | System.out.println(" " + (text.length() > displayLength ? quote(text.substring(0, displayLength)) + " [...]" : quote(text))); |
18 | |
19 | URL url = new URL("http://tinybrain.de:8080/nt-int/add_snippet.php"); |
20 | String postData = makePostData( |
21 | "gummipw", gummipw, |
22 | "text", text, |
23 | "title", title, |
24 | "comment", comment); |
25 | |
26 | String contents = doPost(postData, url.openConnection(), url); |
27 | |
28 | if (isInteger(contents)) { |
29 | long id = parseSnippetID(contents); |
30 | System.out.println("=> #" + id); |
31 | return "#" + id; |
32 | } else |
33 | throw new RuntimeException("Server error: " + contents); |
34 | } |
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: | #1000566 |
Snippet name: | ntUpload |
Eternal ID of this version: | #1000566/2 |
Text MD5: | 0c278117b80cd06d3fc1f6a3f7694fad |
Author: | stefan |
Category: | |
Type: | JavaX fragment (include) |
Public (visible to everyone): | Yes |
Archived (hidden from active list): | No |
Created/modified: | 2017-03-03 17:24:03 |
Source code size: | 1185 bytes / 34 lines |
Pitched / IR pitched: | No / No |
Views / Downloads: | 773 / 1253 |
Version history: | 1 change(s) |
Referenced in: | [show references] |