[C++] cxx_status and support in Clang

Here is the list of current C++ implementation status and support in Clang as per Aug 2017.
You can find the complete list of features and minimum Clang version with support on the source page: https://clang.llvm.org/cxx_status.html

C++98 implementation status

Clang implements all of the ISO C++ 1998 standard (including the defects addressed in the ISO C++ 2003 standard) except for export (which was removed in C++11).

C++11 implementation status

Clang 3.3 and later implement all of the ISO C++ 2011 standard.

By default, Clang builds C++ code according to the C++98 standard, with many C++11 features accepted as extensions. You can use Clang in C++11 mode with the -std=c++11 option. Clang’s C++11 mode can be used with libc++ or with gcc’s libstdc++.

C++14 implementation status

Clang 3.4 and later implement all of the ISO C++ 2014 standard.

You can use Clang in C++14 mode with the -std=c++14 option (use -std=c++1y in Clang 3.4 and earlier).

C++17 implementation status

Clang 5 and later implement all the features of the C++ 2017 Draft International Standard.

You can use Clang in C++17 mode with the -std=c++17 option (use -std=c++1z in Clang 4 and earlier).

C++2a implementation status

Clang has experimental support for some proposed features of the C++ standard following C++17, provisionally named C++2a. Note that support for these features may change or be removed without notice, as the draft C++2a standard evolves.

You can use Clang in C++2a mode with the -std=c++2a option.

More technical specifications and standing documents on the source page: https://clang.llvm.org/cxx_status.html

List of the current GNU dialects of C++ standard options: -std=c++11, -std=c++14, -std=c++17

Here is a list of current GNU dialects of C++ standard options as of November 2017.  Source: gcc.gnu.org

A value for this option must be provided; possible values are

c90
c89
iso9899:1990
Support all ISO C90 programs (certain GNU extensions that conflict with ISO C90 are disabled). Same as -ansi for C code.
iso9899:199409
ISO C90 as modified in amendment 1.
c99
c9x
iso9899:1999
iso9899:199x
ISO C99. This standard is substantially completely supported, modulo bugs and floating-point issues (mainly but not entirely relating to optional C99 features from Annexes F and G). See http://gcc.gnu.org/c99status.html for more information.
The names ‘c9x’ and ‘iso9899:199x’ are deprecated.
c11
c1x
iso9899:2011
ISO C11, the 2011 revision of the ISO C standard. This standard is substantially completely supported, modulo bugs, floating-point issues (mainly but not entirely relating to optional C11 features from Annexes F and G) and the optional Annexes K (Bounds-checking interfaces) and L (Analyzability). The name ‘c1x’ is deprecated.
c17
iso9899:2017
ISO C17, the 2017 revision of the ISO C standard. This standard is same as C11 except for corrections of defects (all of which are also applied with -std=c11) and a new value of __STDC_VERSION__, and so is supported to the same extent as C11.
gnu90
gnu89
GNU dialect of ISO C90 (including some C99 features).
gnu99
gnu9x
GNU dialect of ISO C99. The name ‘gnu9x’ is deprecated.
gnu11
gnu1x
GNU dialect of ISO C11. The name ‘gnu1x’ is deprecated.
gnu17
GNU dialect of ISO C17. This is the default for C code.
c++98
c++03
The 1998 ISO C++ standard plus the 2003 technical corrigendum and some additional defect reports. Same as -ansi for C++ code.
gnu++98
gnu++03
GNU dialect of -std=c++98.
c++11
c++0x
The 2011 ISO C++ standard plus amendments. The name ‘c++0x’ is deprecated.
gnu++11
gnu++0x
GNU dialect of -std=c++11. The name ‘gnu++0x’ is deprecated.
c++14
c++1y
The 2014 ISO C++ standard plus amendments. The name ‘c++1y’ is deprecated.
gnu++14
gnu++1y
GNU dialect of -std=c++14. This is the default for C++ code. The name ‘gnu++1y’ is deprecated.
c++17
c++1z
The 2017 ISO C++ standard plus amendments. The name ‘c++1z’ is deprecated.
gnu++17
gnu++1z
GNU dialect of -std=c++17. The name ‘gnu++1z’ is deprecated.
c++2a
The next revision of the ISO C++ standard, tentatively planned for 2020. Support is highly experimental, and will almost certainly change in incompatible ways in future releases.
gnu++2a
GNU dialect of -std=c++2a. Support is highly experimental, and will almost certainly change in incompatible ways in future releases.

 

CMAKE BUILD TYPES AND HOW TO SPECIFY COMPILERS AND COMPILER FLAGS

