Recent Posts

Recent ISO C++ News and Articles

There’s lots of ISO C++ news and content happening including the unanimous voting approval of ISO C++20, CppCon2020 (starts Monday September 13, 2020) with Bjarne Stroustrup’s opening keynote “The Power and Beauty of Primitive C++”, TIOBE’s Index for September 2020 headline “Programming Language C++ is doing very well”, C++ programming tips and tricks articles and more.

Links to recent ISO C++ news and articles

CppCon 2020 Opening Keynote – The Beauty and Power of “Primitive” C++ – this keynote is an exploration of a design space close to the hardware and of the use of C++ in that space, rather than a standards proposal or the presentation of a mature tool chain. And, no, by “primitive”, I don’t mean “old-fashioned, C-like” code; some of the general techniques are old, but some of the code requires C++17 and much could be done better given features we are unlikely to get even in C++23. Monday, September 14, 2020 8:45 to 10:00 MDT(Mountain Daylight Time).

TIOBE Index for September 2020 – Headline: “Programming Language C++ is doing very well” – Compared to last year, C++ is now the fastest growing language of the pack (+1.48%). I think that the new C++20 standard might be one of the main causes for this. Especially because of the new modules feature that is going to replace the dreadful include mechanism. C++ beats other languages with a positive trend such as R (+1.33%) and C# (+1.18%).

C++20 approved, C++23 meetings and schedule update by Herb Sutter – On Friday September 4, C++20’s DIS (Draft International Standard) ballot ended, and it passed unanimously. This means that C++20 has now received final technical approval and is done with ISO balloting, and we expect it to be formally published toward the end of 2020 after we finish a final round of ISO editorial work.

Concept archetypes by Andrzej Krzemieński – Concepts in the form added in C++20 used to be called lite. This is because they do not provide one quite important functionality: having the compiler check if the author of a constrained template is only using operations and types allowed by the constraining concept. In other words, we can say that our template only requires operations A and B to be valid, but we can still use some other operations inside and this is fine with the compiler. In this post we will show how this is problematic, even for programmers aware of the issue, and how to address it with concept archetypes.

6 Efficient Things You Can Do to Refactor a C++ Project by Bartlomiej Filipe (Bartek) – Bartek took his old pet project from 2006, experimented, refactored it and made it more “modern C++”. This article contains lessons learned and six practical steps that you can apply in your projects.

volatile and Other Small Improvements in C++20 by Rainer Grimm – This article completes Rainer’s tour through the C++20 core language features with a few small improvements. One interesting of these minor improvements is that most of volatile has been deprecated.

The implication of const or reference member variables in C++ by Lesley Lai – In the conventional wisdom of the C++ community, non-static const or reference data variables are considered problematic. There are solid reasons on why you should avoid const or reference member variables in C++. Nevertheless, like many things in C++, “avoid” does not mean “never use.” And they can occasionally still find some uses.

Using Vim for C++ Development by Adem Budak – Adem shares how he uses Vim as C++ development environment, adding things like code completion, linting, formatting and snippet support. If you come from the IDE land and have been set your options with the checkbox on a GUI, you might need a mental shift to use text based configuration tools, like Vim.

LLVM 10 bolsters Wasm, C/C++, and TensorFlow by Serdar Yegulalp – LLVM 10, an upgrade of the open source compiler framework behind a number of language runtimes and toolchains, is available today after a number of delays. The biggest addition to LLVM 10 is support for MLIR, a sublanguage that compiles to LLVM’s internal language and is used by projects like TensorFlow to efficiently represent how data and instructions are handled. Accelerating TensorFlow with LLVM directly is clumsy; MLIR provides more useful programming metaphors for such projects.

Two VCL Example Applications that Use C++Builder and the C++ Boost Libraries by David I – Boost is a set of open source C++ libraries that build on the ISO C++ programming language. In some cases, the Boost library functionality has become part of recent ISO C++ standards. RAD Studio allows you to install a subset of Boost that has been fully tested and preconfigured specifically for C++Builder. Use the GetIt Package Manager to install the Boost libraries for the Win32 classic C++ compiler, Win32 Clang-enhanced C++ compiler and Win64 Clang-enhanced compiler.

C++Builder’s Clang-enhanced ISO C++ compilers, Dinkumware Standard C++ Library and Boost Libraries in version 10.4.1 Sydney

C++ developers often ask about ISO C++ language support in releases of Embarcadero C++Builder. This post includes links and information about the C++ compilers, Dinkumware Standard C++ libraries and Boost libraries that are included in C++Builder 10.4 Sydney Release 1.

The latest release of C++Builder is 10.4 Sydney Release 1 (v10.4.1). Version 10.4.1 includes C++ tool chain and RTL improvements in the Win64 debugger, linker, exception handling and general quality. The DocWiki contains a list of feature enhancements and developer reported issues fixed in the IDE, VCL, FMX, and RTL. RAD Studio 10.4.1 also includes all fixes from 10.4 Patch 1, Patch 2, and Patch 3.

C++Builder Clang-Enhanced Compilers

C++Builder 10.4 Sydney Clang-enhanced compiler Clang and LLVN version information is as follows:

CompilerPlatformClang VersionLLVM Version
BCC32C32-bit Windows5.05.0
BCC32X32-bit Windows5.05.0
BCC6464-bit Windows5.05.0
BCCIOSARM32-bit iOS3.33.3
BCCIOSARM6464-bit iOS3.33.5
BCCAARMAndroid3.33.3

You can find Clang/LLVM ISO C++ Status information at  https://clang.llvm.org/cxx_status.html

  • Clang 3.3 and later implement all of the ISO C++ 2011 standard.
  • Clang 3.4 and later implement all of the ISO C++ 2014 standard.
  • Clang 5 and later implement all the features of the ISO C++ 2017 standard.

If you need your C++ application to test for Clang version use at compile time use the following code:

#if defined(__clang__)
  #if (__clang_major__ == 5 && __clang_minor__ == 0)
    #include <clang5.0\xmmintrin.h>
  #elif (__clang_major__ == 3 && __clang_minor__ == 3)
    #include <clang3.3\xmmintrin.h>
  #else
    #error "Unable to determine correct clang header version"
  #endif
