Get URL parameter value with pure javascript


function getParameterByName(name, url) {
    if (!url) url = window.location.href;
    name = name.replace(/[\[\]]/g, "\\$&");
    var regex = new RegExp("[?&]" + name + "(=([^&#]*)|&|#|$)"),
        results = regex.exec(url);
    if (!results) return null;
    if (!results[2]) return '';
    return decodeURIComponent(results[2].replace(/\+/g, " "));


// query string: ?foo=lorem&bar=&baz
var foo = getParameterByName('foo'); // "lorem"
var bar = getParameterByName('bar'); // "" (present with empty value)
var baz = getParameterByName('baz'); // "" (present with no value)
var qux = getParameterByName('qux'); // null (absent)



TomEE 7 and Hibernate 5.2 persistence.xml

Load all Hibernate jars and dependencies (exclude slfj 1.6) in tomee/libs folder, and use scope provided in pom.xml.

Property hibernate.temp.use_jdbc_metadata_defaults is set to false due to hibernate startup is slow with postgres in true.

Property “tomee.jpa.factory.lazy” is due Romain Manni-Buc forum statement:

You can disable cdi for hibernate tomee.jpa.cdi=false in the persistence
unit or system properties.

If you want it – was not part if 7.0.1 – you can in the same locations set
tomee.jpa.factory.lazy to true.

Idea is to let hibernate initialize ince cdi is started but let cdi have
jpa entity manager or factory – yes chicken egg problem but spec is written
this way ;).

Add SSL certificate manually to JVM

Getting this Maven error at dependency resolving:

ValidatorException: PKIX path building failed:

Download (via browser) the certificate (cer), then install via Java Keytool.

Locate the “cacerts” file to add the cert in jre\lib\security\cacerts.

C:\"Program Files"\Java\jdk1.8.0_91\bin\keytool.exe -import -alias example -keystore C:\"Program Files"\Java\jdk1.8.0_91\jre\lib\security\cacerts -file primefaces.cer

C:\"Program Files"\Java\jdk1.8.0_91\bin\keytool.exe -import -alias example -keystore C:\"Program Files"\Java\jre1.8.0_91\lib\security\cacerts -file primefaces.cer

When ask for password, type: changeit , When asks for confirmation type: yes

Install local jar maven

# cd to project(pom) directory
cd C:\Users\Fernando\Documents\Dev\Samborondon\VentanillaServer

Install jar with mvn command (Netbeans version)
C:\"Program Files"\"NetBeans 8.1"\java\maven\bin\mvn install:install-file -Dfile=C:\Downloads\all-themes-1.0.10.jar -DgroupId=org.primefaces.themes -DartifactId=all-themes -Dversion=1.0.10 -Dpackaging=jar

Install Postgresql 9.6 on Centos 7

Get correct RPM from, then download rpm with wget and install with rpm -i

# install EPEL repos:
rpm -ivh epel-release-7-11.noarch.rpm

yum install postgresql96 postgresql96-contrib postgresql96-server postgresql96-devel postgresql96-plpython postgis2_96 postgis2_96-devel postgis2_96-client postgis2_96-utils

export PGSETUP_INITDB_OPTIONS="--pgdata=/var/lib/pgsql/9.6/data/ -E 'UTF-8' --lc-collate='en_US.UTF-8' --lc-ctype='en_US.UTF-8'"

/usr/pgsql-9.6/bin/postgresql96-setup initdb 

systemctl start postgresql-9.6.service
systemctl enable postgresql-9.6.service

passwd postgres

su postgres
psql -c "ALTER USER postgres WITH PASSWORD 'xxxxxx'" -d template1

nano /var/lib/pgsql/9.6/data/postgresql.conf
# listen_addresses='*'

nano /var/lib/pgsql/9.6/data/pg_hba.conf
# host    all             all               md5
# host    all             all                  md5

systemctl restart postgresql-9.6.service

# Open firewall ports:
firewall-cmd --zone=dmz --add-port=5432/tcp --permanent
firewall-cmd --zone=public --add-port=5432/tcp --permanent
firewall-cmd --reload

Install Postgresql 9.6 on Ubuntu LTS 16.04, 14.04, 12.04 and 16.10


For any Ubuntu version you need to can do this by the official PostgreSQL Apt Repository.

Ubuntu Yakkety (16.10)

(It is not officialy supported but it works using the Xenial repository.)

sudo add-apt-repository "deb xenial-pgdg main"
wget --quiet -O - | sudo apt-key add -
sudo apt-get update
sudo apt-get install postgresql-9.6

Ubuntu Xenial (16.04)

sudo add-apt-repository "deb xenial-pgdg main"
wget --quiet -O - | sudo apt-key add -
sudo apt-get update
sudo apt-get install postgresql-9.6

Ubuntu Trusty (14.04)

sudo add-apt-repository "deb trusty-pgdg main"
wget --quiet -O - | sudo apt-key add -
sudo apt-get update
sudo apt-get install postgresql-9.6

Ubuntu Precise (12.04)

sudo add-apt-repository "deb precise-pgdg main"
wget --quiet -O - | sudo apt-key add -
sudo apt-get update
sudo apt-get install postgresql-9.6
psql -c "ALTER USER postgres WITH PASSWORD 'sis98'" -d template1
sudo pg_dropcluster --stop 9.6 main
sudo pg_createcluster --locale en_US.UTF-8 9.6 main



Install pgAdmin 4 on Ubuntu 16.04

or pgAdmin 4 v1.2 on Ubuntu 16.04, according to the download page and desktop deployment:

Install dependencies, create a virtual environment, download, install & configure

sudo apt-get install virtualenv python-pip libpq-dev python-dev

virtualenv pgadmin4
cd pgadmin4
source bin/activate


pip install pgadmin4-1.2-py2-none-any.whl


Write the SERVER_MODE = False in lib/python2.7/site-packages/pgadmin4/ to configure to run in single-user mode:

echo "SERVER_MODE = False" >> lib/python2.7/site-packages/pgadmin4/


python lib/python2.7/site-packages/pgadmin4/

Access at http://localhost:5050


Other option is to use docker and a docker image provided by thaJeztah –

$ docker run --rm -p 5050:5050 thajeztah/pgadmin4