我正在尝试通过XMPP服务器使用SMACK API连接到gmail.但得到了
错误:使用PLAIN机制的SASL身份验证失败
你可以查看代码的一瞥.我只是从网上得到它
ConnectionConfiguration connConfig = new ConnectionConfiguration("talk.google.com", 5222, "gmail.com");
connection = new XMPPConnection(connConfig);
connection.connect();
SASLAuthentication.supportSASLMechanism("PLAIN", 0);
Run Code Online (Sandbox Code Playgroud)
我检查了smack调试窗口.它用XML说:
<invalid-authzid />
我已经在gmail上有帐号,我的gtalk也在运行.
对于集合的要求是什么,以便我们可以在c#中使用foreach?我们可以为每种类型提供哪些类型?
编辑1:任何人都可以提供一个用户定义集合的示例代码,其中实现了Foreach.
我使用 Gmock 进行方法调用,它返回 QList heightsFromCsvResult 的元素作为 out 参数。这是当前工作的代码:
EXPECT_CALL(*_mockAttributeRepository, getGeometryHeightValues(_,_))
.WillOnce(DoAll(SetArgReferee<1>(heightsFromCsvResult.at(0)), Return(true)))
.WillOnce(DoAll(SetArgReferee<1>(heightsFromCsvResult.at(1)), Return(true)))
.WillOnce(DoAll(SetArgReferee<1>(heightsFromCsvResult.at(2)), Return(true)))
.WillOnce(DoAll(SetArgReferee<1>(heightsFromCsvResult.at(3)), Return(true)));
Run Code Online (Sandbox Code Playgroud)
第一个参数 lineNumber 来自
getGeometryHeightValues(int lineNumber, QPair<QString, QString>)
Run Code Online (Sandbox Code Playgroud)
是 heightsFromCsvResult.at(lineNumber) 的索引。
现在我尝试以更通用的方式使用 Gmock:
int* mockLineNumber = new int;
EXPECT_CALL(*_mockAttributeRepository, getGeometryHeightValues(_,_))
.Times(4)
.WillRepeatedly(DoAll(SaveArg<0>(mockLineNumber), SetArgReferee<1>(heightsFromCsvResult.at(*(mockLineNumber))), Return(true)));
Run Code Online (Sandbox Code Playgroud)
但是这段代码不起作用,因为mockLineNumber 从来不是由Gmock 编写的。但是 EXPECT_CALL 是满意的。
有没有人看到代码中的问题?
我想将视频文件发布到Facebook.以前我使用Facebook iOS SDK3.0,它的工作原理.但是,对于iOS6社交框架,存在问题.
__block ACAccount * facebookAccount;
ACAccountStore* accountStore = [[ACAccountStore alloc] init];
NSDictionary *options = @{
ACFacebookAppIdKey: @"MY APP ID",
ACFacebookPermissionsKey: @[@"publish_actions", ],
@"ACFacebookAudienceKey": ACFacebookAudienceFriends
};
ACAccountType *facebookAccountType = [accountStore
accountTypeWithAccountTypeIdentifier:ACAccountTypeIdentifierFacebook];
[accountStore requestAccessToAccountsWithType:facebookAccountType options:options completion:^(BOOL granted, NSError *error) {
if (granted) {
NSArray *accounts = [accountStore
accountsWithAccountType:facebookAccountType];
facebookAccount = [accounts lastObject];
NSLog(@"access to facebook account ok %@", facebookAccount.username);
NSData *videoData = [NSData dataWithContentsOfFile:[self videoFileFullPath]];
NSLog(@"video size = %d", [videoData length]);
NSDictionary *params = [NSDictionary dictionaryWithObjectsAndKeys:
videoData, @"video.mov",
@"video/quicktime", @"contentType" …Run Code Online (Sandbox Code Playgroud) 我正试图从shoutcast服务器获取一个.pls流,以便在我的ios应用程序中播放.到目前为止,我一直没有成功.我在stackoverflow上发布了很多帖子但是没有这些帖子有任何帮助.
任何人都可以向我解释,如果它甚至可能,如何获得.pls流?
为什么SQL中的以下Query返回true?我预计它是假的,因为它无法转换为int数值或数值
select ISNUMERIC(',')
回来1???
select ISNUMERIC('0,1,2')
select ISNUMERIC(',,,')
Run Code Online (Sandbox Code Playgroud)
也回来了 1
我可以在SQL中进行严格的数字检查吗?
我按照例子使用了singleton calss:
但我得到的错误是"未解析的外部符号"
这是我试过的代码:
#include<iostream>
using namespace std;
class singleton
{
int value;
static singleton *instance;
protected:
singleton()
{
value=0;
}
public:
static void initialize()
{
if(instance==NULL)
singleton();
else
cout<<"An instance of singleton already exist...";
}
static singleton& getInstance()
{
return *instance;
}
int getValue()
{
return value;
}
};
void main()
{
singleton::initialize();
}
Run Code Online (Sandbox Code Playgroud)
关于Singleton类的一点解释真的很棒.它使用的场景.优点和缺点.Singleton的替代品.等等
我想在用户在C++中输入一些数字后清除屏幕.我在控制台应用程序模式下编程.
那该怎么办?我的操作系统是win7,我的IDE是CodeBlocks,编译器是MingW ...
我正在使用VS2008在Windows窗体应用程序中创建.我需要添加ActiveX控件.但无法这样做.
这个例子是我试图实现LINK子主题"与ActiveX控件互操作"
以下是为实现它而提供的步骤,但我无法在Visual Studio中找到下面提到的选项.
(1)显示表单后,右键单击"工具箱"并选择"选择项目".
(2)单击"COM组件"选项卡.
(3)找到你的ActiveX控件并勾选它,然后单击"确定".
(4)现在它应该出现在工具箱上; 将其拖放到表单上并设置其属性.
我有一个包含vector成员变量的类.我知道当它们超出范围时,存储在堆栈中的向量将被清除(即内存空闲),但我不确定类对象的破坏 - 包含向量成员变量 - 是否被认为是超出范围.
如果不是,那么破坏向量的适当方法是什么?
例如:
class fred {
char *stuff;
vector<int> v;
fred() : stuff(), v() {}
~fred() {
if (stuff) free(stuff);
// now how do I clear up the vector v? Will it be done automatically?
}
}
Run Code Online (Sandbox Code Playgroud) c++ ×4
c# ×2
activex ×1
codeblocks ×1
collections ×1
facebook ×1
foreach ×1
google-talk ×1
googlemock ×1
googletest ×1
ios ×1
ios6 ×1
member ×1
mingw ×1
objective-c ×1
shoutcast ×1
singleton ×1
smack ×1
sql ×1
static ×1
vector ×1
video ×1
windows-7 ×1
xmpp ×1