小编GEO*_*HET的帖子

当我使用DirectoryServices"member"属性时,"Domain Users"组为空

我正在使用以下代码来获取我的域中组的成员:

  Dim de As New DirectoryEntry("LDAP://" & GroupDN)

  For Each user As String In CType(de.Properties("member"), IEnumerable)

          GroupCollection.Add(Username, Username)

  Next
Run Code Online (Sandbox Code Playgroud)

我的问题是,当GroupDN(组的可分辨名称)是" CN = Domain Users,CN = Users,DC = Mydomain,DC = local "时,For ... Each循环不执行,当我检查时手动使用属性语句,它的计数为零.这似乎适用于我的域中的每个其他组,但"域用户"组应该包含所有人,并且它似乎包含任何人.

我已经检查过,该组在我的Windows AD工具中正确列出了所有人.我有什么明显的遗漏吗?另外,有没有更好的方法来获得一个团体的所有成员?

vb.net directoryservices active-directory

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

8
推荐指数
2
解决办法
3567
查看次数

使用cygwin的g ++ C++编译器

我正在尝试执行我的第一个"Hello World!" 在C++中.我使用的是Windows XP,我安装了cygwin,其中安装了g ++ C++编译器.我写了一个小的hello-world程序,并将其保存在hello.cpp中.从命令提示符我写:

g ++ hello.cpp

但我得到:

'g ++'不被识别为内部或外部命令,可操作程序或批处理文件.

我在我的D:\ programs\cygwin中安装了cygwin.我在D:\ cpp中使用我的hello-world文件创建了另一个目录.我的安装或路径的东西似乎不好,但我无法弄清楚是什么.我运行了cygwin的exe文件,在安装目录中我有所有必需的文件,我认为:bin文件夹,lib,Cygwin.bat等.

我已经读过,如果出现此类错误消息,我应该检查cygwin1.dll文件是否已复制到Windows的主文件夹中.这是C:\ WINDOWS目录吗?我看过那里,我那里没有这样的文件.我在cygwin的bin文件夹中有cygwin1.dll:D:\ programs\cygwin\bin.另外,如何在命令的搜索路径中检查bin文件夹(D:\ programs\cygwin\bin)?

我认为hello-world程序不应该包含任何语法错误,我刚刚复制了它.还有,当我写的时候

g ++ -v

我收到相同的错误消息:该命令无法识别.如果有人给我一个暗示我应该看什么,我将不胜感激.谢谢.

这是hello-world程序的代码:

#include <iostream>
using namespace std;

int main() {
  cout <<"Hello World!"<<endl;
  return 0;
}
Run Code Online (Sandbox Code Playgroud)

我已经安装了g ++,现在当我输入g ++ -v时,我得到:读取规格:\ d\cygnus\cygwin-b20\H-i586-cygwin32\bin ..\lib\gcc-lib\i586-cygwin32\egcs-2.91.57\specs gcc version egcs-2.91.57 19980901(egcs-1.1 release)

在bin目录中,我有g ++.exe和gcc.exe.我不明白为什么我得到"gcc"而不是"g ++".我不知道这有多重要,但是当我尝试在DOS命令提示符下编译程序时收到错误消息:

g ++ hello.cpp

我明白了:

hello.cpp:1: parse error before character 0357
hello.cpp: In function 'int main()':
hello.cpp:'cout' undeclared (first use this function)
hello.cpp: (Each undeclared identifier is reported …
Run Code Online (Sandbox Code Playgroud)

c++ cygwin g++

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

ASP.NET中的Membership,MembershipProvider和MembershipUser关系?

我将用户数据存储在名为Users的MSSQL表中.我想要的是访问实际登录用户的所有用户数据(电子邮件,地址,电话,如果用户是订户等).

我不想使用配置文件,所以我决定使用自定义MembershipProvider(或者你知道一些更好,更少痛苦的方式吗?).

我不明白的是MembershipUser和Membership.如果我从MembershipProvider继承,则在重写方法中,我控制从数据库到数据库的访问数据.

但是如何使用MembershipProvider中的继承类?如果我想通过使用成员资格来验证用户,我应该这样做:

if(Membership.ValidateUser(string username, string password))
{
   FormsAuthentication.RedirectFromLoginPage(string username, string password);
}
Run Code Online (Sandbox Code Playgroud)

但是从MembershipProvider继承的类在哪里?何时使用从MembershipUser继承的类?会员资格与会员资格提供者之间的关系是什么?

membership membership-provider

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

如何使用UIActionSheet传递参数?

我弹出一个Action Sheet,我想将一个参数传递给一个按钮处理方法.

例如:

我有一个表,我想传递给在表中选择的按钮处理方法行号.

我怎样才能做到这一点?

iphone objective-c

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

不允许在查询中显式构造实体类型[MyClass]

就像标题所说,我有以下例外:

描述:事件代码:3005事件消息:发生了未处理的异常.异常信息:异常类型:NotSupportedException异常消息:不允许在查询中显式构造实体类型"Company.Project.Core.Domain.Friend".

我正在使用LINQ to SQL并在我的datacontext中使用以下代码:

var friends2 = (
    from f in dc.Friends
    where f.MyFriendsAccountId == accountId
    where f.AccountId != accountId
    select new 
    {
        f.FriendId,
        AccountId = f.MyFriendsAccountId,
        MyFriendsAccountId = f.AccountId, 
        f.CreateDate,
        f.Timestamp
    }).Distinct();

result.AddRange(
    from o in friends2
    select new Friend()
    {
        FriendId = o.FriendId, 
        AccountId = o.AccountId, 
        CreateDate = o.CreateDate, 
        MyFriendsAccountId = o.MyFriendsAccountId, 
        Timestamp = o.Timestamp
    });
Run Code Online (Sandbox Code Playgroud)

最后的代码块抛出错误,我很确定这个声明是罪魁祸首:

.Select( o => **new Friend**
Run Code Online (Sandbox Code Playgroud)

我应该如何重新编写代码以避免此错误?

c# asp.net linq-to-sql

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

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

用AVPlayer播放AVMutableComposition?

我想要按顺序播放两个视频.我尝试过AVQueuePlayer,但两个剪辑之间有一个巨大的"打嗝".我需要他们不间断地玩.

所以我正在尝试使用AVMutableComposition和AVPlayer,但无法正确使用它.

这是我的代码(忽略内存泄漏,只是在空项目中测试..):

composition = [[AVMutableComposition alloc] init];

NSString * path = [[NSBundle mainBundle] pathForResource:@"test" ofType:@"mp4"];
NSURL * url = [NSURL fileURLWithPath:path];
AVURLAsset * asset = [[AVURLAsset alloc] initWithURL:url options:nil];

NSError * error = NULL;
[composition insertTimeRange:CMTimeRangeMake(CMTimeMake(0,1000),CMTimeMake(4,1000)) ofAsset:asset atTime:CMTimeMake(0,1000) error:&error];
if(error) NSLog(@"error: %@",error);

path = [[NSBundle mainBundle] pathForResource:@"chug1" ofType:@"mp4"];
url = [NSURL fileURLWithPath:path];
asset = [[AVURLAsset alloc] initWithURL:url options:nil];

error = NULL;
[composition insertTimeRange:CMTimeRangeMake(CMTimeMake(0,1000),CMTimeMake(3,1000)) ofAsset:asset atTime:CMTimeMake(4.1,1000) error:&error];
if(error) NSLog(@"error: %@",error);

AVPlayerItem * item = [[AVPlayerItem alloc] initWithAsset:composition];
AVPlayer * player …
Run Code Online (Sandbox Code Playgroud)

avfoundation ios

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

在程序中检测不必要的递归调用的工具?

编写递归函数时,一个非常常见的初学者错误是意外触发来自同一函数的完全冗余的递归调用.例如,考虑这个递归函数,它在二叉树(而不是二叉搜索树)中找到最大值:

int BinaryTreeMax(Tree* root) {
    if (root == null) return INT_MIN;

    int maxValue = root->value;
    if (maxValue < BinaryTreeMax(root->left))
        maxValue = BinaryTreeMax(root->left);   // (1)
    if (maxValue < BinaryTreeMax(root->right))
        maxValue = BinaryTreeMax(root->right);  // (2)

    return maxValue;
}
Run Code Online (Sandbox Code Playgroud)

请注意,此程序可能会BinaryTreeMax在第(1)行和第(2)行中进行两次完全冗余的递归调用.我们可以重写这段代码,这样只需缓存之前的值就不需要这些额外的调用:

int BinaryTreeMax(Tree* root) {
    if (root == null) return INT_MIN;

    int maxValue = root->value;
    int leftValue = BinaryTreeMax(root->left);
    int rightValue = BinaryTreeMax(root->right);

    if (maxValue < leftValue)
        maxValue = leftValue;
    if (maxValue < rightValue)
        maxValue = rightValue;

    return maxValue;
}
Run Code Online (Sandbox Code Playgroud)

现在,我们总是进行两次递归调用.

我的问题是,是否有一个工具可以对程序进行静态或动态分析(用你喜欢的任何语言;我不太挑剔!),它可以检测程序是否正在进行完全不必要的递归调用."完全没必要"我的意思是 …

language-agnostic recursion

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

是否可以在 asp.net mvc 应用程序中使用 node.js?

我想将 node.js 网络终端模拟器集成到 ASP.NET MVC 应用程序中。所以在那之前,我想知道 node.js 与 ASP.NET MVC 集成的可能性。

javascript asp.net terminal-emulator node.js asp.net-mvc-3

8
推荐指数
0
解决办法
4706
查看次数