#else
    #error "Only supported for clang compilers"
#endif

David Millington, Product Manager for C++Builder keeps the Embarcadero C++Builder information updated on the C++ Reference compiler support page. On this page you can look at the different ISO C++ language releases to see what many compilers support in their compiler releases.

Dinkumware Standard Library

The Dinkumware Standard C++ Library is the implementation of the C++ Standard Library that C++Builder uses for applications on the 32-bit Windows, 64-bit Windows and macOS target platforms.

The libraries include containers such as vectors, lists, sets, maps, and bitsets. Dinkumware also includes algorithms for common operations, such as sorting a container or searching inside a container.

Dinkumware version 8.03a is available specifically for C++ application development on target platforms that support the Clang enhanced compilers. Dinkumware version 5.01 is provided to support the classic C++ compiler.

Target PlatformCompilerC++ StandardDinkumware Version
32-bit WindowsBCC32C++98/035.01
BCC32CC++178.03a
BCC32XC++178.03a
64-bit WindowsBCC64C++178.03a
Note: C++Builder does not currently support the use of the Dinkumware Standard C++ Library on mobile platforms. On mobile platforms, the SDK’s standard library platform is used.

Boost Libraries

C++Builder supports different versions of the Boost libraries depending on the C++ compiler that you use to compile your application.

PlatformCompilerBoost Version
32-bit WindowsBCC321.39.0
BCC32C1.70.0
64-bit WindowsBCC641.70.0

To install the Boost libraries you need, use the IDE’s Tools | GetIt Package Manager menu and select one or more of the Boost packages.

See Also

C++ Reference

C++Builder Developer’s Guide

Dinkumware Standard C++ Library

Boost Libraries

Supported Target Platforms

C++Builder Product Page – Native Apps that Perform. Build Windows C++ Apps 10x Faster with Less Code

C++Builder Product Editions – C++Builder is available in four editions – Professional, Enterprise, Architect and Community (free). C++Builder is also available as part of the RAD Studio development suite.

Desktop First UX Summit – Sept 16th & 17th, 2020

The FREE Desktop First UX Summit is your chance to learn from the best UI and UX industry experts and practitioners and take your desktop applications to the next level.

Move beyond the Mobile-First design of just stretching a small UI to fill a desktop screen. Learn how to take the most advantage of the most powerful platform and make your users more productive.
Sponsored by Embarcadero’s RAD Studio 10.4 Sydney.

Here are the first two of many talks being given at the Desktop First UX Summit:

Register Now

View the Schedule

NoRuKo 2020 “Ruby3 and Beyond” Presentation by Yukihiro “Matz” Matsumoto

The father of the Ruby programming language, Yukihiro “Matz” Matsumoto, gave a presentation at the recent NoRuKo online virtual conference (Friday 21st of August, 2020).

The presentation (mostly) focused on the next major release of Ruby (version 3). Matz said that “Ruby is very old” (the first version of Ruby was released in 1995). Matz confirmed that the target release date is Christmas Day 2020 “unless something very, very bad happens”.

There are three specific design goals for the version 3 release: being fast, being concurrent, being correct. During the presentation he discussed three new features: an intricate pattern matching syntax, support for assigning values to a variable on the right hand side of the equals sign and numbered block parameters. Taking a page from Steve Jobs presentations, Matz presented “one more idea” for Ruby: a Ruby subset which is more strict and (hopefully) faster or easier to optimize.

Matz ended his presentation and Q&A session by saying that he hoped that Ruby can “help make the world better”.

I had the distinct pleasure to spend some time with Matz during the Borland/CodeGear Japan Developer Camp on June 5, 2007 at the Cerulean Tower Hotel in Tokyo. Shelby Sanders (software engineer who worked on the Turbo Ruby and 3rd Rail products) and I had a session titled “Talking with Matz, Ruby creator”. I also spent some time with Matz in a hotel meeting room where I demonstrated a few of the features of our Ruby products.

Matz’s closing “hope” remarks reminded me of attending the San Jose California OOPSLA 1996 keynote presentation, given by Christopher Alexander, “The Origins of Pattern Theory, The Future of the Theory, and The Generation of a Living World”. At the end of Chris’ keynote he stopped for a moment, thought for awhile and then said:

“Please forgive me, I’m going to be very direct and blunt for a horrible second. It could be thought that the technical way in which you currently look at programming is almost as if you were willing to be ‘guns for hire.’ In other words, you are the technicians. You know how to make the programs work. ‘Tell us what to do daddy, and we’ll do it.’ That is the worm in the apple.”

“What I am proposing here is something a little bit different from that. It is a view of programming as the natural genetic infrastructure of a living world which you/we are capable of creating, managing, making available, and which could then have the result that a living structure in our towns, houses, work places, cities, becomes an attainable thing. That would be remarkable. It would turn the world around, and make living structure the norm once again, throughout society, and make the world worth living in again.”

“This is an extraordinary vision of the future, in which computers play a fundamental role in making the world—and above all the built structure of the world—alive, humane, ecologically profound, and with a deep living structure. I realize that you may be surprised by my conclusion. This is not what I am, technically, supposed to have been talking about to you. Or you may say, Well, great idea, but we’re not interested. I hope that is not your reaction. I hope that all of you, as members of a great profession of the future, will decide to help me, and to help yourselves, by taking part in this enormous world-wide effort. I do think you are capable of it. And I do not think any other professional body has quite the ability, or the natural opportunity for influence, to do this job as it must be done.”

References

“Ruby3 and Beyond” NoRuKo 2020 presentation by Matz replay on YouTube

2021 Fukuoka Ruby Award Competition – Entries to be judged by Matz – The Government of Fukuoka, Japan together with “Matz” Matsumoto would like to invite you to enter the following Ruby competition.If you have developed an interesting Ruby program, please be encouraged to apply. 2021 Fukuoka Ruby Award Competition – Grand Prize – 1 Million Yen! Entry Deadline: December 4, 2020

Ruby Language home page

Books by Christopher Alexander:

The Timeless Way of Building

