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

1  
!747
2  
3  
m {
4  
  p {
5  
    // List all JavaX programs
6  
    
7  
    L<S> ids = searchSnippets("type:34 type:40"); // all main programs
8  
    print(ids.size() + " JavaX programs found");
9  
    
10  
    // Load their sources
11  
    
12  
    // Find questions
13  
    
14  
    // Group
15  
  }
16  
  
17  
  // returns list of snippet IDs
18  
  static L<S> searchSnippets(S query) ctex {
19  
    S url = "http://tinybrain.de:8080/tb/search.php?q=" + urlencode(query);
20  
    S page = loadPage(url);
21  
    Matcher m = Pattern.compile(">(#\\d+)</a> - (.*?)<br>").matcher(page);
22  
    
23  
    new L<S> ids;
24  
    while (m.find())
25  
      ids.add(m.group(1));
26  
    return ids;
27  
  }
28  
  
29  
  static L<S> findQuestions(S src) {
30  
    new L<S> questions;
31  
    L<S> tok = javaTok(src);
32  
    for (int i = 1; i+4 < tok.size(); i += 2)
33  
      if (tok.get(i).equals("match3") && tok.get(i+2).equals("(")
34  
        && isQuoted(tok.get(i+4)))
35  
        questions.add(tok.get(i+4));
36  
    return questions;
37  
  }
38  
}

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