小编shy*_*kov的帖子

SQL - 迭代表记录

我创建了用户定义的函数,将逗号分隔的字符串转换为表格.我这样执行这个函数:

select [String] as 'ID' from dbo.ConvertStringToTable('1,2,3,4')
Run Code Online (Sandbox Code Playgroud)

此查询的结果如下所示:

ID
--
1
2
3
4
Run Code Online (Sandbox Code Playgroud)

实际上,我想遍历此表中的每一行.但是,我无法弄清楚如何做到这一点.有人可以给我看一些如何迭代表中行的示例SQL吗?

sql sql-server

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

每次提交时都会使用Git diff工具吗?

我想运行git difftool HEAD~3.. path/to/file并让git为这三个提交中的每个提交打开difftool,以便我可以看到每个提交的并排视图.

我怎样才能获得git-difftool来做到这一点?

git diff git-diff difftool

12
推荐指数
2
解决办法
2589
查看次数

返回返回另一个替换的方法的结果会在NSubstitute中引发异常

我在使用NSubstitute几次时遇到了一个奇怪的问题,虽然我知道如何解决它,但我从来没有能够解释它.

我已经精心设计了证明问题的最低要求测试,它似乎与使用方法创建替代返回值有关.

public interface IMyObject
{
    int Value { get; }
}

public interface IMyInterface
{
    IMyObject MyProperty { get; }
}

[TestMethod]
public void NSubstitute_ReturnsFromMethod_Test()
{
    var sub = Substitute.For<IMyInterface>();

    sub.MyProperty.Returns(MyMethod());
}

private IMyObject MyMethod()
{
    var ob = Substitute.For<IMyObject>();
    ob.Value.Returns(1);
    return ob;
}
Run Code Online (Sandbox Code Playgroud)

当我运行上面的测试时,我得到以下异常:

Test method globalroam.Model.NEM.Test.ViewModel.DelayedAction_Test.NSubstitute_ReturnsFromMethod_Test threw exception: 
NSubstitute.Exceptions.CouldNotSetReturnException: Could not find a call to return from.
Make sure you called Returns() after calling your substitute (for example: mySub.SomeMethod().Returns(value)).
If you substituted for a class rather than …
Run Code Online (Sandbox Code Playgroud)

c# nsubstitute

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

从MS CRM工作流活动中调用SQL Server Reporting Services

我的任务是在MS CRM 2011界面中生成可打印的报告.

有没有推荐的方法来访问CRM托管代码中的SQL Server Reporting Service?我不想直接连接,因为它需要将正确的凭据传递给正确的URL - 而且这些信息因安装而异.

所以我要么创建安装表来保存所有连接信息,要么我应该对其进行硬编码并重新编译.

这个问题有没有通用的解决方案?

c# sql-server reporting-services dynamics-crm-2011

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

用于msysgit的gvimdiff mergetool

我试图在Windows上使用gvimdiff作为git的mergetool.以前我在控制台模式下使用了vimdiff,但是我知道我对限制视图Windows控制台大小感到不满意,所以我试图切换到gvimdiff,它有更灵活的方法来设置窗口大小.

但是git mergetool现在试着打电话我收到的错误对我来说并不清楚:

The merge tool gvimdiff is not available as 'gvim'

如何解决这个问题?

gvimfor Windows是安装的,可通过命令行访问.gvimdiff命令也是如此.

我试图找到在git脚本中引发此错误的地方,但目前没有运气.

git vim diff msysgit mergetool

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

git从上次合并中获取冲突而不再次运行合并

我合并了两个分支机构.有很多冲突.解决了所有问题.现在我不确定,也许我在冲突解决期间犯了错误.而且我没有看到没有其他方法可以检查是否为真 - 只需再次运行合并,并逐个检查冲突.

这意味着我需要创建一个分支来存储我的合并结果,对吧?

我可以避免吗?也许这是可能得到所有这些冲突的所有文件<<<<<<,======,>>>>>>从某处混帐,但不运行再次合并吗?

git merge

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

使用RetrieveMultipleRequest检索每个的相关实体

我正在尝试从CRM中检索实体列表,但我想让每个实体都与相关实体相关联.到目前为止,我有以下代码:

FilterExpression filterExpression = new FilterExpression();
ConditionExpression condition = new ConditionExpression(Constants.ModifiedOnAttribute, ConditionOperator.GreaterEqual, lastSync);
filterExpression.AddCondition(condition);

