我有两台机器,一台PC,一台Mac.两者都有Xamarin Studio.在我的电脑上,我已经配置了Android签名密钥,并使用此密钥向Google Play发布了一个应用程序.我对代码进行了一些应用程序更改 - 在我的Mac上 - 并尝试使用不同的密钥进行签名并上传,当然,我得到了"您必须使用相同的密钥签名"错误.
我找不到从我的PC上的Xamarin Studio安装导出Android签名密钥的方法.我可以看到导入新密钥的位置,但不能导出如何导出现有密钥.我还在Windows上检查了本地系统和我的用户帐户的证书管理器,没有运气.
知道怎么出口?
我已经构建了一个大量使用JSON的分布式系统应用程序.该应用程序在Windows上运行(在7,8,8.1,Server 2008,Server 2012上测试)和使用Mono的Ubuntu 14.04
然而,当我尝试在OSX Yosemite 10.10.2(也许是其他人)上运行它时,应用程序以一种光荣的方式失败.我已经隔离了一些对Newtonsoft JSON.NET的调用,并在一个独立的沙盒应用程序中运行它们,并且永远无法重现这个问题.我已粘贴下面的调试信息,希望有人看到堆栈跟踪中的某些内容或其他可能指向明显问题的内容.
Stacktrace:
at <unknown> <0xffffffff>
at (wrapper managed-to-native) object.__icall_wrapper_mono_gc_alloc_vector (intptr,intptr,intptr) <0xffffffff>
at (wrapper alloc) object.AllocVector (intptr,intptr) <0xffffffff>
at System.Reflection.Emit.DynamicMethod.AddRef (object) <0x00077>
at System.Reflection.Emit.DynamicMethodTokenGenerator.GetToken (System.Reflection.MemberInfo,bool) <0x0001b>
at System.Reflection.Emit.ILGenerator.Emit (System.Reflection.Emit.OpCode,System.Type) <0x000ee>
at Newtonsoft.Json.Utilities.ILGeneratorExtensions.BoxIfNeeded (System.Reflection.Emit.ILGenerator,System.Type) <0x0007a>
at Newtonsoft.Json.Utilities.DynamicReflectionDelegateFactory.GenerateCreateGetPropertyIL (System.Reflection.PropertyInfo,System.Reflection.Emit.ILGenerator) <0x0009b>
at Newtonsoft.Json.Utilities.DynamicReflectionDelegateFactory.CreateGet<T> (System.Reflection.PropertyInfo) <0x000bf>
at Newtonsoft.Json.Utilities.ReflectionDelegateFactory.CreateGet<T> (System.Reflection.MemberInfo) <0x0007d>
at Newtonsoft.Json.Serialization.DynamicValueProvider.GetValue (object) <0x0003f>
at Newtonsoft.Json.Serialization.JsonSerializerInternalWriter.CalculatePropertyValues (Newtonsoft.Json.JsonWriter,object,Newtonsoft.Json.Serialization.JsonContainerContract,Newtonsoft.Json.Serialization.JsonProperty,Newtonsoft.Json.Serialization.JsonProperty,Newtonsoft.Json.Serialization.JsonContract&,object&) <0x000fe>
at Newtonsoft.Json.Serialization.JsonSerializerInternalWriter.SerializeObject (Newtonsoft.Json.JsonWriter,object,Newtonsoft.Json.Serialization.JsonObjectContract,Newtonsoft.Json.Serialization.JsonProperty,Newtonsoft.Json.Serialization.JsonContainerContract,Newtonsoft.Json.Serialization.JsonProperty) <0x00197>
at Newtonsoft.Json.Serialization.JsonSerializerInternalWriter.SerializeValue (Newtonsoft.Json.JsonWriter,object,Newtonsoft.Json.Serialization.JsonContract,Newtonsoft.Json.Serialization.JsonProperty,Newtonsoft.Json.Serialization.JsonContainerContract,Newtonsoft.Json.Serialization.JsonProperty) <0x0015f>
at Newtonsoft.Json.Serialization.JsonSerializerInternalWriter.Serialize (Newtonsoft.Json.JsonWriter,object,System.Type) <0x000bf>
at Newtonsoft.Json.JsonSerializer.SerializeInternal (Newtonsoft.Json.JsonWriter,object,System.Type) <0x0053b>
at Newtonsoft.Json.JsonSerializer.Serialize (Newtonsoft.Json.JsonWriter,object,System.Type) <0x00019> …Run Code Online (Sandbox Code Playgroud) 我有一个使用NewtonSoft的JSON序列化器的简单方法,我喜欢它(简单,返回格式化JSON).但是我似乎无法正确地序列化UTF8字符(它们显示为问号,即'?'),这些字符位于对象内的字符串中.
我正在使用的代码是:
string serialized = JsonConvert.SerializeObject(obj, Newtonsoft.Json.Formatting.Indented, new JsonSerializerSettings { });
Run Code Online (Sandbox Code Playgroud) 我知道如何处理关键事件,即
private void Page_KeyUp(object sender, KeyRoutedEventArgs e)
{
switch (e.Key)
{
case Windows.System.VirtualKey.Enter:
// handler for enter key
break;
case Windows.System.VirtualKey.A:
// handler for A key
break;
default:
break;
}
}
Run Code Online (Sandbox Code Playgroud)
但是如果我需要在小写'a'和大写'A'之间辨别怎么办?另外,如果我想处理百分号'%'之类的键,该怎么办?
我很难找到一个非常具体的用例来工作.有问题的应用程序有两个组件:Windows服务,需要在桌面外的特权上下文中运行(即,在用户登录时是否接受连接)和客户端Winforms应用程序.该服务接受websocket连接,如果连接请求成功,则应该以交互方式(进入桌面)登录用户,并以具有桌面访问权限的用户生成进程.我使用了以下链接,虽然他们能够冒充用户,但他们实际上并没有将用户登录到桌面,即如果我使用VNC观看系统,或者我在本地系统上测试它,用户没有登录.但是,该过程会以用户身份生成,但显然不是桌面访问.
有没有人有一个代码示例,将用户登录到桌面?
我试过的链接和代码:
使用Process.Start()以Windows服务中的不同用户身份启动进程
目前的代码是:
using Cassia;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Diagnostics;
using System.DirectoryServices;
using System.Runtime.InteropServices;
using System.Security;
using System.Security.Permissions;
using System.Security.Principal;
using System.ServiceProcess;
namespace program
{
public partial class service
{
#region Interop
[StructLayout(LayoutKind.Sequential)]
public struct LUID
{
public UInt32 LowPart;
public Int32 HighPart;
}
[StructLayout(LayoutKind.Sequential)]
public struct LUID_AND_ATTRIBUTES
{
public LUID Luid;
public UInt32 Attributes;
}
public struct TOKEN_PRIVILEGES
{
public UInt32 PrivilegeCount;
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 1)]
public LUID_AND_ATTRIBUTES[] Privileges; …Run Code Online (Sandbox Code Playgroud) 似乎无法找到如何使用XElement正确解析它:
<messages>
<message subclass="a" context="d" key="g">
<message subclass="b" context="e" key="h">
<message subclass="c" context="f" key="i">
</messages>
Run Code Online (Sandbox Code Playgroud)
我想把它带到一个List,其中有三个字符串子类,context,key.
可能重复:
如何使用其名称调用方法?
厌倦了使用switch/case语句.我想知道是否有某种方法可以根据用户提供的值调用方法.明白为什么这是一个坏主意可能有一百万个理由,但这就是我在想的:
Console.Write("What method do you want to call? ");
string method_name = Console.ReadLine();
Run Code Online (Sandbox Code Playgroud)
然后以某种方式调用'method_name'中包含的方法.这甚至可能吗?
我无法通过其 ID 从索引中删除对象。我尝试了以下解决方案:
它们会产生各种我无法解决的失败或无法编译的问题。
简单的例子:
public class Doc
{
public int DocID;
public string Name;
}
static void Main(string[] args)
{
try
{
string indexName = "idx";
Uri uri = new Uri("http://localhost:9200");
ConnectionSettings settings = new ConnectionSettings(uri);
ElasticClient client = new ElasticClient(settings);
client.CreateIndex(indexName);
Doc d1 = new Doc();
d1.DocID = 1;
d1.Name = "foo";
Doc d2 = new Doc();
d2.DocID = 2;
d2.Name = "bar";
var d1add = client.Index(d1, i => …Run Code Online (Sandbox Code Playgroud) 我已经看了几个关于promises递归的问题,并对如何正确实现它们感到困惑:
我把一个简单的例子(见下文)放在一起 - 这只是一个例子,所以我可以理解如何使用promises工作进行递归,而不是代表我正在工作的代码.
Net-net,我想要解决的承诺,但根据节点上的输出,它无法解决.有关如何解决问题的任何见解?
var i = 0;
var countToTen = function() {
return new Promise(function(resolve, reject) {
if (i < 10) {
i++;
console.log("i is now: " + i);
return countToTen();
}
else {
resolve(i);
}
});
}
countToTen().then(console.log("i ended up at: " + i));
Run Code Online (Sandbox Code Playgroud)
和控制台上的输出:
> countToTen().then(console.log("i ended up at: " + i));
i is now: 1
i is now: 2
i is now: 3
i is now: 4
i is now: 5 …Run Code Online (Sandbox Code Playgroud) 我知道使用ResultSet的问题,并且已经看到了将数据提取到对象(或列表)中的示例,但是,我想以通用方式执行此操作,即无需了解类.
有没有办法做到这一点,结果将是一个对象或列表,然后我可以使用反射迭代?
我检查过的解决方案似乎无法工作或要求目标类的类认知包括:
我也尝试过ResultSetMapper(http://resultsetmapper.sourceforge.net/),它似乎也需要这个类.我真的只想要一个我可以采取行动的对象或列表.