小编moh*_*sen的帖子

如何使用jquery检查是否隐藏了一个元素

我想显示和隐藏一个div如下:

$('#Div1').click(function () {
            if ($("#Div2").hidden) {
                $("#Div2").show(500);
            }
            else {
                $("#Div2").hide(1000);
            }

        });
Run Code Online (Sandbox Code Playgroud)

这段代码不起作用.

我想通过点击页面的空白来隐藏div2我该怎么做以及我的代码在哪里错了?

html javascript jquery

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

在 chrome 下载列表中打开 apk 没有打开 apk 安装程序

我有一个 QtQuick2 应用程序。我用 Qt 5.15.1 的发布配置为 android 构建它(带签名),

当我用 chrome 下载 Apk 并在 chrome 上的下载列表中单击它时,它应该用安装程序打开,但它会用文件资源管理器打开 我的许多用户说它将用 UnZip Apps 打开。我没有这个问题使用 Qt 5.12,自从我安装 Qt 5.15 后就发现了这个问题。

当我在文件资源管理器(在 Android 上)上单击此文件时,没有问题,它将使用 Apk 安装程序打开。如何解决问题?

apk 链接在这里:

http://rokhshid.jooyabash.ir/files/rokhshid-3.apk

在此处输入图片说明

和另一个图像

在此处输入图片说明

我认为 Qt 5.13(及更高版本)或 Qt Creator 上存在错误。我现在使用 Qt 5.15.1 和 Qt Creator 4.13.2 进行测试

AndroidManifest.xml 文件:

<?xml version="1.0"?>
<manifest package="org.companyname.myapp" xmlns:android="http://schemas.android.com/apk/res/android" android:versionName="1.5.14" android:versionCode="3" android:installLocation="auto">
<!-- The following comment will be replaced upon deployment with default permissions based on the dependencies of the application.
         Remove the comment if you …
Run Code Online (Sandbox Code Playgroud)

qt android qml android-install-apk qtquickcontrols2

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

如何检查登录操作中是否存在用户?

我开始使用新的身份管理并且有一个简单的需求.当我的用户使用错误的名称登录时,它会报告密码错误.如何更改此设置以便它还使用dbcontext方法检查用户名是否存在?

    public ActionResult Login(LoginViewModel model, string returnUrl)
    {
        if (ModelState.IsValid)
        {
            // Validate the password
            IdentityResult result = IdentityManager.Authentication.CheckPasswordAndSignIn(AuthenticationManager, model.UserName, model.Password, model.RememberMe);
            if (result.Success)
            {
                return Redirect("~/home");
            }
            else
            {
                AddErrors(result);
            }
        }

        // If we got this far, something failed, redisplay form
        return View(model);
    }
Run Code Online (Sandbox Code Playgroud)

c# asp.net asp.net-mvc-5 asp.net-identity

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

如何用roslyn获得一个方法体的il?

我想在我的c#源代码文件中获取一个方法.我已经用roslyn打开了解决方案,并找到如下方法符号

Roslyn.Compilers.Common.ISymbol s=GetMethodSymbolAtPosition (30);
Run Code Online (Sandbox Code Playgroud)

我有一个ISymbol现在怎么样?

c# roslyn

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

如何在 ASP.NET Core 3.1 中找到 bin 目录?

我的 EF 项目在一个项目中,而我的 ASP.NET Core 项目在另一个项目中,

D:\AspProjects\DatabaseHafez> <=== 我的 ef 模型在这个文件夹中

D:\AspProjects\Hafez> <=== 我的aspnet core 3 在这个文件夹中

所以每个项目都有一个 bin 文件夹。

下面的构建器(ConfigurationBuilder)应该有用于读取连接字符串的 appsettings.json 文件的路径。所以下面有这个路径 =>

D:\AspProjects\DatabaseHafez\bin\Debug\netcoreapp3.1\appsettings.json

但是我的 asp.net 核心项目中的 appettins.json 文件因此在构建后将复制到输出文件夹 =>

D:\AspProjects\Hafez\bin\Debug\netcoreapp3.1\appsettings.json

那么如何找到输出文件夹路径?

