Re: Scheduling tasks

2006-07-20 Thread Martijn Hinten
any oracle developer or dba could tell you:

alter system kill session 'sid,serial';

Kills any session. In Oracle you can allways kill session that have
gone astray. And even if it doesn't work from sql+, you can always
look op the OS-pid (in v$session) and kill the process on the os
level. (Be sure that you set job_queue_processes to 0, because if you
don't Oracle sometimes restarts the job).

Martijn

 Original Message 
From: [EMAIL PROTECTED]
To: users@tapestry.apache.org
Subject: Re: Scheduling tasks
Date: Thu, 20 Jul 2006 07:28:42 -0500

>I can't comment on Quartz but I did use the Oracle scheduler until
>someone scheduled a query that ran for hours and made the database
>useless. It was difficult to recover from because you could not login
>to stop the task.
>
>If you schedule
>
>* * * * * wget http://localhost/cronjob
>
>then you don't have any machine dependencies although I generally
>schedule a shell script because I want an email if it fails which
>leads to Quartz only works when the JVM is running. I've seen enough
>JVM crashes to have a cronjob that restarts Tomcat. I don't recall
>cron ever crashing.
>
>-
>To unsubscribe, e-mail: [EMAIL PROTECTED]
>For additional commands, e-mail: [EMAIL PROTECTED]



-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: regular expression in pattern

2006-05-22 Thread Martijn Hinten




Hi Carl,

I'm afraid the code that actually /calls/ the validator, is stripping
the square brackets, so you can't pass in the regexp you mentioned
below. I haven't looked up the code that calls a validator, but I
assume it has to do with the syntax of the ognl-_expression_-parsing. The
parser is using square brackets to set the boundaries of the total
_expression_, so you can't pass those in. 

On another thread, I more or less asked the same question, but did not
get a reply. This caused me to write my own validator, that /does/
accept square brackets. Well, sort of. It replaces all accolades ( "{"
and "}" ) by square brackets. This allows me to use, for example: 

    
    

or, including a custom error message:

      
    

The code for the validator I wrote is fairly straightforward:

public class PatternValidator extends BaseValidator {

  private static final Log log =
LogFactory.getLog(PatternValidator.class);
  
  private String pattern;
  public void setMzzPattern(String pattern) {
    this.pattern = pattern.replace('{','[').replace('}',']');
  }

  public void validate(IFormComponent field, ValidationMessages
messages, Object object) throws ValidatorException {
    if( log.isDebugEnabled() ) {
  log.debug("Validating input: "+object+" pattern:"+pattern);
    }
    if( object==null ) {
  return;
    }
    
    if( !Pattern.matches(pattern,object.toString())) {
   if( messageKey==null ) {
 setMessageKey("{0} dos not comply to regExp: "+pattern);
   }
   throw new ValidatorException(buildMessage(messages, field),
ValidationConstraint.PATTERN_MISMATCH);
    }
  }

}

Hope this helps. Anybody with a better way? Would love to see that too.

Martijn

BTW: you can find the code of Tapestry's pattern validator at:
tapestry-4.0.1\framework\src\java\org\apache\tapestry\form\validator\Pattern.java


Carl Pelletier wrote:

  Hi everyone, I'm trying to validate a Canadian Postal code in a text field. Can somebody point me to the doc where I can find all the type of pattern supported by pattern= in the validator ?

I search on the forum and get a look at the online doc, but can't find explication on this.

For now, I'm trying to do something like:



Thanks for any help ! sorry for the bad english...

P.S. I'm thinking of starting a french version of this forum. Please email me if your think it's a good idea. 

Carl Pelletier



  


-- 

 
Cumquat Information
Technology
De Dreef 19
3706 BR Zeist
T +31 (0)30 - 6940490
F +31 (0)10 - 6940499
  http://www.cumquat.nl   

 [EMAIL PROTECTED] 

M +31 6 22 384 318 





-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



How to use my own ValidationStrings.properties?

2006-05-19 Thread Martijn Hinten

Er... This list still for tech geeks, or graphical artists?

Hold your horses, just joking. ;-)

But I do have a question: What is the preferred way of overriding Tap's 
ValidationStrings.properties? I could not find any configuration 
setting, so I sort of have overriden Howards 'getPattern() method in 
BaseValidator, like the code below. I call my 
getMessageFromValidationStrings from within my validator's 
buildMessages() method. Is that a good way to use my own ValidationStrings?