A Pattern Language: Towns, Buildings, Construction (Center for Environmental Structure Series)

Two VCL Example Applications that Use C++Builder and the C++ Boost Libraries

Boost is a set of open source C++ libraries that build on the ISO C++ programming language. In some cases, the Boost library functionality has become part of recent ISO C++ standards. RAD Studio allows you to install a subset of Boost that has been fully tested and preconfigured specifically for C++Builder. Use the GetIt Package Manager to install the Boost libraries for the Win32 classic C++ compiler, Win32 Clang-enhanced C++ compiler and Win64 Clang-enhanced compiler.

Boost libraries available in C++Builder’s GetItPackage Manager

boost::filesystem and std:filesystem VCL example

The ISO C++ std::filesystem evolved from the Boost filesystem library. The Filesystem library started in Boost, then became an ISO C++ Technical Specification and was finally merged into the ISO C++17 standard. The first example shows how to create a C++Builder VCL application using the Boost filesystem and the ISO C++ filesystem.

The VCL form contains two TButton, one TEdit and two TMemo components. The TEdit is used to set a path to files and directories on your hard drive. One button OnClick event handler will use the boost::filesystem functions to display the contents of the path. The other button OnCLick event handler will use the std::filesystem functions to display the contents of the same path. Why use both libraries? You may have an application and compiler than does not support the latest C++17 filesystem library standard. There are additional boost library versions available to support a wider range of platform filesystem operations.

VCL form for Boost and Std filesystem libraries application

C++Builder VCL application after using the boost and std filesystem library buttons

Filesystem VCL app mainunit.h:

//---------------------------------------------------------------------------

#ifndef MainUnitH
#define MainUnitH
//---------------------------------------------------------------------------
#include <System.Classes.hpp>
#include <Vcl.Controls.hpp>
#include <Vcl.StdCtrls.hpp>
#include <Vcl.Forms.hpp>
//---------------------------------------------------------------------------
class TForm1 : public TForm
{
__published:	// IDE-managed Components
	TButton *BoostButton;
	TEdit *Edit1;
	TMemo *Memo1;
	TButton *Cpp17Button;
	TMemo *Memo2;
	void __fastcall BoostButtonClick(TObject *Sender);
	void __fastcall Cpp17ButtonClick(TObject *Sender);
private:	// User declarations
public:		// User declarations
	__fastcall TForm1(TComponent* Owner);
};
//---------------------------------------------------------------------------
extern PACKAGE TForm1 *Form1;
//---------------------------------------------------------------------------
#endif

Filesystem VCL App MainUnit.cpp:

//---------------------------------------------------------------------------

#include <vcl.h>

/*
	https://en.cppreference.com/w/cpp/filesystem
	The filesystem library was originally developed as boost.filesystem,
	was published as the technical specification ISO/IEC TS 18822:2015,
	and finally merged to ISO C++ as of C++17.

	https://www.boost.org/doc/libs/1_70_0/libs/filesystem/doc/index.htm
*/

#include <boost/filesystem.hpp>
namespace Boostfs = boost::filesystem;

#include <filesystem>
namespace Cpp17fs = std::filesystem;

#pragma hdrstop

#include "MainUnit.h"
//---------------------------------------------------------------------------
#pragma package(smart_init)
#pragma resource "*.dfm"
TForm1 *Form1;

//---------------------------------------------------------------------------
__fastcall TForm1::TForm1(TComponent* Owner)
	: TForm(Owner)
{
}
//---------------------------------------------------------------------------
void __fastcall TForm1::BoostButtonClick(TObject *Sender)
{

	// Boost Filesystem verion

	Memo1->Lines->Clear();
	// use the Boost FileSystem to get directories and files using path in editbox
	Boostfs::path directoryPath = Edit1->Text.c_str();
	for (const auto& entry : Boostfs::directory_iterator(directoryPath)) {
		Boostfs::path p = entry.path();
		// test if the path is a file
		if (is_regular_file(p)) {
			int fsize = file_size(p);
			std::string s = p.string() + " : size = ";
			Memo1->Lines->Add(s.c_str() + IntToStr(fsize));
		}
		// test if the path is a directory
		else if (is_directory(p)) {      // is p a directory?
			std::string s = p.string() + " : directory";
			Memo1->Lines->Add(s.c_str());
		}
		// otherwise it is something else :)
		else {
			std::string s = p.string() + " not a file or directory";
			Memo1->Lines->Add(p.c_str());
		}
	}
}
//---------------------------------------------------------------------------
void __fastcall TForm1::Cpp17ButtonClick(TObject *Sender)
{
	// C++17 FileSystem version

	Memo2->Lines->Clear();
	// use C++17 std FileSystem library to get directories given a path in the editbox
	Cpp17fs::path directoryPath = Edit1->Text.c_str();
	for (const auto& entry : Cpp17fs::directory_iterator(directoryPath)) {
		Cpp17fs::path p = entry.path();
		if (Cpp17fs::is_directory(p)) {
			std::string s = p.string() + " : directory";
			Memo2->Lines->Add(s.c_str());
		}
		else if (Cpp17fs::is_regular_file(p)) {
			int fsize = Cpp17fs::file_size(p);
			std::string s = p.string() + " : size = ";
			Memo2->Lines->Add(s.c_str() + IntToStr(fsize));
		}
		else {
			std::string s = p.string() + " not a file or directory";
			Memo2->Lines->Add(p.c_str());
		}
	}
}
//---------------------------------------------------------------------------

boost::circular_buffer VCL example

The boost circular buffer (also known as a ring or cyclic buffer) library allows for the storing of data. The boost is designed to support fixed capacity storage. When the buffer is full, additional elements will overwrite existing elements at the front and back of the buffer (depending on the operations used).

