小编liv*_*ove的帖子

当使用大于和小于?时,xpath查询返回错误的值

此查询返回的值小于1000.它应该只返回1000到1100之间的值.为什么会这样?

//results/Building[ 1 = 1 and (( Vacancy/sqft > 1000 ) and ( Vacancy/sqft < 1100 ) ) ]

查询将返回以下建筑物,其空位小于1000平方英尺,大于1100平方英尺:

<Building>
  <Vacancy><sqft>900</sqft></Vacancy>
  <Vacancy><sqft>1000</sqft></Vacancy>
  <Vacancy><sqft>2000</sqft></Vacancy>
  <Vacancy><sqft>500</sqft></Vacancy>
</Building>
Run Code Online (Sandbox Code Playgroud)

为什么它包含在结果中?

样本数据:

<results>
  <Building><!--Shouldn't be selected.--></Building>

  <Building><!--Should be selected-->
    <Vacancy><sqft>1050</sqft></Vacancy>
  </Building>

  <Building><!--Should be selected-->
    <Vacancy><sqft>1025</sqft></Vacancy>
    <Vacancy><sqft>1075</sqft></Vacancy>
  </Building>

  <Building><!--Shouldn't be selected-->
    <Vacancy><sqft>10</sqft></Vacancy>
    <Vacancy><sqft>50</sqft></Vacancy>
  </Building>

  <Building><!--Should be selected.-->
    <Vacancy><sqft>1050</sqft></Vacancy>
    <Vacancy><sqft>2000</sqft></Vacancy>
  </Building>

  <Building><!--Should be selected.-->
    <Vacancy><sqft>900</sqft></Vacancy>
    <Vacancy><sqft>1040</sqft></Vacancy>
  </Building>

  <Building><!--Shouldn't be selected-->
    <Vacancy><sqft>10500</sqft></Vacancy>
  </Building>

  <Building><!--Shouldn't be selected-->
    <Vacancy><sqft>900</sqft></Vacancy>
    <Vacancy><sqft>1000</sqft></Vacancy>
    <Vacancy><sqft>2000</sqft></Vacancy>
    <Vacancy><sqft>500</sqft></Vacancy>
  </Building>

</results>
Run Code Online (Sandbox Code Playgroud)

谢谢.

xml xpath

4
推荐指数
2
解决办法
7662
查看次数

在 C# 中将字节转换为布尔值