Thanks for any reply,
Martijn

 /** Copied from HLS's getPattern
  *
  * TODO document me more
  *
  * @param override
  * @param key
  * @param locale
  * @return
  */
   protected String getMessageFromValidationStrings(String key, Locale 
locale)  {
  
   try {

 ResourceBundle strings =
   ResourceBundle.getBundle("my.package.ValidationStrings", locale);

 return strings.getString(key);
   } catch ( java.util.MissingResourceException e ) {
 return ("["+key+"]").toUpperCase();
   }
 } 




-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Page files or annotations? [was: Validation]

2006-05-10 Thread Martijn Hinten




That's exactly my problem. I use a container that is not Java 1.5
certified, so I cannot use annotations. However I am in favor of
keeping my .page files as short as possible. They only contain things
like page injections, service object injections and such, but almost no
components. All components are fulle embedded in my html files, which I
find easier to read and maintain. Even with some smart macro's. However
I would very much like to get rid of my .page files, *or* find a way to
sort of 'subclass' .page files. The master .page class would then have
all general injections in it so that I do not have to repeate the
injection of for example a "UserInfoService" in all of my .page files.
This has been discussed a few times on this list allready, but I have
not yet seen any good solution that does not use annotations.

I am very interested in the autowiring James writes about.

Martijn

