Re: Over Reliance on Session Storage

2014-04-15 Thread Luke Wilson-Mawer
On Tue, Apr 15, 2014 at 2:31 PM, Thiago H de Paula Figueiredo <
thiag...@gmail.com> wrote:

> On Tue, 15 Apr 2014 07:48:47 -0300, Luke Wilson-Mawer <
> lukewilsonma...@gmail.com> wrote:
>
>  A slightly more significant departure might be to start replacing your
>> pages and components with stateless rest endpoints using Tynamo's
>> tapestry-resteasy, a piece at a time. We've done this with a couple of
>> our components, moving them into angularjs.
>>
>
> This is a webapp rewrite almost from scratch (at least the web UI part)
> and doesn't really solve the problem of over-reliance on session storage.


Yeah that's completely true, it is basically a rewrite apart from the
service layer but it would solve scaling issues around keeping state in the
session by moving the state to the client.

However, I'm sure there are plenty of ways you can solve the issue without
doing this.


>
>
> --
> Thiago H. de Paula Figueiredo
> Tapestry, Java and Hibernate consultant and developer
> http://machina.com.br
>
> -
> To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
> For additional commands, e-mail: users-h...@tapestry.apache.org
>
>


Re: Over Reliance on Session Storage

2014-04-15 Thread Luke Wilson-Mawer
Hi Ben,

Have you tried using Tapestry's client persistence? I'm not up to speed
with how well it works now.

A slightly more significant departure might be to start replacing your
pages and components with stateless rest endpoints using Tynamo's
tapestry-resteasy, a piece at a time. We've done this with a couple of our
components, moving them into angularjs.

I'd also suggest that trying to stop users opening multiple tabs for
internal links (e.g. target="_blank") might alleviate the multiple tab
problem a little in the short term.

Cheers,

Luke


On Tue, Apr 15, 2014 at 11:14 AM, Ben Titmarsh
wrote:

> Hi Everyone,
>
> My application is under a level of load where I am starting to regret a
> somewhat naive over reliance on the @Persist annotation.  My pages probably
> contain far too much state and as a result my memory utilisation is going
> through the ceiling and I'm having to perform semi-regular restarts.
>
> In addition the lack of conversational state means that I have issues with
> multiple tabs being open - same old story I guess.
>
> So what I'd like to know is how should I be tackling this in Tapestry 5.3?
>  I had a look around and found the third party Tynamo library that has a
> conversational state implementation but it doesn't look like it's seen an
> update for 3 years.   Is this still the best way forward?
>
> I'm probably going to need to tackle this in baby steps and will likely
> start out by littering my code with
> componentResources.discardPersistentFieldChanges() but I'd like to know
> what other approaches have worked for you guys.
>
> Thanks a lot,
> Ben.
>


Re: Caching of assets (js libraries, css etc.)

2014-03-14 Thread Luke Wilson-Mawer
OK, thanks for this. Seems like we're probably safe.

Thanks,

Luke


On Fri, Mar 14, 2014 at 5:32 PM, Howard Lewis Ship  wrote:

> For normal assets, the URL directly includes a content hash value.  This
> covers stylesheets, images, fonts, and JavaScript libraries.  In addition,
> assets provide both far-future expires headers and ETags, to assist with
> caching in the client or intermediate servers.
>
> Modules are a bit different because they can't include the content hash, as
> the content hash would then be part of the name of the module. So no
> content hash in module URLs, and no far-future expires header (since an
> upgrade of the app may change the module).  However, there's still ETags
> support, so most module requests are quickly responded to with a 304 status
> code.
>
>
> On Fri, Mar 14, 2014 at 9:35 AM, Luke Wilson-Mawer <
> lukewilsonma...@gmail.com> wrote:
>
> > In previous version the asset URLs contained the version, so they would
> > change each time the version changed. In 5.4 this doesn't seem to be the
> > case.
> >
> > Am I mistaken? If not, is this by design? And what's to stop assets being
> > cached between releases of different versions of the software?
> >
> > Kind regards,
> >
> > Luke
> >
>
>
>
> --
> Howard M. Lewis Ship
>
> Creator of Apache Tapestry
>
> The source for Tapestry training, mentoring and support. Contact me to
> learn how I can get you up and productive in Tapestry fast!
>
> (971) 678-5210
> http://howardlewisship.com
>


Caching of assets (js libraries, css etc.)

2014-03-14 Thread Luke Wilson-Mawer
In previous version the asset URLs contained the version, so they would
change each time the version changed. In 5.4 this doesn't seem to be the
case.

