////////////////////////////////////////////////// ////////////////////////////////////////////////
// OBSERVE https://developers.facebook.com/docs/chat/
随着Platform API v2.0的发布,本文档所涵盖的服务和API已被弃用.不推荐使用1.0版后,chat.facebook.com将不再可用.
//阅读本文,你可能想做一些与这个问题有关的事情完全不同的事情.
////////////////////////////////////////////////// //////////////////////////////////////
我正在创建一个与Web Chatms C#连接到Facebook Chat API的聊天.
我也看了这个问题(以及所有链接).由于Facebook auth_token现在需要,因此某些部分不再相关.
要复制此功能,您应该设置一个Facebook Web应用程序,使用appId具有xmpp_login权限集的用户帐户.然后Chat.aspx在后面创建一个代码并相应地粘贴此代码.并替换硬编码用户进行交互.
我有两个(可能是三个)问题我相信会阻止我成功发送聊天消息.
// finishes auth process文档中注明的过程与文档描述不符
(在我从Facebook收到基于SSL/TLS的成功消息后,我没有得到任何响应.)我还有一些帮助,用于添加xmpp_login权限等等..为了清楚起见,删除了.
全局变量:
public partial class Chat : Page
{
public TcpClient client = new TcpClient();
NetworkStream stream;
private SslStream ssl;
private string AppId { get; set; }
public string AppSecret { get; set; }
public string AppUrl { get; set; } …Run Code Online (Sandbox Code Playgroud) 我正在使用以下代码创建拆分归档:
string filename = "FileName.pdf";
using (ZipFile zip = new ZipFile())
{
zip.UseZip64WhenSaving = Zip64Option.Default;
zip.CompressionLevel = Ionic.Zlib.CompressionLevel.Default;
using (FileStream stream = new FileStream(temp, FileMode.Open))
{
zip.AddEntry(filename, stream);
zip.MaxOutputSegmentSize = settings.AttachmentSize * (1024 * 1024);
zip.Save(zipFileName);
}
}
Run Code Online (Sandbox Code Playgroud)
上面的代码生成3个文件:file.zip, file.z01 and file.z02.当我右键单击该zip文件并选择Extract All(不使用WinRAR或其他压缩软件提取,只是内置的Windows zip)时,它会给我以下错误:
相同的卷不能同时用作源和目标

奇怪的是,它只发生在我第一次尝试提取文件时,后续的提取是正常的,所以它必须是文件首先被压缩的方式.
更新1
即使我提取到不同的文件夹,也会发生同样的事情
在DotNetZip Codeplex网站上已就此问题进行了讨论,但似乎问题尚未得到解决
http://dotnetzip.codeplex.com/discussions/239172
http://dotnetzip.codeplex.com/discussions/371005
更新2
查看MaxOutputSegmentSize属性的doc ,引用它:
我不相信Windows资源管理器可以提取拆分存档.
关于为什么,没有进一步的解释.我认为这是假阳性,因为如上所述,
它只在我第一次尝试提取文件时发生,后续提取都可以
我正在使用Windows 8.1 64位.
//解决方案:我只是简单地替换了四次出现,如建议的批准答案和不显眼的ajax插件已启动并再次使用jquery 1.9.0
更新//观察底部标记答案的注释,这是解决此问题的最佳方法.
//原帖:我升级到jQuery 1.9.0,但随后不引人注意的ajax插件因为他们弃用了live方法而失败了.我试图像这样替换它,因为升级修复了我的另一个错误.但是,它不起作用.我只是简单地用以下方式取代了:
$("a[data-ajax=true]").on("click", function (evt) {
evt.preventDefault();
asyncRequest(this, {
url: this.href,
type: "GET",
data: []
});
});
$("form[data-ajax=true] input[type=image]").on("click", function (evt) {
var name = evt.target.name,
$target = $(evt.target),
form = $target.parents("form")[0],
offset = $target.offset();
$(form).data(data_click, [
{ name: name + ".x", value: Math.round(evt.pageX - offset.left) },
{ name: name + ".y", value: Math.round(evt.pageY - offset.top) }
]);
setTimeout(function () {
$(form).removeData(data_click);
}, 0);
});
$("form[data-ajax=true] :submit").on("click", function (evt) {
var name …Run Code Online (Sandbox Code Playgroud) Update2 这篇文章已经老了但仍然相关..下面是我解决它的方式.我标记了其他人回答,因为我认为它更好地回答了这个问题.我在accountcontroller中调用了一个类似的方法(我将要重构:)).字符串应该是一个列表......我想你明白了.
/// <summary>
/// Use this method when an action fails due to lack of priviligies. It will redirect user to facebook with provided permission request.
/// Refactor to handle list of request.
/// </summary>
/// <param name="permission"></param>
private static void AddAdditionalPermissions(string permission)
{
System.Diagnostics.Trace.TraceInformation(permission + " not authorized for user.");
string facebook_urlAuthorize_base = "https://graph.facebook.com/oauth/authorize";
string scope = permission; //see: https://developers.facebook.com/docs/authentication/permissions/ for extended permissions
string urlAuthorize = facebook_urlAuthorize_base;
urlAuthorize += "?client_id=" + AppId;
urlAuthorize += "&redirect_uri=" + "https://fbd.anteckna.nu/";
urlAuthorize …Run Code Online (Sandbox Code Playgroud) 我需要在php中获取特定节点的父节点.我正在使用DomDocument和Xpath.我的xml是这样的:
<ProdCategories>
<ProdCategory>
<Id>138</Id>
<Name>Parent Category</Name>
<SubCategories>
<ProdCategory>
<Id>141</Id>
<Name>Category child</Name>
</ProdCategory>
</SubCategories>
</ProdCategory>
</ProdCategories>
Run Code Online (Sandbox Code Playgroud)
php代码:
$dom = new DOMDocument();
$dom->load("ProdCategories_small.xml");
$xpath = new DOMXPath($dom);
$nodes = $xpath->query('//ProdCategory/Id[.="141"]/parent::*')->item(0);
print_r($nodes);
Run Code Online (Sandbox Code Playgroud)
印刷品是:
DOMElement Object (
[tagName] => ProdCategory [schemaTypeInfo] => [nodeName] => ProdCategory [nodeValue] => 141 Category child [nodeType] => 1 [parentNode] => (object value omitted) [childNodes] => (object value omitted) [firstChild] => (object value omitted) [lastChild] => (object value omitted) [previousSibling] => (object value omitted)
Run Code Online (Sandbox Code Playgroud)
的[parentNode]就是(object value omitted) …
//更新:您可以阅读以下答案.解决方案是使用facebook chat api建立聊天(您应该将其用作聊天,而不是消息系统,但它会留言.)
所以我在Facebook(HiQ)和Magnus之间进行了以下对话.据我所知,没有办法从图形api发起对话,但我应该能够根据https://developers.facebook.com/docs/reference/api/using-comments/回复消息
我有两个问题.(我的尝试解决方案如下)1.我无法得到个人评论.图2(我可以得到评论集合图3)2.我无法回复评论.图2.
另请注意,我已将所有权限设置为允许,如果我没有图表api资源管理器应在请求之前请求它.
图1.消息/对话

图2.我无法检索单个注释(单击登录用户发布的注释)

图3.只是评论工作正常的响应.

尝试的解决方案:文档描述了对这样的评论的回复:https : //developers.facebook.com/docs/reference/api/publishing/ https://developers.facebook.com/docs/reference/api/using-comments /
创建评论和回复
可以使用API调用创建具有/ comments连接的对象的单独注释:
POST/{object-id}/comments?message ='这是我的消息'消息是此API调用中唯一的参数.它应该是包含注释文本的字符串.
所以我尝试了以下(在/ comments之后有问号和没有问号).图4.尝试发表评论评论:

并直接指向评论ID(带和不带问号):

欢迎任何建议,因为我被严重困扰!实施是通过Facebook C#SKD完成的
c# facebook facebook-graph-api facebook-c#-sdk facebook-messages
我有两个Web角色,其中一个运行服务层,包括与net.tcp连接的3个WCF服务,每个服务部署为端口808,810和811上的网站.
现在我希望服务层只对我的其他Web角色开放.
因此,我尝试将其中一个服务端点设置为内部,并为我的前端Web角色提供访问权限.
像这样:
<ServiceDefinition name="MagnusAzureCloudService" xmlns="http://schemas.microsoft.com/ServiceHosting/2008/10/ServiceDefinition" schemaVersion="2015-04.2.6">
<WebRole name="Core.Services" vmsize="Small">
<Runtime executionContext="elevated" />
<Startup>
<Task commandLine="Startup/startup.cmd" executionContext="elevated" taskType="background" />
</Startup>
<Sites>
<Site name="Core" physicalDirectory="C:\CoreServices">
<Bindings>
<Binding name="Endpoint1" endpointName="Endpoint1" />
</Bindings>
</Site>
<Site name="Store" physicalDirectory="C:\StoreServices">
<Bindings>
<Binding name="Endpoint3" endpointName="Endpoint3" />
</Bindings>
</Site>
<Site name="Users" physicalDirectory="C:\UserServices">
<Bindings>
<Binding name="Endpoint4" endpointName="Endpoint4" />
</Bindings>
</Site>
</Sites>
<ConfigurationSettings>
<Setting name="Microsoft.WindowsAzure.Plugins.Diagnostics.ConnectionString" />
</ConfigurationSettings>
<Endpoints>
<InputEndpoint name="Endpoint1" protocol="http" port="8282" />
<InputEndpoint name="Endpoint3" protocol="http" port="81" />
<InputEndpoint name="Endpoint4" protocol="http" port="8181" />
<InputEndpoint name="Endpoint2" protocol="tcp" port="808" localPort="808" /> …
更新 2:该文件未发布。那是错误的。但是,我无法弄清楚为什么我的一台计算机可以以正确的方式发布它而另一台在 Visual Studio 升级后却不能。
更新:在两台不同的计算机上运行相同的解决方案,其中 APIProject.xml 文件从一台计算机正确发布,但不是另一台计算机,现在只剩下一个差异。用于发布的计算机运行未更新版本的 Visual Studio 2017 Enterprise。15.5.2 不起作用而 15.4.2 起作用。
我收到此错误:
FileNotFoundException: 找不到文件“D:\home\site\wwwroot\APIProject.xml”。
该文件位于 bin\Debug\netcoreapp2.0 它在本地工作,但发布到 Azure App 服务时崩溃。
我正在发布到我创建的暂存槽,但尚未尝试生产。发布会替换目的地的所有文件。
这是我对 Swagger 的设置,但它曾经可以工作:)
public void ConfigureServices(IServiceCollection services)
{
services.AddMvc();
// Register the Swagger generator, defining one or more Swagger documents
services.AddSwaggerGen(c =>
{
c.SwaggerDoc("v1", new Info
{
Version = "v1",
Title = "Ecommerce/Product API",
Description = "Handles API based shopping functionality",
TermsOfService = "Terms of service should be contracted with inidividually",
Contact = …Run Code Online (Sandbox Code Playgroud) azure asp.net-web-api .net-core azure-web-app-service visual-studio-2017
我试图在Windows开发人员中心查看我的应用程序的总下载量,但只能选择最近30天或3个月的即时报告.我无法单击下图中的"历史"选项.

最直观的方法是访问https://dev.windows.com/analytics/reports/acquisitions?productId=myProductIdGoesHere,其中显示了收购.我可以更改过滤器,但它们只过滤操作系统版本和市场.
"下载报告"可在"分析"菜单中找到,其中包含以下网址. https://dev.windows.com/analytics/reports/export?productId=9id9id
我怎么用linq写这个?
foreach (var to in allCurrentTradeObjects)
{
foreach (var ro in theseWantMe)
{
if (ro.Type != to.Type
|| ro.MaxRent < to.Rent
|| ro.MinRooms > to.Rooms
|| ro.MinSquareMeters > to.SquareMeters
|| ro.MaxPrice < to.Price
|| ro.MinFloors > to.Floors
|| ro.TradeObjectId == to.TradeObjectId
|| ro.TradeObjectId == myTradeObject.TradeObjectId)
{
continue;
}
RatingListTriangleModel rlt = new RatingListTriangleModel
{
To1Id = myTradeObject.TradeObjectId,
To2Id = to.TradeObjectId,
To3Id = ro.TradeObjectId,
T1OnT2Rating = 0,
T2OnT3Rating = 0,
T3OnT1Rating = 0,
TotalRating = 0
};
//_context.RatingListTriangle.Add(rlt);
this.InsertOrUpdate(rlt);
}
} …Run Code Online (Sandbox Code Playgroud) 我是编程新手.我需要能用C生成随机数的东西.我找到了"rand()".但它不会产生随机值.请检查以下简单代码.
以下代码给出
roll the first dice : 6
roll the second dice : 6
roll the third dice : 5
Run Code Online (Sandbox Code Playgroud)
这是代码:
#include <stdio.h>
#include <stdlib.h>
#include <ctype.h>
#include <string.h>
int main()
{
int dice1,dice2,dice3,total1,total2;
char prediction[10];
int dice_generator()
{
dice1= (rand()%6)+1;
printf("roll the first dice: %d \n", dice1);
dice2= (rand()%6)+1;
printf("roll the second dice: %d \n", dice2);
dice3= (rand()%6)+1;
printf("roll the third dice: %d \n", dice3);
return 0;
}
dice_generator();
total1 = dice1+dice2+dice3;
printf("final value is = %d\n",total1);
return 0; …Run Code Online (Sandbox Code Playgroud) 我正在使用gcc 4.9.2并且有一个程序来打印N个数的4次幂之和.
我已经编写了程序,但总是打印出的总和是输入数字的4次幂,而不是总和.我认为这是柜台的问题,但不知道是什么.
if(n>0 && n<=40)
{
for(c=0;c<=n;c++)
{
s=0;
s=s+c*c*c*c;
}
printf("%d",s);
}
Run Code Online (Sandbox Code Playgroud)