Bloatware

Software disenchantment

Share

Postgresql

Current version is 10.5
username and password are ‘postgres’

Installation

#apt-get update
$#apt-get install postgresql postgresql-client

Server setup

$ip addr show //from server
192.168.1.7/24

$ip addr show //from client
192.168.1.9/24

https://www.postgresql.org/docs/current/static/auth-pg-hba-conf.html

nano /etc/postgresql/11/main/pg_hba.conf

# Allow any user from host 192.168.12.10 to connect to database
# “postgres” if the user’s password is correctly supplied.
#
# TYPE DATABASE USER ADDRESS METHOD
host postgres all 192.168.1.9/24 trust

  • Must reload configuration after this modification:

su - postgres
/usr/lib/postgresql/10/bin/pg_ctl reload

OR

root@cellar:/home/mbc# pg_ctlcluster 11 main restart

OR

SELECT pg_reload_conf(); from psql

  • Must modify postgresql.conf to listen for all addresses

# grep listen /etc/postgresql/10/main/postgresql.conf
listen_addresses = ‘localhost’

#nano /etc/postgresql/10/main/postgresql.conf

# grep listen /etc/postgresql/10/main/postgresql.conf
listen_addresses = ‘*’

Must restart server after this modification

#/usr/lib/postgresql/10/bin/pg_ctl restart -D “/etc/postgresql/10/main”
OR

root@cellar:/home/mbc# pg_ctlcluster 11 main restart

# 2021 March sudo systemctl stop postgresql@11-main to stop

Client setup

#apt-get update
#apt-get install postgresql-client

$ping 192.168.1.7

be sure to get a response

# psql -U postgres -h 192.168.1.7
Welcome to psql 8.1.11 (server 8.4.18), the PostgreSQL interactive terminal.
postgres=#

Extensions

Extensions can be loaded by superuser only.
Extensions can be used by loader only.
Make a regular user a superuser, load extension, revoke superuser status.

su postgres
psql
alter role user_name superuser;
#then create the extension as the user in a different screen
CREATE EXTENSION intarray;
#back to role swapping screen
alter role user_name nosuperuser;

DROP extension; to remove extension

Initialize users/schema

psql -U postgres -h 192.168.1.11 -d lndb

postgres is the superuser
usually there is a database postgres

to see all databases
SELECT datname FROM pg_database;

\du to show all users

Must login as superuser to create a schema

PGbouncer

Needed to terminate artanis persistent connections

Install libevent
Install pgbouncer

./config –prefix=/usr/local
make
#make install

 INSTALL  pgbouncer /usr/local/bin
 INSTALL  README.md /usr/local/share/doc/pgbouncer
 INSTALL  NEWS.md /usr/local/share/doc/pgbouncer
 INSTALL  etc/pgbouncer.ini /usr/local/share/doc/pgbouncer
 INSTALL  etc/userlist.txt /usr/local/share/doc/pgbouncer
 INSTALL  doc/pgbouncer.1 /usr/local/share/man/man1
 INSTALL  doc/pgbouncer.5 /usr/local/share/man/man5

pgbouncer runs on a different port, so start it up in a terminal each session

$pgbouncer -d ./syncd/pgbouncer.ini
$psql -U ln_admin -p 6432 -d lndb -h 127.0.0.1

note the port

[pgbouncer.ini] []
1
2
3
4
5
6
7
8
9
10
lndb = host=127.0.0.1 port=5432 dbname=lndb

[pgbouncer]
listen_port = 6432
listen_addr = 127.0.0.1
auth_type = trust
auth_file = /home/mbc/syncd/userlist.txt
logfile = pgbouncer.log
pidfile = pgbouncer.pid
admin_users = ln_admin
[userlist.txt] []
1
2
"ln_admin" "welcome"

init.el

;_____________________________________________________________________________
;;;;SQLi setup

(require ‘sqlup-mode)
;; Capitalize keywords in SQL mode
(add-hook ‘sql-mode-hook ‘sqlup-mode)
;; Capitalize keywords in an interactive session (e.g. psql)
(add-hook ‘sql-interactive-mode-hook ‘sqlup-mode)
;; Set a global keyword to use sqlup on a region
(global-set-key (kbd “C-c u”) ‘sqlup-capitalize-keywords-in-region)

