我试图在Go程序中使用OpenGL.我想我已经完成了所有的工作,但我仍然无法让它运行起来.
我的C编译器是mingw的64位版本.它在我的%PATH%变量中,我已经验证它使用cgo文档中的随机数示例.
我通过将bin,lib和include文件夹应用到\mingw\x86_64-w64-mingw32mingw-w64安装中的等效文件来安装64位GLEW 1.9.0 .
当我尝试运行时go get github.com/go-gl/gl,请回复以下内容:
In file included from attriblocation.go:7:0:
gl.h:5:25: error: enumerator value for '__cgo_enum__5' is not an integer constant
#define GLEW_GET_FUN(x) (*x)
^
d:\programs\mingw64\x86_64-w64-mingw32\include\gl\glew.h:1956:26: note: in expansion of macro 'GLEW_GET_FUN'
#define glVertexAttrib3f GLEW_GET_FUN(__glewVertexAttrib3f)
^
gl.h:5:25: error: enumerator value for '__cgo_enum__6' is not an integer constant
#define GLEW_GET_FUN(x) (*x)
Run Code Online (Sandbox Code Playgroud)
对于值达到的值,这些错误以类似的方式继续__cgo_enum__15.我也从每个条目的Go方面得到一些匹配错误.
关于我缺少什么的想法让这个工作?
编辑:以下是来自Go方面的"匹配"日志.
attriblocation.go:42:2: error: initializer element is not constant …Run Code Online (Sandbox Code Playgroud) 我正在调试一个似乎像疯了一样泄漏内存的应用程序; 大多数情况似乎是由于固定对象的碎片(在WriteableBitmap中下载的图像数据).但是,我并不是故意使用GC.Handle或类似的东西.我所做的就是将数据存储在a中MemoryStream,并像这样引用它.
什么操作将数据固定在内存中,哪些没有明确说明?另外,我怎样才能找到使用WinDbg固定它的内容?
编辑:每个请求,这是一个(略微清理)输出的System.Int32阵列上的一个!GCRoot与一大块可用内存相邻.这是所有大型免费区块的代表.
编辑2:在与我的新朋友WinDbg和SOS共度时间之后,我发现WriteableBitmapsAND MemoryStream对象都是"固定"的,应该小心分配以防止内存碎片.阅读接受的答案中的文章,以解释为什么需要这样做.
DOMAIN(1AC72358):HANDLE(Pinned):72c12f8:Root: 174c5e20(System.Object[])->
16533060(Project.ProjectParts.PartContainer)->
167fe554(Project.ProjectParts.Part.PartActivity)->
167d21d8(Project.ProjectParts.Sprites.Graphic)->
16770f28(System.Windows.Controls.Canvas)->
16770e1c(System.Windows.Controls.Canvas)->
16770ee4(System.Collections.Generic.Dictionary`2[[MS.Internal.IManagedPeerBase, System.Windows],[System.Object, mscorlib]])->
1680e778(System.Collections.Generic.Dictionary`2+Entry[[MS.Internal.IManagedPeerBase, System.Windows],[System.Object, mscorlib]][])->
16770f9c(System.Windows.Controls.Canvas)->
16819114(System.Collections.Generic.Dictionary`2[[MS.Internal.IManagedPeerBase, System.Windows],[System.Object, mscorlib]])->
16819160(System.Collections.Generic.Dictionary`2+Entry[[MS.Internal.IManagedPeerBase, System.Windows],[System.Object, mscorlib]][])->
16818df4(System.Windows.Controls.Canvas)->
16818e58(System.Collections.Generic.Dictionary`2[[MS.Internal.IManagedPeerBase, System.Windows],[System.Object, mscorlib]])->
16819f10(System.Collections.Generic.Dictionary`2+Entry[[MS.Internal.IManagedPeerBase, System.Windows],[System.Object, mscorlib]][])->
168194c4(System.Windows.Controls.Canvas)->
16819528(System.Collections.Generic.Dictionary`2[[MS.Internal.IManagedPeerBase, System.Windows],[System.Object, mscorlib]])->
16819574(System.Collections.Generic.Dictionary`2+Entry[[MS.Internal.IManagedPeerBase, System.Windows],[System.Object, mscorlib]][])->
16819370(System.Windows.Controls.Image)->
21c82138(System.Collections.Generic.Dictionary`2[[MS.Internal.IManagedPeerBase, System.Windows],[System.Object, mscorlib]])->
21c82184(System.Collections.Generic.Dictionary`2+Entry[[MS.Internal.IManagedPeerBase, System.Windows],[System.Object, mscorlib]][])->
168195dc(System.Windows.Media.Imaging.WriteableBitmap)->
21c7ce2c(System.Int32[])
DOMAIN(1AC72358):HANDLE(AsyncPinned):72c1dfc:Root: 166bae48(System.Threading.OverlappedData)->
1654d448(System.Threading.IOCompletionCallback)->
1654c29c(System.Net.Sockets.SocketAsyncEventArgs)->
1654bad4(System.Net.Sockets.Socket+StaticConnectAsyncState)->
1654ba40(System.Net.Sockets.SocketAsyncEventArgs)->
1654b684(System.ServiceModel.Channels.SocketConnectionInitiator+ConnectAsyncResult)->
1654b414(System.ServiceModel.Channels.ConnectionPoolHelper+EstablishConnectionAsyncResult)->
1654b3b0(System.ServiceModel.Channels.ClientFramingDuplexSessionChannel+OpenAsyncResult)->
1654b380(System.ServiceModel.Channels.CommunicationObject+OpenAsyncResult)->
1654b330(System.ServiceModel.Channels.CommunicationObject+OpenAsyncResult)->
1654b0f4(System.ServiceModel.Channels.ServiceChannel+SendAsyncResult)->
1654b070(System.ServiceModel.ClientBase`1+AsyncOperationContext[[Cassandra.Common.WCF.IAsyncWcfRequestProcessor, Cassandra.Common.Silverlight]])->
1654b05c(System.ComponentModel.AsyncOperation)->
1654b04c(Project.Common.IoC.InvokeAsyncCompletedEventRequestsArgs)->
1654afec(System.Action`1[[Project.Common.IoC.ProcessRequestsAsyncCompletedArgsEx, Project.Common.SL]])->
1654afc8(Project.Common.IoC.AsyncRequestDispatcherEx+<>c__DisplayClass1)->
1654afa0(Project.Common.IoC.NetResponseReceiver)->
1653408c(System.Action`2[[Cassandra.Common.ExceptionInfo, Cassandra.Common.Silverlight],[Cassandra.Common.ExceptionType, Cassandra.Common.Silverlight]])->
16533ffc(Project.ProjectParts.ILE.Services.EngineProxyService+<>c__DisplayClass5)-> …Run Code Online (Sandbox Code Playgroud) 我正在尝试使用最新的Facebook PHP SDK编写应用程序.但是,我请求的任何扩展权限都不会被请求,它始终默认为基本请求,并且不会要求任何请求的扩展权限.
以下是我请求这些权限的方式:
<?php
require_once("facebook.php");
$app_id = "xxx";
$app_secret = "xxx";
$facebook = new Facebook(array(
'appId' => $app_id,
'secret' => $app_secret,
'cookie' => true
));
if(is_null($facebook->getUser())){
$params = array(‘scope’ => ‘user_status,publish_stream,user_photos’);
header("Location:{$facebook->getLoginUrl($params)}");
exit;
}
?>
Run Code Online (Sandbox Code Playgroud)
此文件包含在嵌入我的应用程序的任何页面的开头.关于为什么我没有得到我想要的扩展权限的任何想法?
我为一些自定义文件类型编写了预览处理程序.默认情况下,这些文件类型没有可以打开它们的应用程序.我想将一个图标与文件类型相关联,作为他们自定义的能指.
我已经尝试为DefaultIconin 设置一个注册表项HKCR\.<filetype>,但它似乎没有工作,即使重新启动后.我从C#进行了这些注册表修改,并且修改成功.
图标文件只是%APPDATA%暂时驻留的ico文件.我计划添加一些图标,并将它们放在一个dll文件中.在我采取下一步措施之前,我只想让它发挥作用.
如何设置此图标?
我的工作需要的应用程序访问电子邮件的标题-特别的像return-path,in-reply-to和references.理想情况下,我们希望能够访问电子邮件的所有RFC 2822标头.这是否可以使用Outlook/Office 365 REST API?如果没有,是否可以使用任何API?
我知道可以从这个Outlook REST的电子邮件中获取标题,但有没有办法我们也可以设置自定义标题?我似乎找不到任何文件.
我试图在一个std::stringC++中附加一个HTTP响应的sentinel("\ r \n\r \n").但是,当我附加数据时,我得到了一大堆额外的东西:^[[?62;9;c^[[?62;9;c[然后我的程序终止.然后它将以下内容写入命令行:62;9;c62;9;c62;9;c62;9;c62;9;c62;9;c.这似乎只发生在.jpg / .gif文件中,我已经测试并验证了使用text和html文件的相同方法.
上下文是我试图将此字符串写入套接字,使用string.c_str().在读完所需的文件后,我已经追踪了额外的字符到我做的追加操作.我认为这会导致我的计算内容长度失效,导致崩溃.所以我只需要知道为什么这些额外的东西最终会在我身上string.c_str()?
编辑:这是我的文件阅读代码.(忘了粘贴它)(BUFFER_LENGTH #defined为1024)
int fd = open(filename.c_str(),O_RDONLY);
int bytesRead = 0;
char buffer[BUFFER_LENGTH];
string content = "";
while((bytesRead = read(fd, buffer, BUFFER_LENGTH)) !=0)
{
if(bytesRead==-1)
{
if(errno == EINTR)
{
printf("\nERRONO");
continue;
}
else
{
printf("\nclosing fd");
close(fd);
}
}
content+= buffer;
}
close(fd);
//Printing content.c_str() here gives right value
content += "\r\n\r\n";
//Printing content.c_str() here gives the gibberish, and crash when …Run Code Online (Sandbox Code Playgroud) 我在我的应用程序中使用C#对象持久性模型,并从外部源填充表。我插入具有下列日期行(字符串列)2018-12-12T22:27:14.73Z。这是使用以下Go代码从时间戳生成的:
&dynamodb.AttributeValue{S: aws.String(entity.TimeStamp.UTC().Format("2006-01-02T15:04:05.999Z"))}
Run Code Online (Sandbox Code Playgroud)
但是,当尝试将DynamoDB对象持久性模型转换为时,该模型会System.DateTime出现错误:System.InvalidOperationException: Unable to convert [2018-12-12T22:27:14.73Z] of type Amazon.DynamoDBv2.DocumentModel.Primitive to System.DateTime
如果我让我的服务写一个System.DateTime(使用包含一个DateTime属性POCO),它看起来是这样的:2018-12-19T07:45:36.431Z。我缺少什么使AWS无法正确反序列化我的日期?看起来我以与Amazon相同的格式编写它们?
我正在WebUtility.HtmlDecode尝试解码一个字符串,其中一部分如下:
checkin=%7B%22id%22%3A%224f612730e4b071dd72e3749d%22%2C%22createdAt%22%3A1331767088%2C%22type%22%3A%22checkin%22%2C%22timeZone%22%3A%22America%5C%2FDenver%22%2C
Run Code Online (Sandbox Code Playgroud)
但是,WebUtility.HtmlDecode无法解码它,任何一个.如果重要,这是我如何生成字符串:
public static Dictionary<String, dynamic> DeserializeRequestStream(Stream requestStream, int contentLength)
{
requestStream.Position = 0; //Since a custom route with post data AND an ID passed in a parameter reads this stream. Damn bugs.
var bytes = new byte[contentLength];
requestStream.Read(bytes, 0, contentLength); //(int)requestStream.Length - contentLength
var jsonResponse = System.Text.Encoding.UTF8.GetString(bytes, 0, bytes.Length);
var decodedResponse = WebUtility.HtmlEncode(jsonResponse);
//...snip...
}
Run Code Online (Sandbox Code Playgroud)
这应该是编码的JSON数据,我正在从POST请求中读取.如何将此字符串解码为常规JSON?
编辑: Lasse V. Karlsen指出这实际上是URL编码的,而且我一直在咆哮错误的树.问题仍然存在:我将如何解码?
我检查了一个变更集,将~10个媒体文件添加到我的TFS分支.但是,在分支机构的其他人连续调用"Get Latest"后,他们都没有能够实际获取文件,直到他们从Source Control Explorer中选择"获取特定版本"并选中了这两个框.
应该注意的是,这些媒体文件与它们所属的项目位于同一文件夹中; 但它们不是项目/解决方案的一部分(您无法在Visual Studio中的解决方案资源管理器中看到它们).
以下是关于(可能)问题的两个想法:
他们从解决方案资源管理器而不是源代码管理资源管理器中选择"获取最新"; 更新其工作区版本但不实际下载文件.
以某种方式添加这些文件并不算作改变.
我意识到很难尝试用如此有限的信息回答问题,但我很好奇为什么他们无法获得新的媒体文件.
此外,将来如何避免这样的问题(最佳实践)?