The VCL form contains three TButton, one TSpinEdit and one TMemo components. One TButton OnClick event handler shows the contents of the circular buffer (originally populated by the Form’s OnShow event handler. The other two TButton OnClick event handlers use the boost circular buffer push_front and push_back public member functions.

Boost circular buffer C++Builder VCL form
C++Builder VCL form with Circular Buffer populated by OnShow event handler
Application showing contents of Circular Buffer after Add to front button is clicked
Application showing contents of Circular Buffer after Add to back button is clicked
Circular Buffer VCL app mainunit.h:

//---------------------------------------------------------------------------

#ifndef MainUnitH
#define MainUnitH
//---------------------------------------------------------------------------
#include <System.Classes.hpp>
#include <Vcl.Controls.hpp>
#include <Vcl.StdCtrls.hpp>
#include <Vcl.Forms.hpp>
#include <Vcl.Samples.Spin.hpp>
//---------------------------------------------------------------------------
class TForm1 : public TForm
{
__published:	// IDE-managed Components
	TButton *AddToCircularQueueFrontButton;
	TSpinEdit *SpinEdit1;
	TMemo *Memo1;
	TButton *ShowCircularBufferButton;
	TButton *AddToCircularQueueBackButton;
	void __fastcall FormShow(TObject *Sender);
	void __fastcall ShowCircularBufferButtonClick(TObject *Sender);
	void __fastcall AddToCircularQueueFrontButtonClick(TObject *Sender);
	void __fastcall AddToCircularQueueBackButtonClick(TObject *Sender);
private:	// User declarations
public:		// User declarations
	__fastcall TForm1(TComponent* Owner);
};
//---------------------------------------------------------------------------
extern PACKAGE TForm1 *Form1;
//---------------------------------------------------------------------------
#endif

Circular Buffer VCL app mainunit.cpp:

//---------------------------------------------------------------------------

#include <vcl.h>
#include <boost/circular_buffer.hpp>
#pragma hdrstop

#include "MainUnit.h"
//---------------------------------------------------------------------------
#pragma package(smart_init)
#pragma resource "*.dfm"
TForm1 *Form1;

// Create a circular buffer with a capacity for 3 integers.
boost::circular_buffer<int> cb(3);

//---------------------------------------------------------------------------
__fastcall TForm1::TForm1(TComponent* Owner)
	: TForm(Owner)
{
}
//---------------------------------------------------------------------------
void __fastcall TForm1::FormShow(TObject *Sender)
{
	// initialize circular buffer with 3 integers
	cb.push_back(1);
	cb.push_back(2);
	cb.push_back(3);
}
//---------------------------------------------------------------------------
void __fastcall TForm1::ShowCircularBufferButtonClick(TObject *Sender)
{
	int circularbuffersize = cb.size();
	Memo1->Lines->Clear();
	Memo1->Lines->Add("Circular Buffer Size = "+IntToStr(circularbuffersize));
	Memo1->Lines->Add("Items:");
	// display items in the circular buffer
	for (int i : cb)
		Memo1->Lines->Add("  "+IntToStr(i));
}
//---------------------------------------------------------------------------

void __fastcall TForm1::AddToCircularQueueFrontButtonClick(TObject *Sender)
{
	cb.push_front(SpinEdit1->Value);
}
//---------------------------------------------------------------------------

void __fastcall TForm1::AddToCircularQueueBackButtonClick(TObject *Sender)
{
	cb.push_back(SpinEdit1->Value);
}
//---------------------------------------------------------------------------

References

Boost C++Builder DocWiki

Boost C++ Libraries home page

Boost version 1.70

Converting from Boost to std::filesystem by Scott Furry as a guest post on Bartlomiej Filipek (Bartek) blog.

boost::filesystem library documentation

C++ std::filesystem documentation

boost::circular_buffer documentation

boost and std filesystem VCL app source code project (zip file)

boost circular buffer VCL app source code project (zip file)

C++Builder Product Information

C++Builder Product Page – Native Apps that Perform. Build Windows C++ Apps 10x Faster with Less Code
C++Builder Product Editions – C++Builder is available in four editions – Professional, Enterprise, Architect and Community (free). C++Builder is also available as part of the RAD Studio development suite.

6 Efficient Things You Can Do to Refactor a C++ Project by Bartlomiej Filipek (Bartek)

Bartek posted an article today as part of a series of his work modernizing/refactoring a legacy C++ project. His series of articles takes an old C++ application and brings it up-to-date.

In the article, Bartek covers the following techniques:

  1. Having the latest Compiler and correct C++ Standard version
  2. Fix Deprecated or Removed C++ Features
  3. Unit Tests
  4. Decouple or Extract Classes
  5. Extract Non-member Functions
  6. Reduce the Global State

Read the article on Bartek’s Blog

Note: portions of this article text and images are © Bartlomiej Filipek, 2020.

About Bartek

https://www.bfilipek.com/p/about.html

Bartlomiej Filipek (Bartek) is a software developer in Krakow Poland. He works at Xara as a C++ developer. Bartek is a Microsoft MVP and author of two C++ books:

C++17 in Detail: Learn the Exciting Features of The New C++ Standard! (paperback version available on Amazon)

C++ Lambda Story: Everything you need to know about Lambda Expressions in Modern C++! (Kindle version available on Amazon)

Twitter: @fenbf
LinkedIn: https://www.linkedin.com/in/bartlomiejfilipek/ 
Blog: https://www.bfilipek.com/
Email: bartlomiej DOT filipek AT gmail DOT com

 

Building a C++Builder RSS Feeds VCL Application with XMLDocument, NetHTTPClient, NetHTTPRequest and WebBrowser Components

I have many favorite prebuilt components that are included with C++Builder 10.4 Sydney. In this blog post I’ll show you how to create an RSS Feeds VCL (you can also use the same approach for a FireMonkey FMX) application using the XMLDocument, NetHTTPClient, NetHTTPRequest and WebBrowser components.

Start by creating a C++Builder VCL application. Set the form’s WindowState property to wsMaximized. Add a Panel, Button, ListBox (used to hold the list of RSS feed URLs to process) and a few labels and align them to the top of the form. Add Memo (to display the Feed XML), ListBox (to contain the title and URL for each article found in the feeds) and WebBrowser (to display the web page when you click on an item in the articles list box) components to the rest of the form.

Main Form
The RSS Feed application’s main form.

To populate the Panel’s listbox, I use a text file, “FeedsList.txt”, which contains a number of RSS feed URLs. The panel listbox is populated in the Form’s OnShow event handler.

Clicking on the button will process all of the RSS feed URLs and add each article and URL item found into the list box of articles found.

The XMLDocument component has a DOMVendor property to select the DOM implementation to use for parsing and manipulating the XML document.

DOMVendor choices

Clicking on an item in the articles list box uses the OnClick event handler to call the WebBrowser Navigate method  for the selected article URL. In C++Builder 10.4 Sydney there is a new property added to the WebBrowser component that lets you choose which browser engine will be used on Windows. I’ve chosen the EdgeIfAvailable engine.

SelectedEngine

Here is the contents of the FeedsList.txt file:

https://isocpp.org/blog/rss
https://herbsutter.com/feed/
http://feeds.hanselman.com/scotthanselman
http://feeds.dzone.com/home
https://news.ycombinator.com/rss
http://www.odbms.org/feed/
https://www.techmeme.com/feed.xml
https://techcrunch.com/feed/
http://feeds.feedburner.com/oreilly/radar/atom
http://feeds.feedburner.com/appdevelopermagazine
https://www.infoworld.com/index.rss
https://newsroom.ibm.com/announcements?pagetemplate=rss
https://www.computerworld.com/index.rss
https://techxplore.com/rss-feed/
https://sdtimes.com/feed/
https://www.geeksforgeeks.org/feed/
https://feeds.feedburner.com/venturebeat/SZYF
http://feeds.feedburner.com/ProgrammableWeb

Here is a bitmap of the running application:

Finally here is the source code for the application:

//---------------------------------------------------------------------------

#include <vcl.h>
#include <fstream>
#pragma hdrstop

#include "MainFeedUnit.h"
//---------------------------------------------------------------------------
#pragma package(smart_init)
#pragma resource "*.dfm"
TForm2 *Form2;
//---------------------------------------------------------------------------
__fastcall TForm2::TForm2(TComponent* Owner)
	: TForm(Owner)
{
}
//---------------------------------------------------------------------------
void __fastcall TForm2::ArticlesFoundListBoxClick(TObject *Sender)
{
	// for the ListBox item clicked - get the URL and Browse to the article
	LabelStatus->Caption = ArticlesFoundListBox->Items->Names[ArticlesFoundListBox->ItemIndex];
	ArticleWebBrowser->Navigate(ArticlesFoundListBox->Items->Values[ArticlesFoundListBox->Items->Names[ArticlesFoundListBox->ItemIndex]]);
}
//---------------------------------------------------------------------------
void __fastcall TForm2::Button1Click(TObject *Sender)
{
	// Find and save Title and URL for items found
	std::ofstream fs (AnsiString(FormatDateTime("yyyy-mm-dd-hhnnss",Now())+"_RSSFound.txt").c_str());
	fs << AnsiString("RSS Feed for: "+ NetHTTPRequest1->URL).c_str() << std::endl;
	fs << AnsiString(FormatDateTime("dddd mmmm dd, yyyy @ hh:nn:ss",Now())).c_str() << std::endl;
	fs << std::endl;

	// Clear the Articles Found List Box to prepare for the title and URL of articles
	ArticlesFoundListBox->Clear();
	FeedsItemsCountLabel->Caption = "Items Found = 0";

	// get all articles and URLs in all feeds
	for (int i = 0; i < FeedsListBox->Count; i++) {
		// Get the RSS feed URL string from the ListBox
		NetHTTPRequest1->URL = FeedsListBox->Items->Strings[i];

		UrlLabel->Caption = "Feed URL: "+NetHTTPRequest1->URL;
        UrlLabel->Update();

		// Use NetHTTPRequest Execute method to get the RSS Feed XML
		UnicodeString FeedString = NetHTTPRequest1->Execute()->ContentAsString();

		// copy the XML string to the Memo
		MemoFeedXML->Lines->Clear();
		MemoFeedXML->Lines->Text = FeedString;
		MemoFeedXML->Update();

		// load the RSS Feed XML into the XMLDocument
		XMLDocument1->LoadFromXML(FeedString);
		XMLDocument1->Active = True;

		LabelStatus->Caption = "Processing RSS for "+NetHTTPRequest1->URL;
		LabelStatus->Update();

		// find the RSS feed channel node
		_di_IXMLNode ChannelNode = XMLDocument1->DocumentElement->ChildNodes->FindNode ("channel");
		// test to make sure the ChannelNote is found
		if (ChannelNode != NULL) {
			for (int I=0;I<ChannelNode->ChildNodes->Count;I++) {
				// iterate through child nodes
				_di_IXMLNode ItemNode = ChannelNode->ChildNodes->Get(I);
				// if child node is an item then get the title, pubDate and URL
				if (ItemNode->NodeName == "item") {
					LabelStatus->Caption = "Processing Node " + IntToStr(I);
					LabelStatus->Update();
					UnicodeString title = ItemNode->ChildValues ["title"];
					UnicodeString pubDate = ItemNode->ChildValues ["pubDate"];
					// author := ItemNode.ChildValues ['author'];    // could be nil
					UnicodeString url = ItemNode->ChildValues ["link"];

					// populate the articles found ListBox with the pair of title and URL
					ArticlesFoundListBox->Items->AddPair(title,url);
					ArticlesFoundListBox->Update();
					FeedsItemsCountLabel->Caption = "Items Found = "+IntToStr(ArticlesFoundListBox->Count);
					FeedsItemsCountLabel->Update();

					// write the Title, pubDate and URL to the text file
					fs << AnsiString(title).c_str() << std::endl;
					fs << AnsiString(pubDate).c_str() << std::endl;
					fs << AnsiString(url).c_str() << std::endl;
					fs << std::endl;
				}
			}
		}

	}

	fs << std::endl;
	fs << AnsiString("Items Found = "+IntToStr(ArticlesFoundListBox->Count)).c_str() << std::endl;
	fs << "end of file" << std::endl;
	fs.close();   // close the text file
	LabelStatus->Caption = "RSS Processing Done!";
    UrlLabel->Caption = "";
}
//---------------------------------------------------------------------------
void __fastcall TForm2::FormShow(TObject *Sender)
{
	// load RSS Feeds ListBox with the "FeedsList.txt" text file
    // I put the text file in the same folder as the app .EXE file
	FeedsListBox->Items->Clear();
	FeedsListBox->Items->LoadFromFile("FeedsList.txt");
	LabelStatus->Caption = "RSS Feed Urls Loaded = "+IntToStr(FeedsListBox->Count);
	LabelStatus->Update();

}
//---------------------------------------------------------------------------

References

Using TXMLDocument

Using the Document Object Model

Using an HTTP Client

System.Net.HttpClientComponent.TNetHTTPClient

System.Net.HttpClientComponent.TNetHTTPRequest

Using TEdgeBrowser Component and Changes to the TWebBrowser Component

RSS 2.0 Specification

Download Source Code ZipFile for RSSFeedListsUsingTextFileVCLCpp

C++Builder Product Information

C++Builder Product Page – Native Apps that Perform. Build Windows C++ Apps 10x Faster with Less Code
C++Builder Product Editions – C++Builder is available in four editions – Professional, Enterprise, Architect and Community (free). C++Builder is also available as part of the RAD Studio development suite.

Technology News Worth Reading

Here are a few technology news stories that I’ve read in the past week or so.

News Headlines

Code Partners Acquires SmartInspect from Idera/Gurock

SmartInspect is an advanced .NET logging, Java logging, and Delphi logging tool for debugging and monitoring software applications. It helps customers identify bugs, find solutions to user-reported issues, and gives a precise picture of how software performs in different environments. Read the article by Code Partners. Read the official announcement by Idera/Gurock.

Bill Gates says tech companies ‘deserve rude, unfair, tough questions’

Bill Gates believes tech firms “deserve” the kind of scrutiny they got during Congressional hearings last month. “If you’re as successful as I am or any of those people are, you deserve rude, unfair, tough questions,” the Microsoft founder told host Dax Shepard. “The government deserves to have shots at you,” Gates said. “That type of grilling comes with the super successful territory. It’s fine.” Read the Verge Article.

Scientists use artificial intelligence in new way to strengthen power grid resiliency

At the U.S. Department of Energy’s (DOE) Argonne National Laboratory a research team has developed a novel approach to help system operators understand how to better control power systems with the help of artificial intelligence. Their new approach could help operators control power systems in a more effective way, which could enhance the resilience of America’s power grid, according to a recent article in IEEE Transactions on Power Systems. Read the TechXplore Article.

FBI, CISA Echo Warnings on ‘Vishing’ Threat

“The COVID-19 pandemic has resulted in a mass shift to working from home, resulting in increased use of corporate virtual private networks (VPNs) and elimination of in-person verification,” the alert reads. “In mid-July 2020, cybercriminals started a vishing campaign—gaining access to employee tools at multiple companies with indiscriminate targeting — with the end goal of monetizing the access.” Read the Krebs on Security Article.

How Shopify Reduced Storefront Response Times with a Rewrite

In January 2019, Shopify set out to rewrite the critical software that powers all online storefronts on Shopify’s platform to offer the fastest online shopping experience possible, entirely from scratch and without downtime. Read the Shopify Engineering Blog Article.

Blockchain pet adoptions

Blockchain technology is not limited to cryptocurrencies. There are many other applications that might benefit from such as secure information system. Writing in the International Journal of Blockchains and Cryptocurrencies, a team from India explain how a blockchain might be used in pet adoption. Read the TechXplore Article.

Open source has a people problem

Open source sustainability is really a people problem. Or, as Langel highlights, “In open source, the maintainers working on the source code are the scarce resource that needs to be protected and nurtured.” Read the InfoWorld Article.

Fortnite battle escalates: Apple to terminate developer program membership, Epic files injunction

Epic attempted to lure users to use the new payment system by offering discounts of up to 20% on virtual purchases including the in-game currency V-Bucks on both iOS and Android. Both Google and Apple demand a 30% cut, and once the bypass was introduced, Fornite was removed from both Google Play and Apple’s App Store. Lawsuits have been launched against both tech giants. Epic deems the commission rate as “oppressive” and despite trying to use the massive Fortnite customer base as leverage — alongside some rather intense public mockery — the row now has the potential to severely impact iOS developers. Read the ZDNet Article.

How to disagree with your boss without losing your cool… or job

It doesn’t have to be this way though. You can totally express your opinion to your boss or manager without losing your cool. This post contains some of the scenarios where speaking up would be justified. Read the TNW Article.

Engineers set new world record internet speed

Working with two companies, Xtera and KDDI Research, the research team led by Dr. Lidia Galdino (UCL Electronic & Electrical Engineering), achieved a data transmission rate of 178 terabits a second (178,000,000 megabits a second) – a speed at which it would be possible to download the entire Netflix library in less than a second. Read the TechXplore Article.

Roberto V. Zicari interviews Bjarne Stroustrup, the inventor of C++ programming language

Roberto V. Zicari interviewed Bjarne Stroustrup, the inventor of C++ programming language, back in 2007. Roberto again interviews Bjarne 13 years later.

In the interview, Bjarne talks about notable computer scientists that influenced his career and work. Bjarne also talks about why he designed the C++ language and why he started with the C language. Bjarne also talks about three guiding principles for the design of the C++ language: “Make the language simpler! Add these two essential features now!! Don’t break (any of) my code!!!”

Read the interview on the Roberto’s ODBMS.ORG site.

My Conversations with Bjarne Stroustrup

I’ve also had two opportunities to talk live online with Bjarne about the C++ language during past Embarcadero CodeRage online conferences:

A Conversation with the C++ language designer, Bjarne Stroustrup
Monday, December 10, 2012
C++ Language Conversation with Bjarne Stroustrup and David Intersimone
Tuesday, December 4, 2018

About ODBMS.ORG

ODBMS.ORG is designed to meet the fast-growing need for resources focusing on AI, Big Data, Data Science, Analytical Data Platforms, Scalable Cloud platforms, NewSQL databases, NoSQL datastores, In-Memory Databases, and new approaches to concurrency control.

About Roberto Zicari

Roberto is Full Professor of Database and Information Systems at Frankfurt University. He was for over 15 years the representative of the OMG in Europe. Previously, Roberto served as associate professor at Politecnico di Milano, Italy; Visiting scientist at IBM Almaden Research Center, USA, the University of California at Berkeley, USA; Visiting professor at EPFL in Lausanne, Switzerland, the National University of Mexico City, Mexico and the Copenhagen Business School, Danemark.

About Bjarne Stroustrup

Bjarne is a Technical Fellow and a Managing Director in the technology division of Morgan Stanley in New York City and a Visiting Professor in Computer Science at Columbia University. Bjarne designed and implemented the C++ programming language. To make C++ a stable and up-to-date base for real-world software development, Bjarne says “I have stuck with its ISO standards effort for almost 30 years (so far).”

Bjarne Stroustrup’s homepage

Using C++Builder to list all available VCL styles in a ComboBox and apply a selected style using the ComboBoxChange event

Back in June a developer asked a C++Builder question on StackOverflow. The question was “How can I list all the available VCL styles in a combo box and in the ComboBoxChange event, apply that style in C++ Builder?” I answered the question and gave the example code.

One of my favorite RTL features for the VCL and FMX frameworks is the ability to customize the look and feel of your applications using Styles. The first step is to create a C++Builder VCL project and select a few of the VCL Styles in the Project | Options | Application | Appearance settings. The C++Builder 10.4 Sydney DocWiki explains that “the VCL Styles architecture has been significantly extended to support High-DPI graphics and 4K monitors. In 10.4 Sydney all graphical elements are automatically scaled for the proper resolution of the monitor the element is displayed on. This means that the scaling depends on the DPI resolution of the target computer or the current monitor, in case of multi-monitor systems.”

The C++ Application User Interface

For the application user interface I have a TButton (has code to populate the ComboBox with selected application styles) and a TComboBox (to display and allow selection of a style).

The C++ code

//---------------------------------------------------------------------------

#include <vcl.h>
#pragma hdrstop

#include "Unit1.h"
#include <Vcl.Themes.hpp>
//---------------------------------------------------------------------------
#pragma package(smart_init)
#pragma resource "*.dfm"
TForm1 *Form1;
//---------------------------------------------------------------------------
__fastcall TForm1::TForm1(TComponent* Owner)
	: TForm(Owner)
{
}
//---------------------------------------------------------------------------
void __fastcall TForm1::Button1Click(TObject *Sender)
{
	// populate the ComboBox with VCL styles that are selected
	//    in Project | Options | Application | Appearance
	ComboBox1->Items->BeginUpdate();
    try
    {
		ComboBox1->Items->Clear();

		DynamicArray<String> styleNames = Vcl::Themes::TStyleManager::StyleNames;

        for(int i = 0; i < styleNames.Length; ++i)
        {
            String styleName = styleNames[i];
			ComboBox1->Items->Add(styleName);
        }
    }
    __finally
    {
		ComboBox1->Items->EndUpdate();
	}
}
//---------------------------------------------------------------------------
void __fastcall TForm1::ComboBox1Change(TObject *Sender)
{
	// set the style for the selected combobox item

	Vcl::Themes::TStyleManager::TrySetStyle(ComboBox1->Items->Strings[ComboBox1->ItemIndex],false);
}
//---------------------------------------------------------------------------

The Application in Action

TComboBox populated with VCL styles selected
Application Style Changed by TComboBox selection

References

VCL Styles Overview

Project Options Application Appearance

VCL Styles Support for High-DPI Graphics

C++Builder Product Information

C++Builder Product Page – Native Apps that Perform. Build Windows C++ Apps 10x Faster with Less Code
C++Builder Product Editions – C++Builder is available in four editions – Professional, Enterprise, Architect and Community (free). C++Builder is also available as part of the RAD Studio development suite.

Multithreaded Sorting with C++Builder and the Parallel Programming Library (PPL)

The Parallel Programming Library (PPL) is one of my favorite features in C++Builder runtime library. PPL allows developers to create tasks that run in parallel to take advantage of multi-core processors.

Using the PPL, you can: 1) speed up loops with a Parallel For, 2) run multiple tasks in parallel using TTask, and 3) use Future Objects to allow a process run with your program focused on other work until the future value is set.