Am I mistaken? If not, is this by design? And what's to stop assets being
cached between releases of different versions of the software?

Kind regards,

Luke


Re: [5.4-beta-2] Two JavaScript Errors - Quick Fixes

2014-01-25 Thread Luke Wilson-Mawer
I advised modulemanager to fix this.
On 23 Jan 2014 21:44, "Dimitris Zenios"  wrote:

> Until this is fixed a quick tip.
>
> You dont have to create custom jars.just create a new js file with the same
> filename as the one you want to fix and place it on your meta-inf using the
> same folder structure as the originall
>
> Dimitris Zenios
> On 23 Jan 2014 10:26, "Peter Hvass"  wrote:
>
> > Hi Thiago,
> >
> > Many, many thanks indeed! Have a great weekend!
> >
> > Peter
> >
> > - Original Message -
> >
> > From: "Thiago H de Paula Figueiredo" 
> > To: "Tapestry users" 
> > Sent: Wednesday, January 22, 2014 6:33:37 PM
> > Subject: Re: [5.4-beta-2] Two JavaScript Errors - Quick Fixes
> >
> > On Wed, 22 Jan 2014 06:40:19 -0200, Peter Hvass 
> > wrote:
> >
> > > Hi all,
> >
> > Hi!
> >
> > > Through the alphas and now the betas we've been running with custom
> > > tapestry-core JARs given
> > > two JavaScript issues; one which cripples AjaxFormLoop and the other
> > > causing pageinit.js errors
> > > and thus interrupting script execution on IE8.
> > >
> > > These are both super quick fixes and so was wondering if I could ask
> > > that they be included in the
> > > upcoming beta-3?
> > >
> > > Both on the JIRA;
> > > https://issues.apache.org/jira/browse/TAP5-2230?filter=-2
> > > https://issues.apache.org/jira/browse/TAP5-2272?filter=-2
> >
> > I'll try to apply the fixes this week.
> >
> > --
> > Thiago H. de Paula Figueiredo
> > Tapestry, Java and Hibernate consultant and developer
> > http://machina.com.br
> >
> > -
> > To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
> > For additional commands, e-mail: users-h...@tapestry.apache.org
> >
> >
> >
>


Re: AjaxFormLoop Implementation

2014-01-24 Thread Luke Wilson-Mawer
I suspect it could be that it's just breaking javascript but I'm not using
client side validation and my form updates a zone

Why not just fix the error in your chrome browser tools and see if your
validation woes go away?

On Fri, Jan 24, 2014 at 3:38 PM, George Christman
wrote:

