A simple directive like 'input@value':'person.name' would be easy to
reverse.
But if you start using a function or concatenation, that's becoming
harder to reverse.
I tried different approaches, but I haven't find a simple and fast one
so far.
Do you have an idea on how it would ideally work?
Would some techniques you know from SQLAlchemy, ActiveRecord, and
Doctrine that could fit wiht javascript?
The way I ended parsing our forms is using the name attribute of the
form elements.
<input name="person.name" ...>
The json is updated/built from parsing these "name" attributes.
Nothing fancy, but it is fast and easy.
On Jan 11, 5:09 pm, AJ ONeal <Alvin.ON...@gmail.com> wrote:
> When I first found PURE what I was looking for was something to the effect
> of an ORM for Javascript (I'm a fan of SQLAlchemy, ActiveRecord, and
> Doctrine) but using JSON instead of a database.
>
> However, I'd also like to go in reverse, give a directive and get the data
> from a collection of nodes (mostly forms).
>
> Are there any plans add this kind of feature to PURE?
> I know that there's a storage specification for HTML5. I haven't looked into
> it enough yet, but I assume it could store json or will be sqlite-ish and
> hence this would be a very useful feature.
>
> AJ ONeal
> (317) 426-6525
--
You received this message because you are subscribed to the Google Groups "JavaScript Templates Engine PURE" group.
To post to this group, send email to Pure-Unobtrusive...@googlegroups.com.
To unsubscribe from this group, send email to Pure-Unobtrusive-Rende...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/Pure-Unobtrusive-Rendering-Engine?hl=en.
I didn't know there was already a kind of cross language convention,
thanks.
>
> I don't have a firm understanding of many Design Patterns yet, but I'm
> forming some ideas on a variation of a Dual-MVC which I call DoubleDIP
> (Data-Interface-Presenter) from what I've learned with the various ORMs I've
> dabbled with.
>
> Transport Model - (JSON) - a hash, the properties of which probably map 1:1
> with the Class, which transmit in plain text when traversing systems
>
> Class - (Javascript Classes ) - manipulates the model
> Mapper - (jQuery.jStore) - maps the Model hash (or Class) to the DataStore
> DataStore - (DOM, LocalStorage, Cookies, Flash) - SQL, NoSQL, whatever.
> (HTML5 localstorage uses a NoSQL key/value store with a SQL backend... which
> is interesting because many SQL engines use key/value store backends such as
> BerkleyDB)
>
> Controller - (jQuery) - The application code itself
>
> Presenter - (PURE) - That which the Controller uses to map the Model to the
> View (and Ideally, can go in reverse as well)
> Template - (PURE directive) - The Presenter is to the Template what the
> Mapper is to the DataStore.
> View - (HTML) - What the user interacts with
>
> * Javascript is tricky because it has three DataStores. In HTML5 in has
> LocalStorage and, as always, it has the Web Service and the DOM.
Yep, and you have always to choose which one to use for an action.
But with V8 and initiatives like node.js, I think javascript will
become even more interesting, as the frontend and backend will share
the same language and is a scripting language.
However,
> the mapper can be configured to read from any or multiple of the three of
> these on a per-class basis. For some classes localStorage is a cache, for
> other classes localStorage may be the sole storage of the data (perhaps the
> Web Service only does processing, or some data must legally remain private).
I don't know how the security is handled while offline, is there
something planned for the HTML5 data storage access?
>
> This pattern focuses on the idea of mutual exclusion between a Web Service
> is its own deal and a Client application is its own deal and the two never
> cross barriers except where the Presenter of the one becomes the Data of the
> other. (Whereas every Web Service I've presently seen - Flickr, for example
> - has two APIs: one for internal use, the other for external use.
It looks you see it more like a web app(html, js, css), that runs
locally and has a kind of "save as" or sync to the web?
It depends on the kind of app you want to build.
In our case(a business app) a local storage is ok to provide a backup
usage when offline.
But then while online you synchronise and switch to use live data.
The trend is clearly going to a wider collaboration, and you need to
be online for that.
And you can't really skip the backend as it handles the security(no
security client side) and usually the business logic.
>
> The goal of my 'DoubleDIP' pattern is that I can go 'File -> Save As' on the
> webpage, and then open it from the desktop and it still has all of the same
> data, is still logged in, and functions the same as it did before.
Do you have an example of app you'd want to build?
>
> Additionally, I think that this design pattern can circumvent some licensing
> restrictions and patents, as the data always remains a distinct entity
> regardless of how it is processed on either end.
I don't get it, who's patents and licenses are you thinking of?
>
> Anyway, those are some semi-off the cuff thoughts, perhaps premature.
This topic of reversing came already few times on this forum and
emails I received.
I'm sure there is something to do, but so far, I didn't find a rather
generic and simple way to perform it.
And it was the main reason I "pluginized" PURE to allow people to
build blocks around it.
Soon or later, we'll need for our app an offline/online mechanism
ideally with html/js/css.
I'm interested to continue discussing the subject ;)
Cheers,
PS:For the other post yesterday, I was Chloé (my girlfriend who used
my computer to check her mail) ;)
> <input name="people[][name]" ...>
I didn't know there was already a kind of cross language convention,
thanks.
Yep, and you have always to choose which one to use for an action.
But with V8 and initiatives like node.js, I think javascript will
become even more interesting, as the frontend and backend will share
the same language and is a scripting language.
I don't know how the security is handled while offline, is theresomething planned for the HTML5 data storage access?
Do you have an example of app you'd want to build?
> Additionally, I think that this design pattern can circumvent some licensingI don't get it, who's patents and licenses are you thinking of?
> restrictions and patents, as the data always remains a distinct entity
> regardless of how it is processed on either end.
This topic of reversing came already few times on this forum and
emails I received.
I'm sure there is something to do, but so far, I didn't find a rather
generic and simple way to perform it.
If you google on "blackboard patents invalidated" there seems to be
plainty of
them.
>
> That's my big project goal. WhatSayYe will grow and take another domain as a
> simple survey site. Then it will grow again and become a test generator, on
> a simple testing site, then it will reach maturity as the 'quiz' module in
> Edumacate, a project which I've only conceptualized and drawn out on paper.
Is there any of them already visible somewhere online?
I lost you on this ;)
>
> > This topic of reversing came already few times on this forum and
> > emails I received.
> > I'm sure there is something to do, but so far, I didn't find a rather
> > generic and simple way to perform it.
>
> I'd say think of it as a scraper. I don't think there should be any need for
> functions; so slightly 'dumber' directives. So not necessarily a 1:1
> reversal.
>
> Obviously, if you've got calculated values from functions you can't get back
> the original data sets, but then why would you need to? The purpose would be
> to get user input and changes.
Imagine just a function to convert a currency to a local format.
If you want to parse it back you need an inverse function and the
troubles start.
>
> AJ ONeal
>
> p.s. Perhaps this would be better split into a few messages as its become
> somewhat eclectic.
Yep, when things get too long, better start a new thread |-)
Cheers,