msgpack

Can msgpack pack a user-defined object in C#, send the pack to a C++ app where it is then unpacked?

[亡魂溺海] 提交于 2019-12-10 10:36:00
问题 I have a C# reply server that can pack an object and send it to a requester C# client. Can I do the same thing, but with a C# reply server communicating with a C++ requester client? Here's an example of my C# reply server: using System; using System.Text; using ZMQ; using MsgPack; namespace zmqMpRep { public class Weather { public int zipcode; public int temperature; public int humidity; } public class zmqMpRep { public static void Main(string[] args) { Socket replier = new Socket( SocketType

python使用msgpack(umsgpack)

狂风中的少年 提交于 2019-12-10 01:23:17
前言 如果有业务需要将一个数据塞进队列由另一端接收,我们就需要考虑到数据的大小,因为这跟队列的效率和稳定性正相关,如果你希望能对这部分数据进行一定的压缩,并且提高解压缩的效率时,希望你能想到 msgpack 正文 性能对比 效率 这里先放出测试的数据 我们将网页源代码与其他数据组成dict,使用JSON和msgpack进行转换,每次转换都为dict转换目标格式再转换回来 循环1000次打印耗费时间 代码如下 结果如下 大小 我们数据不变,修改测试代码为下图,意为打印转换后的长度和转换后的数据 结果为 使用 是不是对这种效果满意,那么我们开始使用 安装 pip install umsgpack 转换 import umsgpack umsgpack可方便地将大部分数据格式转换,需要注意的是datetime类型等Python独有的无法正常转换(跟json限制差不多) packd = umsgpack.packb(t) umsgpack.packb可将数据转换为bytes类型的数据 res = umsgpack.unpackb(packd) umsgpack.unpackb将转换后的bytes数据转换为Python使用的数据格式 来源: https://www.cnblogs.com/chnmig/p/12012383.html

Storing a MessagePacked hash in Redis

亡梦爱人 提交于 2019-12-07 05:23:49
问题 I'm having a problem storing a MessagePacked hash in Redis. I've pasted a test case below. When pulling out the packed data from Redis and unpacking it, the hash is slightly corrupted. This appears to happen when the hash values are beyond a certain length, although I can't say that for sure. I'm using Redis 2.4.17 (default config), Ruby 1.9.3p194, MessagePack 0.4.7, and the Redis gem 3.0.2. The same problem happens using node, so I'm assuming the problem is within MessagePack or Redis. Any

High performance object serialization library supporting sum types

放肆的年华 提交于 2019-12-07 01:37:19
问题 I wonder if any of the high performance serialization libraries (like Google protocol buffers) support sum types. Sum types are tagged unions, basically the ability to say that something is either A, B, or C. Sum types are used in languages such as Haskell and ML which support Algebraic Data Types 回答1: If by "like Google protocol buffers" you mean ability to generate code for multiple languages then probably such thing doesn't exist. Emulating sum types in languages which don't support them

MessagePack C API

◇◆丶佛笑我妖孽 提交于 2019-12-06 16:03:02
问题 In looking at the C API for MessagePack, there are a number of functions to appropriately serialize (pack) the data according to type: msgpack_pack_uint8 , msgpack_pack_int32 , ... There doesn't seem to be the equivalent call in the API to unpack the data. msgpack_unpack_next returns a msgpack_object . These objects only have coarse granularity of types (the largest of the type: int64, double, ...), based on the enums included. Am I missing something here? Is the expectation that the coarse

There is an example of Spyne client?

落花浮王杯 提交于 2019-12-06 00:17:01
问题 I'm trying to use spyne (http://spyne.io) in my server with ZeroMQ and MsgPack. I've followed the examples to program the server side, but i can't find any example that helps me to know how to program the client side. I've found the class spyne.client.zeromq.ZeroMQClient , but I don't know what it's supposed to be the 'app' parameter of its constructor. Thank you in advance! Edit: The (simplified) server-side code: from spyne.application import Application from spyne.protocol.msgpack import

Can msgpack pack a user-defined object in C#, send the pack to a C++ app where it is then unpacked?

我怕爱的太早我们不能终老 提交于 2019-12-05 18:59:09
I have a C# reply server that can pack an object and send it to a requester C# client. Can I do the same thing, but with a C# reply server communicating with a C++ requester client? Here's an example of my C# reply server: using System; using System.Text; using ZMQ; using MsgPack; namespace zmqMpRep { public class Weather { public int zipcode; public int temperature; public int humidity; } public class zmqMpRep { public static void Main(string[] args) { Socket replier = new Socket( SocketType.REP ); replier.Bind( "tcp://127.0.0.1:9293" ); while( true ) { Weather weather = new Weather { zipcode

Storing a MessagePacked hash in Redis

送分小仙女□ 提交于 2019-12-05 10:45:09
I'm having a problem storing a MessagePacked hash in Redis. I've pasted a test case below. When pulling out the packed data from Redis and unpacking it, the hash is slightly corrupted. This appears to happen when the hash values are beyond a certain length, although I can't say that for sure. I'm using Redis 2.4.17 (default config), Ruby 1.9.3p194, MessagePack 0.4.7, and the Redis gem 3.0.2. The same problem happens using node, so I'm assuming the problem is within MessagePack or Redis. Any ideas? require 'redis' require 'msgpack' class Test def self.run(url) redis = Redis.new data = {'number'

php常见扩展

拥有回忆 提交于 2019-12-05 09:51:06
#####php常用扩展安装 ######php扩展 扩展帮助信息 http://pecl.php.net/ ######fileinfo 1、下载的php版本中自带有 cd /path/php/ext/fileinfo phpize ./configure --with-php-config=/path/php/bin/php-config make make install 2、在peclphp.net/搜索下载安装 ######msgpack 在peclphp.net/搜索下载安装 注意:版本是否适合php的版本 wget "http://pecl.php.net/get/msgpack-0.5.7.tgz" tar zxf msgpack-0.5.7.tgz cd msgpack-0.5.7 /usr/local/php/bin/phpize ./configure --with-msgpack make make install 最后修改下php.ini文件 extension = "msgpack.so" #######imap php安装包内含有 安装依赖包 yum install -y libc-client-* cd /path/php/ext/fileinfo phpize ./configure --with-php-config=/path/php/bin

High performance object serialization library supporting sum types

江枫思渺然 提交于 2019-12-05 05:38:26
I wonder if any of the high performance serialization libraries (like Google protocol buffers) support sum types . Sum types are tagged unions, basically the ability to say that something is either A, B, or C. Sum types are used in languages such as Haskell and ML which support Algebraic Data Types If by "like Google protocol buffers" you mean ability to generate code for multiple languages then probably such thing doesn't exist. Emulating sum types in languages which don't support them is awkward at best (try to pattern match on boost:variant for example). So it makes sense to leave them out