当我尝试在Windows 8.1上安装Visual Studio 2014 CTP时,出现以下错误:
"此版本的Visual STudio需要2014年4月更新到Windows 8.1和Windows Server 2012 R2,称为KB2919355.请在这些操作系统上安装Visual Studio之前安装KB 2919355".
要尝试解决此问题,我已检查新的Windows更新和已安装的Windows更新,并且KB2919355未显示在任一列表中.
我的下一个停靠点是从Microsoft手动下载更新,但是当我尝试运行它时,我收到错误消息"更新不适用于您的计算机".考虑到我刚被告知要由Visual Studio安装程序安装它,这令人困惑.
我检查了事件日志,WUSA.exe给出了以下错误消息:"由于错误2149842967"无法安装Windows更新""(命令行:"C:\ Windows\system32\wusa.exe C:\ Users\kevin \下载\ Windows8.1-KB2919355-x64.msu程序 ")".
我已经尝试搜索错误代码2149842967,但所有的解决方案都说运行Microsoft fixit应用程序,我试过但无济于事.
我目前正在使用梦幻般的monogame框架编写游戏.我无法正确对触摸输入作出反应.当用户水平或垂直拖动时,我想每次拖动执行一次动作.问题是每次拖动都会多次发出手势.这是我的代码:
var gesture = default(GestureSample);
while (TouchPanel.IsGestureAvailable)
gesture = TouchPanel.ReadGesture();
if (gesture.GestureType == GestureType.VerticalDrag)
{
if (gesture.Delta.Y < 0)
return new RotateLeftCommand(_gameController);
if (gesture.Delta.Y > 0)
return new RotateRightCommand(_gameController);
}
if (gesture.GestureType == GestureType.HorizontalDrag)
{
if (gesture.Delta.X < 0)
return new RotateLeftCommand(_gameController);
if (gesture.Delta.X > 0)
return new RotateRightCommand(_gameController);
}
Run Code Online (Sandbox Code Playgroud)
出于本示例的目的,我已将所有此代码移动到一个块中.然后返回的RotateRightCommand或RotateLeftCommand由调用代码执行,该调用代码在屏幕上旋转对象.整个代码块在monogame的更新循环中运行.我认为我在重置触摸输入方面缺少一些东西,这就是我为一次拖动返回3或4个RotateCommands的原因.我究竟做错了什么?
我有以下弹性搜索查询,以便从按市场ID分组的弹性搜索中获得最高总ms.
{
"from": 0,
"size": 0,
"query": {
"filtered": {
"filter": {
"and": [
{
"term": {
"@type": "tradelog"
}
},
{
"range": {
"@timestamp": {
"gte": "now-7d",
"lt": "now"
}
}
},
{
"range": {
"TotalMs": {
"gte": 200,
"lt": 2000
}
}
}
]
}
}
},
"aggregations": {
"the_name": {
"terms": {
"field": "Market",
"order" : { "totalms_avg" : "desc" }
},
"aggregations": {
"totalms_avg": {
"avg": {
"field": "TotalMs"
}
}
}
}
}
}
Run Code Online (Sandbox Code Playgroud)
此查询返回几个只有1个结果的桶,这些桶是我数据中的异常值,因此我不希望它们被包含在内.是否可以过滤掉任何小于5的桶?弹性搜索等同于SQL的'HAVING'子句.
我正在学习如何在C#中创建文本文件,但我遇到了问题.我用过这段代码:
private void btnCreate_Click(object sender, EventArgs e)
{
string path = @"C:\CSharpTestFolder\Test.txt";
if (!File.Exists(path))
{
File.Create(path);
using (StreamWriter sw = File.CreateText(path))
{
sw.WriteLine("The first line!");
}
}
else if (File.Exists(path))
MessageBox.Show("File with this path already exists.", "Error!", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
Run Code Online (Sandbox Code Playgroud)
当我按下"创建"按钮时,Visual Studio会显示错误"System.IO.DirectoryNotFoundException",它指向"File.Create(path)".
问题出在哪儿?
我正在尝试使用反射来设置指向nil
通过interface{}
Go中传递的结构的指针。
我有这个示例程序,但是由于a设置为,它始终显示false nil
。我究竟做错了什么?
package main
import "reflect"
type MyStruct struct {}
func main() {
a := &MyStruct{}
wipePassed(a)
println(a == nil)
}
func wipePassed(r interface{}){
v := reflect.ValueOf(&r)
p := v.Elem()
p.Set(reflect.Zero(p.Type()))
}
Run Code Online (Sandbox Code Playgroud)