James Carman wrote:

  Well, without autowiring (it'll be in there soon), you have to use .page
files to inject service objects into your pages if you're not willing to use
annotations.  With autowiring, though, all you'll have to do is create a
"getter" for a property of the same type as one of the HiveMind services and
it'll be auto-wired for you.

-Original Message-
From: Paul Cantrell [mailto:[EMAIL PROTECTED]] 
Sent: Wednesday, May 10, 2006 10:48 AM
To: Tapestry users
Subject: Re: Page files or annotations? [was: Validation]

I think Sam has it right: it depends.

In my development, I never write page files -- but we don't have any  
separate person devoted to the page design. That seems like the only  
compelling case left for the page files, but it is somewhat  
compelling: it keeps as much as possible out of the page file, so the  
designed can focus on the HTML and not have to tiptoe over so much  
extra baggage.

(One can of course use annotations to achieve that, too, but it  
requires declaring tons of getXyzComponent() methods that clutter up  
classes.)

However, without the separate designed role, I find the annotations  
approach keeps things much cleaner. Unless you're keen on keeping the  
templates as pared-down as possible, then, I'd recommend that.

In Tap 5, it sounds like things are moving towards annotations only.  
Hopefully 5 will reduce the verbosity of some of the common cases.

Cheers,

Paul

On May 10, 2006, at 7:49 AM, Sam Gendler wrote:

  
  
On 5/10/06, Martijn Hinten <[EMAIL PROTECTED]> wrote:


   I have been wondering this for some time now: Is it the general  
consensus
to get rid of .page files and do all binding in the html (and  
injection via
annotations in the java classes)?

  

I think it depends on the size of your team and complexity of your
app.  With a fairly large team, including one person devoted to
layout, I prefer to keep all component declarations in .page files, so
that the layout templates are as clean as possible and least likely to
get screwed up by someone making edits without a clue about how
tapestry works.  I've generally got nothing but jwcid attributes in my
templates.  A simple macro in just about any editor will make it easy
to switch between .page and .html files in a single keystroke or mouse
click, so the complaint about having to switch files really isn't
valid, to my mind.

We also attempt to keep components in the same order in the .page file
as they are used in the .html template.  It is a couple of minutes of
developer time per page at the end of any release cycle on any pages
that have gotten out of whack and it keeps things easy to find.  In
fact, I have a macro in vim which will switch to a .page file and go
to the same location as I am currently at, as a percentage of the file
length, with two keystrokes.  Odds are usually good that I can see the
component that I am looking for as soon as the other file is visible,
and both files are so much more readable as a result.

The only thing I hate is when informal parameters are important to the
function of the component, since, as far as I know, they must appear
in the html file.  I really wish there were a way to bind informal
parameters to a component from within a .page file, overriding any
informal parameters of the same name that are in the .html template
which may be necessary for layout in the unrendered page.  That way, I
could put ALL of my parameter bindings in the .page file.

--sam

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



  
  
_
Piano music podcast: http://inthehands.com
Other interesting stuff: http://innig.net



-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [E

Re: Validation

2006-05-10 Thread Martijn Hinten




I have been wondering this for some time now: Is it the general
consensus to get rid of .page files and do all binding in the html (and
injection via annotations in the java classes)?

Rui Pacheco wrote:
I was just wondering if I was going to have to write .page
files for every
  
.html page that required validation.
  
Now that my blindness has been healed, I am happily adding
validators="" to
  
all tags on all my .html pages :D
  
  
On 5/10/06, Pedro Viegas <[EMAIL PROTECTED]> wrote:
  
  
If you do all the binding in the .html template, and the class to page

binding in the .application you don't need the .page in Tap4.

Be more specific if this was not the answer you were looking for.


Regards,


On 5/9/06, Rui Pacheco <[EMAIL PROTECTED]> wrote:

>

> Hi all

>

> In Tapestry 4 when doing validation, must I always place the
binding tag

> on

> the page specification or can I do it on the .application file?

>

> I am asking because my application uses a fair amount of classes
and I

am

> simply maping pages to classes through the .application file and I
am

> wondering if I'll have to create all the .page files now.

>

> --

> Cumprimentos,

> Rui Pacheco

>

>



--

Pedro Viegas



  
  
  
--
  
Cumprimentos,
  
Rui Pacheco
  
  


-- 

 
Cumquat Information
Technology
De Dreef 19
3706 BR Zeist
T +31 (0)30 - 6940490
F +31 (0)10 - 6940499
  http://www.cumquat.nl   

 [EMAIL PROTECTED] 

M +31 6 22 384 318 





-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



[SOLVED] How to pass in a message key *and* parameters into a ValidationDelegate

2006-05-09 Thread Martijn Hinten
Just for the record: I solved it. It appears that the ValidationDelegate 
is *not* looking up messages in the resource bundle, but that my own 
code did just that, a bit further down the line. So my own code tried to 
look up a message that was allready the result of a resource bundle 
lookup, and hence did not find it. Fixed my own code and now all works fine.


Ciao,
Martijn

Martijn Hinten wrote:


Hi,

The method

record(String message, ValidationConstraint constraint)

of

org.apache.tapestry.valid.ValidationDelegate

will lookup any message automatically in the message property file. 
However there does not seem to be a record-method that allows me to 
pass in both the message-key and any substitution parameters, for example


// DOES NOT EXIST:
record(String message, String[] parameters, ValidationConstraint 
constraint)


When I try to trick Tapestry, by formatting the message myself, before 
passing it in, like this:


record(getMessages().formatMessage("my-key",new String{"My-param"}, null)

..it will still try to lookup the complete formatted message in the 
property file, and - obviously - won't find it and I end up with the 
complete message text capitalized, between brackets ( like this: 
"[HELLO THIS IS MY MESSAGE WITH MY PARAM: FOO]").


Does anybody out there know of any way to either:
- pass in message-substitution-paramaters into ValidationDelegate's 
record() method
- disable ValidationDelegate's record() method from looking up 
messages in the property file, so that I can pass in a pre-formatted 
message


Thanks for any input. I did look into the archives and didn't find an 
answer yet. If I overlooked it, my humble apologies.



Thanks,
Martijn



--


*Cumquat Information Technology*
De Dreef 19
3706 BR Zeist
T +31 (0)30 - 6940490
F +31 (0)10 - 6940499
http://www.cumquat.nl <http://www.cumquat.nl/>

[EMAIL PROTECTED] <mailto:[EMAIL PROTECTED]>
M +31 6 22 384 318


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



How to pass in a message key *and* parameters into a ValidationDelegate

2006-05-08 Thread Martijn Hinten

Hi,

The method

record(String message, ValidationConstraint constraint)

of

org.apache.tapestry.valid.ValidationDelegate

will lookup any message automatically in the message property file. 
However there does not seem to be a record-method that allows me to pass 
in both the message-key and any substitution parameters, for example


// DOES NOT EXIST:
record(String message, String[] parameters, ValidationConstraint constraint)

When I try to trick Tapestry, by formatting the message myself, before 
passing it in, like this:


record(getMessages().formatMessage("my-key",new String{"My-param"}, null)

..it will still try to lookup the complete formatted message in the 
property file, and - obviously - won't find it and I end up with the 
complete message text capitalized, between brackets ( like this: "[HELLO 
THIS IS MY MESSAGE WITH MY PARAM: FOO]").


Does anybody out there know of any way to either:
- pass in message-substitution-paramaters into ValidationDelegate's 
record() method
- disable ValidationDelegate's record() method from looking up messages 
in the property file, so that I can pass in a pre-formatted message


Thanks for any input. I did look into the archives and didn't find an 
answer yet. If I overlooked it, my humble apologies.



Thanks,
Martijn

--


*Cumquat Information Technology*
De Dreef 19
3706 BR Zeist
T +31 (0)30 - 6940490
F +31 (0)10 - 6940499
http://www.cumquat.nl 

[EMAIL PROTECTED] 
M +31 6 22 384 318


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]