QueryExpression query = new QueryExpression()
{
     EntityName = entityName,
     ColumnSet = new ColumnSet(attributesMetadata.Select(att => att.Name).ToArray<string>()),
     Criteria = filterExpression,
     Distinct = false,
     NoLock = true
};

RetrieveMultipleRequest multipleRequest = new RetrieveMultipleRequest();
multipleRequest.Query = queryExpression;

RetrieveMultipleResponse response = (RetrieveMultipleResponse)proxy.Execute(multipleRequest);
Run Code Online (Sandbox Code Playgroud)

在变量响应中,我可以看到EntityCollection属性,但在内部,相关实体总是空的.

相关实体计数为0

我想知道是否可以使用RetrieveMultipleRequest检索具有相关实体的给定实体的集合,而不是使用RetrieveRequest逐个检索.

dynamics-crm dynamics-crm-2011

10
推荐指数
2
解决办法
9046
查看次数

Django form.cleaned_data是None

这是我的表格:

class EventForm(forms.Form):
    start_date       = forms.CharField(required=True, widget=forms.TextInput(attrs={'class': 'span6 as-date'}))
    end_date         = forms.CharField(required=True, widget=forms.TimeInput(attrs={'class': 'span6 as-date'}))
    title            = forms.CharField(required=True, widget=forms.TextInput(attrs={'class': 'span8'}))
    description      = forms.CharField(required=True, widget=forms.Textarea(attrs={'rows': 4, 'class': 'span8'}))
    total_seats      = forms.IntegerField(required=True, widget=forms.TextInput(attrs={'class': 'span6'}))
    buffer_seats     = forms.IntegerField(required=True, widget=forms.TextInput(attrs={'class': 'span6'}))
    seat_cost        = forms.IntegerField(required=True, widget=forms.TextInput(attrs={'class': 'span8'}))
    published        = forms.BooleanField(required=False, widget=forms.CheckboxInput(attrs={'class': 'span6'}))
    verified_booking = forms.BooleanField(required=False, widget=forms.CheckboxInput(attrs={'class': 'span6'}))

def clean(self):
    try:
        self.cleaned_data['start_date'] = datetime.strptime(self.cleaned_data['start_date'], '%Y/%m/%d %H:%M')
    except ValueError:
        raise forms.ValidationError('Improper start date')
    try:
        self.cleaned_data['end_date'] = datetime.strptime(self.cleaned_data['end_date'], '%Y/%m/%d %H:%M')
    except ValueError:
        raise forms.ValidationError('Improper end date')
    if self.cleaned_data['buffer_seats'] …
Run Code Online (Sandbox Code Playgroud)

django django-forms python-2.7

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

请求中的SOAP Action标头错误.为什么?

我正在尝试从CRM插件中连接到MS CRM部署服务(即我无法使用app.config配置文件).

问题是用源代码替换"配置魔术"真的很困难.

当我使用以下配置文件(在控制台应用程序中本地测试)时:

<client>
    <endpoint address="http://server/XRMDeployment/2011/Deployment.svc"
        binding="customBinding" bindingConfiguration="CustomBinding_IDeploymentService"
        contract="DeploymentService.IDeploymentService" name="CustomBinding_IDeploymentService">
        <identity>
            <userPrincipalName value="DOMAIN\DYNAMICS_CRM" />
        </identity>
    </endpoint>

    ...

</client>
Run Code Online (Sandbox Code Playgroud)

一切都很好,但是当我试图用我正面对的代码替换配置时.在生成的SOAP消息而不是预期的标头中:

<a:Action s:mustUnderstand="1" u:Id="_4">http://schemas.microsoft.com/xrm/2011/Contracts/Services/IDeploymentService/Retrieve</a:Action>
Run Code Online (Sandbox Code Playgroud)

我看到一些奇怪的事:

<a:Action s:mustUnderstand="1" u:Id="_4">http://schemas.xmlsoap.org/ws/2005/02/trust/RST/SCT</a:Action>
Run Code Online (Sandbox Code Playgroud)

有谁知道如何覆盖Action Header以及配置中的哪个语句会使WCF魔术变得有效?

c# xml wcf soap dynamics-crm-2011

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

如何保护镀铬扩展

Chrome扩展程序包含在zip存档中.安装后,它安装在文件夹上,用户可以访问它.他也可以重写扩展甚至克隆到新扩展.

我如何保护用户修改和克隆的扩展?我发现dll文件的可能性(可以编译) - 但它不是很好.

source-code-protection google-chrome-extension

9
推荐指数
2
解决办法
9420
查看次数