public class AppDbContextFactory : IDesignTimeDbContextFactory<AppDbContext>
{
    AppDbContext IDesignTimeDbContextFactory<AppDbContext>.CreateDbContext(string[] args)
    {
        var builder = new ConfigurationBuilder()
            .AddJsonFile("appsettings.json", optional: false, reloadOnChange: true);

        IConfigurationRoot configuration = builder.Build();

        var optionsBuilder = new DbContextOptionsBuilder<AppDbContext>();

        optionsBuilder.UseSqlServer(configuration.GetConnectionString("DefaultConnection"));

        var context = new AppDbContext(optionsBuilder.Options);

        context.Database.EnsureCreated();
        return context;
    }
}
Run Code Online (Sandbox Code Playgroud)

现在我想添加迁移但出现错误

D:\AspProjects\DatabaseHafez>dotnet ef migrations add changed98112601  

Build …
Run Code Online (Sandbox Code Playgroud)

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

5
推荐指数
3
解决办法
5609
查看次数

如何跳过 ef core 中的一些迁移?

我的 ef 上下文发生了一些变化,并添加了新的 Migraions

dotnet ef migrations add changed98112601
Run Code Online (Sandbox Code Playgroud)

然后我运行以下命令

dotnet ef database update
Run Code Online (Sandbox Code Playgroud)

我有以下输出。看来要应用初始迁移。Poems 表位于数据库中,因为它是通过应用初始迁移创建的。我应该如何预防这种情况?当我想要更新时,应该如何跳过初始迁移?

