Answer by Ali Tavakol for how to read a table from oracle database in c++...
You have to add directory of Oracle C/C++ libraries to LD_LIBRARY_PATH environment variable. In my case, it is:export LD_LIBRARY_PATH=/usr/lib/oracle/12.2/client64/lib:$LD_LIBRARY_PATH
View ArticleAnswer by Ali Tavakol for C++ where can I find the implementaion of BOOST_LOG...
I recommend Sublime Text. It is worth the effort and time you put on to learning it. It is fast for navigation and search, and there are plugins like C++11 that direct you to function definitions and...
View Articlecall program in windows command prompt having unicode argument not...
Take this for example:unzip 'C:\test.zip'which works. But this:unzip 'C:\مثال.zip'does not work:unzip: cannot find any matches for wildcard specification "????.zip"even chcp 65001 did not help.p.s....
View Articleshell mis-interprets unicode args of child_process.spawn
A simple C++test_program opens file specified by argv[1] for reading:#include <fstream>#include <iostream>int main(int argc, char *argv[]) { for (int i = 0; i < argc; i++) std::cout...
View ArticleComment by Ali Tavakol on Typscript error when accessing object's value by...
@SvetoslavPetkov works well tnx
View ArticleComment by Ali Tavakol on Typscript error when accessing object's value by...
field is used in a lot of object types and can almost be considered dynamic (but I am sure it is one of the allowed values). that's why I am using let and I can't write any literals.
View ArticleComment by Ali Tavakol on Typscript error when accessing object's value by...
that's a snippet from a big set of different type of objects, so I can't write any literals. but your second recommendation works well. tnx
View ArticleAnswer by Ali Tavakol for QStackWidget - Search by name
You may name your stack widgets using QObject::setObjectName function, and then iterate over them to find desired widget using its name, which is QObject::objectName.
View ArticleAnswer by Ali Tavakol for atoi() produces incorrect value when applied to a...
Use strtoll function:timeSlice = strtoll(argv[1], nullptr, 10);
View ArticleAnswer by Ali Tavakol for Heap corruption detected (String makes heap...
The strcat will append to folderName which is problematic. folderName is comming from outside and it might result in memory corruption if you write beyond its allocated storage. See strcat appends to...
View ArticleAnswer by Ali Tavakol for reversing using ^= in C++
To swap two values a and b, we can write:a = a ^ b;b = a ^ b;a = a ^ b;See https://en.wikipedia.org/wiki/XOR_swap_algorithm for more information. That code is exactly this algorithm, but written in one...
View Articlestd::atomic to what extent?
In the C++ Seasoning video by Sean Parent https://youtu.be/W2tWOdzgXHA at 33:41 when starting to talk about “no raw synchronization primitives”, he brings an example to show that with raw...
View ArticleAnswer by Ali Tavakol for How to link a template library in Visual Studio 2019
After extracting the Eigen, add path to its root directory (which contains another Eigen directory just inside) to the list of additional include directories of the quadcopter-simulation project. (open...
View ArticleAnswer by Ali Tavakol for C++: Read in complex numbers from a .txt file and...
I recommend using regular expressions. This is my method:#include <iostream>#include <fstream>#include <string>#include <regex>int main() { std::regex...
View ArticleQt window layout spans beyond window borders when QOpenGLWidget is present
There is a Qt window, which hosts many widgets, among them is one QOpenGLWidget widget to plot waveform. This works well on almost all machines, but there is one strange case with a machine having an...
View ArticleLoad huge text buffer into QPlainTextEdit
What is the correct and optimum way to show a huge text buffer in a QPlainTextEdit widget? I mean listen to scrollbar move events, and dynamically pass only the visible portion of the text to the...
View ArticleAnswer by Ali Tavakol for Determine Next Point on a Line Between Point A and...
With A = (x1,y1) and B = (x2,y2) the line is (expressed in two same equations):(1) y = (x-x1)*(y2-y1)/(x2-x1) + y1(2) x = (y-y1)*(x2-x1)/(y2-y1) + x1To find next point, put x1+1 (or x1-1 you know) in...
View ArticleAnswer by Ali Tavakol for Finding the maximum tuple in a vector
I add my flavor to what @2power10 answered:auto result = std::max_element(v.begin(), v.end(), [](const auto &x, const auto &y) { return std::get<2>(x) > std::get<2>(y); });
View ArticleAnswer by Ali Tavakol for What happens in background or in memory when we...
This is the result of ((51×256+50)×256+49)×256+48, where 51 is ASCII code of '3' and 50 is ASCII code of '2' and so on. In fact, pp[0] points to 4 bytes of memory (int is 4 bytes), and those 4 bytes...
View ArticleAnswer by Ali Tavakol for boost::filesystem::space() is reporting wrong...
Use a type that boost::filesystem::space(p).free requires. it may require a 64 bit integer type:uintmax_t freeSpace = boost::filesystem::space(p).free;use of auto is also good.
View Article