grossd's Forum Posts

  • Hi,

    I'd like to use CloudBase.IO, a cloud based NoSQL DB, to store JSON data in the cloud (http://cloudbase.io/documentation/javas ... et-started).

    It looks rather simple to do. There are a number of js libraries, available in full text, defining various functions. I need to get those libraries included and the can call functions.

    I want to do this without! plugin programming using C2 facilities and existing plugins, such as external js calls, only! Can this be done?

    1. It is possible to include the libraries somehow in C2, so that the functions are available upon C2 start, and in particular in node-webkit.

    2. Is it possible to make JS library calls -- i presume that this is the easy part

    3. There is a need to response to call backs. Can this be done from C2.

    Or does this all require plugin programming (i.e. creation of a wrapper plugin) to make this work?

    thank you,

    Dan

  • all my keys are strings.

  • Thanks.

    Its like this:

    UserSession.addKey(gameMetric_n, m)

    UserSessions.addKey(Date1, UserSession.asJson)

    AllUsersSessions.addKey(userName, UserSessions.asJson)

    and a few more like these nested within UserSession

    In the end i stored AllUsersSessions.asjson into a text file.

    So, the total outcome appears like nested wrapped C2 Json

  • Thanks.

    In the end I (nested) looped (with conditions) through all the dictionary structures and used the JSON plugin to recreate JSON. Took some time to work out.

    Would there be value to have a compatible JSON export on dictionaries and arrays?

  • Hi,

    A useful feature for my purposes would be to set the path to one "level' back.

    So, if the path is set as follows:

    JSON: Set Current Path to root@"my","path","to","an","array"

    setCurrentPath_one_back

    would set it as so:

    "my","path","to","an"

    this is very useful for when you loop though complex structures and need to "automatically" back up one step, before going down several path steps again.

    Dan

  • Hi (@Ashley),

    I have quite a bit of trouble with moving data via JSON export from Dictionaries and Arrays to other programs. I need to reparse all my structure to generate "genuine" JSON, and am still working on this code and its brittle. Its all lots of recursive structures, five levels down with an element of dynamism (some are four or three levels down, and some are five).

    It would be really great, if there was a JSON export geared for interoperability without C2s Dictionary and Array wrappers. This could then be imported straight into other programs -- such as Mathematica (where i want to do all the data visualization).

    thanks,

    Dan

  • Thanks ggibson1

    Reloading into C2 works very well for me too. Just when I try to load the JSON into mathematica with Import, the nested JSON isn't recognized as an association, but as a string.

    Testing with a number of other JSON parsers, I get similar results.

    Perhaps some JSON parsers are more robust to unusual input than others ...

    p.s. BTW, i just ran my nested JSON through Lint and it only recognizses the top level keys.

  • Hi,

    I explorted into a text file a recursive JSON string I got from a dictionary which includes JSON strings as value. However, JSON parsers have trouble parsing the JSON, including the Mathematica JSON import parser -- sometimes only the first key is recognized, and Mathematica seems to view the whole JSON file as one big string.

    any thoughts on that would be appreciated,

    Dan

  • Perhaps you are right,

    In my case I have a following structure (All are dictionaries, and "varying game section" stats an Array, say, someone drops something X times during a game section, and i capture when (in seconds since game section start) each drop happened):

    User-Groups->Users->UserGamePlayedDate-Time>TotalGameStats->GameSectionsStats->VaryingGameSectionStats

    I need to analyze this data from various perspectives, such as improvements over time of individual users; average comparisons between user goups, etc. and graph it using charts (I am using the canvas chart plugin).

    Programming everything individually with loops can be pretty tedious. I am hoping that a map reduce implementation will make the code shorter and simpler.

    Dan

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • Rex,

    It now occurred to me that it should be pretty easy to rewrite the short MapReduce algorithm with C2. C2 has the ability to pass functions to function, as strings, and have the called. So, beside the neat packaging as a plugin, there seems no need to actually write a plugin for that. A separate event sheet should suffice.

    Dan

  • Thanks Rex,

    what I am thinking about is to create support a simple MapReduce function: https://code.google.com/p/mapreduce-js/

    With the C2 functions passed as parameters.

    I wonder if this can be done. Perhaps its already doable with your javascript function plugin

    Dan

  • I just noticed that Function is actually a plugin.

    So, it should be possible to retrieve all relevant function plugin instance data from another plugin, and thereby refer and also call functions ....

  • Hi,

    Is it possible to program a plugin so that it gets the name of a C2 function passed, and then calls that function, including passing of parameters to the function and retrieving return values?

    If so, is there documentation or examples how to do this?

    thanks,

    Dan

  • All

    I think that the C2 programming "language" and environment is fantastic.

    It's even driven paradigm, and its include sheets, allows programming constructions that are hard to accomplish in "traditional" languages, including Java and the like. It would be great if C3 could build on its strength and selectively (and carefully) add some "software engineering" constructs, to make larger code more maintainable.

    This could include native support for state machines, making functions a first class entity, rather than string only, support and perhaps even named approaches to define, reuse, adapt (inherit?) event expressions.

    I dream of a general purpose web programming environment build on a C3 type of paradigm. Its no-nonsense, and much easier to use than, say, Javascript, with its numerous programming idioms.

    I think a good example to think about is Wolfram's Mathematica, It's a functional language with which you can process list and recursive structures in a very elegant way.

    Instead of say ("procedural code):

    for each (ArrayA): ArrayA.currentValue>5, ArrayB.push(Array.currentValue)

    you write (in functional pseudo code):

    Push(ArrayB ,Select(x >5, ArrayA), ArrayB))

    Or, sometimes, like this (using a pipe function "=>"):

    Select(x >5, ArrayA) => Push(ArrayB)

    Javascript, btw, does support functional programming to some good extent.

    Thanks, the json plugin sounds very promising, to help with a path oriented approach to navigating to relevant data in hierarchical json structures.

    Dan

  • Thanks. Looks interesting, but its just a first step towards what i am looking for.

    What i need, essentially, is a the application of a select function, to generate selected entries (recursively, if needed), and then an apply function that applies to all results another function. The functions could be C2 functions with parameters, and perhaps a special parameter called "this" if needed.