To showcase the TTask feature of the PPL, I’ve created a C++Builder VCL application (build and tested using the C++Builder 10.4 Sydney release) that runs three sort algorithms in separate tasks – Bubble Sort, Shell Sort and the ISO C++ standard Sort (which implements the Quicksort algorithm).

The User Interface

The VCL user interface for my application includes a TButton, two TMemos, and four TLabels. The TButton onClick event handler creates a vector of integers, creates three TTasks (for the sort algorithms) and waits for the sort tasks to complete using the TTask::WaitForAll method.

The Code

MainUnit.h:

#ifndef MainUnitH
#define MainUnitH
//---------------------------------------------------------------------------
#include <System.Classes.hpp>
#include <Vcl.Controls.hpp>
#include <Vcl.StdCtrls.hpp>
#include <Vcl.Forms.hpp>
#include <Vcl.ExtCtrls.hpp>
//---------------------------------------------------------------------------
class TForm1 : public TForm
{
__published:	// IDE-managed Components
	TButton *Button1;
	TLabel *SortingStatusLabel;
	TLabel *BubbleSortLabel;
	TMemo *Data_Memo;
	TMemo *SortResult_Memo;
	TLabel *ShellSortLabel;
	TLabel *STDSortLabel;
	void __fastcall Button1Click(TObject *Sender);
private:	// User declarations
public:		// User declarations
	__fastcall TForm1(TComponent* Owner);
};
//---------------------------------------------------------------------------
extern PACKAGE TForm1 *Form1;
//---------------------------------------------------------------------------
#endif

