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
/** | |
* 将阿拉伯数字转换成中文数字,仅支持到万 | |
*/ | |
inline static std::string toChineseString(unsigned int n) | |
{ | |
std::string result; | |
std::vector<std::string> units{ "十", "百", "千", "万" }; | |
std::vector<std::string> nums{ "零", "一", "二", "三", "四", "五", "六", "七", "八", "九" }; |
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/questions/478898/how-do-i-execute-a-command-and-get-the-output-of-the-command-within-c-using-po | |
std::string exec(const char* cmd) | |
{ | |
std::array<char, 128> buffer; | |
std::string result; | |
std::unique_ptr<FILE, decltype(&_pclose)> pipe(_popen(cmd, "r"), _pclose); | |
if (!pipe) { | |
throw std::runtime_error("popen() failed!"); | |
} | |
while (fgets(buffer.data(), buffer.size(), pipe.get()) != nullptr) { |
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
struct _TempHandleData { | |
unsigned long processId; | |
HWND windowHandle; | |
}; | |
BOOL isMainWindow(HWND handle) | |
{ | |
return ::GetWindow(handle, GW_OWNER) == (HWND)0 && ::IsWindowVisible(handle); | |
} |
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
Set objPPT = CreateObject("PowerPoint.Application") | |
If IsNull(objPPT) Then | |
MsgBox("Create PowerPoint.Application Failed.") | |
Else | |
MsgBox("Create PowerPoint.Application OK.") | |
objPPT.Quit | |
End If |
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
// Convert a wide Unicode string to an UTF8 string | |
std::string utf8_encode(const std::wstring &wstr) | |
{ | |
int size_needed = WideCharToMultiByte(CP_UTF8, 0, &wstr[0], (int)wstr.size(), NULL, 0, NULL, NULL); | |
std::string strTo(size_needed, 0); | |
WideCharToMultiByte(CP_UTF8, 0, &wstr[0], (int)wstr.size(), &strTo[0], size_needed, NULL, NULL); | |
return strTo; | |
} | |
// Convert an UTF8 string to a wide Unicode String |
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
class NumberEditUI : public CEditUI { | |
public: | |
NumberEditUI() : CEditUI() | |
{ | |
this->OnNotify += DuiLib::MakeDelegate(this, &NumberEditUI::OnTextChanged); | |
} | |
protected: | |
virtual void SetAttribute(LPCTSTR pstrName, LPCTSTR pstrValue) override | |
{ | |
if (_tcsicmp(pstrName, _T("min")) == 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
#include <iostream> | |
#include <stdio.h> | |
#include <Windows.h> | |
#include <TlHelp32.h> | |
void suspend(DWORD processId) | |
{ | |
HANDLE hThreadSnapshot = CreateToolhelp32Snapshot(TH32CS_SNAPTHREAD, 0); | |
THREADENTRY32 threadEntry; |
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 <QCoreApplication> | |
#include <QtCore> | |
bool ping_test(const QString &ip) { | |
QStringList parameters; | |
#ifdef Q_OS_WIN | |
parameters << "-n" << "1"; | |
#else | |
parameters << "-c 1"; | |
#endif |
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
import os, glob, re | |
module = 'xxx' | |
fixup = r""" | |
/*! | |
* \class {cls} | |
* \inmodule {module} | |
*/ |
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
update utclabm_formula_control_info | |
set group_id = t2.group_id | |
from utclabm_formula_control_info t1 | |
inner join ( select group_id, line_id from utclabm_station where status = 'active' ) t2 | |
on t1.line_id = t2.line_id |
NewerOlder