Posts

Static library and Dynamic library C++

Image
Agenda 1) Static Library vs Dynamic Library 2) Create and use static library 3) Create and use Dynamic library A library is a collection of pre-compiled code that can be re-used by programs. There are 2 types of libraries: static library and dynamic library. 1)  Static Library vs Dynamic Library A static library (or archive) contains code that is linked to users’ programs at compile time. The executable file generated keeps its own copy of the library code. A dynamic library (or shared library) contains code designed to be shared by multiple programs. The content in the library is loaded to memory at runtime. Each executable does not maintain its replication of the library. 2) Create and use static library Linux -> .a (archive file) Windows -> .lib file [Create a static library]: The process involves 2 steps.  STEP-1:  Generate the object file(s).     E.g: g++ -c my_code.cpp -o my_code.o STEP-2:   [LINUX] involves using ar (a Linux archive utili...

CxxTest - A unit test framework for C++

Agenda: 1) Testing normal functions. 2) Mock the functions. 3) Advanced Mocking. 4) Mock the class functions. 1) Testing normal functions. Step1:  Download the latest version of source code from here: https://sourceforge.net/projects/cxxtest/files/cxxtest/ Step2: Write your test suite & test cases. First Simple Test Suite with one test:

MariaDB Installation & Configuration settings for protecting it using NetBackup

  Agenda: 1) About MariaDB 2) MariaDB installation on Linux 3)  MariaDB installation on Windows 4) Create large dummy data for testing 5) Protection using NetBackup 1) About MariaDB MariaDB Server is one of the most popular open-source relational databases. It’s made by the original developers of MySQL and guaranteed to stay open source. It is part of most cloud offerings and the default in most Linux distributions. We could say it's a wrapper over MySQL or compatible drop-in replacement for the widely used MySQL database technology. MariaDB meets the same standard enterprise requirements as MySQL , often with additional features, capabilities and options, and by implementing the MySQL protocol and maintaining compatibility with common MySQL data types and SQL syntax, it's easy to migrate from MySQL to MariaDB without modifying applications. When it comes to performing queries or replication, MariaDB is faster than MySQL . So if you need a high-performance relational database...

Design Patterns

Image
Agenda: In this article, the following points are covered: 1) What is a design pattern? 2) What does the pattern consist of? 3) History of patterns. 4) Why should I learn patterns? 5) Catalog 6) Criticism 1) What is a design pattern? Design patterns are typical solutions to commonly occurring problems in software design. They are like pre-made blueprints that you can customize to solve a recurring design problem in your code. You can’t just find a pattern and copy it into your program, the way you can with off-the-shelf functions or libraries. The pattern is not a specific piece of code, but a general concept for solving a particular problem. You can follow the pattern details and implement a solution that suits the realities of your own program. Patterns are often confused with algorithms, because both concepts describe typical solutions to some known problems. While an algorithm always defines a clear set of actions that can achieve some goal, a pattern is a more high-level descripti...

Design Principles

Image
Agenda This article will cover below things: 1) What are software design principles? 2) Why software design principles important? 3) Various design principles & their details. 1) What are software design principles? Software design principles are a set of guidelines that helps developers to make a good system design. Basically, Software design is only a part of the development process in the design step (please look at the below image about development process). Before we do software  design ( low-level)  we have to complete software architecture (high-level). Choosing an architecture will determine how to deal with performance, fault tolerance, scalability, and reliability. Software design is responsible for code level(low-level) such as, what each module is doing, class scope, methods purposes, and so on. 2) Why software design principles important? “Without good software design, programming is an art of adding bugs to an empty text file” -Louise Srygley I have seen a tr...

C++ Smart pointers

Image
What is smart pointer? In modern C++ programming, the Standard Library includes smart pointers, which are used to help ensure that programs are free of memory and resource leaks and are exception-safe. A smart pointer is a class template that you declare on the stack, and initialize by using a raw pointer that points to a heap-allocated object. After the smart pointer is initialized, it owns the raw pointer. This means that the smart pointer is responsible for deleting the memory that the raw pointer specifies. The smart pointer destructor contains the call to delete, and because the smart pointer is declared on the stack, its destructor is invoked when the smart pointer goes out of scope, even if an exception is thrown somewhere further up the stack. Access the encapsulated pointer by using the familiar pointer operators, -> and *, which the smart pointer class overloads to return the encapsulated raw pointer. The C++ smart pointer idiom resembles object creation in languages such ...

All about C++ standards

C++ is standardized by an ISO working group known as JTC1/SC22/WG21. So far, it has published six revisions of the C++ standard and is currently working on the next revision, C++23. In 1998, the ISO working group standardized C++ for the first time as ISO/IEC 14882:1998, which is informally known as C++98. In 2003, it published a new version of the C++ standard called ISO/IEC 14882:2003, which fixed problems identified in C++98. The next major revision of the standard was informally referred to as "C++0x", but it was not released until 2011. C++11 (14882:2011) included many additions to both the core language and the standard library. In 2014, C++14 (also known as C++1y) was released as a small extension to C++11, featuring mainly bug fixes and small improvements.[37] The Draft International Standard ballot procedures completed in mid-August 2014. After C++14, a major revision C++17, informally known as C++1z, was completed by the ISO C++ Committee in mid July 2017 and was ap...