我正在开发一个从GitLab上托管的远程存储库克隆的项目。我对项目进行了一些更改,但我没有\xe2\x80\x99 创建任何分支,并且现在想开始研究其他一些新功能,但不首先将现有工作推送到远程存储库。
\n我可能会放弃新功能中的更改,或者可能需要在稍后阶段将新功能以及早期更改推送到远程存储库。
\n根据我对 Git 的了解,我认为我需要创建一个新的本地分支,我可以使用git checkout -b NEW_BRANCH_NAME. 这是完成我想做的事情的正确方法吗?当我使用此命令时,它会创建一个新分支。如何在这个新分支和之前的分支之间来回切换?
我想运行示例测试并调试Google 测试项目。我在 Ubuntu 16.04 LTS 上使用 VS Code。
/home/user/Desktop/projects/cpp/googletest,mybuildat的新目录/home/user/Desktop/projects/cpp/mybuild。cmake -Dgtest_build_samples=ON /home/user/Desktop/projects/cpp/googletest来构建项目,这生成了一堆文件,显然构建成功。现在,我有两个问题:
如何为项目运行示例测试?
我如何调试这些测试和项目的源代码?
我有一个使用 Typescript 的 Express 应用程序,我想使用 VSCode 中的断点来调试该应用程序。我使用第一个启动配置来调试使用 jest.js 库的测试。这些测试位于项目根目录 /test 内名为 api.test.ts 的文件中。由于我不再调试测试而是调试应用程序,因此我删除了第一个启动配置,只使用第二个配置启动它,但我收到了此错误:
Debugger attached.
Waiting for the debugger to disconnect...
internal/modules/cjs/loader.js:883
throw err;
^
Error: Cannot find module '/home/username/Desktop/PROJ_NAME/node dist/server.js'
at Function.Module._resolveFilename (internal/modules/cjs/loader.js:880:15)
at Function.Module._load (internal/modules/cjs/loader.js:725:27)
at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:72:12)
at internal/main/run_main_module.js:17:47 {
code: 'MODULE_NOT_FOUND',
requireStack: []
}
Run Code Online (Sandbox Code Playgroud)
这是我的 launch.json:
{
"version": "0.2.0",
"configurations": [
{
"type": "node",
"request": "launch",
"name": "Jest watch all tests",
"program": "${workspaceRoot}/node_modules/jest/bin/jest.js",
"args": [
"--verbose",
"-i",
"--no-cache",
"--watchAll"
],
"console": "integratedTerminal",
"internalConsoleOptions": "neverOpen" …Run Code Online (Sandbox Code Playgroud) 我在 Typescript 中创建了一个包并将其发布到 NPM 上。我已经开始declaration: true了tsconfig.json这个包项目。当我构建这个项目时,TS 编译器按预期生成 .d.ts 文件,但是,这些文件没有在 NPM 上发布,因此,当我在其他项目中安装这个包时,我收到错误,Cannot find module 'projectname-common' or its corresponding type declarations.
这是我的 package.json 文件:
\n{\n "name": "@Organisation/lib",\n "version": "1.0.0",\n "description": "",\n "main": "dist/index.js",\n "types": "dist/index.d.ts",\n "scripts": {\n "clean": "rm -rf ./dist",\n "build": "npm run clean && npx tsc",\n "pub": "git add . && git commit -m \\"Changes\\" && git push && npm version patch && npm run build && npm publish --access public"\n },\n "keywords": …Run Code Online (Sandbox Code Playgroud) class parent:
def __init__(self):
self.a=2
self.b=4
def form1(self):
print("calling parent from1")
print('p',self.a+self.b)
class child1(parent):
def __init__(self):
self.a=50
self.b=4
def form1(self):
print('bye',self.a-self.b)
def callchildform1(self):
print("calling parent from child1")
super().form1()
class child2(parent):
def __init__(self):
self.a=3
self.b=4
def form1(self):
print('hi',self.a*self.b)
def callchildform1(self):
print("calling parent from child2")
super().form1()
class grandchild(child1,child2):
def __init__(self):
self.a=10
self.b=4
def callingparent(self):
super().form1()
g=grandchild()
g.callchildform1()
Run Code Online (Sandbox Code Playgroud)
在上面的代码中,当我调用 时g.callchildform1(),根据 MRO 规则,将首先在同一个类中搜索该方法,然后是第一个父级(此处为 child1),然后是第二个父级(child2)。正如预期的那样,它调用child1.callchildform1()并执行第一行print("calling parent from child1")。super().form1()但在此之后,我预计将执行下一行,该行将被调用parent.form1(),但这种情况不会发生。相反,child2.form1()正在被调用。请解释一下为什么会出现这种情况?
我已经创建了一个库Typescript并将在其他NodeJS项目中使用它。我已将源代码包含在NPM包中,因此当我将其安装到使用该包的项目中时,我也会在该文件夹中获取源代码node_modules。
现在,在调试我的项目时,我希望能够命中node_modules. 我怎样才能做到这一点?
假设我有一个正在尝试调试的项目root/my-project,并且该项目正在使用名为 的 NPM 包@my-org/common,该包位于root/my-org-common. 由于该库是my-project使用 NPM 安装的,因此其代码@my-org/common也包含node_modules在root/my-project/node_modules. 如何设置 VSCode 以便root/my-project/node_modules命中代码内的断点?
我在具有此架构的 MongoDB 集合中有一些文档:
{
"_id": {
"$oid": "60c1e8e318afd80016ce58b1"
},
"searchPriority": 1,
"isLive": false,
"vehicleCondition": "USED",
"vehicleDetails": {
"city": "Delhi"
}
},
{
"_id": {
"$oid": "60c1f2f418afd80016ce58b5"
},
"searchPriority": 2,
"isLive": false,
"vehicleCondition": "USED",
"vehicleDetails": {
"city": "Delhi"
}
},
{
"_id": {
"$oid": "60cb429eadd33c00139d2be7"
},
"searchPriority": 1,
"isLive": false,
"vehicleCondition": "USED",
"vehicleDetails": {
"city": "Gurugram"
}
},
{
"_id": {
"$oid": "60c21be618afd80016ce5905"
},
"searchPriority": 2,
"isLive": false,
"vehicleCondition": "USED",
"vehicleDetails": {
"city": "New Delhi"
}
},
{
"_id": {
"$oid": …Run Code Online (Sandbox Code Playgroud) 我正在读一本关于编译器设计的书,其中有一部分说的是,
不同语言的编译器的主要区别在于它们生成的代码.一般来说,可以说命令式和面向对象语言的编译器用汇编语言生成代码; 而功能语言编译器则用C或C++生成.
关于C/C++的最后一部分是否正确?我无法通过Google搜索找到任何内容,所以我在这里问.
typescript ×3
javascript ×2
node.js ×2
c++ ×1
cmake ×1
debugging ×1
express ×1
git ×1
gitlab ×1
googletest ×1
mongodb ×1
mongoose ×1
npm ×1
oop ×1
python ×1
redis ×1
super ×1
transpiler ×1