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

42
LINES

< > BotCompany Repo | #1016872 // Snippets DB v2 [Dyn Module]

JavaX source code (Dynamic Module) [tags: use-pretranspiled] - run with: Stefan's OS

Libraryless. Click here for Pure Java version (30264L/196K).

1  
!7
2  
3  
!include #1016871 // main is not run
4  
5  
module SnippetsDB {
6  
  bool withText, quickUpdate;
7  
  transient ReliableSingleThread rst = new(r updateMe);
8  
9  
  start {
10  
    updateInterval = quickUpdate ? 60 : 3600;
11  
    autoDownloadText = withText;
12  
    useDBOf(#1016871);
13  
    addDirToDontBackupList(dbDir());
14  
    onConceptsChange(rst);
15  
    fullUpdateAtStart = false;
16  
    snippetsDB_init();
17  
    indexConceptField(CSnippet, 'type);
18  
  }
19  
  
20  
  visualize {
21  
    ret centerBoldLabel(jLiveValueLabel(dm_calculatedLiveValue(this, S,
22  
      func -> S { n2(countConcepts(CSnippet), "snippet") })));
23  
  }
24  
  
25  
  enhanceFrame {
26  
    addTitlePopupMenuItem(f, "Full download", r-thread enter { fullDownload(); });
27  
    dm_boolFieldMenuItem(f, 'withText, onSet := r { autoDownloadText = withText });
28  
    dm_boolFieldMenuItem(f, 'quickUpdate);
29  
  }
30  
  
31  
  // API for other modules
32  
  
33  
  L<CSnippet> snippetsOfType(S type) {
34  
    ret sortedByFieldDesc('snippetID, conceptsWhere(CSnippet, +type));
35  
  }
36  
  
37  
  L<CSnippet> allSnippets() { ret list(CSnippet); }
38  
  
39  
  S getSnippetText(S snippetID) enter {
40  
    ret main.getSnippetText(snippetID);
41  
  }
42  
}

Author comment

Began life as a copy of #1016026

download  show line numbers  debug dex  old transpilations   

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

No comments. add comment

Snippet ID: #1016872
Snippet name: Snippets DB v2 [Dyn Module]
Eternal ID of this version: #1016872/31
Text MD5: de70eed6fd6a1b66a0ba1404cdb84c0b
Transpilation MD5: 29ebab24365d22c714f840ade9acaa54
Author: stefan
Category: javax / a.i.
Type: JavaX source code (Dynamic Module)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2022-03-12 23:57:48
Source code size: 1144 bytes / 42 lines
Pitched / IR pitched: No / No
Views / Downloads: 668 / 617458
Version history: 30 change(s)
Referenced in: [show references]