You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@commons.apache.org by di...@multitask.com.au on 2002/11/15 02:10:30 UTC

[validator] bug in javascript generation for regular expressions?

I think that this one is biting us:


<Code snippet>
} else if (Var.JSTYPE_REGEXP.equalsIgnoreCase(jsType)) {
     results.append(
     "this."
         + varKey
         + "=/"
         + ValidatorUtil.replace(varValue, "\\", "\\\\")
         + "/; ");
</CodeSnippet>

Since the javascript regexp starts with '/' shouldn't any embedded '/'s be 
escaped? 

I'll test it locally to see if it solves our problem and report back.
--
dIon Gillard, Multitask Consulting
Work:      http://www.multitask.com.au
Developers: http://adslgateway.multitask.com.au/developers


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: [collections] Trying to test the linked list, a question

Posted by Jeff Varszegi <jv...@yahoo.com>.
I was just wondering if you happened to look at the speed improvements I suggested for
FastArrayList.  I know you're busy, just wondering.  If it's not seen as important I won't
continue on with my plan of performance-tuning some of the other classes in Collections.  (That's
not a huffy statement, but sincere-- I don't want to waste everyone's time, and I'd rather help
out in a valuable way.)  I just like to tinker with things to make them fast, and I thought maybe
I could have a good impact on a few projects at once by speeding up some of the Collections
classes that are reused.

Jeff

__________________________________________________
Do you Yahoo!?
Yahoo! Web Hosting - Let the expert host your site
http://webhosting.yahoo.com

--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: [collections] Trying to test the linked list, a question

Posted by Stephen Colebourne <sc...@btopenworld.com>.
From: "Jeff Varszegi" <jv...@yahoo.com>
> I looked all through the script of my class and I can't find anywhere it
can construct a blank
> string.  I also couldn't find anything wrong in general; I checked over
the logic pretty well, but
> I guess it's always possible to miss something.  Can anyone help me?

TestCollection.getFullNonNullElements() contains the values that are
failing. At some point they get added to a reference collection (ArrayList)
and your collection (NodeCachingLinkedList) - testList.makeFullList().

This uses addAll() to add and the testRemoveByIndex uses an iterator(). One
of those two must be failing. All I can suggest is following the path of the
data from the getFullNonNullElements() to the failure.

Stephen


> Jeff
>
> P.S.  I also attached the NodeCachingLinkedList class, latest version.  It
throws
> NoSuchElementException everywhere that it should. JKV
>
> --- Stephen Colebourne <sc...@btopenworld.com> wrote:
> > From: "Jeff Varszegi" <jv...@yahoo.com>
> > > Can you tell me more about the unit testing?
> > See the JUnit website if you've never used it before. However its easy
to
> > get to grips with.
> >
> > Collections uses JUnit with an abstract superclass. The superclass aims
to
> > test compliance with the List interface spec (for example), leaving the
> > individual test class to just test for the differences in that
particular
> > implementation. You'll need to have a look at some of the classes in the
> > test package to figure it out (as I wasn't involved with the test
structure
> > that was created) I believe that BulkTest is a significant class, but
don't
> > hold me to it ;-)
> >
> > Stephen
> >
> >
> > --
> > To unsubscribe, e-mail:
<ma...@jakarta.apache.org>
> > For additional commands, e-mail:
<ma...@jakarta.apache.org>
> >
>
>
>
> __________________________________________________
> Do you Yahoo!?
> Yahoo! Web Hosting - Let the expert host your site
> http://webhosting.yahoo.com


----------------------------------------------------------------------------
----


> --
> To unsubscribe, e-mail:
<ma...@jakarta.apache.org>
> For additional commands, e-mail:
<ma...@jakarta.apache.org>


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


[collections] Trying to test the linked list, a question

Posted by Jeff Varszegi <jv...@yahoo.com>.
All right, I have JUnit 3.8 installed.  I read all the documentation on it and compiled and ran
some simple tests, but I'm having a minor problem.

I made a class named TestNodeCachingLinkedList that extends TestList (I attached it).  It fails
twice with the same error, and I can't tell why it's happening.  I know you're busy, but if you
could look at it I'd be much obliged.  I don't know enough to tell if it's a fault in the test
script or not...

Here's the output of the script:

................F........................F.
.........................................
..................
Time: 0.3
There were 2 failures:
1) testListRemoveByIndex(TestNodeCachingLinkedList.testListRemoveByIndex)
junit.framework.AssertionFailedError: remove should return correct element expected:<null> but
was:<>
	at org.apache.commons.collections.TestList.testListRemoveByIndex(TestList.java:699)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
	at
org.apache.commons.collections.TestNodeCachingLinkedList.main(TestNodeCachingLinkedList.java:32)
2) testListRemoveByIndex(TestNodeCachingLinkedList.bulkTestSubList.testListRemoveByIndex)
junit.framework.AssertionFailedError: remove should return correct element expected:<null> but
was:<Three>
	at org.apache.commons.collections.TestList.testListRemoveByIndex(TestList.java:699)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
	at
org.apache.commons.collections.TestNodeCachingLinkedList.main(TestNodeCachingLinkedList.java:32)

FAILURES!!!
Tests run: 100,  Failures: 2,  Errors: 0


I looked all through the script of my class and I can't find anywhere it can construct a blank
string.  I also couldn't find anything wrong in general; I checked over the logic pretty well, but
I guess it's always possible to miss something.  Can anyone help me?

Jeff

P.S.  I also attached the NodeCachingLinkedList class, latest version.  It throws
NoSuchElementException everywhere that it should. JKV

--- Stephen Colebourne <sc...@btopenworld.com> wrote:
> From: "Jeff Varszegi" <jv...@yahoo.com>
> > Can you tell me more about the unit testing?
> See the JUnit website if you've never used it before. However its easy to
> get to grips with.
> 
> Collections uses JUnit with an abstract superclass. The superclass aims to
> test compliance with the List interface spec (for example), leaving the
> individual test class to just test for the differences in that particular
> implementation. You'll need to have a look at some of the classes in the
> test package to figure it out (as I wasn't involved with the test structure
> that was created) I believe that BulkTest is a significant class, but don't
> hold me to it ;-)
> 
> Stephen
> 
> 
> --
> To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
> For additional commands, e-mail: <ma...@jakarta.apache.org>
> 



__________________________________________________
Do you Yahoo!?
Yahoo! Web Hosting - Let the expert host your site
http://webhosting.yahoo.com

Re: [collections][SUBMIT]A faster linked list

Posted by Stephen Colebourne <sc...@btopenworld.com>.
From: "Jeff Varszegi" <jv...@yahoo.com>
> Can you tell me more about the unit testing?
See the JUnit website if you've never used it before. However its easy to
get to grips with.

Collections uses JUnit with an abstract superclass. The superclass aims to
test compliance with the List interface spec (for example), leaving the
individual test class to just test for the differences in that particular
implementation. You'll need to have a look at some of the classes in the
test package to figure it out (as I wasn't involved with the test structure
that was created) I believe that BulkTest is a significant class, but don't
hold me to it ;-)

Stephen


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: [collections][SUBMIT]A faster linked list

Posted by Jeff Varszegi <jv...@yahoo.com>.
I think it can be used as a direct LL substitute now.  I don't agree that it needs to extend
LinkedList.  My reason is that someone would have to change at least one line of code, where the
thing is declared and/or allocated, anyway.  Also, if someone is using a LinkedList as a
LinkedList (instead of a List) they're doing things wrong anyway.  The main point of the
Collections API is the interfaces.  I dunno if that makes me a prig or a purist...  ;0)  I will
make a new version that extends LinkedList and see how I like it.

Actually, it looks like I lied earlier when I said that it was exactly like LinkedList except for
the node caching.  It looks like somewhere along the way I changed the contract of the getXXX
methods to stop throwing NoSuchElementException.  I agree that that should be changed back to
support better integration into existing code.

Can you tell me more about the unit testing?

Thanks,

Jeff

--- Stephen Colebourne <sc...@btopenworld.com> wrote:
> I am broadly in favour of this class. However,
> - I would like to see it extend LinkedList, so it can be used as a direct LL
> substitute
> - This then implies changes to the logic in certain methods (eg.getFirst(),
> getLast())
> - I would like to see unit tests (There is a structure for unit tests, that
> means that you need to write very little as the superclass of the test does
> all the work of comparing against the List spec.)
> 
> Stephen
> 
> ----- Original Message -----
> From: "Jeff Varszegi" <jv...@yahoo.com>
> To: "Jakarta Commons Developers List" <co...@jakarta.apache.org>;
> <mi...@mikebryant.com>
> Sent: Friday, November 15, 2002 4:23 PM
> Subject: [collections][SUBMIT]A faster linked list
> 
> 
> > NodeCachingLinkedList is identical to LinkedList except in that it
> maintains an internal node
> > cache so it doesn't have to create new ones as often.
> >
> > Jeff
> >
> >
> > __________________________________________________
> > Do you Yahoo!?
> > Yahoo! Web Hosting - Let the expert host your site
> > http://webhosting.yahoo.com
> 
> 
> ----------------------------------------------------------------------------
> ----
> 
> 
> > --
> > To unsubscribe, e-mail:
> <ma...@jakarta.apache.org>
> > For additional commands, e-mail:
> <ma...@jakarta.apache.org>
> 
> 
> --
> To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
> For additional commands, e-mail: <ma...@jakarta.apache.org>
> 


