stringification

Why do I see HASH(0xABCDEF) in my Perl output?

I am running perl, v5.6.1 built for sun4-solaris-64int I am calling print on an array print "@vals\n"; and the output looks like HASH(0x229a4) uid cn attuid or another example @foo = {}; push(@foo, "c"); print "@foo I am done now\n"; with output of HASH(0x2ece0) c I am done now Where is HASH(0x2ece0) comming from? Thanks...

Stringifying template arguments

Is it possible in C++ to stringify template arguments? I tried this: #define STRINGIFY(x) #x template <typename T> struct Stringify { Stringify() { cout<<STRINGIFY(T)<<endl; } }; int main() { Stringify<int> s; } But what I get is a 'T', and not an 'int'. Seems that the preprocessors kicks in before tem...

Is JSON.stringify() reliable for serializing JSON objects?

I need to send full objects from Javascript to PHP. It seemed pretty obvious to do JSON.stringify() and then json_decode() on the PHP end, but will this allow for strings with ":" and ","? Do I need to run an escape() function on big user input strings that may cause an issue? What would that escape function be? I don't think escape ...

In Javascript, if there is an object with a lot of properties that are functions, how do you convert them to array of strings (of the function names)?

In Javascript, if an object has lots of properties that are functions: var obj = { foo: function() { ... }, bar: function() { ... }, ... } then how can you get an array of names of those functions? That is, an array ["foo", "bar", ... ] thanks. ...

Stringified template argument

Is it possible to get a stringified version of a template argument name? Something like this, if only we were running the preprocessor: template <typename T> struct Named{ const char* name(){ return "Named<" #T ">"; } }; Edit Duplicate. See here http://stackoverflow.com/questions/1488186/stringifying-template-arguments ...

Web page does not preserve newlines.

Building a web app that includes several contentEditable divs. The users add stuff to the div's, clicks the save button, which saves all the data from each div to a json object. That goes through JSON.stringify to a mysql database as a TEXT (uploaded with php via mysql_real_escape_string() ). When loaded it goes back to JSON.parse and th...

C Unstringification with macros

Is there any way to unstringify strings provided as macro arguments? I need to be able to call functions who's names are in strings. Something like this: void hello() { printf("Hello, world!"); } call_func("hello"); How would I implement call_func. It would be in a module that would be #included and would be used to call functio...

Getting JSON data of JSTree, and it's metadata

Hi all, We're using jstree for a navigation menu editor, and have been assigning metadata to the nodes of the tree like this: var data = currentNode.data("jstree"); data.title = textBoxTitle.val(); data.linkType = textBoxLink.val(); I can see that the data object contains the relevant properties, but not too sure where jquery keeps t...