This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Ref: https://stackoverflow.com/questions/60023890/organize-all-urls-in-one-place-inside-a-class | |
#include <QDebug> | |
#include <QString> | |
#include <QUrl> | |
namespace url { | |
static constexpr auto default_ip = "localhost"; | |
static constexpr auto default_port = "8080"; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Ref: https://stackoverflow.com/questions/60023221/finding-the-closest-true-value-for-an-index | |
#include <iostream> | |
#include <vector> | |
#include <algorithm> | |
#include <tuple> | |
#include <limits> | |
using Result = std::tuple<bool, std::size_t, std::string>; // result (T/F), index, message | |
Result find_nearest( const std::vector<int>& v, const std::size_t index, const int value ) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// https://stackoverflow.com/a/51587626/7670262 | |
#include <QDebug> | |
#include <QtConcurrent> | |
#include <QFuture> | |
#include <QThread> | |
#define LOG() qDebug() << __func__ << ": " | |
void test() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <iostream> | |
#include <future> | |
#include <thread> | |
#include <chrono> | |
#define LOG() std::cout << __func__ << " : " | |
void test() | |
{ | |
LOG() << "IN\n"; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// https://stackoverflow.com/a/51889159/7670262 | |
#include <iterator> | |
#include <iostream> | |
struct data | |
{ | |
data() = default; | |
int num1 = 0; | |
int num2 = 0; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// https://stackoverflow.com/a/44558860/7670262 | |
/* | |
Directory structure: | |
C:\Test | |
-- A | |
---- a.txt | |
-- B | |
---- b.tx |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// https://stackoverflow.com/a/55187379/7670262 | |
#include <QDebug> | |
#include <QMap> | |
#include <QMapIterator> | |
#include <QString> | |
int main() | |
{ | |
using InnerMap = QMap<int, QString>; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// https://stackoverflow.com/a/51742823/7670262 | |
#include <QProcess> | |
int main() | |
{ | |
QProcess process; | |
process.setProgram( "cmd.exe" ); | |
process.setArguments( { "/C", R"(E:\deleteme.bat)" } ); | |
process.setWorkingDirectory( R"(E:\)" ); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import ( | |
"fmt" | |
"strings" | |
) | |
func checkSubstrings(str string, subs ...string) (bool, int) { | |
matches := 0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// https://stackoverflow.com/a/55297349/7670262 | |
#include <QDebug> | |
#include <QJsonDocument> | |
#include <QJsonObject> | |
#include <QJsonArray> | |
int main() | |
{ | |
const auto data = R"({ "Name": "45", "Path": "C:\file.json" })"; |