__________________________________________________
Do you Yahoo!?
Yahoo! Web Hosting - Let the expert host your site
http://webhosting.yahoo.com

--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: [collections][SUBMIT]A faster linked list

Posted by Stephen Colebourne <sc...@btopenworld.com>.
I am broadly in favour of this class. However,
- I would like to see it extend LinkedList, so it can be used as a direct LL
substitute
- This then implies changes to the logic in certain methods (eg.getFirst(),
getLast())
- I would like to see unit tests (There is a structure for unit tests, that
means that you need to write very little as the superclass of the test does
all the work of comparing against the List spec.)

Stephen

----- Original Message -----
From: "Jeff Varszegi" <jv...@yahoo.com>
To: "Jakarta Commons Developers List" <co...@jakarta.apache.org>;
<mi...@mikebryant.com>
Sent: Friday, November 15, 2002 4:23 PM
Subject: [collections][SUBMIT]A faster linked list


> NodeCachingLinkedList is identical to LinkedList except in that it
maintains an internal node
> cache so it doesn't have to create new ones as often.
>
> Jeff
>
>
> __________________________________________________
> Do you Yahoo!?
> Yahoo! Web Hosting - Let the expert host your site
> http://webhosting.yahoo.com


----------------------------------------------------------------------------
----


> --
> To unsubscribe, e-mail:
<ma...@jakarta.apache.org>
> For additional commands, e-mail:
<ma...@jakarta.apache.org>


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


[collections][SUBMIT]A faster linked list

Posted by Jeff Varszegi <jv...@yahoo.com>.
NodeCachingLinkedList is identical to LinkedList except in that it maintains an internal node
cache so it doesn't have to create new ones as often.

Jeff


__________________________________________________
Do you Yahoo!?
Yahoo! Web Hosting - Let the expert host your site
http://webhosting.yahoo.com

Re: [DBUtils] Introduction and some thoughts

Posted by Mike Bryant <mi...@mikebryant.com>.
Yep, my apologies for not being familiar with the sql subproboject as I
perhaps should have been.  There is definitely no need to recreate what
has already been written.


Thanks,

Mike


James Strachan said:
> From: "Mike Bryant" <mi...@mikebryant.com>
>> Hello all,
>>
>> My name is Mike Bryant.  I just wanted to send an email to introduce
>> myself and say that I am excited about the DBUtils package.  I've
>> spent a good bit of time at my current job writing database utility
>> code, a package like this could have really saved some time.
>>
>> The code so far looks great I think.  I am especially impressed with
>> the EnhancedResultSet class and the DbUtils.resultSetToArray method.
>>
>> Some thoughts I have on this package:
>> - Data class (ColumnData) to hold a DB field's data.  This might
>> contain data like column index, data type, column name, value.
>
> In the commons-sql project I used a DynaBean to hold a row of data from
> a database.  See the bottom of this page for it in action..
>
> http://jakarta.apache.org/commons/sandbox/sql/
>
> A DynaBean has a DynaClass and a DynaProperty for the metadata. So I
> just implemented an SqlDynaBean, SqlDynaClass and SqlDynaProperty so
> that the additional database-specific metadata can be captured (SQL
> types, primary keys, indices, auto-increment, nullable, foreign keys
> etc).
>
> http://jakarta.apache.org/commons/sandbox/sql/apidocs/org/apache/commons/sql
> /dynabean/package-summary.html
>
> e.g. an SqlDyanBean has a collection of SqlDynaProperty objects each of
> which refers to a Column definition...
>
> http://jakarta.apache.org/commons/sandbox/sql/apidocs/org/apache/commons/sql
> /model/Column.html
>
>
> would that do for now?
>
>
>> - Method (similar to DbUtils.resultSetToArray method) that would build
>> a List (or maybe Map) of ColumnData objects.  This might be useful if
>> users need more information than the resultSetToArray method provides.
>
> Already the beanutils project has a way of turning a ResultSet into an
> Iterator over DynaBeans which is quite useful.
>
>
>> - Method to take a SQL stmt as a param, execute it, build a List of
>> ColumnData objects (or a List of Strings), representing a vertical
>> list of column data.  An example of this would be to use a stmt like
>> 'select user_name from users' to get a List of all users.
>
> FWIW the DynaSql class provides a way to preform queries and get the
> results back as an iterator over DyanBeans as well as to perform inserts
> and updates via DynaBeans.
>
> http://jakarta.apache.org/commons/sandbox/sql/apidocs/org/apache/commons/sql
> /dynabean/DynaSql.html
>
>
> James
> -------
> http://radio.weblogs.com/0112098/
>
> __________________________________________________
> Do You Yahoo!?
> Everything you'll ever need on one web page
> from News and Sport to Email and Music Charts
> http://uk.my.yahoo.com