CMake has a CMAKE_BUILD_TYPE option for predefined build types. The build type affects optimization and whether the result of the build is debuggable. Those used by MySQL are RelWithDebInfo or Debug.
RelWithDebInfo (optimizations are on, debug info is generated) is used in MySQL by default.
Debug (optimizations are off, debug info is generated) is used if the WITH_DEBUG option is set.

CMAKE_BUILD_TYPE is not set when custom compile flags are used

To define which C and C++ compilers to use, you can define the CC and CXX environment variables. For example:

To specify your own C and C++ compiler flags, for flags that do not affect optimization, use the CMAKE_C_FLAGS and CMAKE_CXX_FLAGS CMake options:

When providing your own compiler flags, you might want to specify CMAKE_BUILD_TYPE as well.
For example, to create a 32-bit release build on a 64-bit Linux machine, do this:

If you set flags that affect optimization (-Onumber), you must set the CMAKE_C_FLAGS_build_type and/or CMAKE_CXX_FLAGS_build_type options, where build_type  corresponds to the CMAKE_BUILD_TYPE value.

To specify a different optimization for the default build type (RelWithDebInfo) set the CMAKE_C_FLAGS_RELWITHDEBINFO and CMAKE_CXX_FLAGS_RELWITHDEBINFO options.
For example, to compile on Linux with -O3 and with debug symbols, do this:

SPECIFY ADDITIONAL COMPILER OPTIONS IN QTCREATOR OR SIMPLE ADD THEM TO QMAKE

List of build-specific variants to specify your Qt project.

QSQLDATABASE CONNECTION TEST TOOL

A simple 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.

Software prerequisites:
Remote MySQL server version: 5.7 or above
Qt version: Qt_5_7_1 or above
OpenSSL 1.0.x or above the for SSL feature

How to use it:
1. I simply run the mysql_conn_test_database.sql SQL script file to create a test database on the remote server.
2. Set the hostname or IP, port number, username and password. You migth need to create a new database user for this purpose.
[You will need to create SSL certificates for the database server and client in order to test SSL Feature on the MySQL Server.]
3. If everthing is set just simple build and run the project in your QtCreator.

If everything goes well you will recieve the following feedback from your terminal:


QSqlDatabase connection test tool was created and written by Roland Ihasz and it is licensed under the GNU General Public License (GPL) Version 2 or above.

Check out on GitHub. https://github.com/lnrsoft/QSqlDatabase-connection-test-tool

 mysql_db_connection_test.pro

 main.cpp

 mysql_conn_test_database.sql

Alternatively, use the following shorter source code to check the connection without any sql query.  
 QSqlDatabase connection test tool without query

[SOLVED] QSQLDATABASE: QMYSQL DRIVER NOT LOADED ON OSX AND LINUX

After spending a quite a bit of time to find the solution of this often-occurring
QMYSQL driver not loaded problem mainly after installing Qt installation in a new software environment, So I thought I am going to share my best practice to fix this issue.
I wasn’t able to establish database connection even if I received the list of available drivers:

QSqlDatabase: available drivers: QSQLITE QMYSQL QMYSQL3 QODBC QPSQL
QSqlDatabase: QMYSQL driver not loaded

The following simple method helps to fix the problem.
On OSX system just simple install or re-install mysql using the flowing command. I usually prefer Homebrew as it fulfils most my requirements and using MacPort when I really no other options available.

then place the following libmysqlclient.18.dylib file to the path below:

On different Linux distributions I usually apt install or yum install the MySQL package basically the only thing I need to make sure that place the libmysqlclient.18.dylib file to the following path:

This method solves the QMYSQL driver not loaded issue and allows me to establish database connection, it might work on Windows system as well, however I had not opportunity to try before.
Please, let me know if this method also working for you by dropping a line.

Download libmysqlclient.18.dylib

HOW TO RETURN A STRING EQUIVALENT OF THE NUMBER N USING QT.

QString QString::number(double n, char format = ‘g’, int precision = 6) returns a string equivalent of the number n, formatted according to the specified format and precision.

Let’s see the following example.
There are 3 double values x, y, z.
We want to return the result of the following equation:
(x / z) * (5.961 / y)
We also want to ask the user to set the desired precision of the result.

Here is how I do with Qt.
You can also Fork the complete qt project from my GitHub.
* note = there are many ways to solve this issue, much simpler, but this time I want to demonstrate how we do in Qt.

Argument Formats
In member functions where an argument format can be specified (e.g., arg(), number()), the argument format can be one of the following:

Format            Meaning

e                      format as [-]9.9e[+|-]999

E                      format as [-]9.9E[+|-]999

f                       format as [-]9.9

g                      use e or f format, whichever is the most concise

G                     use E or f format, whichever is the most concise

