How to temporarily disable IPv6 on Ubuntu? You need to diagnose a communication issue or track down a network problem?

IPv6 provides solution of the IPv4 address exhaustion as it’s offering a much larger addressing space.
However, there are few instances in which IPv6 is casing network problems.
Some hardware doesn’t utilize it or take any advantages of IPv6 communications protocol. There are instances in which the temporary and easy solution is to (permanently) disable it. It can be easily re-enabled when it needed again.

In case you need to disable it, either only for troubleshooting or permanently, you can use the following terminal commands.

First of all, let’s verify the current status of your IPv6 communications protocol.

If this command returns 0 that means IPv6 is enabled in your system.

Scroll down to the end of the file and insert these three lines below.

Save and quit your editor, then reboot your system.

Verifying the status of IPv6.

This command should return 1 meaning you successfully disabled IPv6 communications protocol.

To re-enable IPv6 just simple delete or comment out those 3 lines above.

You can use

to read values from file, it should return:

There are some additional commands if this method does not work.

Disable the network manager

Get the IP address from the server using:

List of IP address

Removing all IP information from an interface (enp2s1 in my case)

Assign the first ip addresses like this:

You can repeat for other IP addresses.
You can add the default route using:

List of network devices:

Restart the networking.service

or

Ipv6 test is a free online service to diagnose connection problems: http://ipv6-test.com/

SQLite – How to use fundamental functions in C++

SQLite operations in C++

This tutorial aimed to demonstrate how to use SQLite database operations such as CREATE, INSERT, UPDATE, SELECT and DELETE in C++. Since the appearance first smartphone and other mobile devices SQLite become most widely deployed and used database engine in the world. Precise numbers are difficult to obtain but SQLite is likely used more than all other database engines combined. We can find SQLite in every Android device, iPhone and iOS device, Mac, Windows10, Firefox, Chrome, Safari, Skype, Dropbox, TurboTax, QuickBooks, PHP, Python, television sets, set-top cable boxes and many automotive multimedia systems.

It’s an open-source SQL database engine. You can download the source code or precompiled binaries depending your requirements. You might also need to add [-lsqlite3] and [-std=c++17] to successfully compile, create an executable file. Each of the following source code available on my git repository. https://github.com/lnrsoft

Step 1 – The first thing we need to do is to create the actual database file that we will use in this article. I called sqltdemo.db in our case.

Compile and run our source code to create the local_db.sqlite with the following command. Here we link our code with the sqlite3 library that will create our db file.

Verify our result:

Step 2 – CREATE TABLE

Compile and run.

Step 3 – INSERT INTO our CANDIDATE TABLE

Compile and run.

Step 4 – Fetch and display records from the company CANDIDATE TABLE. In this scenario we use a callback function that obtains results from SELECT statement.

Compile and run.

Step 5 – Using UPDATE statement to update any records in our CANDIDATE table.

Compile and run.

Step 6 – DELETE statement can delete any records from the CANDIDATE table.

Compile and run.

I recommend you to check the official SQLite documentation at sqlite.org for more advance SQLite features and options and support. For further info about using sql with c++ you might found it useful to read me previous post of  a simple Qt tool to test QSqlDatabase access connection to a MySQL database. I created this simple Qt command line tool to test connection between Qt client applications and a remote Mysql Server. The code includes Secure Sockets Layer (SSL) support to test secure connection. The QSqlDatabase class provides an interface for accessing a database through a connection where an instance of QSqlDatabase represents the connection. The connection provides access to the database via one of the supported database drivers, which are derived from QSqlDriver.

Alternatively, we can subclass your own database driver from QSqlDriver. My next post will be an article how to write your own database driver in Qt for Unix, OSX and Windows platforms.

Install Java SE Development Kit 10.0.1 on Ubuntu 18.04 LTS x64

Download: jdk-10.0.1_linux-x64_bin.tar.gz

You might need to reboot your system.