std::thread
std::mutex
std::condition_variable
modernescpp, Rainer Grimm
RIP Tutorial
Medium
Daily bit(e) of C++ | std::condition_variable
std::thread
std::mutex
std::condition_variable
Daily bit(e) of C++ | std::condition_variable
Const Correctness / C vs. C++ Differences
error: passing xxx as ‘this’ argument of xxx discards qualifiers
you’re calling a non-const member function on const object which is not allowed because non-const member functions make NO PROMISE not to modify the object
What is the meaning of ‘const’ at the end of a member function declaration?
declaring a const instance of a class
error: passing xxx as 'this' argument of xxx discards qualifiers error: passing ‘const Foo’ as ‘this’ argument of ‘void Foo::bar()’ discards qualifiers [-fpermissive]
class Foo {
public:
Foo() {};
virtual ~Foo() {};
// must be const:
// void bar() const {};
void bar() {};
};
int
main(int argc, char *argv[])
{
const Foo foo;
foo.bar();
return 0;
}
C++ Performance Timer, uses the C++20 language standard
Date and time utilities
std::chrono::duration
std::formatter
std::put_time
std::chrono::duration
C++ Cross-Platform High-Resolution Timer
chrono_literals is not a namespace-name
How to get duration, as int milli’s and float seconds from
Outputting Date and Time in C++ using std::chrono
Print current system time in nanoseconds using c++ chrono
How to convert std::chrono::time_point to string
Print current system time in nanoseconds using c++ chrono
what is gettimeofday() equivalent in c++11
struct timeval now; // seconds and nanoseconds gettimeofday(&now, NULL); const std::tm *localTime = std::localtime((time_t *) &now.tv_sec); // only in seconds //std::time_t now = std::time(nullptr); //const std::tm *localTime = std::localtime(&now); // GCC < 5.0 char dateTime[] = "00.00.00 00:00:00."; char millis [] = "000"; strftime(dateTime, sizeof(dateTime), "%d.%m.%y %H:%M:%S.", localTime); snprintf(millis, sizeof(millis), "%03li", now.tv_usec/1000 ); cout << dateTime << millis << " | ";
$ gdb build/bin/PerfTest GNU gdb (GDB) Red Hat Enterprise Linux 7.6.1-120.el7 Copyright (C) 2013 Free Software Foundation, Inc. License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html> This is free software: you are free to change and redistribute it. There is NO WARRANTY, to the extent permitted by law. Type "show copying" and "show warranty" for details. This GDB was configured as "x86_64-redhat-linux-gnu". For bug reporting instructions, please see: <http://www.gnu.org/software/gdb/bugs/>... Reading symbols from /app/dev/andreas/build/bin/PerfTest...done. (gdb) r Starting program: /app/dev/andreas/build/bin/PerfTest [Thread debugging using libthread_db enabled] Using host libthread_db library "/lib64/libthread_db.so.1". Program received signal SIGSEGV, Segmentation fault. 0x00007ffff6b316a3 in std::basic_ostream<char, std::char_traits<char> >& std::operator<< <char, std::char_traits<char>, std::allocator<char> >(std::basic_ostream<char, std::char_traits<char> >&, std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&) () from /lib64/libstdc++.so.6 Missing separate debuginfos, use: debuginfo-install glibc-2.17-326.el7_9.x86_64 libgcc-4.8.5-44.el7.x86_64 libstdc++-4.8.5-44.el7.x86_64 (gdb) bt #0 0x00007ffff6b316a3 in std::basic_ostream<char, std::char_traits<char> >& std::operator<< <char, std::char_traits<char>, std::allocator<char> >(std::basic_ostream<char, std::char_traits<char> >&, std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&) () from /lib64/libstdc++.so.6 #1 0x0000000000401751 in app (trx=0x7fffffffe260) at /app/dev/andreas/PerfTest/main.cpp:47 #2 0x00000000004018d1 in main (argc=1, argv=0x7fffffffe398) at /app/dev/andreas/PerfTest/main.cpp:104
Fun with printing tables with std::format and C++20
Const collection of unique_ptr, options and design choices
C++ Map Explained with Examples
Map in C++ Standard Template Library (STL)
How to use range-based for() loop with std::map?
std::map::at
How to find if a given key exists in a C++ std::map
C++: std::map throws an out_of_range exception
//
for (const auto& [key, value]: myMap) {
std::cout << key << " has value " << value << std::endl;
}
Structured binding declaration
A brief introduction to C++ structured binding
Structured binding in C++
for (const auto& kv : myMap) {
std::cout << kv.first << " has value " << kv.second << std::endl;
}
Range-based for loop
Range-based for loop in C++
Range-based for Statement (C++)
/*************************************************************************************
* sqlplus: no TNS_ADMIN => error
*/
$ ${ORACLE_HOME}/bin/sqlplus -L <user>@<servicename>
SQL*Plus: Release 19.0.0.0.0 - Production on Mon Jul 10 19:08:27 2023
Version 19.13.0.0.0
Copyright (c) 1982, 2021, Oracle. All rights reserved.
ERROR:
ORA-12154: TNS:could not resolve the connect identifier specified
SP2-0751: Unable to connect to Oracle. Exiting SQL*Plus
/*************************************************************************************
* sqlplus: with TNS_ADMIN, TCPS using sqlnet.ora/wallet => error, wallet not accessible (permission denied)
*/
$ TNS_ADMIN=/app/tns ${ORACLE_HOME}/bin/sqlplus -L <user>@<servicename>
SQL*Plus: Release 19.0.0.0.0 - Production on Mon Jul 10 19:08:56 2023
Version 19.13.0.0.0
Copyright (c) 1982, 2021, Oracle. All rights reserved.
ERROR:
ORA-28759: failure to open file
SP2-0751: Unable to connect to Oracle. Exiting SQL*Plus
/*************************************************************************************
* tnsping: with TNS_ADMIN, TCPS using sqlnet.ora/wallet => error, wallet not accessible (permission denied)
*/
$ TNS_ADMIN=/app/tns ${ORACLE_HOME}/bin/tnsping <servicename>
TNS Ping Utility for Linux: Version 19.0.0.0.0 - Production on 11-JUL-2023 08:18:34
Copyright (c) 1997, 2021, Oracle. All rights reserved.
Used parameter files:
/app/tns/sqlnet.ora
Used TNSNAMES adapter to resolve the alias
Attempting to contact (DESCRIPTION_LIST= (LOAD_BALANCE=off) (FAILOVER=off) (DESCRIPTION= (CONNECT_TIMEOUT=5) (TRANSPORT_CONNECT_TIMEOUT=3) (RETRY_COUNT=3) (ADDRESS_LIST= (LOAD_BALANCE=on) (ADDRESS= (PROTOCOL=TCPS) (HOST=<hostname>) (PORT=1522))) (CONNECT_DATA= (SERVICE_NAME=<servicename>))))
TNS-12560: TNS:protocol adapter error
/*************************************************************************************
* tnsping: with TNS_ADMIN, TCP => ok
*/
$ TNS_ADMIN=/app/tns ${ORACLE_HOME}/bin/tnsping <servicename>
TNS Ping Utility for Linux: Version 19.0.0.0.0 - Production on 11-JUL-2023 09:52:39
Copyright (c) 1997, 2021, Oracle. All rights reserved.
Used parameter files:
/app/tns/sqlnet.ora
Used TNSNAMES adapter to resolve the alias
Attempting to contact (DESCRIPTION_LIST= (LOAD_BALANCE=off) (FAILOVER=off) (DESCRIPTION= (CONNECT_TIMEOUT=5) (TRANSPORT_CONNECT_TIMEOUT=3) (RETRY_COUNT=3) (ADDRESS_LIST= (LOAD_BALANCE=o) (ADDRESS= (PROTOCOL=TCP) (HOST=<hostname>) (PORT=1521))) (CONNECT_DATA= (SERVICE_NAME=<servicename>))))
OK (0 msec)
/*************************************************************************************
* sqlplus: with TNS_ADMIN, TCP => ok
*/
$ TNS_ADMIN=/app/tns ${ORACLE_HOME}/bin/sqlplus <user>@<servicename>
SQL*Plus: Release 19.0.0.0.0 - Production on Tue Jul 11 09:52:48 2023
Version 19.13.0.0.0
Copyright (c) 1982, 2021, Oracle. All rights reserved.
Enter password:
Last Successful login time: Tue Jul 11 2023 07:18:44 +02:00
Connected to:
Oracle Database 19c Enterprise Edition Release 19.0.0.0.0 - Production
Version 19.18.0.0.0
SQL> exit
NLS_LANG=American_America.WE8ISO8859P1 NLS_LANG=American_America.UTF8
RFC 4462 Generic Security Service Application Program Interface (GSS-API) Authentication and Key Exchange for the Secure Shell (SSH) Protocol
The Kerberos V5 (“GSSAPI”) Simple Authentication and Security Layer (SASL) Mechanism
RFC 2743, Generic Security Service Application Program Interface Version 2, Update 1
RFC 2744, Generic Security Service API Version 2 : C-bindings
RFC 7546, Structure of the Generic Security Service (GSS) Negotiation Loop
GssApiProblem
Dell Unity: Weak SSH key exchange algorithm is reported by third-party Vulnerability scanning software on Unity code 5.1.X (User Correctable)
GSSAPI im RZ der TUHH
SSPI/Kerberos Interoperability with GSSAPI
Chapter 1 The GSS-API: An Overview
Steps for setting up user authentication with GSS-API (Kerberos)
GSSAPI (de)
Generic Security Service Application Program Interface (GSSAPI) (en)
compile error with xrdp version 0.9.18.1 on CentOS 7 #2156
C standard library
$ CFLAGS=-std=gnu99 ./configure --prefix=/app/xrdp
#define __USE_GNU
#define __USE_POSIX
session.c:32:0: error: "__USE_GNU" redefined [-Werror]
#define __USE_GNU
^
<command-line>:0:0: note: this is the location of the previous definition
session.c:33:0: error: "__USE_POSIX" redefined [-Werror]
#define __USE_POSIX
# ifdef __USE_GNU
extern char *strptime_l (const char *__restrict __s,
const char *__restrict __fmt, struct tm *__tp,
__locale_t __loc) __THROW;
# endif
# if defined __USE_POSIX || defined __USE_MISC
/* Return the `struct tm' representation of *TIMER in UTC,
using *TP to store the result. */
extern struct tm *gmtime_r (const time_t *__restrict __timer,
struct tm *__restrict __tp) __THROW;
/* Return the `struct tm' representation of *TIMER in local time,
using *TP to store the result. */
extern struct tm *localtime_r (const time_t *__restrict __timer,
struct tm *__restrict __tp) __THROW;
# endif /* POSIX or misc */
make[2]: Entering directory `/home/andreas/xrdp-0.9.22.1/common'
CC base64.lo
CC fifo.lo
CC file.lo
CC guid.lo
guid.c: In function 'guid_new':
guid.c:36:12: error: missing braces around initializer [-Werror=missing-braces]
struct guid guid = {0};
^
guid.c:36:12: error: (near initialization for 'guid.g') [-Werror=missing-braces]
cc1: all warnings being treated as errors
make[2]: *** [guid.lo] Error 1
make[2]: Leaving directory `/home/andreas/xrdp-0.9.22.1/common'
make[1]: *** [all-recursive] Error 1
make[1]: Leaving directory `/home/andreas/xrdp-0.9.22.1'
make: *** [all] Error 2
make[3]: Entering directory `/home/andreas/xrdp-0.9.22.1/sesman/chansrv'
CC chansrv.o
CC chansrv_common.o
CC chansrv_config.o
CC chansrv_fuse.o
CC chansrv_xfs.o
CC clipboard.o
CC clipboard_file.o
CC devredir.o
CC fifo.o
CC irp.o
CC rail.o
CC smartcard.o
CC smartcard_pcsc.o
CC sound.o
sound.c: In function ‘process_pcm_message’:
sound.c:1121:21: error: ‘for’ loop initial declarations are only allowed in C99 mode
for (int i = 0; i < send_silence_times; i++)
^
sound.c:1121:21: note: use option -std=c99 or -std=gnu99 to compile your code
make[3]: *** [sound.o] Error 1
make[3]: Leaving directory `/home/andreas/xrdp-0.9.22.1/sesman/chansrv'
make[2]: *** [all-recursive] Error 1
make[2]: Leaving directory `/home/andreas/xrdp-0.9.22.1/sesman'
make[1]: *** [all-recursive] Error 1
make[1]: Leaving directory `/home/andreas/xrdp-0.9.22.1'
make: *** [all] Error 2
make[3]: Entering directory `/home/andreas/xrdp-0.9.22.1/sesman'
CC access.o
CC config.o
CC env.o
CC scp.o
CC scp_v0.o
CC scp_v1.o
CC scp_v1_mng.o
CC sesman.o
CC session.o
session.c: In function ‘session_start_fork’:
session.c:981:9: error: implicit declaration of function ‘localtime_r’ [-Werror=implicit-function-declaration]
localtime_r(<ime, &stime);
^
cc1: all warnings being treated as errors
make[3]: *** [session.o] Error 1
make[3]: Leaving directory `/home/andreas/xrdp-0.9.22.1/sesman'
make[2]: *** [all-recursive] Error 1
make[2]: Leaving directory `/home/andreas/xrdp-0.9.22.1/sesman'
make[1]: *** [all-recursive] Error 1
make[1]: Leaving directory `/home/andreas/xrdp-0.9.22.1'
make: *** [all] Error 2
Target Management Home
TM Developer Documents
Eclipse Communication Framework (EFC) Project Home
Eclipse Target Management: Terminal and Remote System Explorer (RSE)
TCF terminology or is it a dead technology for embedded development?