小编Jia*_*nYA的帖子

Android Google地图无需动画即可转到当前位置

我知道这可能有点傻,我一定错过了一些东西但是如何禁用那个放大到我的标记的动画并立即加载谷歌地图和我当前的位置?

这是我目前的代码

@Override
    public void onLocationChanged(Location location) {
        currentLocation = location;
        String curr_location = currentLocation.getLatitude()+ ","+currentLocation.getLongitude();
        LatLng coordinates = new LatLng(currentLocation.getLatitude(),currentLocation.getLongitude());
        CameraUpdate current = CameraUpdateFactory.newLatLngZoom(coordinates,15);
        googleMap.animateCamera(current);
        UpdateLocation(userid,email,curr_location);
    }
Run Code Online (Sandbox Code Playgroud)

我想尽可能删除动画相机.谢谢!

android google-maps

12
推荐指数
1
解决办法
3992
查看次数

SSOCircle保持重定向到Consent页面SAML2.0

我正在使用SSOCircle来测试我的SAML实现与Codeigniter.目前的步骤是:

  1. 访问website.com
  2. 重定向到SSOCircle同意页面
  3. 验证身份
  4. 将用户数据传回website.com

但是,在步骤3之后,它立即进入步骤4并返回步骤3.

这是我的代码:

public function index()
    {
        $data['languages']= get_all_languages();
        $sp_auth = 'default-sp';
        try {
            $auth = new SimpleSAML_Auth_Simple($sp_auth);
            $auth->requireAuth(array(
            'ReturnTo' => $this->data['controller'],
            'KeepPost' => FALSE,
            ));
            $attributes = $auth->getAttributes();
            var_dump($attributes);
        } catch (Error $e) {
            print_r($e);
        }
    }
Run Code Online (Sandbox Code Playgroud)

我认为我的重定向可能是它继续调用同意页面的原因.但是当添加另一个url以便使用此功能进行访问时

public function auth(){
        $attributes = $auth->getAttributes();
        var_dump($attributes);
}
Run Code Online (Sandbox Code Playgroud)

我收到此错误:

SimpleSAML_Error_Error: UNHANDLEDEXCEPTION

Backtrace:
1 www/_include.php:45 (SimpleSAML_exception_handler)
0 [builtin] (N/A)
Caused by: SimpleSAML_Error_Exception: No authentication source with id 'Login/Auth' found.
Backtrace:
2 lib/SimpleSAML/Auth/Source.php:335 (SimpleSAML_Auth_Source::getById)
1 modules/saml/www/sp/saml2-acs.php:12 (require)
0 www/module.php:135 …
Run Code Online (Sandbox Code Playgroud)

php codeigniter saml saml-2.0 simplesamlphp

9
推荐指数
1
解决办法
571
查看次数

如何在mPDF中使用bootstrap?

我目前正在使用 mpdf 从 html 生成 pdf。到目前为止,使用我当前传递的 html,我能够生成带有页眉和页脚的一页 pdf。但是,如果有多个页面,我的页脚会一直到第二页的底部。有没有办法为每个页面添加页眉和页脚?

我已经尝试过 $pdf->setHTMLHeader 但它似乎没有接受我的 css 文件,并且在我的徽标应该在的地方留下了一个 x 。我怎样才能做到这一点?我尝试在不同的地方进行搜索,但似乎找不到解决方案。

这是我的代码