> You do make an interesting point, I do remember seeing that JS error when
> adding new rows. I'm wondering if that JS error is breaking clientside
> validation? I do believe there are still other bugs in this component
> unrelated to the JS error.
>
> Luke, since you appear to be using this component, would you mind telling
> me if my configuration is similar to yours? I'm not sure that I'm using the
> encoder properly etc. Thank you.
>
>
> On Fri, Jan 24, 2014 at 7:15 AM, Luke Wilson-Mawer <
> lukewilsonma...@gmail.com> wrote:
>
> > Yes, I noticed a bug in Tap 5.4-beta-2 but it may not be related to
> yours.
> >
> > The events.zone.didUpdate event isn't triggered when a row is added
> because
> > of a javascript error.
> >
> > From memory the  click event for adding a new element returns
> > something like newElement.trigger... when it should be
> > $(newElement).trigger(
> >
> > On Thu, Jan 23, 2014 at 8:15 PM, George Christman
> > wrote:
> >
> > > Does anybody else use the AjaxFormLoop? Either I am using it
> incorrectly,
> > > or it is very buggy. I'd like to point out I'm using Tap 5.4-beta-2.
> > >
> > > Another interesting bug seems to happen when you add a new row and
> > provide
> > > a null toValue from the encoder. The row adds without issue, but if you
> > > attempt to remove the row before saving, you get an exception. This
> > > behavior worked without issue in 5.3.7. I can provide a temp id if
> that's
> > > whats required to make it work properly.
> > >
> > > Issue 2, when I have textfield number validate="min-length=10,required"
> > and
> > > I submit the form on a new row with a validation error, the page
> reloads
> > > with a serverside error without highlighting the field, "clienside
> > > validation on", the url ends in form rather than the original person
> id.
> > > Now when I fixed the validation error and resubmit it, that's when I
> > > discover the phone has somehow been persisted with a pk despite
> hibernate
> > > save never being called. I am not sure how it's getting it's ID. When I
> > > remove the cascade all, it does no persist the phone record. I
> discovered
> > > this issue when I noticed my toValue was failing do to the fact it was
> > > trying to do a query against the database for a record that does not
> yet
> > > exist.
> > >
> > > If the data is correct on a save, the save works perfectly and as long
> as
> > > the data has a pk, the remove works perfectly.
> > >
> > >
> > > On Wed, Jan 22, 2014 at 11:23 PM, George Christman
> > > wrote:
> > >
> > > > Hello, I'm having some difficulties with the AjaxFormLoop component
> and
> > > > I'm hoping one of you guys could help me out.
> > > >
> > > >
> > > > For the most part, I've followed the following example
> > > >
> > >
> >
> http://tapestry.apache.org/current/apidocs/org/apache/tapestry5/corelib/components/AjaxFormLoop.htmlhowever
> > ,
> > > my implementation needs to be slightly different from the
> > > > example.
> > > >
> > > > I need to be able to instantiate a new Person() object and before
> ever
> > > > persisting the object be able to add new Phone objects to the
> arraylist
> > > > with the ajaxformloop. Once the user finishes inputting the data,
> then
> > > save
> > > > the changes by submitting the form and commit them all to the
> database.
> > > >
> > > > Now I'm aware you need to use a value encoder to do this, but I'm
> > running
> > > > into an issue where hibernate is trying to save the phone object
> > before I
> > > > ever call session.save() which is resulting exceptions.
> > > >
> > > > I'm hoping someone can provide me with a little help or an example of
> > how
> > > > to accomplish this task.
> > > >
> > > > Example code
> > > >
> > > >  > > value="phone" encoder="encoder">
> > > > 
> &

Re: AjaxFormLoop Implementation

2014-01-24 Thread Luke Wilson-Mawer
Yes, I noticed a bug in Tap 5.4-beta-2 but it may not be related to yours.

The events.zone.didUpdate event isn't triggered when a row is added because
of a javascript error.

>From memory the  click event for adding a new element returns
something like newElement.trigger... when it should be
$(newElement).trigger(

On Thu, Jan 23, 2014 at 8:15 PM, George Christman
wrote:

> Does anybody else use the AjaxFormLoop? Either I am using it incorrectly,
> or it is very buggy. I'd like to point out I'm using Tap 5.4-beta-2.
>
> Another interesting bug seems to happen when you add a new row and provide
> a null toValue from the encoder. The row adds without issue, but if you
> attempt to remove the row before saving, you get an exception. This
> behavior worked without issue in 5.3.7. I can provide a temp id if that's
> whats required to make it work properly.
>
> Issue 2, when I have textfield number validate="min-length=10,required" and
> I submit the form on a new row with a validation error, the page reloads
> with a serverside error without highlighting the field, "clienside
> validation on", the url ends in form rather than the original person id.
> Now when I fixed the validation error and resubmit it, that's when I
> discover the phone has somehow been persisted with a pk despite hibernate
> save never being called. I am not sure how it's getting it's ID. When I
> remove the cascade all, it does no persist the phone record. I discovered
> this issue when I noticed my toValue was failing do to the fact it was
> trying to do a query against the database for a record that does not yet
> exist.
>
> If the data is correct on a save, the save works perfectly and as long as
> the data has a pk, the remove works perfectly.
>
>
> On Wed, Jan 22, 2014 at 11:23 PM, George Christman
> wrote:
>
> > Hello, I'm having some difficulties with the AjaxFormLoop component and
> > I'm hoping one of you guys could help me out.
> >
> >
> > For the most part, I've followed the following example
> >
> http://tapestry.apache.org/current/apidocs/org/apache/tapestry5/corelib/components/AjaxFormLoop.htmlhowever,
> my implementation needs to be slightly different from the
> > example.
> >
> > I need to be able to instantiate a new Person() object and before ever
> > persisting the object be able to add new Phone objects to the arraylist
> > with the ajaxformloop. Once the user finishes inputting the data, then
> save
> > the changes by submitting the form and commit them all to the database.
> >
> > Now I'm aware you need to use a value encoder to do this, but I'm running
> > into an issue where hibernate is trying to save the phone object before I
> > ever call session.save() which is resulting exceptions.
> >
> > I'm hoping someone can provide me with a little help or an example of how
> > to accomplish this task.
> >
> > Example code
> >
> >  value="phone" encoder="encoder">
> > 
> > remove
> > 
> >
> > public class Edit {
> >
> >   @PageActivationContext
> >   @Property
> >   private Person person;
> >
> >   @Property
> >   private Phone phone;
> >
> >   @Inject
> >   private Session session;
> >
> >   public void onPrepare() {
> >   if(person == null) {
> >   person = new Person();
> >   }
> >   }
> >
> >   @CommitAfter
> >   public Object onSuccess() {
> >   session.saveOrUpdate(person);
> >   return Index.class;
> >   }
> >
> >   Object onAddRowFromPhones() {
> >   return new Phone();
> >   }
> >
> >   @CommitAfter
> >   void onRemoveRowFromPhones(Phone phone) {
> >   if(phone.getId() != null) {
> >   session.delete(phone);
> >   }
> >   }
> >
> >   @SuppressWarnings("unchecked")
> >   public ValueEncoder getEncoder() {
> >
> >  return new ValueEncoder() {
> >
> > @Override
> > public String toClient(Phone value) {
> > Long id = value.getId();
> > return id != null ? id.toString() : null;
> >
> > }
> >
> > @Override
> > public Phone toValue(String toValue) {
> > if(toValue != null) {
> > System.out.println(toValue);
> > Long id = Long.parseLong(toValue);
> >
> > phone = session.createCritera(Phone.class, id);
> > } else {
> > person.getPhones().add(phone);
> > phone = new Phone(person);
> >
> > }
> > return phone;
> > }
> > };
> > }
> > }
> >
> > @Entity
> > public class Person {
> >
> > @Id
> > @GeneratedValue(strategy = GenerationType.auto)
> > @NonVisual
> > private long id;
> >
> > @OneToMany(mappedBy = "person", cascade = CascadeType.ALL,
> orphanRemoval = true)
> > private List phones;
> >
> > public List getPhones() {
> > if(phones == null) {
> > phones = new ArrayList<>();
> > }
> > return phones;
> > }
> >
> > publi

Re: PlasticClass.getMethods() doesn't include introduced methods.

2012-04-21 Thread Luke Wilson-Mawer

On 20 Apr 2012, at 19:00, Howard Lewis Ship wrote:

> On Fri, Apr 20, 2012 at 9:39 AM, Luke Wilson  wrote:
>> 
>> More is described here: 
>> http://stackoverflow.com/questions/10249254/tapestry-5-3-plasticclass-getmethods-doesnt-include-introduced-methods.
>> 
> 
> Ah, yes, I can see what you are going there.
> 
> I think, perhaps, PlasticField and PlasticMethod may need a
> makeVisible() method that makes the introduced members visible inside
> PlasticClass.getMethods() and PlasticClass.getFields().  I don't think
> there's a way to extricate things so that member access within the
> introduced method is not transformed, but that's probably fine ... in
> your case, you want to make sure that the ParameterWorker sees your
> defaultValidate() method, and that method will be a stub with advice.

What's the reason that introduced methods aren't visible by default like in in 
the old ClassTransformation? Are there consequences to just adding a line in 
PlasticClassImpl.createNewMethod() to add the new method onto the end of the 
methods list? I'm not all too familiar with the Plastic API but I could imagine 
using it for a whole bunch of things

> 
> 
>> Kind regards,
>> 
>> Luke
>> 
>> 
>> 
>> -
>> To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
>> For additional commands, e-mail: users-h...@tapestry.apache.org
>> 
> 
> 
> 
> -- 
> Howard M. Lewis Ship
> 
> Creator of Apache Tapestry
> 
> The source for Tapestry training, mentoring and support. Contact me to
> learn how I can get you up and productive in Tapestry fast!
> 
> (971) 678-5210
> http://howardlewisship.com
> 
> ---------
> To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
> For additional commands, e-mail: users-h...@tapestry.apache.org
> 

Luke Wilson-Mawer
Director, Viscri Limited
l...@viscri.co.uk

Registered address: Cawley House, 149-155 Canal Street, Nottingham, NG1 7HR
Postal address: 804, Eurotower, Courland Grove, London, SW8 2PX
Registered number: 07031070





CSS Stacks

2011-11-09 Thread Luke Wilson-Mawer
Hi,

Are relative URLs in CSS the only reason that combining CSS files in stacks 
isn't supported? Or are there other issues?

Basically, I want to serve a combined stack for each 'product' in our multi 
product application. Products contain many CSS files.

I'm looking now at how to add CSS support to stacks, perhaps by advising 
JavaScriptSupport service and overriding JavaScriptStackPathConstructor. Can 
anyone see any problems with this approach? Or would you go about it in another 
way?

Thanks,

Luke
-
To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
For additional commands, e-mail: users-h...@tapestry.apache.org