我正在尝试将列表保存到文本文件中.
这是我的代码:
public void button13_Click(object sender, EventArgs e)
{
TextWriter tw = new StreamWriter("SavedLists.txt");
tw.WriteLine(Lists.verbList);
tw.Close();
}
Run Code Online (Sandbox Code Playgroud)
这是我在文本文件中得到的:
System.Collections.Generic.List`1 [System.String]
我必须使用ConvertAll<>吗?如果是这样,我不知道如何使用它.
我在Visual Studio 2012中使用Xamarin开发了一个Android项目.我最近从硬盘升级到SSD,所以我重新安装了Windows和我的所有程序.
克隆我的git存储库并尝试在我的设备上运行应用程序后,我无法让它运行.我能够启动一个新的hello world项目,然后我就可以运行了,但是我无法运行这个项目.
这就是错误所说的:
该应用程序无法启动.确保已将应用程序安装到目标设备并具有可启动活动(MainLauncher = true).
此外,请检查Build-> Configuration Manager以确保将此项目设置为Deploy for this configuration.
我已经搜索了这个问题的解决方案,但一直找不到任何有效的方法.
我正在使用Qt5.我试图从json对象获取值.以下是json对象的样子,我试图从中获取数据:
{
"success": true,
"properties": [
{
"ID": 1001,
"PropertyName": "McDonalds",
"key": "00112233445566778899aabbccddeeff"
},
{
"ID": 1002,
"PropertyName": "Burger King",
"key": "10112233445566778899aabbccddeeff"
},
{
"ID": 1003,
"PropertyName": "Taco Bell",
"key": "20112233445566778899aabbccddeeff"
}
]
}
Run Code Online (Sandbox Code Playgroud)
如何在Qt中创建三个包含属性[x] .ID,属性[x] .PropertyName和属性[x] .key的数组?
编辑:
使用QScriptEngine我试过这个:
QString data = (QString)reply->readAll();
QScriptEngine engine;
QScriptValue result = engine.evaluate(data);
qDebug() << result.toString();
Run Code Online (Sandbox Code Playgroud)
调试是说"SyntaxError:Parse error"
所以你不能继承string.你不能成为不可空的string.但我想这样做.我想要一个类,让我们称之为nString,否则返回默认值为null.我有JSON对象可能有谁知道有多少空字符串,甚至是空对象.我想创建具有永远不会返回null的字符串的结构.
public struct Struct
{
public nString value;
public nString value2;
}
Run Code Online (Sandbox Code Playgroud)
我想我可以这样做:
public struct Struct
{
public string val { get { return val ?? "N/A"; } set { val = value; } }
public string val2 { get { return val2 ?? "N/A"; } set { val2 = value; } };
}
Run Code Online (Sandbox Code Playgroud)
但那是更多的工作.有没有办法做到这一点?
有没有办法使用Qt发送信号或任何其他方式来判断USB串口线是否已拔下?
我正在尝试编写一个可以读取和写入通过串行com端口接受普通串行通信的设备的应用程序.我正在使用蓝牙连接设备.蓝牙到串行设备是一个bolutek BK-MD-BC04-B_DEMO.它基本上是一个带有串口的蓝牙设备.
我可以使用我的Android手机连接到设备,我可以向其发送数据.我的计算机连接到蓝牙设备上的串口使用COM5上的PuTTY和USB转串口,我可以看到我使用Android手机发送的数据.但是,当我将蓝牙适配器连接到我的串行设备时,我似乎无法使串行命令正常工作.我也无法从蓝牙适配器读回任何东西.
我已经验证所有串行设置似乎都是正确的.波特率,数据位,停止位和奇偶校验都在蓝牙设备上正确设置.
我试图通过电子邮件联系bolutek,但他们回复的速度很慢.以下是我在我尝试使用的设备上找到的一些内容:
http://www.electrodragon.com/w/index.php?title=BC04
http://docs.teguna.ro/BC04-electrondragon-2013-01-17.pdf
http://diwo.bq.com/wp-content/uploads/2014/11/BLK-MD-BC04-B_AT-COMMANDS.pdf
这是我的代码:
using System;
using System.Linq;
using System.IO;
using Android.App;
using Android.Content;
using Android.Runtime;
using Android.Views;
using Android.Widget;
using Android.OS;
using Android.Bluetooth;
//...
public class MainActivity : Activity
{
private BluetoothSocket socket;
protected override void OnCreate(Bundle bundle)
{
base.OnCreate(bundle);
SetContentView(Resource.Layout.Main);
Button button = FindViewById<Button>(Resource.Id.MyButton);
EditText text = FindViewById<EditText>(Resource.Id.editText);
button.Click += delegate
{
BluetoothAdapter adapter = BluetoothAdapter.DefaultAdapter;
Action finish = new Action(async delegate
{
if (socket == null)
{
BluetoothDevice device = (from bd …Run Code Online (Sandbox Code Playgroud) 所以我正试图在我的设备上运行Xamarin Studio中的项目.我收到错误"在钥匙串中找不到有效的iOS代码签名密钥".
我生成了一个全新的iOS开发证书,如下所示:

然后我下载了证书并打开它以将其添加到钥匙串.这里是钥匙串:

然后我创建了一个配置文件.我添加了适当的设备,并将证书设置为我刚刚生成的证书.查看配置文件的编辑部分,您可以看到它设置为正确的证书:

完成所有这些后,我进入Xcode,然后点击Xcode-> preferences.我添加了AppleID并查看了帐户的详细信息.似乎一切都在那里,除了iOS开发签名身份说"丢失私钥".

我假设这就是我在Xamarin Studio中收到错误的原因.我怎样才能解决这个问题?
我一直在玩蓝牙串行设备一段时间,现在试图让它与Android一起使用。我已经让它与 Android 正常通信,那里的一切似乎都运行良好。
现在我需要让它与 iOS 一起工作。似乎苹果一如既往地和苹果一样,只支持某些接口。根据此文档,我使用的设备仅支持 UART、USB、SPI、PCM、SPDIF 和 SPP。可以在此处找到有关该设备的更多信息。
我不确定除了 USB 和 SPP 之外还有什么,但我相信 SPP 不适用于 iOS。
所以我的问题是该设备是否可以与 iOS 配合使用以进行蓝牙到串行通信?
另外,如果这个设备不能工作(我假设它不能),有什么好的蓝牙到串行选项?根据我的一些研究,我需要 MFi 认证的设备吗?
经过进一步研究,看起来蓝牙 LE 是一个选项,使用这些设备和 connectBlue 低功耗串行端口服务:
http://www.u-blox.com/en/bluetooth-wifi-multiradio-modules/bluetooth-low-energy/ols425-olp425-modules.html http://www.spezial.cz/pdf/RBS421-Product -Brief.pdf
这对我来说非常困惑.不知何故IndexOf(string),我的List<string>对象的方法返回-1,即使List中的值是CLEARLY.
protected readonly List<string> validPrefixes = new List<string>() { "01", "02", "03", "FE", "E1", "E2", "E3" };
Run Code Online (Sandbox Code Playgroud)
string prefix 是"01"

validPrefixes 索引0是"01".

indexOf是-1.嗯......怎么样?

我正在尝试使用带有用户池的AWS Cognito通过我的API进行身份验证.我有一个通过AWS Cognito用户池创建的用户,我正在尝试使用该用户登录.
我得到的错误是CredentialsError: Missing credentials in config.特别是它告诉我,我需要一个IdentityPoolId.但我似乎无法IdentityPoolId在我的AWS控制台中找到它.在哪里,我从我的用户池得到这个?我看到的只是一个Pool id和一个Pool ARN.
相关源代码:
var aws = require('aws-sdk');
aws.config.update({
region: 'us-east-1',
credentials: new aws.CognitoIdentityCredentials({
IdentityPoolId: '???'
})
});
var authUser = function(params, callback)
{
if (!params || !params.Email || !params._password)
{
callback(new Error('Invalid parameters.'));
return false;
}
var cognito = new aws.CognitoIdentityServiceProvider();
var authParams = {
AuthFlow: 'USER_SRP_AUTH', // not sure what this means...
ClientId: conf.AWSConfig.ClientId,
AuthParameters: {
Username: params.Email,
Password: params._password
}
};
cognito.initiateAuth(authParams, function(err, data) …Run Code Online (Sandbox Code Playgroud) c# ×5
xamarin ×3
android ×2
bluetooth ×2
ios ×2
list ×2
qt ×2
serial-port ×2
aws-cognito ×1
c++ ×1
certificate ×1
indexof ×1
json ×1
node.js ×1
non-nullable ×1
qt-signals ×1
qtcore ×1
qtserialport ×1
string ×1