serialization

Howto serialize multiple Lists with Jquery

别来无恙 提交于 2020-01-01 10:24:28
问题 I have 3 sortable UL's and a simple jquery/javascript <ul class="sortable" id="menu1"> <li id="id_1">whatever</li> <li id="id_2">you</li> </ul> <ul class="sortable" id="menu2"> <li id="id_3">wanne</li> <li id="id_4">put</li> </ul> <ul class="sortable" id="menu3"> <li id="id_5">in</li> <li id="id_6">here</li> </ul> $(function() { $("ul.sortable").sortable({ connectWith: 'ul' }); }); </script> LI's are draggable between UL's How can i serialize this so i get for example menu1[0]=1&menu1[1]=3 Or

Howto serialize multiple Lists with Jquery

…衆ロ難τιáo~ 提交于 2020-01-01 10:22:25
问题 I have 3 sortable UL's and a simple jquery/javascript <ul class="sortable" id="menu1"> <li id="id_1">whatever</li> <li id="id_2">you</li> </ul> <ul class="sortable" id="menu2"> <li id="id_3">wanne</li> <li id="id_4">put</li> </ul> <ul class="sortable" id="menu3"> <li id="id_5">in</li> <li id="id_6">here</li> </ul> $(function() { $("ul.sortable").sortable({ connectWith: 'ul' }); }); </script> LI's are draggable between UL's How can i serialize this so i get for example menu1[0]=1&menu1[1]=3 Or

Howto serialize multiple Lists with Jquery

你。 提交于 2020-01-01 10:22:05
问题 I have 3 sortable UL's and a simple jquery/javascript <ul class="sortable" id="menu1"> <li id="id_1">whatever</li> <li id="id_2">you</li> </ul> <ul class="sortable" id="menu2"> <li id="id_3">wanne</li> <li id="id_4">put</li> </ul> <ul class="sortable" id="menu3"> <li id="id_5">in</li> <li id="id_6">here</li> </ul> $(function() { $("ul.sortable").sortable({ connectWith: 'ul' }); }); </script> LI's are draggable between UL's How can i serialize this so i get for example menu1[0]=1&menu1[1]=3 Or

Django Rest Framework receive primary key value in POST and return model object as nested serializer

馋奶兔 提交于 2020-01-01 10:08:33
问题 I'm not completely sure that the title of my question is as specific as I wanted it to be, but this is the case: I have a HyperlinkedModelSerializer that looks like this: class ParentArrivalSerializer(serializers.HyperlinkedModelSerializer): carpool = SchoolBuildingCarpoolSerializer() class Meta: model = ParentArrival As you can see the carpool is defined as a nested serializer object and what I want is to be able to make a POST request to create a ParentArrival in this way (data as

Django Rest Framework receive primary key value in POST and return model object as nested serializer

半世苍凉 提交于 2020-01-01 10:08:08
问题 I'm not completely sure that the title of my question is as specific as I wanted it to be, but this is the case: I have a HyperlinkedModelSerializer that looks like this: class ParentArrivalSerializer(serializers.HyperlinkedModelSerializer): carpool = SchoolBuildingCarpoolSerializer() class Meta: model = ParentArrival As you can see the carpool is defined as a nested serializer object and what I want is to be able to make a POST request to create a ParentArrival in this way (data as

How to serialize a model with all validation attributes from the individual properties?

你。 提交于 2020-01-01 09:56:11
问题 Context: creating a jsonP service with mvc controller methods which provides a definition of formfields including all validation rules. My problem is that I do not know how to serialize the validation attributes. I prefer the validation attributes in the same format as they are serialized by Razor when using unobtrusive validation in regular Mvc views. For serializing to json I use NewtonSoft.Json (4.0.2). Example of model: public class Profile{ [Required(ErrorMessage="This field is required.

Fast simple object serialization

北战南征 提交于 2020-01-01 09:38:26
问题 I am looking for fastest serialization method tiles in 2D world. Lets say the world is big and because computer can't handle that much blocks loaded at the same time, so I splitted the world to chunks. BinaryFormatter seems to be slow. Is there any faster method, how to serialize the chunk object? WChunk object structure public class WChunk { public int ChunkX; public int ChunkY; public SortedDictionary<WPoint, WTile> Tiles; } WTile object structure public class WTile { WPoint Location; int

How to use XmlElementAttribute for List<T>?

淺唱寂寞╮ 提交于 2020-01-01 09:29:11
问题 I have a class like this: public class Level { [XmlAttribute] public string Guid { get; set; } } public class LevelList : List<Level> { } public class Test { public LevelList CalLevelList { get; set; } } Using XmlSerializer, I get the output like this: <CalLevelList> <Level Guid="0de98dfb-ce06-433f-aeae-786b6d920aa6"/> <Level Guid="0de98dfb-ce06-433f-aeae-786b6d920aa7"/> </CalLevelList> Which is technically correct. However, without changing the class names, I'd like to make the output look

getting the class path or name space of a class in python even if it is nested

只谈情不闲聊 提交于 2020-01-01 09:22:34
问题 I'm currently writing a serialization module in Python that can serialize user defined classes. in order to do this I need to get the full name space of the object and write it to a file. I can then use that string to recreate the object. for example assume that we have the following class structure in a file named A.py class B: class C: pass now with the assumption that my_klass_string is the string "A::B::C" klasses = my_klass_string.split("::") if globals().has_key(klasses[0]): klass =

How to save / serialize a trained model in theano?

霸气de小男生 提交于 2020-01-01 09:13:02
问题 I saved the model as documented on loading and saving. # saving trained model f = file('models/simple_model.save', 'wb') cPickle.dump(ca, f, protocol=cPickle.HIGHEST_PROTOCOL) f.close() ca is a trained auto-encoder. It's a instance of class cA. From the script in which I build and save the model I can call ca.get_reconstructed_input(...) and ca.get_hidden_values(...) without any problem. In a different script I try to load the trained model. # loading the trained model model_file = file(