首先:StackOverflow 上已经有两个关于这个主题的问题有可靠的答案,但我仍然感到困惑。我有点理解“什么”,但不明白“为什么”。
我的问题是:为什么显示git log A..B (双点)从 B 到 A 的提交列表,但为了获得同一组提交的差异,必须编写git diff A...B (三点)。
git log如果和git diff会以同样的方式对待提交范围,不是会更加一致吗?现在它们的行为似乎彼此正交。
也许我缺少一些关于为什么要这样设计的见解?
我正在使用 SonarCloud 来维护/改进我们的 Angular5 应用程序的代码质量。我在 VSC 中安装了 SonarCloud 插件,一旦我打开一个 TypeScript 文件,它就会显示它的警告/问题(如果有的话)。到现在为止还挺好。
不幸的是,SonarCloud 分析是在文件级别而不是项目级别触发的。我想在整个项目上运行它,并在完整列表中查看所有警告/问题。一次打开所有文件以查看警告对我来说似乎不切实际。
当我在 VSC 中打开命令面板时,我本希望有一个像“运行分析”这样的命令,但没有。如何触发整个项目的分析?
我正在使用 SQL Server 和 Entity Framework Core 2。我有以下 SQL 查询(在 SQL Server Management Studio 中)正确地为我提供了前一小时添加的度量(到度量表):
SELECT id, [timestamp]
FROM measurement
WHERE
dateADD(MINUTE, 60, [timestamp]) > getdate()
Run Code Online (Sandbox Code Playgroud)
这很好用。但是现在我想使用 EF Core 2 在 LINQ 中编写此查询。当然我可以编写以下代码:
dbContext
.Measurement
.Include(m => m.Section)
.GroupBy(m => m.Section, (section, m) => new Section
{
Name = section.Name,
CustomerId = section.CustomerId,
MostRecentMeasurement = m.Max(z => z.Timestamp)
})
.Where(x => x.MostRecentMeasurement > DateTime.Now.AddHours(-1))
.ToList();
Run Code Online (Sandbox Code Playgroud)
但这有以下缺点:
如何在 EF Core 中表达查询,使其可以完全转换为 SQL?
该角文档指定几个原因支持JIT的使用AOT编译:
但是,在寻找使用 JIT 的参数时,我没有找到。此外,从 Angular 5.2 升级到 Angular 8 后,我在运行开发构建(使用 JIT)时突然遇到一个奇怪的错误。错误是:
ERROR in ./src/app/shared/app-configuration/shared/app-configuration.model.ts 22:16-35
"export 'IMyComponents' was not found in '@mycompany/mypackage'
Run Code Online (Sandbox Code Playgroud)
运行产品构建(使用 AOT)时,一切正常。这让我感到惊讶,因为我从未遇到过prod 构建成功而dev 构建失败的 Angular 编译问题。
所以我的假设是 JIT 只适用于开发构建(即速度)。添加--aot标志可以安全地完成,没有任何问题。或者我错过了什么?
该combineLatest功能可以从进口rxjs和从rxjs /运营商。
当我从rxjs / operators导入它时(就像我导入CombineAll一样,我得到以下错误:
TS2339: Property 'subscribe' does not exist on type 'OperatorFunction<{}, [{}, number, number, number]>'
Run Code Online (Sandbox Code Playgroud)
我使用了以下代码片段:
import { timer } from "rxjs";
import { combineLatest } from "rxjs/operators";
const timerOne = timer(1000, 2500);
const timerTwo = timer(1500, 2500);
const timerThree = timer(2000, 2500);
//when one timer emits, emit the latest values from each timer as an array
const combined$ = combineLatest(timerOne, timerTwo, timerThree);
combined$.subscribe(
([timerValOne, timerValTwo, timerValThree]) …Run Code Online (Sandbox Code Playgroud) 在我的 Angular 8 应用程序中,我在调试单元测试时遇到了 Chrome 调试器的问题。调试单元测试代码本身是有效的,直到我想单步执行我的生产代码(由测试调用)。
我使用ng test. 在 Chrome 中,我在单元测试代码中添加了一个断点,并且单步执行代码会在调试器中显示正确的行。但是,当我进入生产代码时,它步入了错误的行。有时它会跳转到空行和声明,这完全没有意义。据推测,源映射未正确生成,但我不确定。
如何使单元测试调试工作?我试图将目标从es5设置为es2015,但之后我无法再在 Chrome 中打开源文件。
tsconfig.spec.json
{
"extends": "../tsconfig.json",
"compilerOptions": {
"outDir": "../out-tsc/spec"
},
"files": ["test.ts", "polyfills.ts"],
"include": ["**/*.spec.ts", "**/*.d.ts", "../node_modules/@mycompany/**/*.ts"],
"exclude": ["../node_modules/@mycompany/**/*.spec.ts"]
}
Run Code Online (Sandbox Code Playgroud)
配置文件
{
"extends": "./node_modules/gts/tsconfig-google.json",
"compileOnSave": false,
"compilerOptions": {
"outDir": "./dist/out-tsc",
"sourceMap": true,
"declaration": false,
"moduleResolution": "node",
"emitDecoratorMetadata": true,
"experimentalDecorators": true,
"noUnusedLocals": true,
"noUnusedParameters": true,
"strict": false,
"target": "es5",
"typeRoots": ["node_modules/@types"],
"types": [
"node",
"jasmine",
"googlemaps"
],
"lib": [
"es2017",
"dom"
], …Run Code Online (Sandbox Code Playgroud) 我正在尝试使用量角器(5.4.2),并尝试测试Angular组件。我创建了以下测试,这是从Joe Eames的Angular课程中的单元测试启发而来的。
我的(错误的)代码
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
import { DetailsComponent } from './details.component';
import { By } from 'protractor';
describe('DetailsComponent', () => {
let fixture: ComponentFixture<DetailsComponent>;
beforeEach(async(() => {
TestBed.configureTestingModule({
declarations: [DetailsComponent]
})
.compileComponents();
}));
beforeEach(() => {
fixture = TestBed.createComponent(DetailsComponent);
fixture.detectChanges();
});
it('contains 3 titles', () => {
expect(fixture.debugElement.queryAll(By.css('.card-title')).length).toBe(3);
});
});
Run Code Online (Sandbox Code Playgroud)
但是,在测试方法中的.query调用中发生以下类型错误:
类型“ By”的参数不能分配给类型“ Predicate”的参数。
我不明白为什么会发生此错误,因为我的代码看起来像该示例。
为了将传感器数据从IoT设备写入云中的SQL数据库,我使用Azure流分析作业。SA作业具有IoT中心输入和SQL数据库输出。查询很简单;它只是通过发送所有数据)。根据MS价格计算器,最便宜的方式(在西欧)每月约75欧元(请参见屏幕截图)。
实际上,每分钟仅通过集线器发送1条消息,并且每月固定价格(与消息量无关)。如此琐碎的小数据任务的价格令我感到惊讶。对于如此低的容量需求,是否会有更便宜的选择?也许是Azure功能?
azure azure-stream-analytics azure-sql-database azure-iot-hub azure-functions
angular ×3
typescript ×3
angular-aot ×1
angular-jit ×1
azure ×1
git ×1
jasmine ×1
karma-runner ×1
linq ×1
protractor ×1
rxjs ×1
sonarlint ×1
sql-server ×1
unit-testing ×1