小编1Ma*_*yur的帖子

应用程序配置不允许使用URL

我在我的html页面中使用过这个...

<script>     
window.fbAsyncInit = function() {
    // init the FB JS SDK
    FB.init({
      appId      : 'xxxxxxxxxxxxxx', // App ID from the App Dashboard
      status     : true, // check the login status upon init?
      cookie     : true, // set sessions cookies to allow your server to access the session?
      xfbml      : true  // parse XFBML tags on this page?
    });

    // Additional initialization code such as adding Event Listeners goes here
};

// Load the SDK's source Asynchronously
// Note that …
Run Code Online (Sandbox Code Playgroud)

configuration facebook-javascript-sdk facebook-social-plugins

61
推荐指数
4
解决办法
13万
查看次数

用于List的JSON

我上课了

public class ItemList
{
    public long Id { get; set; }
    public string Name { get; set; }
    public string Description { get; set; }
    public List<int> ItemModList { get; set; }
}
Run Code Online (Sandbox Code Playgroud)

我应该如何为int列表提供输入JSON,因为它没有匹配其值的键

JSON

{
    "Id": "610",
    "Name": "15",
    "Description": "1.99",
    "ItemModList": []
}
Run Code Online (Sandbox Code Playgroud)

我应该在ItemModList中写什么

json

53
推荐指数
2
解决办法
23万
查看次数

解析错误:语法错误,意外'[',期待')'

我有这个行代码

$media = $dc->thumbnail->attributes()['url'];
Run Code Online (Sandbox Code Playgroud)

在我的本地(WAMP)php 5.4.3上运行正常但是当我在我的服务器cpanel上托管它然后它给出了这个错误

Parse error: syntax error, unexpected '[', expecting ')'
Run Code Online (Sandbox Code Playgroud)

我服务器上的php版本是5.2.17

我看到它有任何问题,请帮忙

php syntax-error php-5.2

10
推荐指数
1
解决办法
4万
查看次数

将类属性转换为键值对

我有这两个班

public class BuyEstimateResult
{
    public string SubTitle { get; set; }
    public string Value { get; set; }
    public string Formulae { get; set; }
}
public class SellerReportClass
{
    public string Entityname { get; set; }
    public double EntityAmt { get; set; }
    public string Formulae { get; set; }
}
Run Code Online (Sandbox Code Playgroud)

我必须使它们应该被转换为

public class KeyValue
{
    public string key {get;set;}
    public string value {get;set;}
}
Run Code Online (Sandbox Code Playgroud)

如果我传递BuyEstimateResult,它的SubTitle应该是key,Value应该是KeyValue Class的值,如果我传递SellerReportClass,那么Entityname应该是key,EntityAmt应该是Value

任何想法怎么做

注意:我将获得该类的列表

c#

5
推荐指数
1
解决办法
4157
查看次数

FB Share没有App ID

是否可以使用没有APP ID的FB共享插件?如果我使用HTML5代码,则控制台会记录错误FB.getLoginStatus() called before calling FB.init().要使用HTML 5 FB,是否需要拥有APP ID?

谢谢

html5 facebook-sharer facebook-like

4
推荐指数
1
解决办法
1万
查看次数

使用SMO在SQL Server Express中创建数据库

我正在尝试使用WinForms和C#在SQL Server Express中创建数据库

这就是我想要做的

Microsoft.SqlServer.Management.Smo.Server srv = new Microsoft.SqlServer.Management.Smo.Server srvServer();
int i = srv.Databases.Count;
Run Code Online (Sandbox Code Playgroud)

只是为了在开始时得到计数.但是我得到了错误

建立与SQL Server的连接时发生与网络相关或特定于实例的错误.服务器未找到或无法访问.
验证实例名称是否正确,以及SQL Server是否配置为允许远程连接.
(提供者:命名管道提供程序,错误:40 - 无法打开与SQL Server的连接)这是堆栈跟踪

Microsoft.SqlServer.Management.Management.Management.Comct.ConnectionManager.get_ServerVersion()
中的Microsoft.SqlServer.Management.Common.ConnectionManager.Connect()
位于Microsoft.SqlServer.Management.Smo.ExecutionManager.GetServerVersion(),
位于Microsoft.SqlServer.Management.Smo
Microsoft.SqlServer.Management.Smo.AbstractCollectionBase.getContring()
中的Microsoft.SqlServer.Management.Smo.SqlSmoObject.InitializeStringComparer()
位于Microsoft.SqlServer.Management.Smo.SimpleObjectCollectionBase.InitInnerCollection()的.SqlSmoObject.GetDbComparer(Boolean inServer )
在Microsoft.SqlServer.Management.Smo.SmoCollectionBase.get_InternalStorage()
at Microsoft.SqlServer.Management.Smo.SmoCollectionBase.InitializeChildCollection(Boolean refresh)
at Microsoft.SqlServer.Management.Smo.SmoCollectionBase.get_Count()
at CreateDB.CreateDB.btnCreateDB_Click (对象发送者,EventArgs e)在C:\ Users\Guest1\Downloads\CreateDB\CreateDB\CreateDB.cs中:第82行

应该做什么?

c# smo sql-server-2008

3
推荐指数
1
解决办法
2020
查看次数

UTF8无法在Excel中运行

在我正在使用的.net代码中

byte[] bytesToSend = System.Text.Encoding.UTF8.GetBytes(partialtorender);
Run Code Online (Sandbox Code Playgroud)

然后我写它擅长

"印地语"语言中的文字在生成的excel中变得乱七八糟,你能建议做什么吗?

