Javascript. JSON-Schema validators (libraries)

If you need to validate your JSON-Schema I recommend next libraries:

- jjv (https://github.com/acornejo/jjv)

- djv (https://github.com/korzio/djv)

- ajv (https://github.com/epoberezkin/ajv)

jjv  is a simple library but hasn't a good performance. If you need to validate small json objects it might be good choice. However I recommend djv or ajv. As far as I know ajv is more popular than djv but all of them have good performance.

Ubuntu Desktop. Proxy ignore list

Recently, I faced with the following problem. We have a proxy server in the company.
Therefore, after setting up my test host on my local machine, I had to add it to the exception list.
Of course, I could configure browsers, but it wasn't entirely correct.
Therefore, it was better to add the host to the ignore list using the console.

If you want to view the list, run the command:

$ gsettings get org.gnome.system.proxy ignore-hosts
['localhost', '127.0.0.0/8', '::1']

To set your host to the ignore list, run the command:

$ gsettings set org.gnome.system.proxy ignore-hosts "['localhost', '127.0.0.1', 'test.com', '*.test.com']"


As you can see in my case I added 'test.com' and '*.test.com'.

I hope that somebody this article will help to save time :)

Ubuntu Desktop 14.04. Install PostgreSQL

As you know PostgreSQL is a powerful, open source object-relational database system. It has more than 15 years of active development and a proven architecture that has earned it a strong reputation for reliability, data integrity, and correctness.

Below is a short instruction on how to install PostgreSQL.

1. Let's install PostgreSQL:

sudo apt-get update
sudo apt-get install postgresql postgresql-contrib

2. Next, let's install graphical client pgAdmin for PostgreSQL:

sudo apt-get install pgAdmin3

After all installations you have done, add minimal changes to config files.

The working directory by default  is /etc/postgresql/{version}/main/
(the graphical installer installs in /opt/, then the working directory is
/opt/PostgreSQL-{version}/data). It contains the main configuration files.

1. Allow TCP/IP connections

In the configuration file postgresql.conf (the default is in
/etc/postgresql/{version}/main/), uncomment the line
#listen_addresses = 'localhost' by deleting the # character.

listen_addresses = 'localhost'

To connect to the server from other machines, the value 'localhost' should be replaced with the IP address of the machine, or 0.0.0.0, or simply put '*'.
All the necessary details can be found in the comments in the configuration file.

2. User settings

When you install the server, it creates a user postgres with a password postgres. These rights allow the server communicate with the operating system (as I know). But for work it's not enough. You must set a password for the same user in database. To do this, run the psql console client with the postgres user right:

sudo -u postgres psql

Then execute the query:

alter user postgres with encrypted password '_password_'

Where '_password_' is the password for connecting to the server under the user postgres.

3. Changing the authentication method:

In the configuration file pg_hba.conf (the default is in
/etc/postgresql/{version}/main/), change the authentication method for the postgres user to md5:

local   all         postgres                          md5

Restart the server:

sudo /etc/init.d/postgresql restart

pgAdmin configuration

1. Run pgAdmin
2. Create a new connection to the server: File-> Add server
3. Give the connection a name, specify it as the localhost host, as the postgres user with the password created when configuring the server
4. If everything is well configured, there should not be any problems.

Note: If you need a remote connection to the server, you need to make the following settings:

1. Add or edit the following line in your postgresql.conf:

listen_addresses = '*'

2. Add the following line as the first line of pg_hba.conf.
It allows access to all databases for all users with an encrypted password:

# TYPE DATABASE USER CIDR-ADDRESS  METHOD
host  all  all 0.0.0.0/0 md5

3. Restart the server:

sudo /etc/init.d/postgresql restart

psql console commands

Connect to database     \c  database_name
List of databases       \l
List of tables          \dt
List of columns         \d  table_name
Table description       \d+ table_name
List of users           \du
Exit from psql          \q

Server management commands

sudo service postgresql (start|stop|reload|restart|status)


Software versioning

The software life cycle might be very long. Changes in the program might be different - from correcting the error to full rewriting. Therefore we should reflect those changes in the software version. The following convention is recommended:

Major.Minor.Patch

Below you can see pictures for better understanding. More details are available on wiki-page.

Ubuntu. curl behind a proxy

1. Open default config file:

sudo nano ~/.curlrc

2. Add next setting

proxy = user:password@proxy-address:proxy-port

Ubuntu Desktop. add-apt-repository behind a proxy

1. Switch to super user (necessary):

sudo su

2. Then set two path variable:

export http_proxy="http://user:password@proxy-address:proxy-port/"
export https_proxy="http://user:password@proxy-address:proxy-port/"

3. After that you can add your repository:

add-apt-repository ppa:...

Tested on Ubuntu Desktop 16.04.3

Ubuntu Desktop. Solving the problem with sound

If you have trouble with sound like this. Sometimes it might disappear or appear by itself. Đ¢hen you can apply bellow recipe.

1. Open conf file:

nano /etc/pulse/daemon.conf

2. Find option realtime-scheduling, change option value from yes to no
and uncomment it:

..
; high-priority = yes
; nice-level = -11

realtime-scheduling = no
; realtime-priority = 5

; exit-idle-time = 20
; scache-idle-time = 20
... 

3. Then restart PulseAudio:

pulseaudio -k