我正在尝试基于 arduino 库(http://blog. electrodragon.com/rc522-write-a-card-demo-code/)在 C# 上创建一个物联网核心库,但我不明白是什么:

if (!(temp & 0x03))
Run Code Online (Sandbox Code Playgroud)

或者

while ((i!=0) && !(n&0x01) && !(n&waitIRq))
Run Code Online (Sandbox Code Playgroud)

它需要布尔值,但这些是字节!我怎样才能转换这个?

如果有人知道已经制作的图书馆,请告诉我。谢谢。

c# arduino rfid raspberry-pi2 windows-10-iot-core

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

无法使用 exit 或 quit 退出 Asterisk CLI

我使用以下命令启动了 Asterisk CLI:

asterisk -vvvvvvc
Run Code Online (Sandbox Code Playgroud)

当我尝试使用 exit 或 quit 退出 CLI 时,我看到以下错误:

*CLI> exit
No such command 'exit' (type 'core show help exit' for other possible commands)
*CLI> quit
No such command 'quit' (type 'core show help quit' for other possible commands)
Run Code Online (Sandbox Code Playgroud)

我可以使用^C. 为什么退出和退出不起作用?

linux asterisk exit command-line-interface

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

需要 API 版本,但未指定。网络接口

var constraintResolver = new DefaultInlineConstraintResolver()
{
    ConstraintMap =
    {
        ["apiVersion"] = typeof( ApiVersionRouteConstraint )
    }
};
                
config.MapHttpAttributeRoutes(constraintResolver);
config.AddApiVersioning(o => o.AssumeDefaultVersionWhenUnspecified = true);


[ApiVersion("2.05")]
[RoutePrefix("api/v{version:apiVersion}/ger")]
public class caGerController
[Route("~/api/ger/getDetail")]
[Route("getDetail")]
 GetGerData


[ApiVersion("1")]
[RoutePrefix("api/v{version:apiVersion}/gerDetail")]

public class caGerDetailsController
caGerController
[Route("~/api/gerDetail/getDetail")]
[Route("getDetail")]
 GetGerData
   
>>  GetGerData
Run Code Online (Sandbox Code Playgroud)

结果:

  1. 两个 URL 都与 v1 版本 ROUTE 一起使用。

  2. 第二个 URL 既适用于 v1 也适用于没有 v1 路由的直接路由,即 [Route("~/api/gerDetail/getDetail")]

  3. 问题:第一个 URL 仅适用于 v1,它不适用于像“[Route("~/api/ger/getDetail")]”这样的直接路由,并收到如下错误:

    "Error": { "Code": "ApiVersionUnspecified", "Message": "API 版本是必需的,但未指定。" }

如何解决这个问题?当我从 2.05 更改为 1.0 时,它可以工作,但 2.0 或 2.05 都不起作用。是否需要单独的文件夹?

routes asp.net-web-api asp.net-web-api-routing api-versioning

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

无服务器 502 错误网关

我可以按照文档创建一个简单的无服务器函数,但是当我添加http侦听器时,我502 Bad Gateway在尝试访问我的端点时不断收到一个。

我该如何调试?

'use strict';

module.exports.hello = async (event, context) => {
  return {
    statusCode: 200,
    body: {
      message: 'Go Serverless v1.0! Your function executed successfully!',
      input: event,
    },
  };
};
Run Code Online (Sandbox Code Playgroud)

无服务器.yaml

service: playing-with-serverless # NOTE: update this with your service name

provider:
  name: aws
  runtime: nodejs8.10

functions:
  hello:
    handler: handler.hello
    events:
      - http:
          path: hello
          method: get
Run Code Online (Sandbox Code Playgroud)

我已经部署了我的功能

service: playing-with-serverless # NOTE: update this with your service name

provider:
  name: aws
  runtime: nodejs8.10

functions: …
Run Code Online (Sandbox Code Playgroud)

amazon-web-services node.js aws-lambda serverless

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

Angular - 找不到带有名称的管道

我使用“ng g pipe”命令创建了一个管道。在我的代码中使用它时出现控制台错误。下面附上代码的截图。错误:错误 NG8004:未找到名称为 'filterByPrcName' 的管道filter-by-prc-name.pipe.ts控制台错误信息 product-list.component.html

web-frontend angular-pipe angular angular8 angular9

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

如何让我的Windows服务以特定间隔运行?

我想写一个Windows服务.但它需要在特定时间运行.例如,我的服务应该每隔5分钟给我发电子邮件.

private Timer _timer;
private DateTime _lastRun = DateTime.Now;

protected override void OnStart(string[] args)
{
    _timer = new Timer(10 * 60 * 1000); // every 10 minutes
    _timer.Elapsed += new System.Timers.ElapsedEventHandler(timer_Elapsed);
    //...
}


private void timer_Elapsed(object sender, System.Timers.ElapsedEventArgs e)
{
    // ignore the time, just compare the date
    if (_lastRun.Date < DateTime.Now.Date)
    {
        // stop the timer while we are running the cleanup task
        _timer.Stop();
        //
        // do cleanup stuff
        //
        _lastRun = DateTime.Now;
        _timer.Start();
    }
}
Run Code Online (Sandbox Code Playgroud)

我希望我的服务每隔5分钟给我发电子邮件.

c# windows windows-services

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

SoapHttpClientProtocol在异常后自动重试?

我对此很好奇.我正在对这个项目进行更改,即使用NetSuite Web服务,有时它会随机抛出一个SoapException,"一次只能对一个会话发出一个请求".

    private NetSuiteService _service;

    SessionResponse response = _service.login(passport); //if SoapException, retries??
    Status status = response.status;

Reference.cs:
    public partial class NetSuiteService : 
System.Web.Services.Protocols.SoapHttpClientProtocol
Run Code Online (Sandbox Code Playgroud)

我的问题是:如果我处于调试模式,我跟踪它,我点击F5,它似乎在抛出异常后自动重试(代码保持运行,没有实现try catch块,没有while循环)直到成功( status.isSuccess == true).当我在发布模式下运行它作为Windows服务时,日志显示它在抛出异常后停止运行.

这怎么可能?是否更好地在try catch块中捕获此异常并重试?

soaphttpclientprotocol netsuite soapexception

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

双向数据绑定不更新 UI

我试图理解为什么设置值不会自动刷新用户界面。如果我调用 binding.setItem,UI 就会刷新。

我知道绑定对象包含更新的值,但在设置 item.name 和 item.checked 后,UI 没有刷新。

我究竟做错了什么?我需要每次调用setItem来刷新UI吗?我认为这是不必要的,因为 UI 会在设置值后自动更新。

项目.java:

public class Item  {
    public String name;
    public Boolean checked;
}
Run Code Online (Sandbox Code Playgroud)

MainActivity.java:

public class MainActivity extends AppCompatActivity {

    public Item item;
    ActivityMainBinding binding;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);

        item = new Item();
        item.checked = true;
        item.name = "a";

        binding = DataBindingUtil.setContentView(this, R.layout.activity_main);
        binding.setItem(item);
    }

    public void button_onClick(View v) {
        item.checked = !item.checked;
        item.name = item.name  + "a";
        ///binding.setItem(item); --> ??? this updates UI, do …
Run Code Online (Sandbox Code Playgroud)

android android-databinding

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

Flutter Scaffold.of(context).openDrawer() 不起作用

我想在按下底部菜单中的自定义按钮后打开一个抽屉 我在使用 Scaffold.of(context).openDrawer() 时遇到问题,它不起作用。我的BottomMenu 是一个单独的小部件类。据我了解,它不起作用,因为它是一个单独的上下文。我怎样才能获得正确的上下文?或者也许有人知道另一种解决方案。

这是我的代码复制器:

import 'package:flutter/material.dart';

void main() => runApp(MyApp());

class MyApp extends StatelessWidget {
  // This widget is the root of your application.
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      title: 'Flutter Demo',
      home: MyHomePage(title: 'Flutter Drawer'),
    );
  }
}

class MyHomePage extends StatefulWidget {
  MyHomePage({Key key, this.title}) : super(key: key);
  final String title;

  @override
  _MyHomePageState createState() => _MyHomePageState();
}

class _MyHomePageState extends State<MyHomePage> {
  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        title: …
Run Code Online (Sandbox Code Playgroud)

dart navigation-drawer flutter

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