--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: [DBUtils] Introduction and some thoughts

Posted by James Strachan <ja...@yahoo.co.uk>.
From: "Mike Bryant" <mi...@mikebryant.com>
> Hello all,
>
> My name is Mike Bryant.  I just wanted to send an email to introduce
> myself and say that I am excited about the DBUtils package.  I've spent a
> good bit of time at my current job writing database utility code, a
> package like this could have really saved some time.
>
> The code so far looks great I think.  I am especially impressed with the
> EnhancedResultSet class and the DbUtils.resultSetToArray method.
>
> Some thoughts I have on this package:
> - Data class (ColumnData) to hold a DB field's data.  This might contain
> data like column index, data type, column name, value.

In the commons-sql project I used a DynaBean to hold a row of data from a
database.  See the bottom of this page for it in action..

http://jakarta.apache.org/commons/sandbox/sql/

A DynaBean has a DynaClass and a DynaProperty for the metadata. So I just
implemented an SqlDynaBean, SqlDynaClass and SqlDynaProperty so that the
additional database-specific metadata can be captured (SQL types, primary
keys, indices, auto-increment, nullable, foreign keys etc).

http://jakarta.apache.org/commons/sandbox/sql/apidocs/org/apache/commons/sql
/dynabean/package-summary.html

e.g. an SqlDyanBean has a collection of SqlDynaProperty objects each of
which refers to a Column definition...

http://jakarta.apache.org/commons/sandbox/sql/apidocs/org/apache/commons/sql
/model/Column.html


would that do for now?


> - Method (similar to DbUtils.resultSetToArray method) that would build a
> List (or maybe Map) of ColumnData objects.  This might be useful if users
> need more information than the resultSetToArray method provides.

Already the beanutils project has a way of turning a ResultSet into an
Iterator over DynaBeans which is quite useful.


> - Method to take a SQL stmt as a param, execute it, build a List of
> ColumnData objects (or a List of Strings), representing a vertical list of
> column data.  An example of this would be to use a stmt like 'select
> user_name from users' to get a List of all users.

FWIW the DynaSql class provides a way to preform queries and get the results
back as an iterator over DyanBeans as well as to perform inserts and updates
via DynaBeans.

http://jakarta.apache.org/commons/sandbox/sql/apidocs/org/apache/commons/sql
/dynabean/DynaSql.html


James
-------
http://radio.weblogs.com/0112098/

__________________________________________________
Do You Yahoo!?
Everything you'll ever need on one web page
from News and Sport to Email and Music Charts
http://uk.my.yahoo.com

--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


[DBUtils] Introduction and some thoughts

Posted by Mike Bryant <mi...@mikebryant.com>.
Hello all,

My name is Mike Bryant.  I just wanted to send an email to introduce
myself and say that I am excited about the DBUtils package.  I've spent a
good bit of time at my current job writing database utility code, a
package like this could have really saved some time.

The code so far looks great I think.  I am especially impressed with the
EnhancedResultSet class and the DbUtils.resultSetToArray method.

Some thoughts I have on this package:
- Data class (ColumnData) to hold a DB field's data.  This might contain
data like column index, data type, column name, value.
- Method (similar to DbUtils.resultSetToArray method) that would build a
List (or maybe Map) of ColumnData objects.  This might be useful if users
need more information than the resultSetToArray method provides.
- Method to take a SQL stmt as a param, execute it, build a List of
ColumnData objects (or a List of Strings), representing a vertical list of
column data.  An example of this would be to use a stmt like 'select
user_name from users' to get a List of all users.

