小编Ido*_*dov的帖子

在C++中将对成员的引用初始化为NULL

是否可以在c ++中将引用成员初始化为NULL?
我正在尝试这样的事情:

class BigClass
{
private:
  Object m_inner;
public:
  const Object& ReadOnly;
  BigClass() : ReadOnly(NULL)
  {
    Do stuff.
  }
};
Run Code Online (Sandbox Code Playgroud)

我知道我能做到这一点,如果我初始化"只读"到对象的实际的参考,但是当我想摆在那里"NULL",我得到的错误:

"无法从'int'转换为'const Object&'

我怎么解决这个问题?

c++ reference initialization-list

20
推荐指数
4
解决办法
4万
查看次数

条件"可浏览"属性


有没有办法使"可浏览"属性成为条件,因此应用它的属性有时会出现在属性页面中,有时不会出现?
谢谢 :)

c# conditional properties browsable

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

EXE或DLL映像基址

有没有办法在C++/windows中获取exe/DLL映像基址?谢谢 :)

c++ windows base-address portable-executable

14
推荐指数
4
解决办法
3万
查看次数

rollup.JS和"'this'关键字相当于'undefined'

我正在尝试使用Rollup.js捆绑Angular2模块.这是我的rollup.config.vendor.js文件:

import typescript from 'rollup-plugin-typescript2';
import resolve from 'rollup-plugin-node-resolve';
import commonjs from 'rollup-plugin-commonjs';

export default {
    entry: 'vendor.ts',
    dest: './Bundle/vendor.js',
    format: 'iife',
    moduleName: 'vendor',
    plugins: [
        typescript(),
        resolve({
            jsnext: true,
            main: true,
            browser: true
        }),
        commonjs({
            include: 'node_modules/rxjs/**',
        }),
    ]
}
Run Code Online (Sandbox Code Playgroud)

它创建了一个捆绑的js,但在这个过程中它会不断打印这种消息:

The 'this' keyword is equivalent to 'undefined' at the top level of an ES module, and has been rewritten
https://github.com/rollup/rollup/wiki/Troubleshooting#this-is-undefined
node_modules\@angular\forms\@angular\forms.es5.js (1:25)
1: var __extends = (this && this.__extends) || function (d, b) {
                            ^
2:     for (var …
Run Code Online (Sandbox Code Playgroud)

javascript rollupjs angular

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

从RVA获取文件偏移量

我正在尝试读取PE文件.
问题是数据使用RVA指针,而我需要在文件中偏移
以获得我需要的东西.如何将RVA转换为文件中的偏移量?

64-bit portable-executable

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

实体框架DbContext和线程安全

我需要在单个事务中更新我的数据库中的几个表,并且我认为使用DbContext.SaveChanges应该是这样做的方法.

但是我还读到,它的生命周期DbContext应该尽可能短,因为它会随着时间的推移而增加,因为它会加载更多的实体.

我还读到,为了使其成为线程安全的,每个动作都应该有自己的DbContext.

我应该有一个DbContext,因为我想改变,并呼吁每个表SaveChanges上的每一个DbContext?最后一次SaveChanges通话是否会覆盖之前通话的更改?

最好的方法是什么?(我需要这个网站)

c# asp.net-mvc multithreading entity-framework

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

使用RollUp捆绑打字稿 - 无法处理编译器选项

我正在尝试捆绑我的打字稿文件RollUp(https://rollupjs.org/)
我使用了这个配置文件:

rollup.config.js:

import alias from 'rollup-plugin-alias';
import resolve from 'rollup-plugin-node-resolve';
import typescript from 'rollup-plugin-typescript';
import angular from 'rollup-plugin-angular';

export default {
    entry: '../main.ts',
    format: 'iife',
    dest: 'dist/bundle.es2015.js',
    sourceMap: true,
    plugins: [
        angular(),
        typescript(),
        alias({ rxjs: __dirname + '/node_modules/rxjs-es' }),
        resolve({
            jsnext: true,
            main: true,
            browser: true
        })
    ],
    external: [
        '@angular/core',
        '@angular/common',
        '@angular/compiler',
        '@angular/core',
        '@angular/http',
        '@angular/platform-browser',
        '@angular/platform-browser-dynamic',
        '@angular/router',
        '@angular/router-deprecated'
    ],
    globals: {
        '@angular/common': 'vendor._angular_common',
        '@angular/compiler': 'vendor._angular_compiler',
        '@angular/core': 'vendor._angular_core',
        '@angular/http': 'vendor._angular_http',
        '@angular/platform-browser': 'vendor._angular_platformBrowser',
        '@angular/platform-browser-dynamic': 'vendor._angular_platformBrowserDynamic',
        '@angular/router': 'vendor._angular_router',
        '@angular/forms': …
Run Code Online (Sandbox Code Playgroud)

javascript bundler typescript rollupjs

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

Angular5-TypeScript编译中缺少文件

我有一个file.ts文件,它不包含组件/服务/等,而只是一种数据类型。

当我尝试编译程序时,出现以下错误:模块构建失败:错误:TypeScript编译中缺少我的path \ File.ts。请通过“文件”或“包含”属性确保它在您的tsconfig中。

然后,我将tsconfig.app.json文件更改为包含include标记:

{
  "extends": "../tsconfig.json",
  "compilerOptions": {
    "outDir": "../out-tsc/app",
    "baseUrl": "./",
    "module": "es2015",
    "types": []
  },
  "include": [
        "**/*.ts"
    ],
  "exclude": [
    "**/*.spec.ts"
  ]
}
Run Code Online (Sandbox Code Playgroud)

如提示信息所示,但出现此错误:

错误TS18003:在配置文件“ tsconfig.json”中找不到输入。指定的“包含”路径为“ [[src / ** / *。ts“]],“排除”路径为“ [” ** / *。spec.ts“]”。

我究竟做错了什么?

tsconfig angular

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

PE Header 的大小

有没有办法在不阅读所有内容或整个文件的情况下找出 PE 标头的大小?

windows portable-executable

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

.NET Core 在处理 HTTPS 证书时出现未知错误

我正在尝试构建一个使用 HTTPS 连接的 .NET Core 服务器。

我使用工具创建了一个自签名证书dotnet dev-certs并设置了 Kestrel,如下所示:

    return WebHost.CreateDefaultBuilder(args)
                    .UseKestrel(options =>
                    {
                        options.Listen(IPAddress.Loopback, 5000, lisOpt => lisOpt.UseHttps("myCert.pfx", "test"));
                    })
                  .UseStartup<Startup>()
                .Build();
Run Code Online (Sandbox Code Playgroud)

但是当我尝试与我的客户端连接时,我不断收到此异常:

fail: Microsoft.AspNetCore.Server.Kestrel[0]
      Uncaught exception from the OnConnectionAsync method of an IConnectionAdapter.
System.Security.Authentication.AuthenticationException: Authentication failed, see inner exception. ---> System.ComponentModel.Win32Exception: An unknown error occurred while processing the certificate
   --- End of inner exception stack trace ---
   at System.Net.Security.SslState.StartSendAuthResetSignal(ProtocolToken message, AsyncProtocolRequest asyncRequest, ExceptionDispatchInfo exception)
   at System.Net.Security.SslState.CheckCompletionBeforeNextReceive(ProtocolToken message, AsyncProtocolRequest asyncRequest)
   at System.Net.Security.SslState.StartSendBlob(Byte[] incoming, Int32 count, AsyncProtocolRequest asyncRequest) …
Run Code Online (Sandbox Code Playgroud)

ssl ssl-certificate .net-core kestrel-http-server

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