System.IO.MemoryStream memStr = new System.IO.MemoryStream();

memStr.Write(bytesToSend, 0, bytesToSend.Length);

 memStr.Position = 0;

FileStreamResult result1 = new FileStreamResult(memStr, "application/ms-excel");

Response.AddHeader("content-disposition", "attachment; filename=" + "newExcelSheet" + ".xls");

return result1;
Run Code Online (Sandbox Code Playgroud)

.net c# asp.net-mvc excel

2
推荐指数
1
解决办法
4747
查看次数

Web客户端 - 在此上下文中不允许异步操作

它是一个类库,它被称为网页

try
  {
    System.Net.WebClient wc = WebAccess.GetWebClient();
    wc.UploadStringCompleted += new System.Net.UploadStringCompletedEventHandler(wc_UploadStringCompleted);
    wc.UploadStringAsync(new Uri("http://" + MobileWLCUrl + urlCreateCacheAPI), GetJSONforGetMenuDetails(Id, MenuIds));                    
  }
catch (Exception ex) { EngineException.HandleException(ex); }

void wc_UploadStringCompleted(object sender, System.Net.UploadStringCompletedEventArgs e)
    {
        string result = e.Result;
        EngineException.CreateLog("Cache Created (for Menus: " + MenuIds + ") in API for LocationId: " + LocId);
    }
Run Code Online (Sandbox Code Playgroud)

嗨伙计们,我试图异步地打这个网址而且它给了我这个错误,任何帮助都会受到关注.

Asynchronous operations are not allowed in this context. 
Page starting an asynchronous operation has to have the Async attribute set to true 
and an asynchronous operation …
Run Code Online (Sandbox Code Playgroud)

.net c# asynchronous webclient class-library

2
推荐指数
1
解决办法
1万
查看次数

遇到异常时,此对象是否会自动处理?

using(YourType yourObject = new YourType())
{
   //Treatment on you object 
   //Exception occurs here
}
Run Code Online (Sandbox Code Playgroud)

当我们写这样一来,垃圾收集器将自动销毁的对象,但发生这里面的异常将垃圾收集仍处置对象或者我写的东西吧,我知道这是一个蹩脚的q,但真的很迷茫,日Thnx

请在不同的.net框架中解释处理,使事情变得清晰.

.net c# garbage-collection

2
推荐指数
1
解决办法
134
查看次数

具有不同返回值的 Jest jest.mock 函数

用笑话和酶测试反应和打字稿,我将如何模拟这个 expectsVideo 函数,以便我可以根据我的测试用例场景定义它是否返回 true 或 false

jest.mock('utils/media-utils', () => ({
  expectsVideo: () => true,
  myOtherFunctions: jest.fn()
}));
Run Code Online (Sandbox Code Playgroud)

utils/media-utils 如果正在我正在测试的反应组件中导入的文件。如果我尝试从外部引用对象,则会出现错误,指出不能使用范围外的变量。尝试了各种实现,我遇到了不同的博客,但没有帮助。

reactjs jestjs enzyme

2
推荐指数
1
解决办法
6672
查看次数

转换匿名类型会抛出转换错误

在我的Global.asax文件中,我创建了包含匿名类型对象的数组列表

Application["userRecordsCountList"] = new ArrayList();

((System.Collections.ArrayList)Application["userRecordsCountList"]).Add(new { userCount = 12, logTime = DateTime.Now });
Run Code Online (Sandbox Code Playgroud)

现在在我的cs文件中我有一个像这样的转换函数

T Cast<T>(object obj, T type)
{
    return (T)obj;
}
Run Code Online (Sandbox Code Playgroud)

现在,当我运行循环迭代数据并提取数据集中的数据时,我得到一个错误,请参阅代码

ArrayList countRecord = new ArrayList((System.Collections.ArrayList)Application["userRecordsCountList"]);

foreach (var item in countRecord)
    {
        dr = dt.NewRow();
        var record = Cast(item, new { userCount = "", logTime = "" });
        dr["Time"] = record.logTime;
        dr["Users"] = record.userCount;
        dt.Rows.Add(dr);
    }
Run Code Online (Sandbox Code Playgroud)

错误是

Unable to cast object of type '<>f__AnonymousType0`2[System.Int32,System.DateTime]' to type '<>f__AnonymousType0`2[System.String,System.String]'.
Run Code Online (Sandbox Code Playgroud)

请帮帮我..我已经尝试过在stackoverflow或任何其他来源找到的每一种方法.....

日Thnx

c# asp.net casting type-conversion

1
推荐指数
1
解决办法
1786
查看次数

没有任何服务器脚本的简单HTML POST可以使用JS完成

我想严格地使用POST从一个html页面传递给另一个文本框值...如何在不使用任何服务器端语言(如asp.net或php)的情况下完成

可以用javascript完成吗?

日Thnx

html javascript post

1
推荐指数
1
解决办法
1929
查看次数

c ++ substr Visual Studio 2008

我在Visual Studio 2008 Forms环境中尝试了这个简单的例子:

String^ textn;
textn = this->dateTimePicker1->Value.ToString();
textn = textn.substr(0, 7);
Run Code Online (Sandbox Code Playgroud)

这没有用神秘的消息编译:

1>        type is 'System::String ^'
1>        did you intend to use '->' instead?
Run Code Online (Sandbox Code Playgroud)

我用谷歌搜索了大约1个小时,现在找出它失败的原因,但我找不到答案.我通常编写C#代码,但由于工作中的情况我必须降级到C++,我发现做最简单的事情非常困难.

c++ visual-studio-2008

1
推荐指数
1
解决办法
1578
查看次数