[aida] Post Tutorial comments
Elliot Finley
efinley.lists at gmail.com
Mon Apr 18 06:54:44 CEST 2011
2011/4/11 Janko Mivšek <janko.mivsek at eranova.si>:
>> #1) Where would I hook in data validations?
>
> See the WebDemoApp>>ajaxValidationExample :
> ...
> field := e cell addInputFieldAspect: #year for: self size: 4.
> field
> onChangePost;
> validIfTrue: [:value | value asInteger = Date today year];
> errorText: 'Wrong!'.
> e newCell add: field errorElement.
>
> So, #validIfTrue: aBlock is the main thing for making a validation of
> your data. If this block doesn’t pass, submitting of a whole form is
> blocked. Only until all fields on form are valid, submitting will succeed.
>
> What you see in above demo is an additional ajaxified validation and
> error reporting immediately after data entry.
how would I do a validation based on another form field. For example
if I had a scheduling application and I had a startDate and endDate.
I would want to validate that both dates were in the future and I
would want to validate that startDate < endDate.
>> #2) UrlResolver: This is slick in a small tutorial but doesn't it mean
>> I can not scale past a single image? It seems like it would also mean
>> I have to use image persistence because the urlResolver is holding a
>> reference to all the objects. I'm hoping I'm way off the mark here.
>
> URLResolver is only one of possible resolvers and you can add you own of
> you really need it. There is a WebRouter where you can register an
> additional one and where you can see some more already. URLResolver
> itself is also a two way resolver: url->object and also very important
> object->url. Later is what makes navigation in Aida apps so easy so
> powerful.
Looking at URLResolver, it looks like if I want to scale past a single
image, I would need to persist allWebPages and allURLLinks to my
database (Magma for example). The only problem is allWebPages is an
identityDictionary. The identity will change each time it is brought
in from the database.
Am I looking at this the right way? If so, do you know of a way to solve this?
> URLResolver itself is capable to resolve up to about 100K objects, after
> this it becomes slow because of hashing, specially in object->url way.
> But funny thing is that I didn't yet got so big web app to need more
> that so much objects.
perhaps a btree structure rather than a hash structure? a little
slower with few objects but much much faster after the hash starts to
degrade.
> URLResolver is also meant for long living objects. For image persistency
> or GLASS therefore.
This makes sense but, I'd also like to be able to use Magma as an
option. It appears that the only obstacle is the allWebPages
IdentityDictionary. I don't know how to persist that in Magma since
the identity of an object will change each time it's resurrected from
the database. Any thoughts on this would be appreciated.
Elliot
More information about the Aida
mailing list