(setq sql-postgres-login-params
‘((user :default “postgres”)
(database :default “postgres”)
(server :default “192.168.1.7”)
(port :default 5432)))

(add-hook ‘sql-interactive-mode-hook
(lambda ()
(define-key sql-mode-map ‘[f5] ‘sql-send-region)
(toggle-truncate-lines t)))

to launch: M-x sql-postgres

Share

Gradle notes

Use the local Maven repository

1
2
3
4
5
6
7
8
9
10
11
12
repositories {
// Use jcenter for resolving your dependencies.
// You can declare any Maven/Ivy/file repository here.
jcenter()
// maven {
// url 'http://m2.objectdb.com'
// }
mavenLocal()
mavenCentral()


}
1
2
3
4
dependencies {
//.......
compile 'net.stihie:llm:0.1'
}

gradle build –refresh-dependencies

Include other jars in the dependencies. Define the variable extraLibs

1
2
3
configurations {
extraLibs
}

In the dependencies, add the jars to extraLibs:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37

dependencies {
// This dependency is found on compile classpath of this component and consumers.
compile 'com.google.guava:guava:23.0'
extraLibs group: 'com.google.guava', name: 'guava', version: '23.0'

extraLibs group: 'org.postgresql', name: 'postgresql', version: '42.2.5'
configurations.compile.extendsFrom(configurations.extraLibs)
// Use JUnit test framework
testCompile 'junit:junit:4.12'
//compile files("objectdb-2.7.5/bin/converter.jar")

// PostgreSQL:
compile(group: 'org.postgresql', name: 'postgresql', version: '42.2.5')
implementation(group: 'org.postgresql', name: 'postgresql', version: '42.2.5')
//Help system
// compile 'javax.help:javahelp:2.0.05'
// implementation 'javax.help:javahelp:2.0.05'
compile 'javax.swing:jlfgr:1.0'
implementation 'javax.swing:jlfgr:1.0'
extraLibs group: 'javax.swing', name: 'jlfgr', version: '1.0'

// compile 'net.stihie:bllm:0.1'
// implementation 'net.stihie:bllm:0.1'
// compile 'javax.swing:jnlp:1.0'
// implementation 'javax.swing:jnlp:1.0'

//JSON parsing
compile 'com.google.code.gson:gson:2.8.5'

//QR code library
// compile 'com.google.zxing:core:3.3.3'
// implementation 'com.google.zxing:core:3.3.3'
// compile 'com.google.zxing:javase:3.3.3'
// implementation 'com.google.zxing:javase:3.3.3'

}

Show contents of the cache:

1
2
3
task showMeCache doLast{
configurations.compile.each { println it }
}
1
2
3
4
5
task refreshLicense(type: Copy) {
from("/home/mbc/LitecoinLicenses/license/DkFzn23a")
into(".")
include("*.ser")
}
1
2
3
task myJavadocs(type: Javadoc) {
source = sourceSets.main.allJava
}
1
2
3
4
5
6
7
8
task copyJavaDocsToWeb(type: Copy, dependsOn: [myJavadocs]) {
// from configurations.runtime
from("build/docs/.")
into("/home/mbc/pm/public")
include('*.html', '*.js', '*.js')
include('javadoc/**')

}

task getDeps(type: Exec) {
configurations.testRuntime.files
commandLine ‘echo’, ‘Downloaded all dependencies’
}

//update the local Maven repository
task updateMaven(type: Exec) {

executable "mvn"
args "install:install-file", "-Dfile=/home/mbc/Downloads/postgresql-42.2.5.jar", "-DgroupId=org.postgresql", "-DartifactId=postgresql", "-Dversion=42.2.5", "-Dpackaging=jar"

// args “install:install-file”, “-Dfile=/home/mbc/Downloads/poi-bin-4.0.1-20181203/poi-4.0.1/poi-ooxml-4.0.1.jar”, “-DgroupId=org.apache”, “-DartifactId=poi-ooxml”, “-Dversion=4.0.1”, “-Dpackaging=jar”

// args “install:install-file”, “-Dfile=build/libs/pm-0.1.jar”, “-DgroupId=net.stihie”, “-DartifactId=pm”, “-Dversion=0.1”, “-Dpackaging=jar”

}