A precision is also specified with the argument format. For the ‘e’, ‘E’, and ‘f’ formats, the precision represents the number of digits after the decimal point. For the ‘g’ and ‘G’ formats, the precision represents the maximum number of significant digits (trailing zeroes are omitted).

How to return a string equivalent of the number n using Qt was written by Roland Ihasz>, you can modify or distribute. You can do anything you want with this software, just don’t say you wrote it.

More info on   doc.qt.io

Accessing Inherited Functions – HackerRank Challenge Solved in C++

Accessing Inherited Functions – HackerRank Challenge Solved in C++

You and run the code from your terminal using the following commands:

Multi Level Inheritance – HackerRank Challenge Solved in C++

Multi Level Inheritance – HackerRank Challenge Solved in C++

Variable Sized Arrays – HackerRank Challenge Solved in C++

Variable Sized Arrays – HackerRank Challenge Solved in C++

Set STL – HackerRank Challenge Solved in C++

Set – STL – HackerRank Challenge Solved in C++

HackerRank C++ Virtual Functions Challenge

HackerRank C++ Virtual Function Challenge

HackerRank Challenge – Find out the area of a rectangle using C++ inheritance

Rectangle Area HackerRank Challenge

..and a bit longer version.

How to display an image on a QtWidget


There is a simple method to insert images such as a png file using QPixmap. I personally prefer to use a QLabel to show simple images on QWidget, particularry if there is no any other fancy requirements.
Basically you can locate the QLabel anywhere on your QWidget. You will find the pixelmap option at the text option section in your Qt Creator, right below the textFormat. When you click on the Value section you’ll find a small arrow pointing down.
Simple click on it, then choose your png file.

If you just simple want to display an image to the QWidget, I found the following option works well. You just need to insert the path of the image file right after the

member function in your main parent widget, then insert the following source code.

If you know other method to display an image on a QtWidget Please, let me know by dropping a line, I can add it to this post if it is relevant and you agree to do.

[SOLVED] How to re-flash the corrupted BIOS of a Dell Laptop using a USB drive

This is the latest version of the How re-flash the corrupted BIOS of a Dell Inspiron Laptop article.

Repair-Corrupted-BIOS-Firmware

There is, however, no guarantee that the following method will also work for you, as reading this sentence you agree that I am taking no responsibility of any damage caused by the following procedure.

CORRUPTED BIOS AND HOW TO FLASH IT?
How to Recover from a disastrous BIOS update?
How to Flash a Corrupted Dell Inspiron Laptop BIOS?

Simply follow this procedure to re-flash failed BIOS update on a Dell Inspiron (n5010 model in my case) laptop. Presumably the following method also works on almost all other Dell models.

Phase 1.

  • Rename the newly created N5010A15.HDR and N5010A15.ROM files to N5010.HDR and N5010.ROM.
  • Format an USB thumb-drive to FAT and copy the N5010.HDR, N5010.ROM files on it. You do not need to create bootable USB drive.
    *UPDATE: most of the time I hear feedback about this method people add a comment that they formatted their USB thumb-drive to FAT16 as the FAT32 file system did NOT work.

Phase 2.

  • Shutdown your faulty laptop if is is still running with the black screen.
  • Remove the battery
  • Remove the CMOS battery
  • Disconnect the power supply.
  • Insert the USB drive in the USB port.
    *UPDATE: According to the feedback on this method most people use the left USB socket, as the rest of the USB sockets might not functioning at this state.

*Note: There are few cases reported about not active USB ports. Simply try to use other USB port if you notice or suspect that the system cannot read the USB drive from the port you plugged it. Use USB drive with activity LED if you have one, the blinking LED will confirm that the system reads data from your USB drive.

Phase 3.

  • Press and keep hold the END key on the keyboard for your faulty laptop.
  • Plug the DC power connectors (power plug) into the laptop.
  • After a few seconds your faulty laptop will start itself and will re-flash its corrupted BIOS and automatically reboot.
  • You can release the END key after the flashing process started. A USB drive with an activity LED can confirm that the BIOS flashing process started. The complete re-flashing process will take no longer than 60 maximum 90 seconds.

Useful resources:

  1. AT24C01A EEPROM datasheet
  2. DELL EMC System Update for Windows and Linux
  3. Flashrom or Qflashrom
  4. Superiotool – Detect which Super I/O you have on your mainboard
  5. Official Dell BIOS Recovery options
  6. Dell: What is BIOS and How to Download and Install the latest BIOS?
  7. Dell: 64-bit BIOS Installation Utility


This work (How to re-flash the corrupted BIOS of a Dell Laptop using only a USB drive, by LnRSoft Software Development) is free of known copyright restrictions.

 

