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: 

 binding name="validators"
value="validators:mzzPattern={a-zA-Z}*"/
 !-- This will be replaced by: [a-zA-Z] --

or, including a custom error message:

  binding name="validators"
value="validators:mzzPattern={^%}.*[{0} may not start with a
'%'.]"/ 
 !-- This will be replaced by: [^%].* --

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:

input class="postalCode" maxlength="8" jwcid="[EMAIL PROTECTED]" type="text" value="ognl:address.postalCode" validators="validators:pattern=[A-Z][0-9][A-Z][SPACE][0-9][0-9][A-Z][0-9][%postalCode-format]" displayName="postalCode" /

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]