serialization

Can you represent CSV data in Google's Protocol Buffer format?

眉间皱痕 提交于 2019-12-21 17:12:06
问题 I've recently found out about protocol buffers and was wondering if they could be applied to my specific problem. Basically I have some CSV data that I need to convert to a more compact format for storage as some of the files are several gig. Each field in the CSV has a header, and there are only two types, strings and decimals (because sometimes there are alot of significant digits and I need to handle all numbers the same way). But each file will have different column names for each field.

Override ToString method in WCF service

落爺英雄遲暮 提交于 2019-12-21 16:56:12
问题 This is my service generated class: public partial class MyClass : object, System.Runtime.Serialization.IExtensibleDataObject, System.ComponentModel.INotifyPropertyChanged { } I'm using my own service. In MyClass I have overridden ToString() but I don't have it in my client. I want either to generate it or as MyClass is partial am I able to override ToString myself? I know that I can write in generated .cs file. What is the best way to do it and at all should I do it? 回答1: If you are defining

How to handle data structure migration in a compositional way in Haskell?

女生的网名这么多〃 提交于 2019-12-21 16:53:53
问题 I am trying to implement (de)serialization of data structures in Haskell in a way that: Takes care of evolving schema of the data structure, Allows safe reading of past versions if provided some "patching" code exists, Does not need to keep old versions of data type definition around (as is the case with safecopy I have implemented this mechanism in the past in a way that I find unsatisfying: There is much repetition in the code as it needs to traverse whole structure even if only a leaf

Rails Serialized Data Validations

巧了我就是萌 提交于 2019-12-21 15:40:28
问题 I have a field that is serialized to YAML through the default AR behavior. It is currently in an Array of Hashes for examples: [{'name' => 'hi', 'url' => 'bye'}, {'name' => 'hi', 'url' => 'bye'}, {'name' => 'hi', 'url' => 'bye'}] Is there a way I can use some basic AR validations on some of these fields? 回答1: Yes, use the validates_each method serialize :urls validates_each :urls do |record, attr, value| # value is an array of hashes # eg [{'name' => 'hi', 'url' => 'bye'}, ...] problems = ''

Rails Serialized Data Validations

大城市里の小女人 提交于 2019-12-21 15:40:09
问题 I have a field that is serialized to YAML through the default AR behavior. It is currently in an Array of Hashes for examples: [{'name' => 'hi', 'url' => 'bye'}, {'name' => 'hi', 'url' => 'bye'}, {'name' => 'hi', 'url' => 'bye'}] Is there a way I can use some basic AR validations on some of these fields? 回答1: Yes, use the validates_each method serialize :urls validates_each :urls do |record, attr, value| # value is an array of hashes # eg [{'name' => 'hi', 'url' => 'bye'}, ...] problems = ''

Updating serialised array in mysql (without unserialising?)

自闭症网瘾萝莉.ら 提交于 2019-12-21 15:10:58
问题 Everything I've read says that storing serialised arrays in Mysql is a bad idea - I know that already ;) Unfortunately I'm working with an open source script that uses this method, and changing the structure isn't an option in this scenario. Is it possible to update this URL without first unserialising? I originally tried using replace, however it throws an error: $rssquery = "UPDATE config SET `array` = replace(`array`, \"http://www.oldurl.com\", \"http://www.newurl.com\") WHERE name='config

Updating serialised array in mysql (without unserialising?)

与世无争的帅哥 提交于 2019-12-21 15:09:13
问题 Everything I've read says that storing serialised arrays in Mysql is a bad idea - I know that already ;) Unfortunately I'm working with an open source script that uses this method, and changing the structure isn't an option in this scenario. Is it possible to update this URL without first unserialising? I originally tried using replace, however it throws an error: $rssquery = "UPDATE config SET `array` = replace(`array`, \"http://www.oldurl.com\", \"http://www.newurl.com\") WHERE name='config

Jquery .serialize() not processing value of dropdown list?

£可爱£侵袭症+ 提交于 2019-12-21 11:31:31
问题 I think this should be a simple thing but for some reason all my form values are being serialized fine except for the selected value of the dropdown list, the form is below: <form id="contactform"> <label for="name">Name</label> <input type="text" id=name name=name placeholder="First and last name" tabindex="1" /> <label for="phonenumber">Phone Number</label> <input type="text" id=phonenumber name=phonenumber placeholder="Please enter your phone number" tabindex="2" /> <label for="email"

How to have a WCF DataContract with a json dynamic member

丶灬走出姿态 提交于 2019-12-21 09:23:09
问题 at the project I am working on, we have a requirement to have a DataContract that can contain some undefined JSON. The DataMember is some JSON that makes sense to the client only. We want to allow the client to send us json we do not know about. Example: public class Contract { [DataMember] public int clientId; [DataMember] public string json; } Obviously, having a contract defined like that would require the client to escape the json like this: { "clientId":1, "json": "{\"test\":\"json\"}" }

“max allowed size 128000 bytes, actual size of encoded class scala” error in akka remoting

旧时模样 提交于 2019-12-21 08:54:50
问题 I want to use Akka Remoting to exchange message over network between actors, but for large String message i got the following error: akka.remote.OversizedPayloadException: Discarding oversized payload sent to Actor :: max allowed size 128000 bytes , actual size of encoded class scala. How can i fix this limitation? 回答1: I add the following configuration and now everything is ok: akka { actor { provider = "akka.remote.RemoteActorRefProvider" } remote { maximum-payload-bytes = 30000000 bytes