task makeHelp(type: Copy, dependsOn: [copyJavaDocsToWeb, copySchemaDocsToWeb]){

}

task getDeps(type: Exec) {
configurations.testRuntime.files
commandLine ‘echo’, ‘Downloaded all dependencies’
}

//update the local Maven repository
task updateMaven(type: Exec) {

executable "mvn"
args "install:install-file", "-Dfile=/home/mbc/Downloads/postgresql-42.2.5.jar", "-DgroupId=org.postgresql", "-DartifactId=postgresql", "-Dversion=42.2.5", "-Dpackaging=jar"

// args “install:install-file”, “-Dfile=/home/mbc/Downloads/poi-bin-4.0.1-20181203/poi-4.0.1/poi-ooxml-4.0.1.jar”, “-DgroupId=org.apache”, “-DartifactId=poi-ooxml”, “-Dversion=4.0.1”, “-Dpackaging=jar”

// args “install:install-file”, “-Dfile=build/libs/pm-0.1.jar”, “-DgroupId=net.stihie”, “-DartifactId=pm”, “-Dversion=0.1”, “-Dpackaging=jar”

}

1
2
3
4
5
6
7
8
task initializePostgres(type:Exec) {

executable '/usr/bin/psql -U postgres -h 192.168.1.11'
args '-f ~/syncd/prog/plate-manager/pm/postgres/create_tables.sql'
outputs.upToDateWhen { false }


}
1
2
3
4
5
task refreshLicense(type: Copy) {
from("/home/mbc/LitecoinLicenses/license/DkFzn23a")
into(".")
include("*.ser")
}

JavaDocs and Schema

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
task myJavadocs(type: Javadoc) {
source = sourceSets.main.allJava
}


task copyJavaDocsToWeb(type: Copy, dependsOn: [myJavadocs]) {
// from configurations.runtime
from("build/docs/.")
into("/home/mbc/syncd/labsolns/public")
include('*.html', '*.js', '*.js')
include('javadoc/**')

}


task getSchema(type: JavaExec) {
main = "-jar";
args "/home/mbc/temp/schemaspy/schemaspy-6.1.0-SNAPSHOT.jar","-configFile", "/home/mbc/temp/schemaspy/schemaspy.properties","-dp","/home/mbc/temp/schemaspy/postgresql-42.2.5.jar"
}

task copySchemaDocsToWeb(type: Copy, dependsOn: [getSchema]) {
// from configurations.runtime
from("./output")
// include('*.html', '*.js', '*.css','*.png','*.txt','*.xml')
into("/home/mbc/syncd/labsolns/public/schema")


}

