如何配置我的Google API访问权限以在进行身份验证时请求用户的图像?目前,"个人资料"仅在用户成功通过身份验证后包含以下属性:
profile.identifier :(字符串)
profile.displayName :(字符串)
profile.emails :(对象)
名称:(对象)
是否可以请求用户的帐户图像?这是我目前的Passport/Google策略配置:
passport.use(new GoogleStrategy({
clientID: CLIENT_ID,
clientSecret: CLIENT_SECRET,
returnURL: 'http://localhost:3000/auth/google/return',
realm: 'http://localhost:3000'
},
function(identifier, profile, done) {
console.log('identifier ' + identifier)
for(var p in profile){
console.log(p + ' : ' + profile[p])
if(p === 'name'){
for(var n in profile[p]){
console.log(n + ' : ' + profile[p][n])
}
}
}
}
));
Run Code Online (Sandbox Code Playgroud)
您可以看到我正在检查配置文件以查看返回的信息.我认为这需要在我的Google Api控制台中以某种方式进行配置.这是Google+ api功能吗?
我正在尝试根据日期范围聚合字段。我不知道如何创建一个将计算多个表达式的 $cond 表达式。我正在尝试使用逻辑 $or 运算符,但没有成功。
db.project.aggregate(
{ $match : { brand : 4 } },
{ $project : {
_id : 0,
brand : 1,
count : 1,
day : 1}
},
{ $group : {
_id : "$brand",
TotalCount : { $sum : "$count" },
TimeRangeCount : {$sum: { $cond: [ { $gte: [ "$day", new Date(2014, 0, 6) ], {$or: [$lte: [ "$day", new Date(2014, 0, 8) ]]} }, "$count", 0 ] }}
}}
)
Run Code Online (Sandbox Code Playgroud)
是否可以将 $or 嵌套在 …
我需要ItemTemplate在我的内部执行一个方法DataList.如何格式化页面中的方法以正常使用Eval?
该方法以int参数为参数.
<%# NumberOfEmplyeeOrders(Int32.Parse("EmployeeID"))%>
Run Code Online (Sandbox Code Playgroud) 我有一个Web服务,它返回一个包含字符串"Hello World"的JSON对象.如何从对象中拉出此字符串?
data = [object Object]
谢谢
缺口
我用 C 编写了一个小的 irc bot 应用程序。它只是将服务器消息写出到屏幕上。这只是通过从服务器文件描述符读取的 while 循环来完成的。如何同时接受输入?我现在想扩展它以接受用户输入,以便它可以用作客户端应用程序。我是 C 开发的新手,所以我不确定这是如何完成的。有人可以为我提供示例或为我指明某些文档的方向吗?
我基本上想模仿一个 telnet 应用程序。标准输出已更新,用户可以在控制台提供服务器命令。
任何帮助/建议将不胜感激。
编辑
我正在 Unix 环境中开发。
谢谢
我无法弄清楚为什么我在这段代码中得到了"发送到不可变对象的变异方法".数组必须以某种方式不可变,但我不知道为什么.
接口:
@interface SectionsViewController : UIViewController<UITableViewDelegate, UITableViewDataSource, UISearchBarDelegate> {
UITableView *table;
UISearchBar *search;
NSMutableDictionary *names;
NSMutableArray *keys;
}
@property (nonatomic, retain) IBOutlet UITableView *table;
@property (nonatomic, retain) IBOutlet UISearchBar *search;
@property (nonatomic, retain) NSDictionary *allNames;
@property (nonatomic, retain) NSMutableDictionary *names;
@property (nonatomic, retain) NSMutableArray *keys;
-(void) resetSearch;
-(void) handleSearchForTerm:(NSString *)searchTerm;
@end
Run Code Online (Sandbox Code Playgroud)
请注意,名称是MutableDictionary.
以下行抛出异常
[array removeObjectsInArray:toRemove];
Run Code Online (Sandbox Code Playgroud)
完整上下文中的方法:
-(void)handleSearchForTerm:(NSString *)searchTerm
{
NSMutableArray *sectionsToRemove = [[NSMutableArray alloc] init];
for(NSString *key in self.keys)
{
NSMutableArray *array = [names valueForKey:key];
NSMutableArray *toRemove = [[NSMutableArray alloc] …Run Code Online (Sandbox Code Playgroud) 我正在MS Access中编写调查(数据输入)表单.我需要在表单上的标签中动态显示问题表中的所有问题.这些问题标签中的每一个都将附有一个组合框,可以显示可能的答案.
如何动态地向表单添加标签?
我刚刚下载并编译了curl.在我的/ usr/include文件夹中,我可以看到文件夹'curl',我可以看到我确实有'/usr/include/curl/curl.h'.但是在编译时我不能说XCode在那里看.
#import <curl/curl.h>
Run Code Online (Sandbox Code Playgroud)
在我的目标属性中,我将'/ usr/include'包含在'标题搜索路径'中.构建继续失败,说它找不到'curl/curl.h'
我没有正确添加搜索路径吗?
谢谢
我需要检查两个字符串是否匹配.第一个字符串不包含另一个下划线.从第二个字符串中删除下划线将导致字符串相同.我可以使用Regex.Match()方法执行此检查吗?
这是我正在寻找的一个例子:
my_table == mytable;
db_rv_term == dbrvterm;
Run Code Online (Sandbox Code Playgroud)
所以我只想匹配不包括下划线的两个字符串.
提前致谢!
我是C++的新手,我正在尝试使用dirent.h头来操作目录条目.以下小应用程序编译后,你补充目录名称后呕吐.有人能给我一个暗示吗?int退出是为了提供while循环.我删除了循环以试图隔离我的问题.
谢谢!
#include <iostream>
#include <dirent.h>
using namespace std;
int main()
{
char *dirname = 0;
DIR *pd = 0;
struct dirent *pdirent = 0;
int quit = 1;
cout<< "Enter a directory path to open (leave blank to quit):\n";
cin >> dirname;
if(dirname == NULL)
{
quit = 0;
}
pd = opendir(dirname);
if(pd == NULL)
{
cout << "ERROR: Please provide a valid directory path.\n";
}
return 0;
}
Run Code Online (Sandbox Code Playgroud) asp.net ×2
c# ×2
objective-c ×2
.net ×1
c ×1
c++ ×1
cocoa ×1
cocoa-touch ×1
curl ×1
dirent.h ×1
eval ×1
google-api ×1
javascript ×1
jquery ×1
json ×1
libcurl ×1
mongodb ×1
ms-access ×1
ms-office ×1
node.js ×1
nosql ×1
passport.js ×1
regex ×1
web-services ×1
xcode ×1
xcode4 ×1