Menu

Home

Arsi

Welcome to Code snippets community manager wiki!

Icons

Community server
Team server
Local database

Full text search
Keyword search


Options


To post code snippets to community server or team server with enabled authentication, you must sign up..
After registering, you will receive a password by mail..


Post code snippet

Highlight the code and right click the mouse button and select Create community help


Editor toolbar

Select source for code snippets search. (community server, team server, local database)

Select search type. (by key, full text)


Full text code completion

Default ist search for decription and the whole line used. After highlighting some text and ctrl-space the highlighted text ist searched in code section of snippet..


Snippets browser


You can edit or delete your own code snippets..


To start server execute:

java -jar CodeSnippetsServer.jar /path/to/config.ini

config.ini

[SERVER]
PORT = 3232 ;server port
TURN_OFF_AUTHENTICATION = false ; enable/disable user autentication for post code snippets

[SMTP]
ENABLE = false ; enable/disable smtp for user autentication must enabled
SERVER = 
USER = 
PASSWORD =
MAIL_ADDRESS = 

[ADMIN]
ENABLE = false ;enable/disable admin email info  
MAIL = user@user.com
MAIL_ON_USER_ADD = true
MAIL_ON_HELP_ADD = true
SEND_DAILY_STATISTICS = true

[DATABASE]
DIRECTORY = /ssd/codesnippets ;H2 database directory

Discussion

  • Tony Gravagno

    Tony Gravagno - 2018-12-21

    NetBeans v9 -
    Attempt to run server just for my local PC.

    The only file that's available is in folder:
    ide\modules\ext\sk.arsi.CodeSnippetsCommunityManager-Module\sk-arsi
    File: CodeSnippetsCommunityManager-server.jar

    java -jar that.jar config.ini

    The ini file is in the local folder. Putting the file elsewhere or setting an absolute location for the database can result in Jdbc errors. Easy setup:

    [SERVER]
    PORT = 3232 ;server port
    TURN_OFF_AUTHENTICATION = true
    
    [DATABASE]
    DIRECTORY = .
    

    That creates file codesnippetsDB.mv.db.
    From there an exception is thrown:

    Exception in thread "main" java.lang.NullPointerException
            at sk.arsi.nb.help.server.backup.PublicDatabaseBackup.startPublicBackup(PublicDatabaseBackup.java:46)
            at sk.arsi.nb.help.server.Main.main(Main.java:228)
    

    Now go into NetBeans, Options>Editor>Code snippets and attempt to connect to the community server as localhost:3232 with no email/password. The Test Connection fails. Check netstat and the socket is not listening. Other ports tried, firewall turned off, etc. Any tips?

     
  • Arsi

    Arsi - 2018-12-22

    Try to enter the full path to the config.ini

    public static void main(String[] args) {
            if (args.length != 1) {
                System.out.println("Command line: path to config.ini");
                System.exit(0);
            }
            try {
                ConfigManager.loadConfig(args[0]);
            } catch (IOException ex) {
                System.out.println("Unable to parse " + args[0]);
                System.exit(0);
            }
    
    public static final void loadConfig(String path) throws IOException {
    Ini ini = new Ini();
            ini.getConfig().setMultiSection(true);
            ini.load(new File(path));
            Set<Map.Entry<String, Profile.Section>> sections = ini.entrySet();
            for (Map.Entry<String, Profile.Section> e : sections) {
                if ("SMTP".equalsIgnoreCase(e.getKey())) {
                    SMTP = e.getValue();
                } else if ("SERVER".equalsIgnoreCase(e.getKey())) {
                    SERVER = e.getValue();
                } else if ("ADMIN".equalsIgnoreCase(e.getKey())) {
                    ADMIN = e.getValue();
                } else if ("DATABASE".equalsIgnoreCase(e.getKey())) {
                    DATABASE = e.getValue();
                } else if ("BACKUP".equalsIgnoreCase(e.getKey())) {
                    BACKUP = e.getValue();
                }
            }
    
     
  • Arsi

    Arsi - 2018-12-22

    But the project is designed for java 8 and Netbeans 8.x

     

Log in to post a comment.