task makeHelp(type: Copy, dependsOn: [copyJavaDocsToWeb, copySchemaDocsToWeb]){

Prep the development environment

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
task prep {
doLast{

exec{
commandLine 'git', 'pull'
}
exec{
workingDir '../postgres'
commandLine 'git', 'pull'

}
exec{
workingDir '/home/mbc'
// commandLine 'gnome-terminal psql -U pm_admin -h 192.168.1.7 -d pmdb'
commandLine 'gnome-terminal', '--command=/usr/bin/psql -U ln_admin -h 192.168.1.11 -d lndb'
}
//exec{
// workingDir '/home/mbc'
// commandLine 'psql','-Upm_admin', '-h192.168.1.7', '-dpmdb'
//}
exec{
commandLine 'gnome-terminal','--command=emacs'
}

}

}
Share

Bitcoin/Litecoin License Manager plug-in

Before using the plugin, you need to generate license.ser files. Learn how to here.

The BLLM plug-in is the code you will integrate into your software, likely making it available as a menu item under “Help/License”.

The workflow for obtaining a license looks like this:

Download BLLM from Github

Github link here.

Note that the license file has to be handled separately. Generate a license file with the Bitcoin/Litecoin License Manager License Key Generator and include the license in your programs installation directory or another directory of your choosing. Users will need read write access to the directory containg the license.ser file. The license file license.ser should NOT be packaged in your applications jar file.

Integrate BLLM into your application

Provide a menu item that will launch BLLM:

In the ActionListener of your menu item, launch the main window for BLLM

MenuForMyApplication.java
1
2
3
4
5
6
7
8
9
10

menuItem = new JMenuItem("License", KeyEvent.VK_L);
menuItem.addActionListener(
new ActionListener() {
public void actionPerformed(ActionEvent e) {
new bllm.DialogLicenseManager( "My Apps Title", "/path/to/license.ser", "privatekeyforencryption");
}
});
menu.add(menuItem);

If you are working with Gradle, you can install BLLM in your local repository and make BLLM a dependency. First add to the local repository:

1
2
>mvn install:install-file -Dfile=build/libs/bllm-0.1.jar -DgroupId=net.stihie -DartifactId=bllm -Dversion=0.1 -Dpackaging=jar

Check your ./.m2 directory and be sure it is there. Then in your gradle.build file:

gradle.build
1
2
3
4
5
6
7
8
9
repositories {
//....
mavenLocal()
}

dependencies {
//.......
compile 'net.stihie:bllm:0.1'
}

Javadocs available here.

Share

bllmplugin/javadoc/allclasses-noframe

All Classes (bllm 0.1 API)

All Classes

Share

bllmplugin/javadoc/constant-values

Constant Field Values (bllm 0.1 API)

Constant Field Values

Contents

Share

bllmplugin/javadoc/allclasses-frame

All Classes (bllm 0.1 API)

All Classes

Share

bllmplugin/javadoc/deprecated-list

Deprecated List (bllm 0.1 API)

Deprecated API

Contents

Share

bllmplugin/javadoc/help-doc

API Help (bllm 0.1 API)

How This API Document Is Organized

This API (Application Programming Interface) document has pages corresponding to the items in the navigation bar, described as follows.
  • Package

    Each package has a page that contains a list of its classes and interfaces, with a summary for each. This page can contain six categories:

    • Interfaces (italic)
    • Classes
    • Enums
    • Exceptions
    • Errors
    • Annotation Types
  • Class/Interface

    Each class, interface, nested class and nested interface has its own separate page. Each of these pages has three sections consisting of a class/interface description, summary tables, and detailed member descriptions:

    • Class inheritance diagram
    • Direct Subclasses
    • All Known Subinterfaces
    • All Known Implementing Classes
    • Class/interface declaration
    • Class/interface description
    • Nested Class Summary
    • Field Summary
    • Constructor Summary
    • Method Summary
    • Field Detail
    • Constructor Detail
    • Method Detail

    Each summary entry contains the first sentence from the detailed description for that item. The summary entries are alphabetical, while the detailed descriptions are in the order they appear in the source code. This preserves the logical groupings established by the programmer.

  • Annotation Type

    Each annotation type has its own separate page with the following sections:

    • Annotation Type declaration
    • Annotation Type description
    • Required Element Summary
    • Optional Element Summary
    • Element Detail
  • Enum

    Each enum has its own separate page with the following sections:

    • Enum declaration
    • Enum description
    • Enum Constant Summary
    • Enum Constant Detail
  • Tree (Class Hierarchy)

    There is a Class Hierarchy page for all packages, plus a hierarchy for each package. Each hierarchy page contains a list of classes and a list of interfaces. The classes are organized by inheritance structure starting with java.lang.Object. The interfaces do not inherit from java.lang.Object.

    • When viewing the Overview page, clicking on "Tree" displays the hierarchy for all packages.
    • When viewing a particular package, class or interface page, clicking "Tree" displays the hierarchy for only that package.
  • Deprecated API

    The Deprecated API page lists all of the API that have been deprecated. A deprecated API is not recommended for use, generally due to improvements, and a replacement API is usually given. Deprecated APIs may be removed in future implementations.

  • Index

    The Index contains an alphabetic list of all classes, interfaces, constructors, methods, and fields.

  • Prev/Next

    These links take you to the next or previous class, interface, package, or related page.

  • Frames/No Frames

    These links show and hide the HTML frames. All pages are available with or without frames.

  • All Classes

    The All Classes link shows all classes and interfaces except non-static nested types.

  • Serialized Form

    Each serializable or externalizable class has a description of its serialization fields and methods. This information is of interest to re-implementors, not to developers using the API. While there is no link in the navigation bar, you can get to this information by going to any serialized class and clicking "Serialized Form" in the "See also" section of the class description.

  • Constant Field Values

    The Constant Field Values page lists the static final fields and their values.

This help file applies to API documentation generated using the standard doclet.
Share