Build started...
Build succeeded.
Applying migration '20191225133128_Initial'.
Failed executing DbCommand (159ms) [Parameters=[], CommandType='Text', CommandTimeout='30']
CREATE TABLE [Poems] (
    [Id] int NOT NULL IDENTITY,
    [Number] int NOT NULL,
    [Meaning] nvarchar(max) NULL,
    CONSTRAINT [PK_Poems] PRIMARY KEY ([Id])
);
Microsoft.Data.SqlClient.SqlException (0x80131904): There is already an object named 'Poems' in the database.
   at Microsoft.Data.SqlClient.SqlConnection.OnError(SqlException exception, Boolean breakConnection, Action`1 wrapCloseInAction) in E:\agent1\_work\34\s\src\Microsoft.Data.SqlClient\netcore\src\Microsoft\Data\SqlClient\SqlConnection.cs:line 1591
   at Microsoft.Data.SqlClient.SqlInternalConnection.OnError(SqlException exception, Boolean breakConnection, Action`1 …
Run Code Online (Sandbox Code Playgroud)

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

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

无法在qt快速应用程序中构建图形管道状态

我有一个 qt 快速 pyside 应用程序。我之前有一个问题,但现在出现了另一个问题。只是出现一个空窗口,然后在应用程序窗口中我看到下面的消息。虽然我有另一个用 c++ 编写的 qt 快速应用程序,显示没有问题,显示这条消息!,这个应用程序是python(pyside6)

我使用 Qt 6.0.2、Python 3.9.2、Qt Creator 4.14.1 和 Pyside6

Failed to create vertex shader: Error 0x80070057: The parameter is incorrect.
Failed to build graphics pipeline state
Run Code Online (Sandbox Code Playgroud)

*主.qml

import QtQuick 2.15
import QtQuick.Window 2.15
import QtQuick.Controls 2.15

Window {
    id:mainWindow
    width: 1000
    height: 580
    visible: true
    title: qsTr("JooyaTrader")

    Rectangle{

        width: 152
        height: 62
        anchors.fill: parent
        color: "red"
    }
}
Run Code Online (Sandbox Code Playgroud)

主要.py

import sys,os
from PySide6.QtGui import QGuiApplication
from PySide6.QtQml import QQmlApplicationEngine …
Run Code Online (Sandbox Code Playgroud)

python qt pyside qtquick2 pyside6

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

交叉引用标头中的错误“未终止的条件指令”

在它们的头中有两个相互关联的类:

绘图标记

#ifndef PLOTMARKER_H
#define PLOTMARKER_H

#include <QObject>
#include "plotter.h"

class Plotter;

class PlotMarker : public QObject
{
    // ...
    Plotter* m_attachedPlot;    
    // ...
};

#endif // PLOTMARKER_H
Run Code Online (Sandbox Code Playgroud)

绘图仪

#ifndef PLOTTER_H
#define PLOTTER_H

// ...
#include "plotmarker.h"
// ...

class PlotMarker;

class Plotter : public QQuickPaintedItem
{
    // ...
    QLinkedList<PlotMarker*> m_markerList;
    // ...
};

#endif // PLOTTER_H
Run Code Online (Sandbox Code Playgroud)

程序编译良好,但出现错误error: unterminated conditional directive#ifndefIDE 中的类代码因此没有突出显示。

如果我#include "plotter.h"在 PlotMarker 的标头或#include "plotmarker.h"Plotter 的标头中删除,Qt Creator 会像往常一样突出显示代码,但由于有关无效使用不完整类型的错误,编译失败。

你能告诉我有什么问题吗?我认为这是因为错误的标题交叉引用,但我遇到了这个 …

c++ qt compiler-errors include header-files

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

如何在qml中将TextInput分配给int?

如何TextInput在qml中将in 分配给int?

int new_span_seconds

TextInput {
        id: editor
        width: 80
        height: 17
        color: "white"
        font.bold: true; font.pixelSize: 14
        text: "21"
        horizontalAlignment: TextInput.AlignHCenter

    }

    Keys.forwardTo: [ (returnKey), (editor)]

    Item {
        id: returnKey
        Keys.onReturnPressed: new_span_seconds = editor. <<< ?  >>>
        Keys.onEnterPressed:  new_span_seconds = editor. <<< ?  >>>
    }
Run Code Online (Sandbox Code Playgroud)

qt textinput qml qt-quick

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

如何用roslyn删除我的c#解决方案中源代码的所有注释?

我想在Roslyn的C#解决方案中删除源代码中的所有注释.但我该怎么做?

public void DeleteComment()
{
        var code = File.ReadAllText("code.cs");
        SyntaxTree tree = SyntaxFactory.ParseSyntaxTree(code);
        ///Delete Comments ?

}
Run Code Online (Sandbox Code Playgroud)

c# roslyn

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

如何在其他QML文件中访问"ApplicationWindow"引用?

我有一个名为main.qml的文件,它实例化ApplicationWindow.我想在其他qml文件中访问此对象(app).

ApplicationWindow {
    id:app
    title: "Title"
    visible: true
    property int keyboardPosition:10//need to access from other qml files for set/get
....
...
}
Run Code Online (Sandbox Code Playgroud)

是否有任何API可用于访问qml应用程序对象?
或如何在qml中设置应用程序设置.是单身类方法还是其他方法?

qt qml qt5 qtquick2

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

User.Identity.Name 在我的 ASP.NET Core Web API 中为 null

我在一个具有一个数据库的项目中添加了 ASP.NET Core 标识和 Identity Server4,并且我想在所有其他项目中使用我的 Identity Server。

IdentityServer4 启动类

public class Startup
{
    public IConfigurationRoot Config { get; set; }

    public Startup(IConfiguration configuration)
    {
        Config = new ConfigurationBuilder()
                     .SetBasePath(Directory.GetCurrentDirectory())
                     .AddJsonFile("appsettings.json", false)
                     .Build();

        Configuration = configuration;
    }

    public IConfiguration Configuration { get; }

    public void ConfigureServices(IServiceCollection services)
    {
        IdentityModelEventSource.ShowPII = true;

        //=== Identity Config ===
        string ConnectionString = Config.GetSection("AppSettings:DefaultConnection").Value;
        var migrationAssembly = typeof(Startup).GetTypeInfo().Assembly.GetName().Name;

        //-----------------------------------------------------------------
        services.AddDbContext<MyIdentityDbContext>(options =>
             options.UseSqlServer(ConnectionString, sql => sql.MigrationsAssembly(migrationAssembly)));

        //-----------------------------------------------------------------
        services.AddIdentity<MyIdentityUser, IdentityRole>(op =>
        {
            op.Password.RequireDigit = false;
            op.Password.RequiredLength = …
Run Code Online (Sandbox Code Playgroud)

c# authentication authorization asp.net-identity identityserver4

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

如何使用Roslyn正确修改类声明语法?

我有一个方法来修改类声明语法.我StatementSyntax为类中的所有方法添加了两个属性,然后我将该类保存到我的解决方案中.一切都很好,但该方法ReplaceNode仅适用于第一种方法,ListOfMethod.我方法的哪一部分不正确?

private ClassDeclarationSyntax GetNewClass(ClassDeclarationSyntax c)
{
    List<MethodDeclarationSyntax>  ListOfMethod = lom(c);
    foreach (var OldMethod in ListOfMethod )
    {
        MethodDeclarationSyntax NewMethod = GetNewMethod (OldMethod);
        c = c.ReplaceNode(OldMethod,NewMethod);
    }
    return c;
}
Run Code Online (Sandbox Code Playgroud)

c# roslyn

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