Top software developer blogs

1) CODE SIMPLICITY
codesimplicity.com
2) JOEL ON SOFTWARE
joelonsoftware.com
3) SCOTT BERKUN
cottberkun.com/blog
4) CODING HORROR
blog.codinghorror.com
5) SCOTT HANSELMAN
hanselman.com/blog
6) /\NDY
andy.pragprog.com
7) PAUL GRAHAM’S ESSAYS
paulgraham.com/articles.html
8) FEDERICO CARGNELUTTI
blog.fedecarg.com
9) DAILYJS
dailyjs.com
10) DAVID WALSH
davidwalsh.name
11) PONTIKIS
pontikis.net
12) SIX REVISIONS
sixrevisions.com
13) WEBAPPERS
webappers.com
14) AJAXIAN
ajaxian.com
15) PROGRAMMABLEWEB
programmableweb.com
16) MARTIN FOWLER
martinfowler.com/bliki
17) ERIC SINK
ericsink.com
18) THE DAILY WTF
thedailywtf.com
19) UIE BRAINSPARKS
uie.com/brainsparks
20) PRAGDAVE
pragdave.me
21) SILK AND SPINACH
silkandspinach.net
22) YTECHIE
ytechie.com
23) BIT-PLAYER
bit-player.org
24) EXPLORATION THROUGH EXAMPLE
exampler.com/blog
25) CLARKE CHING ROLLS ROCKS
rolls.rocks/ccblog
26) JONATHAN KOHL
kohl.ca/blog
27) WORD ALIGNED
wordaligned.org
28) TECHNOLOGY, STRATEGY, PEOPLE & PROJECTS
ericbrown.com/blog
29) DAVID CHELIMSKY
blog.davidchelimsky.net
30) RUMINATIONS OF A PROGRAMMER
debasishg.blogspot.co.uk
31) HERDING CATS
Herding Cats
32) MY SECRET LIFE AS A SPAGHETTI CODER
codeodor.com/index.cfm
33) SOFTWARE BY ROB
softwarebyrob.com
34) IMPLEMENTING SCRUM
implementingscrum.com/section/blog/
35) SUCCEEDING WITH AGILE
mountaingoatsoftware.com/blog
36) REGULAR GEEK
regulargeek.com
37) GOOD CODERS CODE, GREAT REUSE
Catonmat.net
38) SECRETGEEK
secretgeek.net
39) OTAKU, CEDRIC’S BLOG
beust.com/weblog/
40) A GEEK WITH A HAT
swizec.com/blog/

C++ Standards Support in GCC

GNU has announced the stable release of GNU Compiler Collection 7 (GCC 7), which has been marked with the release of GCC 7.1. This month, the 30-year anniversary of GCC 1.0 will also be celebrated.

C++ Standards Support in GCC
This page is a brief summary of some of the huge number of improvements in GCC 7. For more information, see the Porting to GCC 7 page and the full GCC documentation.

Changes
gcc_7.1.0.pdf
gcc.gnu.org/gcc-7
Onlinedocs
Porting to GCC 7
List of GNU GCC Releases

Qt Creator plugins

Just reIf you just started to familiar yourself with Qt’s IDE, this is my advice. After a long time of daily usage became my favorite developing IDE, as it is covering almost every part of the work I do on a daily basis. However there are three (3rd party) plugins am always adding to my Qt Creator IDE wherever I work on-site or in the office they are very useful. Especially CppCheck but gtest and the DB viewing tool can coming handy.
Qt Creator CppCheck integration plugin
Qt Creator Google C++ Testing Framework integration plugin
Qt Creator SQL database viewer plugin

All three plugins developed by Gres

Bottom line: a good and comfortable development enviromet setup if playing a key role of utilizing your almost always limited time and result an efficient way of your daily developing work.
Valgrind (adding memory and function profiler feature to Qt Creator), sometimes preferring GDB instead of LLDB especially project on OSX.
I also use Doxygen for generating documentation from annotated C++ sources.
You can enable/disable plugins, I strongly recommend to enable this very convenient plugging, it is much more helpful compare to my previously used tool. It recognizes notes: TODO, BUG, FIXME, NOTE, HACK by default.

Very simply to use. Here is one of my projects TODO list just started.

Click image to zoom inClick image to zoom in

Sort My List

Sort My List an easy to use very handy online tool where You can sort or clean your list in a variety of ways. This simple online tool could help you remove, add, separate data without using other other softwares sorting features. There are limitations in this online tool, and I won’t recommend on large datasets, however in many cases could be very handy, removing unwanted whitespaces or any characters.
Find out more: sortmylist.com

Fork me on GitHub