小编Fra*_*nva的帖子

TFS 2010是否支持乐观锁定?

有谁知道TFS 2010是支持乐观锁定还是仅支持悲观锁定?

tfs tfs2010

2
推荐指数
1
解决办法
433
查看次数

无法将推送通知插件添加到cordova中

我刚刚创建了一个测试cordova项目,现在我正在尝试在我的项目中添加一个简单的Push Notification插件(https://github.com/phonegap-build/PushPlugin).

我按照它的指示输入了这个:

cordova plugin add https://github.com/phonegap-build/PushPlugin.git
Run Code Online (Sandbox Code Playgroud)

但是,命令行立即失败并显示以下错误消息:

F:\Workplace\pushnotification\pushnotification>cordova plugin add https://github.com/phonegap-build/PushPlugin.git
Fetching plugin "https://github.com/phonegap-build/PushPlugin.git" via git clone
Error: Command failed: fatal: could not create work tree dir 'C:\Users\FRANV_~1\AppData\Local\Temp\plugman\git\1398870928641'.: No such file or directory

    at ChildProcess.exithandler (child_process.js:637:15)
    at ChildProcess.EventEmitter.emit (events.js:98:17)
    at maybeClose (child_process.js:743:16)
    at Socket.<anonymous> (child_process.js:956:11)
    at Socket.EventEmitter.emit (events.js:95:17)
    at Pipe.close (net.js:465:12)
Run Code Online (Sandbox Code Playgroud)

我刚刚更新了我的Tortoise GitHub,但它没有解决问题.

请帮我搞清楚.

谢谢

push-notification cordova

2
推荐指数
1
解决办法
1338
查看次数

WebApi中自动生成的EF代码在Azure上不起作用,但在测试时在本地工作

我将我的项目连接到Azure上的sql数据库.在本地测试时,

这个网址运行正常. - >http://localhost:3287/api/Questions

但是在Azure上进行测试时 - > http://mywebsite.azurewebsites.net/api/Questions 它失败并返回JSON格式的错误消息,如下所示.

{
  "$id": "1",
  "Message": "An error has occurred.",
  "ExceptionMessage": "The 'ObjectContent`1' type failed to serialize the response body for content type 'application/json; charset=utf-8'.",
  "ExceptionType": "System.InvalidOperationException",
  "StackTrace": null,
  "InnerException": {
    "$id": "2",
    "Message": "An error has occurred.",
    "ExceptionMessage": "Error getting value from 'company_answer' on 'System.Data.Entity.DynamicProxies.question_70E4093AC2C7FDC38798C82820B9E2C1CBF9627487D0F09FFAC57467331A277B'.",
    "ExceptionType": "Newtonsoft.Json.JsonSerializationException",
    "StackTrace": "   at Newtonsoft.Json.Serialization.DynamicValueProvider.GetValue(Object target)\r\n   at Newtonsoft.Json.Serialization.JsonSerializerInternalWriter.CalculatePropertyValues(JsonWriter writer, Object value, JsonContainerContract contract, JsonProperty member, JsonProperty property, JsonContract& memberContract, Object& memberValue)\r\n   at Newtonsoft.Json.Serialization.JsonSerializerInternalWriter.SerializeObject(JsonWriter writer, Object …
Run Code Online (Sandbox Code Playgroud)

c# entity-framework azure asp.net-web-api

2
推荐指数
1
解决办法
2418
查看次数

如何使用 Webpack 3 配置 Ant Design

修复及解决方案:

感谢@BoyWithSilver,长话短说,以下是我为解决问题所做的操作:

  1. 添加 .less 到扩展部分
  2. 删除了 webpack.config.json 中不必要的代码,例如删除了 extract-text-webpack-plugin
  3. 从 3.0.1 降级到 2.7.0 修复了一堆错误:antd 中的 index.less 文件中未定义的长度。

更新3

这是我的 package.json

{
  "name": "mobx-reactjsx",
  "version": "1.0.0",
  "description": dfsdfsdfsd",
  "scripts": {
    "start": "webpack-dev-server --config webpack.config.js --progress --inline",
    "lint": "eslint src"
  },
  "keywords": [
    "react",
    "reactjs",
    "boilerplate",
    "mobx",
    "starter-kit",
    "firebase",
    "re-base"
  ],
  "author": "Winston Fan",
  "license": "MIT",
  "homepage": "https://horizontalvision.azurewebsites.net/",
  "devDependencies": {
    "autoprefixer": "^8.0.0",
    "babel-core": "^6.9.1",
    "babel-loader": "^7.1.2",
    "babel-plugin-import": "^1.6.4",
    "babel-plugin-transform-decorators-legacy": "^1.3.4",
    "babel-preset-es2015": "^6.9.0",
    "babel-preset-react": "^6.5.0",
    "babel-preset-stage-1": "^6.5.0",
    "css-loader": "^0.28.9",
    "extract-text-webpack-plugin": "^3.0.2",
    "less": "^3.0.1", …
Run Code Online (Sandbox Code Playgroud)

reactjs webpack antd

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

.net core C# 在 EF Core 数据库上使用动态属性名称首先生成的模型类

我有一个用户详细信息类

public partial class UserDetails
    {
        public int? Level { get; set; }
        public string Unit { get; set; }
        public string Bio { get; set; }
        public bool? Gender { get; set; }
        public int? Mobile { get; set; }
        public string Photo { get; set; }
    }
Run Code Online (Sandbox Code Playgroud)

我正在编写一个更新方法:

public bool UpdateDetails(string userId, UserProperties updateProperty, string value)
        {
         switch(updateProperty)
            {
                case UserProperties.Unit:
                    details.Unit = value;
                    break;
                case UserProperties.Photo:
                    details.Photo = value;
                    break;
                default:
                    throw new Exception("Unknown User Detail property"); …
Run Code Online (Sandbox Code Playgroud)

c# entity-framework-core .net-core

2
推荐指数
1
解决办法
1671
查看次数

Docker WORKDIR不会创建文件夹

更新:

这是代码库:https : //github.com/franva/dockerapi/tree/master/dockerapi


我是Docker的新手,我使用Visual Studio 2017添加了Docker Support,因此基本上它只是在项目文件夹下创建一个Dockerfile。

我跑:

docker build -t dockerapi:init .

E:\temp\playground\dockerapi (master -> origin) 
? docker build -t dockerapi:imp . 

Sending build context to Docker daemon  25.09kB 
Step 1/17 : FROM microsoft/dotnet:2.2-aspnetcore-runtime 
AS base  ---> c56aab97bc42 
Step 2/17 : WORKDIR /app  ---> Using cache  --->8f9c09673b05 
Step 3/17 : EXPOSE 80  ---> Using cache  --->7b773fae0164 
Step 4/17 : EXPOSE 443  ---> Using cache  --->a5c32bea1008 
Step 5/17 : FROM microsoft/dotnet:2.2-sdk AS build  --->155911c343f3 
Step 6/17 : WORKDIR …
Run Code Online (Sandbox Code Playgroud)

.net docker .net-core

2
推荐指数
1
解决办法
160
查看次数

是否可以将 SpaCy 安装到 Raspberry Pi 4 Raspbian Buster

我一整天都在安装 SpaCy。

sudo pip install -U spacy

Looking in indexes: https://pypi.org/simple, https://www.piwheels.org/simple
Collecting spacy
  Using cached https://files.pythonhosted...
  Installing build dependencies ... done
    Complete output from command python setup.py egg_info:
      Failed building wheel for blis
    ERROR: Failed to build one or more wheels
    Traceback (most recent call last):
      File "/tmp/pip-build-env-e4fo917j/lib/python3.7/site-packages/setuptools/installer.py", line 128, in fetch_build_egg
        subprocess.check_call(cmd)
      File "/usr/lib/python3.7/subprocess.py", line 347, in check_call
        raise CalledProcessError(retcode, cmd)
    subprocess.CalledProcessError: Command '['/usr/bin/python', '-m', 'pip', '--disable-pip-version-check', 'wheel', '--no-deps', '-w', '/tmp/tmpgp2s1vb0', '--quiet', 'blis<0.5.0,>=0.4.0']' returned non-zero exit status 1. …
Run Code Online (Sandbox Code Playgroud)

python arm python-3.x raspberry-pi spacy

2
推荐指数
1
解决办法
1605
查看次数

如何填充空心线opencv

我有这样的图像: 在此处输入图片说明

在我应用了一些处理之后,例如cv2.Canny(),它现在看起来像这样: 在此处输入图片说明

如您所见,黑线变为空心。我试过腐蚀和膨胀,但如果我多次这样做,两个入口将被关闭(意味着成为连接线或封闭轮廓)。

我怎样才能使这些线条像下图一样牢固,同时保持 2 个入口不受影响?

在此处输入图片说明


更新 1

我已经用几张照片测试了以下答案,但代码似乎是定制的,只能处理这张特定的图片。由于 SOF 的限制,我不能上传大于 2MB 的照片,所以我将它们上传到我的 Microsoft OneDrive 文件夹中,以方便您测试。

https://1drv.ms/u/s!Asflam6BEzhjgbIhgkL4rt1NLSjsZg?e=OXXKBK

更新 2

我拿起@fmw42 的帖子作为答案,因为他的答案是最详细的。它没有回答我的问题,但指出了处理迷宫的正确方法,这是我的最终目标。我喜欢他的回答问题的方法,首先告诉您每个步骤应该做什么,以便您对如何完成任务有一个清晰的想法,然后从头到尾提供完整的代码示例。很有帮助。

由于SOF的限制,我只能挑出一个答案。如果允许多个答案,我也会选择 Shamshirsaz.Navid 的答案。他的回答不仅指出了解决问题的正确方向,而且形象化的解释对我来说真的很管用~!我想它对所有试图理解为什么需要每一行代码的人都同样有效。他也在评论中跟进了我的问题,这使得 SOF 有点互动:)

Ann Zen 的回答中的 Threshold track bar 也是一个非常有用的提示,可以帮助人们快速找到最佳值。

python opencv image-processing opencv-contour opencv-python

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

为什么services.AddDbContext &lt;dbContext&gt;()使dbContext成为作用域服务?应该不是Singleton服务?

我正在将ASP.NET Core 2.2与Pomelo.EntityFramework.MySql一起使用。

这是我的代码:

 services.AddDbContext<dbContext>(options => options.UseMySQL(appConfigsSection["DbConnectionString"]));
 services.AddSingleton<IUserService, UserService>();


 services.AddAuthentication(x =>
            {
                x.DefaultAuthenticateScheme = JwtBearerDefaults.AuthenticationScheme;
                x.DefaultChallengeScheme = JwtBearerDefaults.AuthenticationScheme;
            })
            .AddJwtBearer(x=> {
                x.Events = new JwtBearerEvents
                {
                    OnTokenValidated = context =>
                    {
                        var userService = context.HttpContext.RequestServices.GetRequiredService<IUserService>();       
                    }
                };
Run Code Online (Sandbox Code Playgroud)

这是错误:

asp.net核心无法使用单例的作用域服务

在:

 var userService = context.HttpContext.RequestServices.GetRequiredService<IUserService>(); 
Run Code Online (Sandbox Code Playgroud)

我的理解是DBContext应该用作Singleton服务,IUserService也应该用作。但是似乎DBContext被视为范围服务。

通过将IUserService切换回作用域服务,可以轻松修复它。但是我想知道为什么不能将DBContext用作单一服务吗?

我认为DBContext应该用作Singleton服务,对吗?

这里

c# entity-framework entity-framework-core asp.net-core

0
推荐指数
1
解决办法
171
查看次数

检测图像上的迷宫位置

我正在尝试从照片中找到迷宫的位置。

我想得到的是迷宫角落的 (x,y) 点。

正如你所看到的,我cv2.Canny()对图片进行了应用,并得到了一个非常漂亮干净的图像作为开始。

在此处输入图片说明

所以下一步就是定位迷宫。

我已经搜索了一段时间,所有 SOF 问题都要求找到“完美”矩形的位置,例如这个这个 但在我的情况下,矩形没有闭合轮廓,因此它们的代码不起作用就我而言。

也看过 OpenCV 代码,他们都试图找到轮廓并将这些轮廓绘制到图像上,但它对我不起作用。我刚刚得到了 1 个大轮廓,它单独出现在我照片的边界上。

cnts = cv2.findContours(thresh, cv2.RETR_EXTERNAL, cv2.CHAIN_APPROX_SIMPLE)      
cnts = imutils.grab_contours(cnts)
Run Code Online (Sandbox Code Playgroud)

更新 1

原始照片: 在此处输入图片说明

代码:

import cv2
from PIL import Image
from matplotlib import pyplot as plt
import numpy as np
import imutils

img = cv2.imread('maze.jpg')
img = cv2.cvtColor(img, cv2.COLOR_BGR2RGB)

edges = cv2.Canny(img,100,200)


f,axarr = plt.subplots(1,2,figsize=(15,15))

axarr[0].imshow(img)
axarr[1].imshow(edges)

plt.show()
Run Code Online (Sandbox Code Playgroud)

python opencv maze image-processing opencv-python

0
推荐指数
1
解决办法
121
查看次数

如何在对扭曲或光线不敏感的情况下从照片中定位和提取迷宫

我一直在问几个关于从 SOF 上的照片中定位和提取迷宫的问题,但是我在不同的照片中得到的答案都没有,甚至在 4 张测试照片中也没有。每次我调整代码以使其适用于 1 张照片时,由于扭曲的角落/部分或光线等,它会在其余照片上失败。我觉得我需要找到一种对扭曲图像不敏感且不同的方法光的强度或迷宫墙壁的不同颜色(迷宫内的线条)。

我一直试图让它在没有运气的情况下工作 3 周。在我放弃这个想法之前,我想问一下是否可以只使用没有 AI 的图像处理来从照片中定位和提取迷宫?如果是的话,你能告诉我怎么做吗?

下面是代码和照片:

import cv2    
import numpy as np

from skimage.exposure import rescale_intensity
from skimage.feature import corner_harris, corner_subpix, corner_peaks
from skimage.io import imread, imshow
from skimage.morphology import reconstruction, binary_erosion, skeletonize, dilation, square
from skimage.morphology.convex_hull import convex_hull_image
from skimage.util import invert
from skmpe import parameters, mpe, OdeSolverMethod

maze=cv2.imread("simple.jpg",0)
ret, maze=cv2.threshold(maze,100,255,cv2.THRESH_BINARY+cv2.THRESH_OTSU)
h, w = maze.shape
seed = np.zeros_like(maze)
size = 40
hh = h // 2
hw = w // 2
seed[hh-size:hh+size, …
Run Code Online (Sandbox Code Playgroud)

python opencv image-processing scikit-image

0
推荐指数
1
解决办法
66
查看次数