小编Pat*_*ick的帖子

生成python中任意长度的数字的升序列表

是否有一个我可以调用的函数返回一个升序列表?即,function(10)会回来[0,1,2,3,4,5,6,7,8,9]吗?

python

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

用于Windows桌面C#应用程序的蓝牙4.0(低能耗)API

我正在寻找一种与Adafruit蓝莓LE(nRF8001芯片组)板接口的方法,在Windows桌面应用程序中使用c#(从我所见,我不能使用Windows.Devices命名空间而不进行黑客入侵.)

该设备已正确配对我的平板电脑,似乎没有任何问题,我只是想找到一种方法从我的程序中接收数据.

必须有一种方法可以做到这一点,我不能认为微软会限制只使用蓝牙到城域应用程序,我只是无法找到它.

c# bluetooth-lowenergy

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

为什么vue.js不使用moment.js使用datepicker更新dom

我在vue.js中编写一个(非常)简单的datepicker控件,使用moment.js进行格式化和变更日期.

我遇到的问题是,即使单击任一按钮时组件中的日期实例被修改,显示也不会更新.

我已经尝试将其更改为一个简单的整数而不是一个日期实例,并且按预期工作(DOM正确更新)

这是我的源代码:

App.js

Vue.component("datePicker", {
    props: ["value"],
    data: function() {
        return { selectedDate: moment(this.value) };
    },
    template: "<div><button v-on:click='decrement'>&lt;</button>{{formattedSelectedDate}}<button v-on:click='increment'>&gt;</button></div>",
    methods: {
        increment: function () {
            this.selectedDate.add(1, "days");
            this.$emit('input', this.selectedDate);
        },
        decrement: function () {
            this.selectedDate.subtract(1, "days");
            this.$emit('input', this.selectedDate);
        }
    },
    computed: {
        formattedSelectedDate: function() {
            return this.selectedDate.format("YYYY-MM-DD");
        }
    }
});

var PointTracker = new Vue({
    el: "#PointTracker",
    data: {
        selectedDate: moment(),
        todoItems: {}
    }
});
Run Code Online (Sandbox Code Playgroud)

的index.html

<html>
    <head>
        <meta charset="utf-8">
        <title>Point Tracker</title>
        <link rel="stylesheet" href="style.css">
    </head>
    <body> …
Run Code Online (Sandbox Code Playgroud)

javascript vue.js

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

GattCharacteristic.ValueChanged停止被调用

我正在尝试使用Adafruit Bluefruit LE(蓝牙4模块)与arduino进行通信,所有内容都已设置并配对,但我在GattCharacteristic上遇到了ValueChanged事件的问题,它在30之间的某个地方停止发射和40次.

以下是此设置代码:

public class Bluetooth
{
    async public void Initialize()
    {
        var devices = await DeviceInformation.FindAllAsync(GattDeviceService.GetDeviceSelectorFromUuid(new Guid("6E400001-B5A3-F393-E0A9-E50E24DCCA9E")), null);

        GattDeviceService firstService = await GattDeviceService.FromIdAsync(devices[0].Id);

        GattCharacteristic rxCharacteristic = firstService.GetCharacteristics(new Guid("6E400003-B5A3-F393-E0A9-E50E24DCCA9E")).First();

        await rxCharacteristic.WriteClientCharacteristicConfigurationDescriptorAsync(GattClientCharacteristicConfigurationDescriptorValue.Notify);

        rxCharacteristic.ValueChanged += rxCharacteristicValueChanged;
    }

    private void rxCharacteristicValueChanged(GattCharacteristic characteristic, GattValueChangedEventArgs e)
    {
        Console.WriteLine(e.CharacteristicValue.ToArray()[6]);
    }
}
Run Code Online (Sandbox Code Playgroud)

我需要清除哪种缓冲区或类似的东西?它看起来不像它的缓冲区相关,因为如果我将发送的数据减半,我不会得到两次调用,但我可能是错的.Arduino报告说它仍然在发送数据(通过串行链接,我可以看到蓝牙库仍然试图以任何速率发送数据.我不确定如何验证数据是否实际发送)

任何帮助将不胜感激,甚至建议检查的事情.

c# bluetooth-lowenergy gatt

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

json.net错误:意外的令牌反序列化对象

我有一个带有一些json的文件,它是由json.net生成的:

[
  {
    "$type": "Dashboard.Gauges.LabelGaugeSeed, Dashboard",
    "Text": "blah",
    "LabelColor": {
      "X": 1.0,
      "Y": 1.0,
      "Z": 1.0,
      "W": 1.0
    },
    "Center": {
      "X": 0.0,
      "Y": 0.0
    },
    "CharacterWidth": 0.05,
    "CharacterHeight": 0.1,
    "LineThickness": 0.01,
    "TextCentering": 0.5
  }
]
Run Code Online (Sandbox Code Playgroud)

在反序列化时,这给了我上面提到的错误.任何人都可以找到这个json的问题?我通过验证器运行它,它说没关系.

它在"中心"之后的空格上出错:如果我更改了Center和LabelColor属性的顺序,那么在"LabelColor"之后它会以相同的方式出错:

这是一个类型的转储:

LabelColor是OpenTK Vector4,Center是OpenTK Vector2,LabelGaugeSeed如下:

public class LabelGaugeSeed : IGaugeSeed
{
    public IGauge Grow()
    {
        return new LabelGauge(this);
    }

    public string Text;
    [JsonConverter(typeof(Vector4Converter))]
    public Vector4 LabelColor;
    [JsonConverter(typeof(Vector2Converter))]
    public Vector2 Center;
    public float CharacterWidth;
    public float CharacterHeight;
    public float LineThickness;
    public float TextCentering;
} …
Run Code Online (Sandbox Code Playgroud)

c# json json.net

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

标签 统计

c# ×3

bluetooth-lowenergy ×2

gatt ×1

javascript ×1

json ×1

json.net ×1

python ×1

vue.js ×1