serialize

PHP unserialize keeps throwing same error over 100 times.

So I have a large 2d array that i serialize and base64_encode and throw into a database. On a different page I pull the array out and when I base64_decode the serialized array i can echo it out and it definitely looks valid. However, if i try to unserialize(base64_decode($serializedArray)) It just throws the same error to the point of ...

PHP unserialize keeps throwing same error over 100 times part 2

So I have a large 2d array that i serialize, but when I attempt to unserialize the array it just throws the same error to the point of nearly crashing firefox. The error is: Warning: unserialize() [function.unserialize]: Node no longer exists in /var/www/dev/wc_paul/inc/analyzerTester.php on line 24 I would include the entire serializ...

Why does ActiveRecord's serialize randomly corrupt my data?

I use serialize in one ActiveRecord model to serialize an Array of simple Hashes into a text database field. I even use the second parameter to coerce deserialization into Arrays. class Shop < ActiveRecord::Base serialize : recipients, Array end It seems to work fine but, after a few requests, the content of recipients turns to Hash...

Is there a way to use jQuery's serialize form fields and trim the value in the fields?

Hi, I have a form that uses jQuery to submit an ajax post and it serializes the form that is sent up. The code looks like this: var form = $("form"); var action = form.attr("action"); var serializedForm = form.serialize(); $.post(action, serializedForm, function(data) { ... }); The problem here is that if a field has trailing white...

Why doesn't jquery turn my array into a json string before sending to asp.net web method?

So far, I've only been passing javascript strings to my web methods, which get parsed, usually as Guids. but now i have a method that accepts an IList... on the client, i build this array of objects and then attempt to pass it like: $.ajax({ type: 'POST', url: 'personalization.aspx/SetPersonalization', data: "{'backerEntries':" +...

Can I serialize map of STL in MFC using CArchive?

I need to write the content of a map (key is ID of int, value is of self-defined struct) into a file, and load it from the file later on. Can I do it in MFC with CArchive? Thank you! ...

Does anyone know where there is a recipe for serializing data and preserving its order in the output?

I am working with a set of data that I have converted to a list of dictionaries For example one item in my list is {'reportDate': u'R20070501', 'idnum': u'1078099', 'columnLabel': u'2005', 'actionDate': u'C20070627', 'data': u'76,000', 'rowLabel': u'Sales of Bananas'} Per request The second item in my list could be: {'reportDat...

HttpWebRequest Won't Serialize

I'm getting the following error when I try to Serialize an HttpWebRequest Type 'System.Net.KnownHttpVerb' in Assembly 'System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' is not marked as serializable. Using .Net Framework 2.0 This is one of the properties that my class holds. It's a requirement to s...

Enforcing serializable from an interface without forcing classes to custom serialize in C#.

I have an interface that defines some methods I would like certain classes to implement. public interface IMyInterface { MethodA; MethodB; } Additionally I would like all classes implementing this interface to be serializable. If I change the interface definition to implement ISerializable as below...: public interface IMyI...

Python human readable object serialization

Hi, i need to store Python structures made of lists / dictionaries, tuples into a human readable format. The idea is like using something similar to pickle, but pickle is not human-friendly. Other options that come to my mind are YAML (through PyYAML and JSON (through simplejson) serializers. Any other option that comes to your mind? T...

Transforming Point object when using simple-xml

I am serializing a class using simple-xml (http://simple.sourceforge.net/) but when i try to use @Element on a Point object i get an error, how can i transform this Point object? ...

serialize form to POST after getting content using CURL

Hi, I want to POST an URL using CURL and php. There is a big form on webpage and I don't want to manually copy all the variables and put it in my POST request. I am guessing there has to be a way to serialize the form automatically (using DOM or something) and then just change whatever values I need. I could not google my way out of ...

Json.Net How to Serialize a JObject without the formatting?

This is basically my problem: I have a JObject (I'm using Json.Net) that I constructed with LINQ to JSON (also provided by the same library) and, when I use the "ToString()' method with object, it throws the results in formated JSON. How do I set the formatting to "none" for this? Thanks in adavance =) ...

What JSON library works well for you in .NET?

I'd be interested in hearing what JSON library folks in the community have been using inside of .NET? I have a need to parse/serialize some JSON object graphs from inside .NET (C#) to actual .NET types. I could roll my own, but if there are some solid libraries folks have used, I'd like to hear your comments. I saw the list of librari...

Php serialize

Im trying to save serialized arrays into my mysql database then retrive them and unserilize them but I cant work out how to unserialize them. here is what I have so far: $query = mysql_query("SELECT friends FROM users WHERE id='$myid'"); $friends = mysql_fetch_array($query); unserialize($friends); Stuck here ????? array_push($friend...

unserialize problem

Hi, I have another problem with my scripy now I have made it more advance, first off the count function doesnt work properly and it gives this error. *Warning: array_push() [function.array-push]: First argument should be an array in C:\wamp\www\social\add.php on line 42* Here is my script: $query = mysql_query("SELECT friends FROM use...

Ruby on Rails :serialize UTF8 problem

When I serialize a hash containing UTF8 strings, like this: poll.variants = {0 => 'тест',1 => '-тест-',2 => 'test # test "тест'} to an ActiveRecord field, the resulting field contains: --- 0: !binary | 0YLQtdGB0YI= 1: !binary | LdGC0LXRgdGCLQ== 2: !binary | dGVzdCAjIHRlc3QgItGC0LXRgdGC The utf8 strings get treated as bi...

How do I use jQuery's form.serialize but exclude empty fields

I have a search form with a number of text inputs & drop downs that submits via a GET. I'd like to have a cleaner search url by removing the empty fields from the querystring when a search is performed. var form = $("form"); var serializedFormStr = form.serialize(); // I'd like to remove inputs where value is '' or '.' here window.l...

jQuery: What to do with the list that sortable('serialize') returns?

With jQuery I'm retrieving positions of a sortable list using 'serialize', like this: var order = $('ul').sortable('serialize'); The variable 'order' then receives the following: id[]=2&id[]=3&id[]=1&id[]=4&id[]=5 Now how can I use this data in an ajax call? This is how I plan to do it, but it's ugly and I can't change the parameter...

How do you serialize a model instance in Django?

There is a lot of documentation on how to serialize a Model QuerySet but how do you just serialize to json the fields of a Model Instance? ...