小编Pau*_*ton的帖子

PHPDocumentor 2和PHP 7与Doctrine中的opcache问题

希望有人在这里知道一件事或两件事.

简短的问题

我在命令行上使用phpdoc遇到错误,在PHP 7.0.2上通过pear安装.错误是:

#> phpdoc
PHP Fatal error:  Uncaught Doctrine\Common\Annotations\AnnotationException: 
You have to enable opcache.load_comments=1 or zend_optimizerplus.load_comments=1. 
in /usr/local/php5-7.0.2-20160108-102134/lib/php/phpDocumentor/vendor/doctrine/annotations/lib/Doctrine/Common/Annotations/AnnotationException.php:193
Run Code Online (Sandbox Code Playgroud)

我该如何解决这个错误?

细节

Opcache已启用并opcache.load_comments=1位于我的opcache.ini文件中,分别使用命令:php -i | grep "Opcode"和验证php -i | grep "opcache".在该.ini文件中,我可以通过检查启用并通过该文件禁用opcache来验证是否加载了更改.

话虽如此,如果我opcache.load_comments=1在我的.ini文件中,为什么我仍然会收到此错误?

谢谢!

php phpdoc opcache phpdocumentor2 php-7

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

PyMySQL和OrderedDict

我一直在使用PyMySQL一段时间,并创建了我自己的包装器,我习惯于简写编写查询.尽管如此,我一直在使用OrderedDict创建CSV文件,因为我需要保持顺序相同但我意识到如果我使用PyMySQL来查询数据库,我将无法得到数据库回馈的顺序.如果我只想转储东西而不是手写订单,这对于检查CSV文件有点烦人.

我的问题是,如何将PyMySQL与OrderedDict一起使用?目前我的代码如下:

import pymysql
conn = pymysql.connect(host='localhost', user='root', passwd='', db='test')
cursor = conn.cursor(pymysql.cursors.DictCursor)
Run Code Online (Sandbox Code Playgroud)

所以每当我查询时,我都会收到一本字典:

cursor.execute("""SELECT * FROM test""")
for row in cursor:
    pp(row)  # gives me dictionary
Run Code Online (Sandbox Code Playgroud)

我想要的是,当我浏览游标时,我实际上是按照它们从数据库中进入的顺序检索列的OrderedDict.

就像是:

cursor = conn.cursor(pymysql.cursors.OrderedDict)
Run Code Online (Sandbox Code Playgroud)

python python-2.7 pymysql

10
推荐指数
1
解决办法
1490
查看次数

EF Core 存储过程 FromSqlRaw 不提供更新值

当使用FromSqlRaw更新表中的值在EF Core 3 上运行过程时,当我查询数据库中的那些更改的值时,EF不会返回更新的值。

我已经能够重现这种行为。要使用 .net core 3.1 重现创建一个新的控制台应用程序 c#。

将下面的代码复制粘贴到您的主 Program.cs 文件中:

using System;
using System.Linq;
using Microsoft.Data.SqlClient;
using Microsoft.EntityFrameworkCore;

namespace EfCoreTest
{
    class Program
    {
        static void Main(string[] args)
        {
            Console.WriteLine("Hello World!");

            // testing proc
            var dbContext = new TestContext();
            var tables = dbContext.TestTables.ToList();
            var updated = dbContext.TestTables
                .FromSqlRaw("execute testProc @Id=@Id, @Comments=@Comments", new object[]
                {
                    new SqlParameter("Id", 1),
                    new SqlParameter("Comments", "testing comments 2"),
                })
                .ToList();
            var again = dbContext.TestTables.ToList();
        }
    }


