当我收到以下消息时,我正在使用Android工作室(在Mac上):
错误:无法从'/Users/Friso/.gradle/daemon/2.2.1/registry.bin'读取缓存值.
我不知道是什么导致它,因为我没有对构建文件做任何事情.
我怎样才能解决这个问题?
我不得不将我的项目从.NET Core 2.1更改为.NET 4.7.1并且我修复了几乎所有错误,除了以下仍然无法解决的错误
'IApplicationBuilder'不包含'UseHsts'的定义,也没有扩展方法'UseHsts'接受类型'IApplicationBuilder'的第一个参数(你是否缺少using指令或汇编引用?)
'IApplicationBuilder'不包含'UseAuthentication'的定义,并且没有扩展方法'UseAuthentication'可以找到接受类型'IApplicationBuilder'的第一个参数(你是否缺少using指令或汇编引用?)
'IApplicationBuilder'不包含'UseCookiePolicy'的定义,并且没有可以找到接受类型'IApplicationBuilder'的第一个参数的扩展方法'UseCookiePolicy'(你是否缺少using指令或程序集引用?)
'IApplicationBuilder'不包含'UseHttpsRedirection'的定义,并且没有可以找到接受类型'IApplicationBuilder'的第一个参数的扩展方法'UseHttpsRedirection'(你是否缺少using指令或程序集引用?)
'IApplicationBuilder'不包含'UseSession'的定义,并且没有可以找到接受类型'IApplicationBuilder'的第一个参数的扩展方法'UseSession'(你是否缺少using指令或汇编引用?)
'IApplicationBuilder'不包含'UseStaticFiles'的定义,也没有扩展方法'UseStaticFiles'接受类型'IApplicationBuilder'的第一个参数(你是否缺少using指令或汇编引用?)
'IServiceCollection'不包含'AddAuthentication'的定义,并且没有扩展方法'AddAuthentication'可以找到接受类型'IServiceCollection'的第一个参数(你是否缺少using指令或程序集引用?)
'IServiceCollection'不包含'AddSession'的定义,并且没有扩展方法'AddSession'可以找到接受类型'IServiceCollection'的第一个参数(你是否缺少using指令或汇编引用?)
我正在使用Microsoft.AspNetCore.Builder和Microsoft.Extensions.DependencyInjection.我需要使用/安装/添加什么来获取IApplicationBuilder和IServiceCollection工作?
在我的WebApi.csproj文件中,我将目标框架从netcoreapp2.1更改为net471.
旧:
<PropertyGroup>
<TargetFramework>netcoreapp2.1</TargetFramework>
</PropertyGroup>
Run Code Online (Sandbox Code Playgroud)
新:
<PropertyGroup>
<TargetFramework>net471</TargetFramework>
</PropertyGroup>
Run Code Online (Sandbox Code Playgroud) 我正在尝试学习如何使用Ruby编程,我想为单独的类创建单独的文件,但是当我这样做时,我得到以下消息:
NameError:未初始化的常量
在org/jruby/RubyModule.java上预订const_missing:2677(root)at /Users/Friso/Documents/Projects/RubyApplication1/lib/main.rb:1
但是,如果我将类直接放入主文件中,它就可以工作.我怎么解决这个问题?
主要代码:
book1 = Book.new("1234", "Hello", "Ruby")
book2 = Book.new("4321", "World", "Rails")
book1.to_string
book2.to_string
Run Code Online (Sandbox Code Playgroud)
班级代码:
class Book
def initialize(isbn,title,author)
@book_isbn=isbn
@book_title=title
@book_author=author
end
def to_string
puts "Title: #@book_title"
puts "Author: #@book_author"
puts "ISBN: #@book_isbn"
end
end
Run Code Online (Sandbox Code Playgroud) 我正在尝试查找实体,但是当实体框架尝试获取 Null 字段的值时,我收到了 SqlNullValueException。
我检查了数据库,并填充了所有不可为空的字段。唯一具有 NULL 值的字段是允许拥有它的字段。
在其他答案中,我发现我应该从类属性中删除 required 属性或从模型构建器定义中删除 IsRequired 方法,但是我自动生成了这些并且它们从来没有必需的定义。
我的应用程序在 .NET Core 3.1 上运行,而我的 EntityFrameworkCore 版本是 2.2.4。即使它成功构建,这是否会导致问题?更新现在所有版本都是 3.1。
如果不是,还有什么可能导致它?
要查找实体,我使用以下方法:
public static CodeLists FindCodeListById(Guid id)
{
using (var context = new classificatielocalContext())
{
return context.CodeLists.Find(id);
}
}
Run Code Online (Sandbox Code Playgroud)
但是,我收到以下异常:
System.Data.SqlTypes.SqlNullValueException
HResult=0x80131931
消息=数据为空。不能对 Null 值调用此方法或属性。
源 = System.Data.Common
堆栈跟踪:
在
System.Data.SqlTypes.SqlGuid.get_Value()在
System.Data.SqlClient.SqlDataReader.GetGuid(Int32 i)在
Microsoft.EntityFrameworkCore.Storage.Internal.TypedRelationalValueBufferFactory.Create(DbDataReader dataReader)在
Microsoft.EntityFrameworkCore.Query.Internal.QueryingEnumerable1.Enumerator.BufferlessMoveNext(DbContext _, Boolean buffer)`在
Microsoft.EntityFrameworkCore.SqlServer.Storage.Internal.SqlServerExecutionStrategy.Execute[TState,TResult](TState state, Func3 操作时,Func3 verifySucceeded)在
Microsoft.EntityFrameworkCore.Query.Internal.QueryingEnumerable1.Enumerator.MoveNext()`在
System.Linq.Enumerable.TryGetFirst[TSource](IEnumerable1 …
c# sql-server entity-framework entity-framework-core .net-core
我试图在卸载组件之前调用我自己创建的post方法,但它不起作用.
我在@HostListener上放了一个断点,当我打开另一个组件时它不会中断.
我正在使用Chrome进行调试,并且我打开了事件侦听器断点以进行卸载和beforeunload,这在我打开其他组件时会中断.
我在代码中遗漏了什么吗?
import { Component, OnInit, HostListener } from '@angular/core';
Component({
templateUrl: 'new-component.html'
})
export class NewComponent implements OnInit {
@HostListener('window:beforeunload') onBeforeUnload() {
PostCall();
}
}
Run Code Online (Sandbox Code Playgroud) 我已经在https://gamedev.stackexchange.com/questions/50374/how-can-i-render-multiple-windows-with-directx-9-in-c 上问过这个问题,但我还没有收到回答。
我正在尝试使用 DirectX 9 和交换链渲染多个窗口,但即使我创建了 2 个窗口,我也只能看到我创建的第一个窗口。我的 RendererDX9 标题是这样的:
#include <d3d9.h>
#include <Windows.h>
#include <vector>
#include "RAT_Renderer.h"
namespace RAT_ENGINE
{
class RAT_RendererDX9 : public RAT_Renderer
{
public:
RAT_RendererDX9();
~RAT_RendererDX9();
void Init(RAT_WindowManager* argWMan);
void CleanUp();
void ShowWin();
private:
LPDIRECT3D9 renderInterface; // Used to create the D3DDevice
LPDIRECT3DDEVICE9 renderDevice; // Our rendering device
LPDIRECT3DSWAPCHAIN9* swapChain; // Swapchain to make multi-window rendering possible
WNDCLASSEX wc;
std::vector<HWND> hwindows;
void Render(int argI);
};
}
Run Code Online (Sandbox Code Playgroud)
我的 .cpp 文件是这样的:
#include "RAT_RendererDX9.h"
static LRESULT CALLBACK …Run Code Online (Sandbox Code Playgroud) 我目前在我的 HTML 中有以下行:
<p> this is my first line </p>
Run Code Online (Sandbox Code Playgroud)
使用包装器指令,我想添加第二个段落并将其包装在一个 div 中,因此它看起来像这样:
<p wrapper> this is my first line </p>
Run Code Online (Sandbox Code Playgroud)
然后指令将添加包装器和第二行,使最终的 HTML 看起来像这样:
<div>
<p> this is my first line </p>
<p> this is my second </p>
</div>
Run Code Online (Sandbox Code Playgroud)
根据我从angular.io 的理解,我需要创建一个结构指令并使用 TemplateRef 和 ViewContainerRef,但我找不到有关如何使用它们来包装 dom 的现有部分并添加第二行的示例.
我在这个项目中使用 Angular 5。
我正在Angular中进行表单验证,并且在阅读API时遇到了nullValidator。它说它是一个“验证程序,不执行任何操作。”在我看来,它是一个验证程序,实际上不执行任何操作。当我在github上检查代码时,这是正确的。它只是返回null。
所以我的问题是,为什么nullValidator存在?它有什么作用?
我正在研究的系统已经制作了自己的引用计数单元,但它与Delphi相互冲突.我试图让它与编译器条件兼容,但我仍然遇到了一些我认为可能导致的错误,因为ARC仍然存在.
我在 Node.js 服务器上工作,连接到 MongoDB 并用 TypeScript 编写。当我尝试使用 MongoDB 时,它不会创建连接,但是当我检查 mongo 输出时,它似乎确实创建了连接。
我在代码中缺少什么来定义 Node.js 中的连接?
我的连接字符串是 'mongodb://localhost:27017'
我的连接方法:
connect() {
console.log('connecting to mongo') //this is called
MongoClient.connect(this.connectionString, {useNewUrlParser: true})
.then(client => {
console.log('setting client'); //this doesn't get called
this.client = client;
console.log(this.client);
})
.catch(error => {
console.log('error during connecting to mongo: '); //this also doesn't get called
console.error(error);
});
}
Run Code Online (Sandbox Code Playgroud)
蒙戈输出:
2018-11-08T23:06:24.106+0100 I NETWORK [listener] 连接从 127.0.0.1:51345 #11 接受(现在打开 2 个连接)
2018-11-08T23:06:24.107+0100 I NETWORK [conn11] 从 127.0.0.1:51345 conn11: { driver: { …
angular ×3
c# ×2
.net-core ×1
angular5 ×1
asp.net ×1
asp.net-core ×1
build ×1
c++ ×1
debugging ×1
delphi ×1
delphi-xe7 ×1
directx-9 ×1
dom ×1
downgrade ×1
html ×1
mongodb ×1
node.js ×1
ruby ×1
sql-server ×1
typescript ×1
validation ×1
window ×1