对于具有脱机功能的智能手机应用程序,我正在为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作为编程语言.)
虽然我可以将一个字符串向上转换为一个对象,但是我无法将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)