我想通过将 *.ts 文件添加到 tsconfig.json 中的“exclude”属性来从编译中排除它。尽管如果我确实在代码中的某个位置导入该文件,它会忽略排除并无论如何编译它。如何强制 TS 排除该文件?
../
../must_be_excluded.ts
../index.ts
使用导入
//index.ts
import {some_stuff} from "./must_be_excluded"
Run Code Online (Sandbox Code Playgroud)
Tsconfig 设置
//tsconfig.json
{
"compilerOptions": {...},
"exclude": ["./must_be_excluded.ts"]
}
Run Code Online (Sandbox Code Playgroud)
无论如何我看到了must_be_excluded.js!
请告诉我,为什么我会遇到这个问题:
如果剪贴板包含unicode字符(eq russian)我只得到第一个选定的单词."空间"字符前的第一个字.
如果剪贴板不包含unicode字符(仅限英文),我将获得所选文本的第一个字符.
获取所选文字:
CStringA getClipboard()
{
CStringA strData;
if (OpenClipboard(NULL)){
HANDLE hClipboardData = GetClipboardData(CF_UNICODETEXT);
char *pchData = (char*)GlobalLock(hClipboardData);
strData = pchData;
GlobalUnlock(hClipboardData);
CloseClipboard();
}
return strData;
}
Run Code Online (Sandbox Code Playgroud)
设置文字:
bool setClipboard(CStringA textToclipboard)
{
bool success = true;
if (OpenClipboard(NULL)){
EmptyClipboard();
HGLOBAL hClipboardData;
size_t size = (textToclipboard.GetLength()+1) * sizeof(TCHAR);
hClipboardData = GlobalAlloc(NULL, size);
TCHAR* pchData = (TCHAR*)GlobalLock(hClipboardData);
memcpy(pchData, LPCTSTR(textToclipboard.GetString()), size);
SetClipboardData(CF_UNICODETEXT, hClipboardData);
GlobalUnlock(hClipboardData);
CloseClipboard();
}
return success;
}
Run Code Online (Sandbox Code Playgroud)
只需获取并设置剪贴板内容.
CStringA str = getClipboard();
setClipboard(str);
Run Code Online (Sandbox Code Playgroud) 有没有一种方法可以使热键在终端中运行特定命令?说我想通过热键来编译我的TypeScript文件,而不是键入到终端“ tsc”或该命令的任何其他变体。(编辑:我知道可以在保存时重新编译TS,但问题仍然相同)
我使用QProcess并将它的readyReadStandardOutput连接到插槽.但是在启动插槽后执行两次.请告诉我,为什么?
{
myProcess = new QProcess(parent);
myProcess->start("mayabatch.exe -file "+scene);
connect(myProcess, SIGNAL(readyReadStandardOutput()), this, SLOT(readOutput()));
}
void MainWindow::readOutput()
{
qDebug()<<"Read";
QByteArray outData = myProcess->readAllStandardOutput();
qDebug()<<QString(outData);
}
Run Code Online (Sandbox Code Playgroud)
OUTPUT:
Read
"File read in 0 seconds.
"
Read
"cacheFi"
Read
"le -attachFile -fileName "nClothShape1" -directory ...
Run Code Online (Sandbox Code Playgroud)
最后一个字符串坏了.单词之间出现"Read".
我正在探索 Google Firebase。从文档中我看到他们授予客户端访问权限以直接更改服务器上的数据库......这安全吗?
private void WriteNewScore(string userId, int score)
{
// Create new entry at /user-scores/$userid/$scoreid and at /leaderboard/$scoreid simultaneously
string key = mDatabase.Child("scores").Push().Key;
LeaderBoardEntry entry = new LeaderBoardEntry(userId, score);
Dictionary<string, Object> entryValues = entry.ToDictionary();
Dictionary<string, Object> childUpdates = new Dictionary<string, Object>();
childUpdates["/scores/" + key] = entryValues;
childUpdates["/user-scores/" + userId + "/" + key] = entryValues;
mDatabase.UpdateChildrenAsync(childUpdates);
}
Run Code Online (Sandbox Code Playgroud)
如果客户端可以被“模拟”或被黑客攻击等怎么办?应该使用带有 REST 接口的 AppEngine 来实现服务器端安全逻辑来更改数据库或直接使用数据库是正确和安全的方式吗?或者是否有任何特定的解决方案可以确保 Firebase 中的数据库安全?谢谢。
文档页面:https : //firebase.google.com/docs/database/unity/save-data