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

38
LINES

< > BotCompany Repo | #1001231 // Find supported questions in all androids (developing)

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

Libraryless. Click here for Pure Java version (203L/3K/6K).

!747

m {
  p {
    // List all JavaX programs
    
    L<S> ids = searchSnippets("type:34 type:40"); // all main programs
    print(ids.size() + " JavaX programs found");
    
    // Load their sources
    
    // Find questions
    
    // Group
  }
  
  // returns list of snippet IDs
  static L<S> searchSnippets(S query) ctex {
    S url = "http://tinybrain.de:8080/tb/search.php?q=" + urlencode(query);
    S page = loadPage(url);
    Matcher m = Pattern.compile(">(#\\d+)</a> - (.*?)<br>").matcher(page);
    
    new L<S> ids;
    while (m.find())
      ids.add(m.group(1));
    return ids;
  }
  
  static L<S> findQuestions(S src) {
    new L<S> questions;
    L<S> tok = javaTok(src);
    for (int i = 1; i+4 < tok.size(); i += 2)
      if (tok.get(i).equals("match3") && tok.get(i+2).equals("(")
        && isQuoted(tok.get(i+4)))
        questions.add(tok.get(i+4));
    return questions;
  }
}

Author comment

Began life as a copy of #1001134

download  show line numbers  debug dex  old transpilations   

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

No comments. add comment

Snippet ID: #1001231
Snippet name: Find supported questions in all androids (developing)
Eternal ID of this version: #1001231/1
Text MD5: cf63178f97640e48711acf289016858f
Transpilation MD5: 2eb9b2330b340ce27ea903a3aa1fab6b
Author: stefan
Category: androids
Type: JavaX source code
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2015-10-04 14:15:52
Source code size: 944 bytes / 38 lines
Pitched / IR pitched: No / Yes
Views / Downloads: 625 / 621
Referenced in: [show references]