小编Ogg*_*las的帖子

Git反向提交SourceTree中的推送合并

我不小心合并了一个分支,并立即"立即推送更改".不幸的是我犯了一个合并错误,现在我不想反向提交删除它.但是,每次我在SourceTree中执行此操作时,都会收到以下错误:

错误:提交X是合并但没有给出-m选项.致命:恢复失败

有没有办法做到这一点,还是我必须使用终端?正在阅读它,但无法找到这个具体案例的解决方案.

c# git merge atlassian-sourcetree

8
推荐指数
1
解决办法
1万
查看次数

Visual Studio 2019 - 使用项目特定的 ESLint 配置 .eslintrc

我已按照本指南来设置.eslintrc配置。

https://github.com/typescript-eslint/typescript-eslint/blob/master/docs/getting-started/linting/README.md

我还按照本指南在 Visual Studio 中启用了 ESLint:

在此输入图像描述

/sf/answers/3112118271/

我的问题是我想使用项目特定的配置而不是全局 ESLint 配置。

该指南设置了一个.eslintrc.js文件,因此我尝试切换到与C:\Users\Oscar\.eslintrc.

尝试将其放在.eslintrc解决方案、项目的根文件夹和我的ClientApp文件夹中,但没有任何结果。是否可以在 Visual Studio 中使用项目特定的 ESLint 配置并接收构建错误/警告?

运行该命令npx eslint . --ext .js,.jsx,.ts,.tsx会给出正确的错误,但 Visual Studio 没有显示任何错误。

.eslintrc:

{
  "root": true,
  "parser": "@typescript-eslint/parser",
  "plugins": [
    "@typescript-eslint",
    "jest"
  ],
  "extends": [
    "eslint:recommended",
    "plugin:@typescript-eslint/recommended",
    "plugin:jest/recommended",
    "plugin:react/recommended"
  ],
  "env": {
    "browser": true,
    "node": true,
    "jest/globals": true
  },
  "rules": {
    "no-console": [
      "error",
      { "allow": [ "warn", "error" ] }
    ]
  } …
Run Code Online (Sandbox Code Playgroud)

visual-studio eslint eslintrc visual-studio-2019 typescript-eslint

8
推荐指数
1
解决办法
1498
查看次数

Visual Studio - >共享TypeScript库 - > TS6059文件''不在'rootDir'''下.'rootDir'应包含所有源文件

我们正在使用Visual Studio 2017并拥有两个独立的Web项目,这些项目应该共享一些React编写的组件TypeScript.还可以有共享JavaScript文件和CSS文件.为此,我们Shared Project在Visual Studio中创建了一个.

Visual Studio 2015中的共享项目和类库有什么区别?

现在,项目只有一个包含此信息的文件.

export const Types = {
    Type1: '1',
    Type2: '2',
    Type3: '3'
}
Run Code Online (Sandbox Code Playgroud)

为了测试,我可以像这样引用它,Visual Studio将找到该文件:

import { Types} from '../../../2/Constants/Types'
Run Code Online (Sandbox Code Playgroud)

但是,当我尝试运行时,webpack我收到以下错误:

TS6059:文件'/2/Constants/Types.ts'不在'rootDir'/ 1'下.'rootDir'应包含所有源文件.

javascript visual-studio typescript webpack typescript2.0

7
推荐指数
2
解决办法
6630
查看次数

使用 fetch(),从非 HTTP OK 状态码读取响应体并捕获异常

我一直在阅读fetch()以及如何从服务器捕获和打印可读的错误消息。理想情况下,我想抛出一个错误,该错误总是Catch 2在下面的示例中结束,并且console.log(`OK: ${data}`);如果出现错误则不会运行。我可以console.log(`OK: ${data}`);通过then直接运行来缓解,response.json();但我想知道实现这一目标的正确方法。

/sf/answers/3120338581/

https://developers.google.com/web/updates/2015/03/introduction-to-fetch

https://developer.mozilla.org/en-US/docs/Web/API/Fetch_API/Using_Fetch

C#:

[HttpGet, Route("api/specific/catalog/test")]
public async Task<IHttpActionResult> Test()
{
    return InternalServerError(new Exception("My Exception"));
}

[HttpGet, Route("api/specific/catalog/test2")]
public async Task<IHttpActionResult> Test2()
{
    return Ok("My OK Message");
}
Run Code Online (Sandbox Code Playgroud)

打字稿:

fetch('api/specific/catalog/test2')
    .then(response => {
        if (!response.ok) {
            response.text().then(text => {
                throw new Error(`Request rejected with status ${response.status} and message ${text}`);
            })
            .catch(error =>
                console.log(`Catch 1: ${error}`)
            );
        }
        else {
            return response.json();
        }
    })
    .then(data …
Run Code Online (Sandbox Code Playgroud)

javascript c# fetch typescript

7
推荐指数
1
解决办法
1568
查看次数

Entity Framework Core 3.0 查询导致“SqlException: 'Execution Timeout Expired'”和 tempdb 变满。适用于 EF Core 2.2.6

我正在 Microsoft Entity Framework Core 3.0 中运行一个相当简单的查询,如下所示:

var dbProfile = db.Profiles.Where(x => x.SiteId == Int32.Parse(id))
    .Include(x => x.Interests)
    .Include(x => x.Pets)
    .Include(x => x.Networks)
    .Include(x => x.PersonalityTraits)
    .SingleOrDefault();
Run Code Online (Sandbox Code Playgroud)

它在 EF Core 2.2.6 上运行良好,但是当升级到 EF Core 3.0 时,此查询会立即针对 721 个配置文件运行,但对于至少一个配置文件,查询超时:

Microsoft.Data.SqlClient.SqlException: '执行超时已过期。
操作完成之前超时时间已过或服务器没有响应。

然后我记录了发送到数据库服务器的实际查询:

/sf/answers/4084371161/

SELECT [t].[Id], [t].[Age], [t].[City], [t].[Country], [t].[County], [t].[DeactivatedAccount], [t].[Gender], [t].[HasPictures], [t].[LastLogin], [t].[MemberSince], [t].[PresentationUpdated], [t].[ProfileName], [t].[ProfilePictureUrl], [t].[ProfileText], [t].[SiteId], [t].[VisitorsCount], [i].[Id], [i].[Name], [i].[ProfileId], [p0].[Id], [p0].[Description], [p0].[Name], [p0].[ProfileId], [n].[Id], [n].[Name], [n].[NetworkId], [n].[ProfileId], [p1].[Id], [p1].[Name], [p1].[ProfileId]
FROM (
    SELECT TOP(2) [p].[Id], …
Run Code Online (Sandbox Code Playgroud)

c# sql-server entity-framework entity-framework-core entity-framework-core-3.0

7
推荐指数
1
解决办法
5257
查看次数

创建 React 应用程序 - (ESLint) 无法加载要扩展的配置“共享配置”。引用自:Visual Studio 中的 &lt;PATH&gt;

我已经从 Create React App 入门指南创建了一个 React 应用程序--template typescript

https://create-react-app.dev/docs/getting-started/

我已经扩展了我的配置以使用 ESLint。

包.json:

{
  "eslintConfig": {
    "extends": ["react-app", "shared-config"],
    "rules": {
      "additional-rule": "warn"
    },
    "overrides": [
      {
        "files": ["**/*.ts?(x)"],
        "rules": {
          "additional-typescript-only-rule": "warn"
        }
      }
    ]
  }
}
Run Code Online (Sandbox Code Playgroud)

https://create-react-app.dev/docs/setting-up-your-editor/

ESLint 在运行时工作正常npm run build并显示在 Chrome 开发者控制台中,但在 Visual Studio 中我收到以下错误:

(ESLint) 无法加载要扩展的配置“共享配置”。引用自:<package.json PATH>

在此输入图像描述

我怎样才能做到这一点?

visual-studio reactjs eslint create-react-app visual-studio-2019

7
推荐指数
1
解决办法
5584
查看次数

获取Umbraco 7.3.5版的当前用户

我正在尝试访问登录的Umbraco用户,而不是成员,但我无法让它工作.

我尝试过以下方法但没有工作,它们都返回null:

umbraco.BusinessLogic.User.GetCurrent()
UmbracoContext.UmbracoUser
UmbracoContext.Security.CurrentUser
umbraco.helper.GetCurrentUmbracoUser()
Run Code Online (Sandbox Code Playgroud)

我可以使用以下代码访问用户,例如Name:

UmbracoContext.Application.Services.UserService.GetByEmail("name@company.com").Name
Run Code Online (Sandbox Code Playgroud)

我已经尝试过这个代码作为用户和成员登录,只有用户,只有成员而根本没有登录,它总是返回相同的结果,null.

我已经在SurfaceController和UmbracoApiController中尝试了相同结果的代码.获取登录成员没有问题有没有Membership.GetUser();其他人经历过这个?

使用:Umbraco版本7.3.5汇编:1.0.5858.25602

c# asp.net umbraco asp.net-web-api

6
推荐指数
2
解决办法
4715
查看次数

C# 通过瑞典国家名称获取 RegionInfo、TwoLetterISORegionName

我需要为国家/地区获取两个字母的 ISO 区域名称ISO 3166- ISO 3166-1 alpha 2。我的问题是我只有瑞典语的国家名称,例如SverigeforSwedenTysklandfor Germany。是否可以仅从这些信息中获取 RegionInfo?我知道英语国家名称是可能的。

作品:

var countryName = "Sweden";
//var countryName = "Denmark";
var regions = CultureInfo.GetCultures(CultureTypes.SpecificCultures).Select(x => new RegionInfo(x.LCID));
var englishRegion = regions.FirstOrDefault(region => region.EnglishName.Contains(countryName));
var twoLetterISORegionName = englishRegion.TwoLetterISORegionName;
Run Code Online (Sandbox Code Playgroud)

/sf/answers/998360471/

c# globalization

6
推荐指数
1
解决办法
1012
查看次数

.NET Standard 2.0 中的 Microsoft.AspNet.Identity 和 Microsoft.AspNet.Identity.EntityFramework

背景:我们正在开展的项目由多个共享两个库的解决方案组成。一切都写在.NET Framework 4.6.1今天。该项目的目标是采用.NET Core新项目并能够在Docker.

随着新版本的发布.NET Standard 2.1以及.NET Framework 4.8将保留.NET Standard 2.0而不是实施的事实,.NET Standard 2.1感觉是开始的合适时机。微软的 Immo Landwerth 说:

但同样正确的是 .NET Framework 的创新速度必须放慢以减少损坏。从这个意义上说,您通常应该期望大多数新功能只会在 .NET Core(以及派生平台,例如 Xamarin、Mono 和 Unity,因为它们从与 .NET Core 相同的源构建)上可用。

https://blogs.msdn.microsoft.com/dotnet/2018/11/05/annoucing-net-standard-2-1/

我们希望能够访问新项目中的新功能,但不想将每个旧项目都转换为.NET Core. 为了保持.NET Framework.NET Core我们之间的兼容性,我们决定将我们的共享库转换为.NET Standard 2.0.

https://docs.microsoft.com/en-us/dotnet/standard/net-standard

除了以下依赖项之外,这非常有效:

1. System.Net.Http.WebRequestHandler - 已解决

用于像这样的客户端证书:

WebRequestHandler requestHandler = new WebRequestHandler();

//Add certificate if setting exists
if (!string.IsNullOrEmpty(pushEvent?.CertificateThumbprint?.Thumbprint))
{ …
Run Code Online (Sandbox Code Playgroud)

.net c# asp.net .net-standard .net-standard-2.0

6
推荐指数
1
解决办法
2286
查看次数

Email that is automatically parsed by Gmail and adds a Calendar event

I hope this question is OK to ask here, given that it could replace my usage for Google Calendar API I think it should be OK.

https://stackoverflow.com/help/on-topic

When you get an email about an event like a flight, concert, or restaurant reservation, it's added to your calendar automatically.

https://support.google.com/calendar/answer/6084018?co=GENIE.Platform%3DDesktop&hl=en

I think this is a really neat feature but I would like to know If I can create an email that will automatically show up in my calendar myself. I'm currently …

c# email gmail google-calendar-api google-schemas

6
推荐指数
0
解决办法
2393
查看次数