小编Fel*_*ala的帖子

将diff-patch应用于字符串/文件

对于具有脱机功能的智能手机应用程序,我正在为Xml文件创建单向文本同步.我希望我的服务器将delta /差异(例如GNU diff-patch)发送到目标设备.

这是计划:

Time = 0
Server: has version_1 of Xml file (~800 kiB)
Client: has version_1 of Xml file (~800 kiB)

Time = 1
Server: has version_1 and version_2 of Xml file (each ~800 kiB)
        computes delta of these versions (=patch) (~10 kiB) 
        sends patch to Client (~10 kiB transferred)

Client: computes version_2 from version_1 and patch  <= this is the problem =>
Run Code Online (Sandbox Code Playgroud)

是否有一个Ruby库可以执行最后一步,将文本补丁应用于文件/字符串?可以根据库的要求格式化补丁.

谢谢你的帮助!

(我使用的是Rhodes跨平台框架,它使用Ruby作为编程语言.)

ruby diff merge smartphone

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

C#:泛型内没有投射?

虽然我可以将一个字符串向上转换为一个对象,但是我无法将IList字符串向上转换为IList对象.怎么会?现在该怎么做才能将所有项目都复制到一个新的IList?

static void ThisWorks()
{
     IList<object> list = new List<object>();
     list.Add("I can add a string since string : object");
}

static void ThisDoesNotWork()
{
     // throws an invalid cast exception
     IList<object> list = (IList<object>) new List<string>(); 

     list.Add("I'm never getting here ... why?");
}
Run Code Online (Sandbox Code Playgroud)

c# generics casting

4
推荐指数
2
解决办法
1077
查看次数

标签 统计

c# ×1

casting ×1

diff ×1

generics ×1

merge ×1

ruby ×1

smartphone ×1