小编Mar*_*cke的帖子

Visual Studio在线迁移(VSO到VSO)

我们正在尝试从一个Visual Studio Online帐户迁移到另一个Visual Studio Online帐户.这TFSVisual Studio Online迁移的内部部署不同.大多数文章仅解释了使用内部部署到VSO方法的迁移.

帐号

  • HTTPS:\ vsoaccount1.visualstudio.com\DefaultCollection
  • HTTPS:\ vsoaccount2.visualstudio.com\DefaultCollection

对于TFS到VSO,我们通过使用OpsHub Visual Studio在线迁移实用程序找到了解决方案.

我们还尝试使用相同的工具指向另一个Visual Studio Online帐户作为源,但它失败说明我们只能指向TFS实例.

这可以通过脚本来完成吗?如果是这样,怎么样?如果有可用的工具,那也会很棒.这应该是一次性迁移.

更新:

我们只需要代码,包括变更集,没有工作项.该项目正在使用TFVC.

migration tfs azure-devops

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

如何在PostgreSQL中选择不区分大小写的JSONB密钥(9.4+)

设置(PostgreSQL 9.4+)

假设我有一张桌子product:

create table product
(
    attributes jsonb
);
Run Code Online (Sandbox Code Playgroud)

有数据:

insert into product (attributes) 
values ('{"Color": "Red"}'), 
       ('{"color": "White"}'),
       ('{"COLOR": "Blue"}');
Run Code Online (Sandbox Code Playgroud)

如何color在PostgreSQL 9.4+中选择所有记录的属性?由于键的外壳不同,我无法使用此语法:

select 
    attributes->>'color' as color
from product;
Run Code Online (Sandbox Code Playgroud)

我的预期输出是:

Red
White
Blue
Run Code Online (Sandbox Code Playgroud)

可能解决方案

我也试过使用这种语法(工作但感觉很难):

select 
    coalesce(
        attributes->>'color', 
        attributes->>'Color', 
        attributes->>'COLOR') as color 
from product;
Run Code Online (Sandbox Code Playgroud)

这可能吗?我可以看到,如果你拥有colorColor锁定同一个对象可能会发生冲突,所以如果这不是一件事我也不会感到惊讶.

参考文献:

postgresql json jsonb postgresql-9.4

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

在Jenkins管道中设置节点标签

是否可以为节点Groovy设置标签而不是名称?我们希望在脚本外部定义标签,以便从Jenkins仪表板轻松访问它们.

想法:而不是:


Groovy脚本

node('Slave_1 || Slave_2'){ echo 'Hello world' }
Run Code Online (Sandbox Code Playgroud)

我们想要这样的东西:


管道配置

Node Label Name:     slaveGroup
Node Label Value:    Slave_1 || Slave_2
Run Code Online (Sandbox Code Playgroud)

Groovy脚本

node(slaveGroup){echo 'Hello world'}
Run Code Online (Sandbox Code Playgroud)

或者是否可以直接在Groovy脚本中使用您可以在从属配置中设置的标签?

groovy jenkins jenkins-pipeline

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

如何测试服务不可用和抛出的http错误

我对单元测试还很陌生,希望在服务不可用时进行模拟/测试,以确保抛出正确的错误。

设想

在 C# 中通过 LDAP/DirectorySearcher 查询 Active Directory 用户帐户的 REST API。我看到三种可能的结果:找到用户、未找到用户和服务不可用 (DirectorySearcher)。我为此设置了三个测试,但一个总是失败,这取决于我是否连接到域。连接后,测试#1、#2 成功。当断开连接时,测试#2,#3 成功。由于 DirectoryServices 库已经稳固,我的测试是否过大?我的目的是确保 Web 服务器在失去查询 Active Directory 的能力时抛出异常。

控制器

using System;
using System.Collections.Generic;
using System.DirectoryServices;
using System.Linq;
using System.Net;
using System.Net.Http;
using System.Runtime.InteropServices;
using System.Web.Http;

namespace IdentitiesApi.Controllers
{
    public class UsersController : ApiController
    {
        // GET api/users/?username=admin
        public SearchResult Get([FromUri]string userName)
        {
            using (var searcher = new DirectorySearcher())
            {
                searcher.Filter = string.Format("(&(objectClass=user)(sAMAccountName={0}))", userName);

                try
                {
                    SearchResult user = searcher.FindOne();

                    if (user == null)
                    {
                        var response …
Run Code Online (Sandbox Code Playgroud)

c# unit-testing visual-studio

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

在C#中重命名extern方法参数是否安全?

我目前正在清理我们使用extern方法的一些遗留代码库.参数名称在命名约定方面都是完整的.我想巩固它们.

[DllImport("customdll", CallingConvention = CallingConvention.Cdecl)]
public static extern void SetStatus(int new_status);
Run Code Online (Sandbox Code Playgroud)

我可以放心地重新命名new_statusnewStatus或将是撕毁合同?

ReSharper认为这是一个改变,但我想验证它.我无法找到它的文件(支持或反对).

不是问是否可以重命名方法名称本身,只是参数定义.

参考

c# dll unmanaged

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

Linq/C#:如何根据列表项信息将列表拆分为可变长度块?

我试图Record根据某些Type信息将 Linq 中的类型列表拆分为子列表。每组记录前面总是有一个类型为“a”的记录,后面总是有一个类型为“b”的记录。我有一堂课Record

class Record
{
    public string Type { get; set; }
    public string SomeOtherInformation { get; set; }
}
Run Code Online (Sandbox Code Playgroud)

这是一个示例列表 ( List<Record> records):

Type    SomeOtherInformation
a       ......
x       ......
x       ......
b       ......
a       ......
b       ......
a       ......
x       ......
x       ......
x       ......
x       ......
x       ......
b       ......
Run Code Online (Sandbox Code Playgroud)

期望的输出是 ( List<List<Record>> lists):

List #1:        List #2:        List #3:
a       ......  a       ......  a       ......
x       ......  b …
Run Code Online (Sandbox Code Playgroud)

.net c# linq list

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