小编Cur*_*per的帖子

压缩并将master合并到同一个分支中

有没有办法压缩并将master合并到同一个分支中?有效地获取所有挂起的提交并将它们置于1次提交中?

我最初的想法是一个脚本,它采取my-branch并做一个git checkout master && git pull && git checkout my-branch-squashed然后 git merge --squash my-branch(处理任何合并冲突),然后最终删除my-branch并重命名my-branch-squashmy-branch

这似乎非常圆,可能不好,所以我试图看看是否还有其他方法.我试图解决的意图是,当我在github上放置分支并将它们"压缩并合并"到master中时,本地机器上存在的分支与合并到master中的分支不匹配,因此在使用git branch --merged ${1-master} | grep -v " ${1-master}$" | xargs -r git branch -d; 它时没有正确删除已合并为master的分支.我想要的是一种自动删除已合并为master的旧分支的方法

git github

17
推荐指数
2
解决办法
713
查看次数

Json.net 仅序列化某些属性

Json.net 有没有办法只指定要序列化的属性?或者根据绑定标志(如仅声明)序列化某些属性?

现在我正在使用JObject.FromObject(MainObj.SubObj);获取 SubObj 的所有属性,它是一个遵循 ISubObject 接口的类的实例:

public interface ISubObject
{

}

public class ParentSubObject : ISubObject
{
    public string A { get; set; }
}


public class SubObjectWithOnlyDeclared : ParentSubObject
{
    [JsonInclude] // This is fake, but what I am wishing existed
    public string B { get; set; }

    [JsonInclude] // This is fake, but what I am wishing existed
    public string C { get; set; }
}

public class NormalSubObject: ParentSubObject
{
    public string B { …
Run Code Online (Sandbox Code Playgroud)

c# serialization attributes json.net

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

STIntersection结果是STIntersects = 0

我有一条@a与另一条线相交的线@b.当我取交点并检测它是否/在哪里与@b相交时,它返回false

declare @a GEOMETRY = Geometry::STGeomFromText('LINESTRING (-83 24, -80.4907132243685 24.788632986627039)', 4326)
declare @b GEOMETRY = Geometry::STGeomFromText('LINESTRING (-74.7 21.8, -75.7 22.1, -77.8 22.6, -79.4 23.3, -80.4 24.5, -81.5 28, -84 33, -87 36)', 4326)


DECLARE @intersectionPoint geometry = @a.STIntersection(@b) -- POINT (-80.49071322436852 24.788632986627078)

IF @intersectionPoint IS NULL
    THROW 50000, '@intersectionPoint not found', 1


-- Expect 1, Result 0
SELECT @b.STIntersects(@intersectionPoint)
Run Code Online (Sandbox Code Playgroud)

sql sql-server floating-point geometry geography

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

使用options.items vs title的jQuery UI工具提示扩展

我对JQuery UI工具提示小部件编写了以下扩展名,该扩展允许工具提示具有从HTMLElement的html获取其内容的上下文。但是,我已经对'title'属性进行了硬编码,但是我想使用options.items中定义的任何属性。例如,如果他们希望工具提示使用alt标签,那么扩展将使用html内容填充该属性。

我也在寻找正确转义contentId字符串连接的jQuery ui方法

$(function() {
    (function() {
        var cache = {};
        $.widget("custom.tooltipContent", $.ui.tooltip, {
            _init: function() {
                this._super();

                this.options.content = function() {
                    return $(this).attr("title");
                };

                this.element.attr("title", function() {
                    var contentId = $(this).attr("data-tooltip-content");

                    if (!cache[contentId]) {
                        cache[contentId] = $("[data-tooltip-content-id=" + contentId + "]").remove().html();
                    }

                    return cache[contentId];
                });
            }
        });
    })();
});
Run Code Online (Sandbox Code Playgroud)

http://jsfiddle.net/5d7sqx89/1/

javascript jquery jquery-ui jquery-ui-tooltip

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

无法加载文件或程序集'System.Web.Helpers'

    Could not load file or assembly 'System.Web.Helpers' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)

Server Error in '/api' Application.

Could not load file or assembly 'System.Web.Helpers' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)

Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information …
Run Code Online (Sandbox Code Playgroud)

c# asp.net-web-api2

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

事务范围类似的功能

我希望设置一些非常类似于事务范围的东西,它在服务上创建一个版本,并在范围的末尾删除/提交.在事务范围内运行的每个SQL语句在内部查看某个连接池/事务存储,以确定它是否在范围内并做出适当的反应.呼叫者不需要将事务传递给每个呼叫.我正在寻找这个功能.

这里有一点关于它:https://blogs.msdn.microsoft.com/florinlazar/2005/04/19/transaction-current-and-ambient-transactions/

这是基本的一次性课程:

public sealed class VersionScope : IDisposable
{
    private readonly GeodatabaseVersion _version;
    private readonly VersionManager _versionManager;