public function generate_pdf($account_id,$transaction_id,$html){
        $document_folder = $_SERVER['DOCUMENT_ROOT']."/".DOCUMENT_FOLDER."/".PAYMENT_RECEIPTS."/".date("Y");
        $extension = ".pdf";
        if(!is_dir($document_folder)){
            mkdir($document_folder, 0777,true);
        }
        $file_name = md5($transaction_id.$account_id);
        $this->load->library('m_pdf');
        $pdf = $this->m_pdf->load();
        $header = $this->load->view('pdfs/header','',true);
        $footer = $this->load->view('pdfs/footer','',true);
        $pdf->setHTMLHeader($header);
        $pdf->setHTMLFooter($footer);
        $pdf->AddPage('', // L - landscape, P - portrait 
            '', '', '', '',
            5, // margin_left
            5, // margin right
           60, // margin top
           30, // margin bottom
            0, // margin header
            0
        ); // margin footer …
Run Code Online (Sandbox Code Playgroud)

html php codeigniter mpdf twitter-bootstrap

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

ASP.NET Core 日志记录 - 过滤掉系统项目

我最近设置了 Serilog 来处理数据库的日志记录活动。然而,当我启动它时,我注意到大量的System活动Microsoft填满了行。我尝试在我的 Serilog 过滤器中添加几个覆盖,但仍然保留了执行操作方法和 Db 命令之类的一些覆盖。我需要覆盖什么才能将它们从我的日志中删除?

我的appsettings.json

"Serilog": {
    "MinimumLevel": "Information",
    "Override": {
      "Microsoft": "Error",
      "Microsoft.EntityFrameworkCore.Storage.IRelationalCommandBuilderFactory": "Error",
      "Microsoft.EntityFrameworkCore.Database.Command": "Error",
      "Microsoft.AspNetCore.Hosting.Internal.WebHost": "Error",
      "ToDoApi": "Error",
      "Engine": "Error",
      "System": "Error"
    },
Run Code Online (Sandbox Code Playgroud)

logging serilog asp.net-core

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

ASP.NET Core Serilog 未将属性推送到其自定义列

appsettings.json我的 Serilog 安装有此设置

"Serilog": {
  "MinimumLevel": "Information",
  "Enrich": [ "LogUserName" ],
  "Override": {
    "Microsoft": "Critical"
  },
  "WriteTo": [
    {
      "Name": "MSSqlServer",
      "Args": {
        "connectionString": "Server=.\\SQLEXPRESS;Database=Apple;Trusted_Connection=True;MultipleActiveResultSets=true;,
        "schemaName": "Apple",
        "tableName": "EventLogs",
        "columnOptionsSection": {
          "customColumns": [
            {
              "ColumnName": "UserName",
              "DataType": "nvarchar",
              "DataLength": 256,
              "AllowNull": true
            }
          ]
        }
      }
    }
  ]
},
Run Code Online (Sandbox Code Playgroud)

我还有一个名为的自定义丰富器LogUserName,它应该将用户用户名添加到UserName数据库中调用的列中。

这是丰富器:

public class LogUserName
{
    private readonly RequestDelegate next;

    public LogUserName(RequestDelegate next)
    {
        this.next = next;
    }

    public async Task InvokeAsync(HttpContext context)
    {
        LogContext.PushProperty("UserName", context.User.Identity.Name); …
Run Code Online (Sandbox Code Playgroud)

c# asp.net asp.net-mvc asp.net-core

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

未定义ASP.NET Core 2.1 SignalR

这是我的聊天javascript

"use strict";

var connection = new signalR.HubConnectionBuilder().withUrl("/chathub").build();

connection.on("ReceiveMessage", function (message) {
    var msg = message.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;");
    var encodedMsg = msg;
    var li = document.createElement("li");
    li.textContent = encodedMsg;
    document.getElementById("Messages").appendChild(li);
});

connection.start().catch(function (err) {
    return console.error(err.toString());
});

document.getElementById("Send").addEventListener("click", function (event) {
    var message = document.getElementById("Message").value;
    connection.invoke("SendMessage", message).catch(function (err) {
        return console.error(err.toString());
    });
    event.preventDefault();
});
Run Code Online (Sandbox Code Playgroud)

这是我使用聊天输入运行页面时遇到的错误:

未捕获的ReferenceError:在chat.js:3中未定义signalR

第3行chat.js是:

var connection = new signalR.HubConnectionBuilder().withUrl("/chathub").build();
Run Code Online (Sandbox Code Playgroud)

SignalR从Visual Studio添加客户端库下载了客户端库。我现在有一个名为文件jquery.signalR.js,它是ASP.NET SignalR JavaScript库2.4.0。

但是,此错误不会消失,由于某些原因,我无法继续。

javascript asp.net jquery signalr asp.net-core

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

Java JPA Illegal Argument Exception - NamedQuery of name:xyz not found

我试图使用这个命名查询基于他们的ID获取用户,但是我一直得到一个非法的参数异常.我一直在看这段代码.希望有人可能会抓到我可能错过的东西.这是我的ORM

@Entity
@Table(name = "MYUSER")
@XmlRootElement
@NamedQueries({
@NamedQuery(name = "Myuser.findAll", query = "SELECT m FROM Myuser m"),
@NamedQuery(name = "Myuser.findByUserid", query = "SELECT m FROM Myuser m WHERE m.userid = :userid"),
@NamedQuery(name = "Myuser.findByName", query = "SELECT m FROM Myuser m WHERE m.name = :name"),
@NamedQuery(name = "Myuser.findByPassword", query = "SELECT m FROM Myuser m WHERE m.password = :password"),
@NamedQuery(name = "Myuser.findByEmail", query = "SELECT m FROM Myuser m WHERE m.email = :email"),
@NamedQuery(name = "Myuser.findByTel", query = "SELECT m …
Run Code Online (Sandbox Code Playgroud)

java netbeans dao jpa

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

JWT 如何添加自定义声明和解码声明

我正在尝试检索我在创建令牌时所做的一些自定义声明。但是,我不确定应该写什么来检索这些声明。

这是我的令牌创建功能

public String createToken(AuthenticationDTO Input)
{
    //Set issued at date
    DateTime issuedAt = DateTime.UtcNow;
    //set the time when it expires
    DateTime expires = DateTime.UtcNow.AddDays(7);

    //http://stackoverflow.com/questions/18223868/how-to-encrypt-jwt-security-token
    var tokenHandler = new JwtSecurityTokenHandler();

    //create a identity and add claims to the user which we want to log in
    ClaimsIdentity claimsIdentity = new ClaimsIdentity(new[]
    {
        new Claim("UserName", Input.UserName),
        new Claim("Email",Input.Email),
        new Claim("PhoneNumber",Input.PhoneNumber),
        new Claim("FirstName",Input.FirstName),
        new Claim("LastName",Input.LastName),
        new Claim("Id",Input.Id)
    });

    const string sec = HostConfig.SecurityKey;
    var now = DateTime.UtcNow;
    var securityKey = new SymmetricSecurityKey(System.Text.Encoding.Default.GetBytes(sec)); …
Run Code Online (Sandbox Code Playgroud)

c# asp.net asp.net-mvc claims-based-identity jwt

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

.NET Core Action Filter 不是属性类

我有这个想要调用的动作过滤器,我已经在 Startup.cs 中声明了它。但是,当我在班级上方调用它时,出现此错误:

LogUserNameFilter 不是属性类

我不确定我错过了什么。

public class LogUserNameFilter : IActionFilter
{
    private readonly RequestDelegate next;

    public LogUserNameFilter(RequestDelegate next)
    {
        this.next = next;
    }

    public void OnActionExecuted(ActionExecutedContext context)
    {
        throw new NotImplementedException();
    }

    public void OnActionExecuting(ActionExecutingContext context)
    {
        LogContext.PushProperty("UserName", context.HttpContext.User.Identity.Name);
    }
}
Run Code Online (Sandbox Code Playgroud)

启动文件

services.AddScoped<LogUserNameFilter>();
Run Code Online (Sandbox Code Playgroud)

类声明

[LogUserNameFilter]
public class HomeController : Controller{


}
Run Code Online (Sandbox Code Playgroud)

asp.net-core-mvc asp.net-core

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

.NET Core Cronos Cron 表达式无法正确解析

我正在使用 Cronos 库来处理 .NET Core 上的 cron 作业。

然而,我遇到了这个问题,常见的 Cron 表达式根本没有被解析。它一直给我一个 CronFormatException。

我浏览了 Github 页面并使用了它们的格式,但我仍然得到相同的异常。

这是我的代码:

services.AddCronJob<Worker1>(x =>
{
    x.TimeZoneInfo = TimeZoneInfo.Local;
    x.CronExpression = "* * * * * *";
});
Run Code Online (Sandbox Code Playgroud)

我想每秒运行一次,但遇到 CronFormatException 问题。

这是库: https: //github.com/HangfireIO/Cronos

该库是否使用不同的 cron 格式?

c# cron asp.net-core-mvc .net-core asp.net-core

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