    public class TestTable …
Run Code Online (Sandbox Code Playgroud)

sql-server stored-procedures entity-framework-core ef-core-3.1

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

身份ASP.NET Core 3.0-找不到IdentityDbContext

我的应用打破了.NET core的3.0版本,并带有的参考错误IdentityDbContext。我正在浏览核心3.0上的Identity的文档,但这意味着IdentityDbContext应该存在。这是我遇到的仅有的几个DbContext错误。

我有一个非常简单的API,没有MVC视图,只有一个返回JSON对象的数据服务器。它基于身份,因此具有用户,角色和声明。它开始利用这一优势。我的主要DbContext进行了扩展,IdentityDbContext<ApplicationUser>但是在升级后将目标平台切换到3.0之后,它说它不存在,并给了我编译错误。有人碰到这个吗?我想念什么吗?迁移和重大更改页面似乎无法解决我的问题。

DbContext看起来像这样:

using System;
using Microsoft.AspNetCore.Identity;
//using Microsoft.AspNetCore.Identity.EntityFrameworkCore; <- this no longer works either
using Microsoft.EntityFrameworkCore; //<- this I had to download as a package
using App.Constants;
using App.Models.Identity;

namespace App.Models
{
    public class AppContext : IdentityDbContext<ApplicationUser> //<- error is right here
    {
        ... my models
    }
}
Run Code Online (Sandbox Code Playgroud)

c# asp.net-core asp.net-core-3.0

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

Rand()在perl中不是那么随意

我有一个Perl脚本,它给了我一个50个字符的随机数字,字母和一些特殊字符串.我正在数据库中输入它们.现在,考虑到字符串的长度和字符数量,我不认为可以轻松创建重复项.

这是创建字符串的漂亮代码块:

my $random_id='';
my @c = ( "A" .. "Z", "a" .. "z", 0 .. 9, qw(! @ $ % ^ & *) );
$random_id = join '', map $c[rand @c] , 1 .. 50;
Run Code Online (Sandbox Code Playgroud)

它产生如下字符串:

C1Qt8L7E7QUD%lkxnh9yjZ2njF0iMj!1O ^ 4DmTbVNhQB9%DKE @

问题是它会在唯一的字符串中复制一次精确的字符串,而在某些字符串上复制一次.这是20个字符串.这很奇怪.我可以解决它并找到解决方案......但这让我感到困惑.想知道为什么.有人有想法吗?

random perl

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

Typescript Google API 编译错误

我正在使用 Typescript、tslint 和 Google API,但是在将 typescript 编译为 javascript 时出现问题,我不确定为什么,出于某种原因,我在网上找不到有关此问题的任何具体信息。谷歌搜索不会产生好的结果。我也找不到一个很好的例子来说明你的 tsconfig 应该如何使用这个库进行设置。所以我来这里。

当我运行tsc.

我的文件实际上就是这一行:

import {google} from 'googleapis'

就是这样。

当我运行tsc它给我这些错误:

$ tsc
node_modules/gaxios/build/src/common.d.ts:1:23 - error TS2688: Cannot find type definition file for 'node'.

1 /// <reference types="node" />
                        ~~~~

node_modules/gaxios/build/src/common.d.ts:3:23 - error TS2307: Cannot find module 'https'.

3 import { Agent } from 'https';
                        ~~~~~~~

node_modules/google-auth-library/build/src/auth/authclient.d.ts:16:23 - error TS2688: Cannot find type definition file for 'node'.

16 /// <reference types="node" />
                         ~~~~

node_modules/google-auth-library/build/src/auth/authclient.d.ts:17:30 - error TS2307: Cannot …
Run Code Online (Sandbox Code Playgroud)

google-api node.js typescript

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

使用 Azure Pipeline 任务进行 EF 迁移

在我看来,使用带有任务的 yaml 构建管道运行迁移并不直接,因为当我尝试创建运行dotnet ef迁移的任务时,出现以下错误。

==============================================================================
Task         : PowerShell
Description  : Run a PowerShell script on Linux, macOS, or Windows
Version      : 2.151.1
Author       : Microsoft Corporation
Help         : https://learn.microsoft.com/azure/devops/pipelines/tasks/utility/powershell
==============================================================================
Generating script.
========================== Starting Command Output ===========================
##[command]"C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe" -NoLogo -NoProfile -NonInteractive -ExecutionPolicy Unrestricted -Command ". 'C:\agent\_work\_temp\a2cda363-57d3-416e-80ae-fb82a650ff74.ps1'"
Could not execute because the specified command or file was not found.
Possible reasons for this include:
  * You misspelled a built-in dotnet command.
  * You intended to execute a .NET Core …
Run Code Online (Sandbox Code Playgroud)

powershell entity-framework .net-core azure-devops azure-pipelines

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

adobe acrobat dc 文档级 javascript

当然,当我搜索论坛、搜索谷歌搜索结果时,所有答案都是针对以前版本的 adobe acrobat,然后他们决定更改所有内容。我找不到可以在 Adob​​e Acrobat Pro DC 中插入文档级 javascript 的位置。不再有“工具”或“高级”菜单,这几乎是我迄今为止看到的所有答案。这里有人知道如何在 Adob​​e Acrobat Pro DC 中快速将文档级 JavaScript 添加到 pdf 中,以便我可以添加可以在任何地方调用的全局函数并分配这些函数所使用的一些全局数据吗?

谢谢你!!

javascript pdf adobe acrobat

5
推荐指数
1
解决办法
3972
查看次数

在 angularjs 组件中使用 Bootstrap 网格

我基本上要做的是将网格元素 div 包装成角度组件。努力是减少打字笔画并获得输入标准:

<bootstrap-row>
   <bootstrap-input-text col=6 ng-model="$ctrl.model" label="hey!">
</bootstrap-row>
Run Code Online (Sandbox Code Playgroud)

这将呈现如下内容

<div class="row">
   <div class="col-md-6">
       <label>hey!</label>
       <input type="text" ng-model="$ctrl.model">
    </div>
</div>
Run Code Online (Sandbox Code Playgroud)

它有效,有点。javascript 与模型绑定一起工作得很好,只是 CSS 被破坏了。我在这里有一个代码打开:https ://codepen.io/anon/pen/JmxmoY ? editors = 1111

它与浏览器如何呈现<bootstrap-input-text>行 div 和列 div 之间的内容有关。如果我打开了开发工具和检查的区别<bootstrap-row>和<bootstrap-input-text>,有没有。有没有办法解决这个问题,或者我是SOL?

html javascript css angularjs bootstrap-4

5
推荐指数
1
解决办法
948
查看次数

Php Destruct被称为两次

下面的代码说明了两次调用destruct().我想知道为什么?

class A {
    function hi(){ echo 'hi'; }
    function __destruct(){
        echo 'destroy';
    }
}
class B{
    public $this_ = '';
    function __construct(){
        $this->this_ = new A;
    }
    function __call($method, $params) {
          return call_user_func_array(array($this->this_, $method), $params);
    }
}

$b = new B;
$b->__destruct();
Run Code Online (Sandbox Code Playgroud)

输出:

destroydestroy
Run Code Online (Sandbox Code Playgroud)

编辑

zneak和TomcatExodus都是正确的.如果我只是:

[..code..]
$b = new B;
$b->__destruct();
print 'end of script';
Run Code Online (Sandbox Code Playgroud)

输出将显示:

destroyend of scriptdestroy
Run Code Online (Sandbox Code Playgroud)

php oop destructor

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

使用 Blazor Asp.Net Core 的 Bootstrap 模态弹出窗口

我正在使用 asp.net core 6.0 开发 blazor,我面临着打开引导弹出模式的问题。当我单击模式按钮时,它不显示任何模式弹出窗口。还要检查检查元素是否没有模态 html 的迹象。我在布局上添加了 bootstrap css。附上参考网址。

链接在这里

这是我的实现

页

<BlazorTaskItems.Pages.Modal @ref="modal"></BlazorTaskItems.Pages.Modal>
<button class="btn btn-primary" @onclick="() => modal.Open()">Modal!</button>
Run Code Online (Sandbox Code Playgroud)
@code {

private BlazorTaskItems.Pages.Modal modal { get; set; }

}
Run Code Online (Sandbox Code Playgroud)

成分

<div class="modal @modalClass" tabindex="-1" role="dialog" style="display:@modalDisplay; overflow-y: auto;">
    <div class="modal-dialog modal-lg" role="document">
        <div class="modal-content">
            <div class="modal-header">
                <h5 class="modal-title">@Title</h5>
                <button type="button" class="close" data-dismiss="modal" aria-label="Close" @onclick="Close">
                    <span aria-hidden="true">&times;</span>
                </button>
            </div>
            <div class="modal-body">
                @Body
            </div>
            <div class="modal-footer">
                @Footer
            </div>
        </div>
    </div>
</div>

@if (showBackdrop)
{
        <div class="modal-backdrop fade show"></div>
}

Run Code Online (Sandbox Code Playgroud)
@code …
Run Code Online (Sandbox Code Playgroud)

asp.net-core blazor

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

模拟 Context.ConnectionId 以进行单元测试 Signalr .NetCore 消息中心

我的问题是,当我在 .Net CORE 中对 Signalr 集线器进行单元测试时,获取 context.connection ID 值插入我的方法之一。我的方法在我的测试类中如下所示:


    [Fact]
    public async Task TestWorkstationCreation()
    {
        Mock<IHubCallerClients<IWorkstation>> mockClients = new Mock<IHubCallerClients<IWorkstation>>();
        Mock<IWorkstation> mockClientProxy = new Mock<IWorkstation>();
        mockClients.Setup(clients => clients.All).Returns(mockClientProxy.Object);
        _workstationHub.Clients = mockClients.Object;
        await _workstationHub.RegisterWorkstation("WKS16", "Ready", new Dictionary<string, string> {{"OS", "Windows 10"}, {"Exam", "GRE, TOEFL"}});
        mockClientProxy.Verify(c => c.WorkstationRegistered(It.IsAny<WorkstationDataModel>(), It.IsAny<string>()), Times.AtLeastOnce);
    }
Run Code Online (Sandbox Code Playgroud)

在我的集线器类中,这是方法:

    public async Task RegisterWorkstation(string id, string status, Dictionary<string, string> capabilities)
    {
        _logger.LogInformation(
            "Registering a Workstation with id: {id}, status: {status}, and capabilities: {capabilities}",
            id, status, string.Join(",", capabilities));
        var workstationAdded = …
Run Code Online (Sandbox Code Playgroud)

xunit signalr .net-core asp.net-core asp.net-core-signalr

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