    public VersionScope(Configuration config)
    {
        _versionManager = new VersionManager(config);
        _version = _versionManager.GenerateTempVersion();
        _versionManager.Create(_version);
        _versionManager.VerifyValidVersion(_version);
        _versionManager.ServiceReconcilePull();
        _versionManager.ReconcilePull(_version);
    }

    public void Dispose()
    {
        _versionManager.Delete(_version);
    }

    public void Complete()
    {
        _versionManager.ReconcilePush(_version);
    }
}
Run Code Online (Sandbox Code Playgroud)

我希望我迄今为止编写的所有代码的能力都没有任何版本的概念.我只想包括一个简单的

Version = GetCurrentVersionWithinScope()

在代码的最低级别.

如果内存中有多个实例同时运行,那么实现类似这样的事情的最安全的方法是什么,几乎没有使用错误版本的风险.

如果有一个进程正在运行的内存块的唯一标识符,我会发现我非常天真的方法.然后将当前工作版本存储到全局数组或并发字典中.然后在我需要当前版本的代码中,我使用其内存标识符块并将其映射到创建的版本.

编辑:

用法示例:

using (var scope = new VersionScope(_config))
{
    AddFeature(); // This has no concept of scope passed to it, and could error …
Run Code Online (Sandbox Code Playgroud)

c# memory idisposable

6
推荐指数
1
解决办法
277
查看次数

如何使用MapRoute捕获所有区域

我是MVC新手并编辑现有应用程序.目前我在RouteConfig.cs中看到以下内容:

public class RouteConfig
{
    public static void RegisterRoutes(RouteCollection routes)
    {
        routes.IgnoreRoute("{resource}.axd/{*pathInfo}");

        routes.MapRoute(
            "Util",
            "util/{action}",
            new {controller = "util"});

        routes.MapRoute(
            "Catchall",
            "{*url}",
            new {controller = "Main", action = "CatchUrl"});
    }
}
Run Code Online (Sandbox Code Playgroud)

在主控制器内部有逻辑,它基本上做a RedirectToRoute并设置调用的区域,控制器,动作和查询字符串location到某个值.

public class MainController : Controller
{
    public ActionResult CatchUrl()
    {
        var agencyId = 9;

        var routeValues = new RouteValueDictionary
        {
            {"area", "area1"},
            {"controller", "dashboard"},
            {"action", "index"},
            {"location", "testLocation"}
        };

        return RedirectToRoute(routeValues );
    }
}
Run Code Online (Sandbox Code Playgroud)

这似乎工作正常,当你给它一个无效区域时,它正确地转到默认区域.

我还看到一个名为CustomAreaRegistration.cs的文件:

public abstract class CustomAreaRegistration : AreaRegistration
{
    public …
Run Code Online (Sandbox Code Playgroud)

c# asp.net-mvc asp.net-mvc-routing

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

标记部署的提交/构建

因此,我们目前只是部署master,但遇到了我们想要部署提交/构建的问题,我们在其中运行了所有测试.这通常是下午4:30的大师快餐店.我们在下午4:30自动为所有测试运行构建配置(让我们调用这个构建配置ALLTESTS),这样我们就可以控制在ALLTESTS配置中如何标记这个提交/构建.

我们将测试和部署分开,因此当执行部署(手动或自动)时,它应该只选择已标记的分支/标记/提交/构建.将测试添加到我们的部署构建配置不是一个可行的解决方案.

最初我曾计划使用Git标签.调用的标记deploy将被删除并添加到某些提交中,然后在触发部署时将部署提交.

我遇到的问题是,在构建步骤中手动添加git标签并不容易.我是否应该编写使用git命令的命令行构建步骤deploy从任何提交中删除标记并将其添加到正在运行的提交中?

有没有更好的团队城市方式来做到这一点?我已成功通过REST API获得teamcity标签,但我不确定这些标签是否符合要求.

我想我可以编写powershell来解析其余的API,以获得在ALLTESTS中最后成功的构建ID,然后以某种方式将其提供给部署.我如何获取内部版本号并将其用作部署的基础?

teamcity

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

在图标单击上展开并显示文本框

我希望模仿这个功能:http://jsbin.com/cirafujinu/edit?html,output

<!DOCTYPE html>
<html lang="en">
  <head>
    <title>My Geocoding Map</title>
    <meta charset="utf-8">
      <link rel="stylesheet" href="https://mapzen.com/js/mapzen.css">
      <script src="https://mapzen.com/js/mapzen.min.js"></script>
    <style>
      #map {
        height: 100%;
        width: 100%;
        position: absolute;
      }
    html,body{margin: 0; padding: 0}
  </style>
  </head>
  <body>
    <div id='map'></div>
    <script>
      // Set the global API key
      L.Mapzen.apiKey = "your-mapzen-api-key";

      // Add a map to the #map div
      // Center on the Pigott building at Seattle University
      var map = L.Mapzen.map("map", {
        center: [47.61033,-122.31801],
        zoom: 16,
      });

      // Disable autocomplete and set …
Run Code Online (Sandbox Code Playgroud)

html javascript jquery jquery-ui

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