小编Yiy*_*hen的帖子

不使用 sqlcmd 在 docker 容器中初始化 SQL Server 数据库

我正在使用配备 M1 CPU 的 MacBook Pro,因此无法使用“普通”mssql docker 映像。我使用的 azure-sql-edge 没有 sqlcmd 来初始化数据库(创建架构、数据库、登录)。

我创建了一个 sql 脚本,我想在容器启动后运行该脚本,但我找不到 sqlcmd 的任何替代方案。

还有其他方法吗?

sql-server sqlcmd docker azure-sql-edge

11
推荐指数
2
解决办法
9886
查看次数

C# 从蓝牙设备获取数据

我正在尝试从已有配对代码和通信协议的医疗 BT 设备获取数据。

寻找一些代码我得到了这个代码:

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using InTheHand.Net.Sockets;
using InTheHand.Net;
using InTheHand.Net.Bluetooth;
using InTheHand.Windows.Forms;
using System.Net.Sockets;
using System.Diagnostics;
using System.Threading;

namespace dConsoleApp
{
    static class Program
    {
        // My BT USB adapter
        private static BluetoothEndPoint EP = new BluetoothEndPoint(BluetoothAddress.Parse("00:02:72:CD:9A:33"), BluetoothService.BluetoothBase);
        private static BluetoothClient BC = new BluetoothClient(EP);

        // The BT device that would connect
        private static BluetoothDeviceInfo BTDevice = new BluetoothDeviceInfo(BluetoothAddress.Parse("94:21:97:60:07:C0"));

        private static NetworkStream stream = null;

