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

48
LINES

< > BotCompany Repo | #1007111 // Back up X [dev.]

JavaX source code [tags: use-pretranspiled] - run with: x30.jar

Libraryless. Click here for Pure Java version (2370L/17K/54K).

1  
!7
2  
3  
sS PUBLIC = "uzbkhxkgharxzxgq"; // Something that is public (can be published anywhere)
4  
sS PRIVATE = "eijowimmhvhnoutw"; // Something that is PRIVATE (must NOT be published without asking)
5  
sS SINGLE_TEXT_FILE_PATH = "mtpwbshdjfkykrlx"; // The path of a text file on my disk
6  
7  
sS beliefs = [[
8  
  // Path of the AI concepts file
9  
  mtpwbshdjfkykrlx of oehbxzbxuoehxptv is "~/JavaX-Data/#1006463/concepts.structure".
10  
]];
11  
12  
sS what;
13  
14  
p {
15  
  what = chooseConceptID("What should I back up?");
16  
  int pub = checkXFor(what, PUBLIC, PRIVATE);
17  
  if (pub == 0) fail("I don't know whether " + what + " is public or private, aborting");
18  
  if (pub < 0) fail("Need to find a private server (COMPLICATED)");
19  
  
20  
  // So X is public => we can possibly handle it
21  
  
22  
  print("Trying to upload " + what + " to TinyBrain.");
23  
  
24  
  S textFile = tryToCast(what, SINGLE_TEXT_FILE_PATH);
25  
  if (textFile != null) {
26  
    S contents = loadTextFile(textFile);
27  
    if (contents == null) {
28  
      print("Text file " + quote(textFile) + " not there, nothing to back up!");
29  
      ret;
30  
    }
31  
      
32  
    print("Uploaded backup as: " + ntUpload(textFile, loadTextFile(textFile)));
33  
  }
34  
  
35  
  fail("Don't know how to handle " + what);
36  
}
37  
38  
sS chooseConceptID(S whatFor) {
39  
  ret "oehbxzbxuoehxptv"; // The directory with the AI concepts
40  
}
41  
42  
sS tryToCast(S x, S y) {
43  
  fail("I don't know how to cast " + x + " to " + y);
44  
}
45  
46  
static int checkXFor(S x, S is, S isnt) {
47  
  fail("I need to know: Is " + x + " " + is + " or " + isnt + "?");
48  
}

download  show line numbers  debug dex  old transpilations   

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

No comments. add comment

Snippet ID: #1007111
Snippet name: Back up X [dev.]
Eternal ID of this version: #1007111/9
Text MD5: f74be23bde825f423aa489fee7e0910b
Transpilation MD5: 90d20760fe87f5093fc28f88b006f394
Author: stefan
Category: javax / a.i.
Type: JavaX source code
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2017-03-04 15:45:25
Source code size: 1532 bytes / 48 lines
Pitched / IR pitched: No / No
Views / Downloads: 384 / 450
Version history: 8 change(s)
Referenced in: [show references]