这是我想为Core Data编写的查询的SQL版本:
SELECT Group.Name, COUNT(Item.Name)
FROM Item INNER JOIN Group ON Item.GroupID = Group.ID
GROUP BY Group.Name
Run Code Online (Sandbox Code Playgroud)
到目前为止我所拥有的是:
NSFetchRequest* fetchGroupSummary = [NSFetchRequest fetchRequestWithEntityName:@"Item"];
NSEntityDescription* entity = [NSEntityDescription entityForName:@"Item" inManagedObjectContext:[[CoreDataManager sharedInstance] managedObjectContext]];
NSAttributeDescription* groupName = [entity.relationshipsByName objectForKey:@"group"];
NSExpression *countExpression = [NSExpression expressionForFunction: @"count:" arguments: [NSArray arrayWithObject:[NSExpression expressionForKeyPath: @"name"]]];
NSExpressionDescription *expressionDescription = [[NSExpressionDescription alloc] init];
[expressionDescription setName: @"count"];
[expressionDescription setExpression: countExpression];
[expressionDescription setExpressionResultType: NSInteger32AttributeType];
NSSortDescriptor *sortDescriptor = [NSSortDescriptor sortDescriptorWithKey:@"group.sort" ascending:YES];
NSPredicate *predicate = [NSPredicate predicateWithFormat:@"group.stage == %@", stage];
[fetchGroupSummary setEntity:entity];
[fetchGroupSummary setSortDescriptors:@[sortDescriptor]]; …Run Code Online (Sandbox Code Playgroud) 我正在尝试开发ac#应用程序,它将生成所有可能的排列列表,在限制和成本范围内.例如,我有80个工作列表.每个作业都有一个值(1-5)(通常为3),每个工程师都有一个限制,他们可以做多少,通常值为20.
目前我已经开始生成所有可能组合的列表(n!/(k!*(nk)!其中n是作业总数,k是2).每个作业之间的链接应该加权每个工作之间的距离.
从这里开始,我想选择一个初始启动工作并生成所有可能的工作组合列表(从开始工作)到20的限制,然后按重量总和进行排序.最低权重路线将赢得并分配给工程师.我的问题是我不知道如何处理这个 - 什么数据结构最好?
通常有大约6-8名工程师(取决于工作量),我计划一次一个地路由每个工程师 - 一旦将路线分配给另一个工程师,这些工作将从列表中删除并选择新的启动工作生成一组新的组合.这听起来像是一种可接受的方法吗?
欢迎任何帮助.
我正在将一些本地应用程序迁移到 Azure 并在一个方面苦苦挣扎 - GhostScript。我们使用 GhostScript 将 PDF 转换为多页 TIFF。目前,它部署在 Azure VM 中,但从管理的角度来看,WebApp 和 WebJob 似乎更合适。在我的所有测试中,我一直无法找到运行 GhostScript exe 的工作。
有没有人能够在 WebJob 中运行 GhostScript 或任何第三方 exe?
我尝试将 GhostScript exe、lib 和 dll 打包成一个 ZIP 文件,然后解压缩到 Path.GetTempPath(),然后使用新的 System.Diagnostics.Process 以所需参数运行 exe - 这不起作用 -进程拒绝启动,退出代码为 -1073741819。
任何帮助或建议将不胜感激。
我正在努力更新一直运行良好的内部路由解决方案.但是,要求的变化会导致一些问题.谷歌搜索时,我遇到了一个名为MapPoint 2010的微软产品.
据我所知,这个产品有一个可以从.net(c#)使用的API.目前,我们使用Google地图对地址进行地理编码并启动工程师的位置.我希望能够将这些数据传递给MapPoint,将每个作业位置标记为第一个呼叫,呼叫或下午呼叫,为每个工程师标记最大分配,并要求MapPoint将工作分配给工程师.完成后,提取数据并将其传递回SQL数据库.这是MapPoint能做的吗?
有没有人使用MapPoint来满足此类要求?
标记
我正在使用反射来调用在运行时确定的类型的泛型方法.我的代码如下:
Type tType = Type.GetType(pLoadOut.Type);
MethodInfo method = typeof(ApiSerialiseHelper).GetMethod("Deserialise", new Type[] { typeof(string) });
MethodInfo generic = method.MakeGenericMethod(tType);
generic.Invoke(obj, new object[] { pLoadOut.Data });
Run Code Online (Sandbox Code Playgroud)
这没问题.但是generic.Invoke方法返回一个对象,但我想要的是在运行时确定的类型.这种方法是否可行,还是有更好的选择?
标记
我有如下操作:
public async Task<ActionResult> Pair(string id)
{
try
{
DocuSignAPIManager docuSignAPIManager = new DocuSignAPIManager();
DocuSignEsignatureAuthContainer authContainer = await docuSignAPIManager.Pair(User.Identity.Name, id).ConfigureAwait(false);
DocuSignManager.Instance.Pair(User.Identity.Name, authContainer);
}
catch(Exception e)
{
ErrorManager.Instance.LogError(e);
}
return new HttpStatusCodeResult(200);
}
Run Code Online (Sandbox Code Playgroud)
当调用该操作时,所有逻辑都被执行,但不是 HTTP 状态 200 代码,我收到以下信息:
System.Threading.Tasks.Task`1[System.Web.Mvc.ActionResult]
Run Code Online (Sandbox Code Playgroud)
为了进行测试,我只是使用以下 URL 从 Web 浏览器调用操作:
http://localhost:20551/CharteredSurveyor/Pair/password
Run Code Online (Sandbox Code Playgroud)
我真的不明白问题是什么 - 任何人都可以帮忙吗?
我有一个使用Castle Windsor的MVC5应用程序(http://www.artisancode.co.uk/2014/04/integrating-windsor-castle-mvc/).我最近尝试添加一个Async方法和一个MVC控制器.当我这样做时,我收到以下错误消息:
异步操作方法'test'返回一个Task,它不能同步执行.
我在VS中创建了一个新的MVC应用程序并没有收到错误,所以我猜我在Castle Windsor配置中留下了什么?但是我不知道从哪里开始,在帮助时我一直找不到任何文章.
使用代码更新问题:
CastleWindsorActionInvoker.cs
public class CastleWindsorActionInvoker : ControllerActionInvoker
{
private readonly IKernel kernel;
public CastleWindsorActionInvoker(IKernel kernel)
{
this.kernel = kernel;
}
protected override ActionExecutedContext InvokeActionMethodWithFilters(ControllerContext controllerContext, IList<IActionFilter> filters, ActionDescriptor actionDescriptor, IDictionary<string, object> parameters)
{
foreach(IActionFilter filter in filters)
{
kernel.InjectProperties(null, filter);
}
return base.InvokeActionMethodWithFilters(controllerContext, filters, actionDescriptor, parameters);
}
protected override AuthorizationContext InvokeAuthorizationFilters(ControllerContext controllerContext, IList<IAuthorizationFilter> filters, ActionDescriptor actionDescriptor)
{
foreach(IAuthorizationFilter filter in filters)
{
Type type = filter.GetType();
IEnumerable<INamedInstanceAttribute> namedInstanceAttributes = type.GetCustomAttributes(typeof(INamedInstanceAttribute), false) as IEnumerable<INamedInstanceAttribute>; …Run Code Online (Sandbox Code Playgroud) 当我将以下覆盖添加到 AppDelegate 时:
public override void HandleAction(UIApplication application, string actionIdentifier, NSDictionary remoteNotificationInfo, [BlockProxy(typeof(NIDAction))] Action completionHandler)
{
}
Run Code Online (Sandbox Code Playgroud)
我收到以下错误:
严重性代码描述项目文件行抑制状态错误CS0246找不到类型或命名空间名称“NIDAction”(是否缺少using指令或程序集引用?)Notifi.iOS C:\development\notifi\Notifi\Notifi\Notifi .iOS\AppDelegate.cs 119 活动
我尝试搜索有关 NIDAction 的信息,但找不到任何有用的信息 - 我可以删除此属性吗?
我正在寻找使用 .net (c#) 解密 Google Pay 响应的帮助。我正在使用 JavaScript API 和 Direct 方法https://developers.google.com/pay/api/web/guides/setup。我在测试中进行集成并接收加密的有效负载。
问题是似乎没有任何支持解密 ECv2 消息的 .net 库。我发现的唯一库是 Tink https://github.com/google-pay/tink-jni-examples,但是它使用的 Java 桥对我不起作用。
有没有人成功地做到了这一点或写了一篇关于它的文章?
我正在尝试延迟发送单独的 SQS 消息。使用https://docs.aws.amazon.com/AWSSimpleQueueService/latest/SQSDeveloperGuide/sqs-send-message-with-timer.html测试消息延迟,我没有看到任何延迟。
如果我在队列上设置延迟,则会尊重该延迟,但不适用于单个消息。我正在执行以下操作(全部来自 AWS 控制台):
但是,当我检查 CloudWatch 时,我可以看到该消息几乎立即传送。我是否误解了某些内容,或者我在配置中遗漏了某些内容?
c# ×5
async-await ×2
amazon-sqs ×1
asp.net-mvc ×1
aws-lambda ×1
core-data ×1
elmah ×1
encryption ×1
generics ×1
google-pay ×1
mappoint ×1
math ×1
objective-c ×1
permutation ×1
xamarin ×1