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

!7

sS PUBLIC = "uzbkhxkgharxzxgq"; // Something that is public (can be published anywhere)
sS PRIVATE = "eijowimmhvhnoutw"; // Something that is PRIVATE (must NOT be published without asking)
sS SINGLE_TEXT_FILE_PATH = "mtpwbshdjfkykrlx"; // The path of a text file on my disk

sS beliefs = [[
  // Path of the AI concepts file
  mtpwbshdjfkykrlx of oehbxzbxuoehxptv is "~/JavaX-Data/#1006463/concepts.structure".
]];

sS what;

p {
  what = chooseConceptID("What should I back up?");
  int pub = checkXFor(what, PUBLIC, PRIVATE);
  if (pub == 0) fail("I don't know whether " + what + " is public or private, aborting");
  if (pub < 0) fail("Need to find a private server (COMPLICATED)");
  
  // So X is public => we can possibly handle it
  
  print("Trying to upload " + what + " to TinyBrain.");
  
  S textFile = tryToCast(what, SINGLE_TEXT_FILE_PATH);
  if (textFile != null) {
    S contents = loadTextFile(textFile);
    if (contents == null) {
      print("Text file " + quote(textFile) + " not there, nothing to back up!");
      ret;
    }
      
    print("Uploaded backup as: " + ntUpload(textFile, loadTextFile(textFile)));
  }
  
  fail("Don't know how to handle " + what);
}

sS chooseConceptID(S whatFor) {
  ret "oehbxzbxuoehxptv"; // The directory with the AI concepts
}

sS tryToCast(S x, S y) {
  fail("I don't know how to cast " + x + " to " + y);
}

static int checkXFor(S x, S is, S isnt) {
  fail("I need to know: Is " + x + " " + is + " or " + isnt + "?");
}

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: 379 / 444
Version history: 8 change(s)
Referenced in: [show references]