Anyway, those are some general thoughts.  I look forward to (hopefully)
spending alot of time with this.

Thanks

Mike Bryant (mike@MikeBryant.com)




--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: relative path in forward?

Posted by Gemes Tibor <ge...@regens.hu>.
2002. november 15. 04:24 dátummal Doug Dates ezt írtad:
> Hi:
>
> I have a small question. It seems that there is no related discussion on
> the web.
>
> My questions: can I use relative path(without "/") in forward in
> struts-config.xml? For example: can I use  <forward name="logon"
> path="logon.do"/> instead of using <forward name="logon"
> path="/logon.do"/>? Notice: there is no "/" before logon.do in the first
> forward. I appreciate your help.

There is no reason to use a forward without the leading slash. It is a 
module-relative (or context-relative) path, and if you omit it you will be 
forwarded to http://myhost/myContextlogin.do. 

I think you are trying to solve the wrong problem. Please describe the reason 
for what are you trying to do this, and I'm sure we can come up with some 
better alternative.

Hth,

Tib

--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


relative path in forward?

Posted by Doug Dates <hi...@yahoo.ca>.
Hi:

I have a small question. It seems that there is no related discussion on the
web.

My questions: can I use relative path(without "/") in forward in
struts-config.xml? For example: can I use  <forward name="logon"
path="logon.do"/> instead of using <forward name="logon" path="/logon.do"/>?
Notice: there is no "/" before logon.do in the first forward. I appreciate
your help.

Thanks.

Doug

______________________________________________________________________ 
Post your free ad now! http://personals.yahoo.ca

--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: [validator] bug in javascript generation for regular expressions?

Posted by di...@multitask.com.au.
Sorry, this is a struts 1.1 issue
--
dIon Gillard, Multitask Consulting
Work:      http://www.multitask.com.au
Developers: http://adslgateway.multitask.com.au/developers


dion@multitask.com.au wrote on 15/11/2002 12:10:30 PM:

> I think that this one is biting us:
> 
> 
> <Code snippet>
> } else if (Var.JSTYPE_REGEXP.equalsIgnoreCase(jsType)) {
>      results.append(
>      "this."
>          + varKey
>          + "=/"
>          + ValidatorUtil.replace(varValue, "\\", "\\\\")
>          + "/; ");
> </CodeSnippet>
> 
> Since the javascript regexp starts with '/' shouldn't any embedded '/'s 
be 
> escaped? 
> 
> I'll test it locally to see if it solves our problem and report back.
> --
> dIon Gillard, Multitask Consulting
> Work:      http://www.multitask.com.au
> Developers: http://adslgateway.multitask.com.au/developers
> 
> 
> --
> To unsubscribe, e-mail: 
<ma...@jakarta.apache.org>
> For additional commands, e-mail: 
<ma...@jakarta.apache.org>
> 

> ForwardSourceID:NT0008ED16 

--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: [validator] bug in javascript generation for regular expressions?

Posted by di...@multitask.com.au.
Sorry, this is a struts 1.1 issue
--
dIon Gillard, Multitask Consulting
Work:      http://www.multitask.com.au
Developers: http://adslgateway.multitask.com.au/developers


dion@multitask.com.au wrote on 15/11/2002 12:10:30 PM:

> I think that this one is biting us:
> 
> 
> <Code snippet>
> } else if (Var.JSTYPE_REGEXP.equalsIgnoreCase(jsType)) {
>      results.append(
>      "this."
>          + varKey
>          + "=/"
>          + ValidatorUtil.replace(varValue, "\\", "\\\\")
>          + "/; ");
> </CodeSnippet>
> 
> Since the javascript regexp starts with '/' shouldn't any embedded '/'s 
be 
> escaped? 
> 
> I'll test it locally to see if it solves our problem and report back.
> --
> dIon Gillard, Multitask Consulting
> Work:      http://www.multitask.com.au
> Developers: http://adslgateway.multitask.com.au/developers
> 
> 
> --
> To unsubscribe, e-mail: 
<ma...@jakarta.apache.org>
> For additional commands, e-mail: 
<ma...@jakarta.apache.org>
> 

> ForwardSourceID:NT0008ED16 

--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>