MainUnit.cpp:

//---------------------------------------------------------------------------

#include <vcl.h>
#include <System.Threading.hpp>
#include <vector>
#include <algorithm>
#pragma hdrstop

#include "MainUnit.h"
//---------------------------------------------------------------------------
#pragma package(smart_init)
#pragma resource "*.dfm"
TForm1 *Form1;
//---------------------------------------------------------------------------
__fastcall TForm1::TForm1(TComponent* Owner)
	: TForm(Owner)
{
}
//---------------------------------------------------------------------------
void __fastcall TForm1::Button1Click(TObject *Sender)
{

	_di_ITask My_Tasks[3];
	const int max_data = 15000;   // number of random numbers to create

	int LoopValue = 0;

	Button1->Enabled = false;
	Button1->Update();
	BubbleSortLabel->Caption = "Bubble Sort";
	BubbleSortLabel->Update();
	ShellSortLabel->Caption = "Shell Sort";
	ShellSortLabel->Update();
	STDSortLabel->Caption = "std::sort";
	STDSortLabel->Update();

	SortingStatusLabel->Caption = "Sorting "+IntToStr(max_data)+" integers!";
	SortingStatusLabel->Update();

	// Windows GetTicks() start and stop for each sort method
	int StartBubble,StopBubble;
	int StartShell,StopShell;
	int StartSTD,StopSTD;

	Data_Memo->Lines->Clear();
	SortResult_Memo->Lines->Clear();

	// create a vector of data that all sort algorithms will use
	std::vector<int> my_data;

	// populate the vector with integers
	for (int i = 1; i <= max_data; i++) {
		int random_value = Random(max_data);
		my_data.push_back(random_value);
		// Data_Memo->Lines->Add(IntToStr(random_value));
	}

	// copy data vector to sort vectors
	std::vector<int> bubble_data = my_data;
	std::vector<int> shell_data = my_data;
	std::vector<int> std_data = my_data;

	// First Task - Bubble Sort
	My_Tasks[0] = TTask::Create([&](){
		// Set Bubble Sort Windows GetTickCount()
		StartBubble = GetTickCount();
		// body of Bubble Sort
		bool swapp = true;
		while(swapp){
			swapp = false;
			for (size_t i = 0; i < bubble_data.size()-1; i++) {
				if (bubble_data[i]>bubble_data[i+1] ){
					bubble_data[i] += bubble_data[i+1];
					bubble_data[i+1] = bubble_data[i] - bubble_data[i+1];
					bubble_data[i] -=bubble_data[i+1];
					swapp = true;
				}
			}
		}
		// Set the Bubble Sort Stop GetTicks()
		StopBubble = GetTickCount();
	});
	// Start the Bubble Sort Task
	My_Tasks[0]->Start();


	// Second Task - Shell Sort
	My_Tasks[1] = TTask::Create([&](){
		// Set Shell Sort Windows GetTickCount()
		StartShell = GetTickCount();
		// body of the Shell Sort
		for (int gapSize = shell_data.size() / 2; gapSize > 0; gapSize /= 2) {
			for (int currentIndex = gapSize; currentIndex < shell_data.size(); currentIndex++) {
				// save the currentIndex
				int currentIndexCopy = currentIndex;
				// save the value of the currentIndex
				int item = shell_data[currentIndex];
				while (currentIndexCopy >= gapSize && shell_data[currentIndexCopy - gapSize] > item) {
					shell_data[currentIndexCopy] = shell_data[currentIndexCopy - gapSize];
					currentIndexCopy -= gapSize;
				}
				shell_data[currentIndexCopy] = item;
			}
		}
		// Set the Shell Sort Stop GetTicks()
		StopShell = GetTickCount();
	});
	// Start the Shell Sort
	My_Tasks[1]->Start();


	// Third Task - std::sort
	My_Tasks[2] = TTask::Create([&](){
		// Set std::sort Windows GetTickCount()
		StartSTD = GetTickCount();
		// Body of the std::sort
		std::sort(std_data.begin(),std_data.end());
		// Set the std::sort Stop GetTicks()
		StopSTD = GetTickCount();
	});
	// Start the Shell Sort
	My_Tasks[2]->Start();

	// wait until all of the sorting tasks complete
	TTask::WaitForAll(My_Tasks, sizeof(My_Tasks)/sizeof(My_Tasks[0])-1);

	SortingStatusLabel->Caption = "Sorting All done!";

	BubbleSortLabel->Caption = "Bubble Sort Time: "
		+ IntToStr(StopBubble - StartBubble)
		+ " ms";
	BubbleSortLabel->Update();

	ShellSortLabel->Caption = "Shell Sort Time: "
		+ IntToStr(StopShell - StartShell)
		+ " ms";
	ShellSortLabel->Update();

	STDSortLabel->Caption = "std::sort: "
		+ IntToStr(StopSTD - StartSTD)
		+ " ms";
	STDSortLabel->Update();

	// if you want to see the sort results un-comment
	// one of the for loops and the sort result memo statement
	// for(int n : std_data) {
	// for(int n : bubble_data) {
	// for(int n : shell_data) {
		// SortResult_Memo->Lines->Add(IntToStr(n));
	// }

	// clear the vectors
	my_data.clear();
	bubble_data.clear();
	shell_data.clear();
	std_data.clear();

	Button1->Enabled = true;
}
//---------------------------------------------------------------------------

The form after sorting 15,000 integers

References

PPL – Parallel Programming Library – http://docwiki.embarcadero.com/RADStudio/Sydney/en/Using_the_Parallel_Programming_Library

Using TTask – http://docwiki.embarcadero.com/RADStudio/Sydney/en/Using_TTask_from_the_Parallel_Programming_Library

Using TParallel::For – http://docwiki.embarcadero.com/RADStudio/Sydney/en/Using_TParallel.For_from_the_Parallel_Programming_Library

Using TTask::IFuture – http://docwiki.embarcadero.com/RADStudio/Sydney/en/Using_TTask.IFuture_from_the_Parallel_Programming_Library

Algorithms Library – https://en.cppreference.com/w/cpp/algorithm

std::sort – https://en.cppreference.com/w/cpp/algorithm/sort

C++Builder Product Information

C++Builder Product Page – Native Apps that Perform. Build Windows C++ Apps 10x Faster with Less Code
C++Builder Product Editions – C++Builder is available in four editions – Professional, Enterprise, Architect and Community (free). C++Builder is also available as part of the RAD Studio development suite.