        static void Main(string[] args)
        {
            if (BluetoothSecurity.PairRequest(BTDevice.DeviceAddress, …
Run Code Online (Sandbox Code Playgroud)

c# bluetooth networkstream 32feet

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

使用javascript启用/禁用ASP.NET控件

我正在构建一个页面来上传服务器上的Excel文件以进行导入操作.所以一个javascript检查文件选中文件扩展名void其他文件类型.现在我正在尝试启用上传ASP.NET按钮,但javascript返回错误document.getElementById(...)为null.

这里的代码:

<script type="text/javascript" language="javascript" defer="defer">
    function enableControl() {
        document.getElementById('button').disable = false;
    }

    function disableControl() {
        document.getElementById('button').disable = true;
    }

    function checkExcelFileUpload(elem) {
        var filePath = elem.value;
        if (filePath.indexOf('.') == -1)
            return false;
        var validExtensions = new Array();
        var ext = filePath.substring(filePath.lastIndexOf('.') + 1).toLowerCase();
        //Add valid extentions in this array
        validExtensions[0] = 'xls';
        //validExtensions[1] = 'pdf';
        for (var i = 0; i < validExtensions.length; i++) {
            if (ext == validExtensions[i])
                return true;
        }
        elem.value = '';
        alert('Sono ammessi …
Run Code Online (Sandbox Code Playgroud)

javascript asp.net

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

setRadius:不是数字,MVC 5中的Google Maps V3

我正在尝试在MVC 5项目中显示带有标记和圆圈的地图.地图显示标记,但在圆圈方法a上获取错误setRadius:不是数字.

这里的代码:

    <script type="text/javascript" src="http://maps.google.com/maps/api/js?sensor=false"></script>
<script type="text/javascript">
    $(document).ready(function () {
        initialize();
    });
    function initialize() {

        var myLat = '@Model.Lat'.replace(',', '.').replace(' ', '');
        var myLong = '@Model.Lon'.replace(',', '.').replace(' ', '');

        var rad = '@Model.Acc'.replace(',', '.').replace(' ', '');

        var center = new google.maps.LatLng(myLat, myLong); // LatLng of center point of circle

        var mapOptions = {
            center: center,
            zoom: 16,
            mapTypeId: google.maps.MapTypeId.ROADMAP
        };

        var map = new google.maps.Map(document.getElementById("map_canvas"),
          mapOptions);
        // create a marker
        var marker = new google.maps.Marker({
            position: center,
            map: map, …
Run Code Online (Sandbox Code Playgroud)

javascript geometry google-maps-api-3 asp.net-mvc-5

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

无法通过路径'myFormArray - > [index] - > myProperty找到控件

我正在尝试使用Angular ReactiveForms生成动态表单.目前我收到错误Cannot find control with path 'myFormArray -> [index] -> myProperty.我已经检查了一些在互联网上找到的答案但没有成功.这是我的代码:

HTML:

<form [formGroup]="myForm">
    <div formArrayName="myFormArray" *ngFor="let ctrl of foo.controls; let i=index">
        <div [formGroupName]="i">
            <input matInput type="text" formControlName="myProperty">
        </div>
    </div>
</form>
Run Code Online (Sandbox Code Playgroud)

TS:

export class MyClass implements OnChanges {

  @Input() myData: any;

  myForm: FormGroup;

  get foo(): FormArray{
    return <FormArray>this.myForm.get('myFormArray');
  }

  constructor(private fb: FormBuilder) { }

  ngOnChanges() {
    if (!this.myForm) {
      this.myForm = this.fb.group({
        myFormArray: this.fb.array([this.buildMyFormArray()])
      });
    }

    this.myForm.setControl('myFormArray', this.fb.array(myData || []));
  }

  buildMyFormArray(): FormGroup {
    return this.fb.group({
      myProperty: '' …
Run Code Online (Sandbox Code Playgroud)

reactive-forms angular angular-reactive-forms formarray

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

将Json反序列化为{List:{[...],[...]}}

这是我与Json的第一次合作.我已经在我的Visual Studio项目中安装了Json.Net并用于反序列化一些简单的字符串,如下所示:

{
      "A":"1",
      "B":"2",
      "C":"3"
}
Run Code Online (Sandbox Code Playgroud)

使用此代码:

JToken token = JObject.Parse("{ "A":"1","B":"2","C":"3"}";
string aValue = token.SelectToken("A");
string aValue = token.SelectToken("B");
string aValue = token.SelectToken("C");
Run Code Online (Sandbox Code Playgroud)

但我不知道如何处理像这样的Json:

{
     "LIST":[
          {
               "A":"value1",
               "B":"value1",
               "C":"value1"
          }
          {
               "A":"value2",
               "B":"value2",
               "C":"value2"
          }
          {
               "A":"value3",
               "B":"value3",
               "C":"value3"
          }
     ],
     "D":"value4",
     "E":"value5",
     "F":"value6"
}
Run Code Online (Sandbox Code Playgroud)

如何获得所有类型的元素和其他变量,如D,E和F?

谢谢

c# asp.net json json.net

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

应用程序繁忙时显示活动指示器

我正在使用 Xamarin.Forms 开发跨平台移动应用程序。

我正在尝试使用简单的活动指示器和 I 按钮来模拟 Web 服务上的 POST。我希望单击按钮时活动指示器会显示并保持不变,直到 IsLoading 属性设置为 false。

这是我的 XAML:

<AbsoluteLayout x:Name="layOuter">
    <ActivityIndicator x:Name="actWebRequest"
        IsVisible="{ Binding IsLoading,
                             Mode=TwoWay }"
        IsRunning="{ Binding IsLoading,
                             Mode=TwoWay }"
        AbsoluteLayout.LayoutBounds="0.5, 0.5, 100, 100"
        AbsoluteLayout.LayoutFlags="PositionProportional" />


    <Button x:Name="btnLogin"
                    IsVisible="{ Binding Show,
                             Mode=TwoWay }"
                    Text="{ StaticResource LoginButtonText }"
                    Command="{ Binding LoginCommand }"
                    BackgroundColor="Teal" />
</AbsoluteLayout>
Run Code Online (Sandbox Code Playgroud)

他的登录命令:

公共事件 PropertyChangedEventHandler PropertyChanged;

    protected void OnPropertyChanged([CallerMemberName] string propertyName = null)
    {
        PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
    }

    protected void SetValue<T>(ref T backingField, T value, [CallerMemberName] string propertyName = null) …
Run Code Online (Sandbox Code Playgroud)

loading spinner xamarin xamarin.forms

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