Best unofficial Apache Server developers community |
| |||||
| Sep 1, 2010 | |||||
|
Daniel V. Klein |
|
||||
| Tags: | |||||
Similar Threads
Using Regex
All,
I am using pig embedded in Java and need to use matches in my pig job.
However when I try to use escape characters in the pig line, the
compiler complains. How do I use complex regex while embedding?
Sample code that is throwing errors:
myServer.registerQuery("filtered = FILTER firstcut BY dIP matches
'\Q34.21.12.*\E';");
error: invalid escape sequence.
Thanks,
Matt
Ask a question about regex in CRS
Hi, everyone
The following rule comes from
rules/base_rules/modsecurity_crs_41_sql_injection_attacks.conf , but I
don't understand what does the regular expression "(?:[\\\(\)\%#]|--)"
mean. What's the meaning of "\%" in a regex?
SecRule MATCHED_VAR "(?:[\\\(\)\%#]|--)"
"t:none,setvar:'tx.msg=%{rule.msg}',setvar:tx.sql_injection_score=+%{tx.critical_anomaly_score},setvar:tx.anomaly_score=+%{tx.critical_anomaly_score},setvar:tx.%{rule.id}-WEB_ATTACK/SQL_INJECTION-%{matched_var_name}=%{tx.0}"
Re: Confusion with Regex
Are you sure your variable name(s) are not declared elsewhere in your test plan? Might be a dumb question, but I've used the RegexExtractor for a long time w/o issue. How are you getting your multiple values out?
Using variables in regex
Well, how do I use the content of a variable in regex?
$username = "user1"
file { "userdata.tar.bz2":
source => "puppet://$server/modules/$module/
userdata.tar.bz2",
ensure => $users ? {
/$username/ => absent,
default => present,
},
}
$users is a custom fact that contains all local users:
users => at avahi bin daemon dnsmasq ftp games haldaemon lp mail
messagebus nobody ntp polkituser postfix pulse root sshd suse uuidd
wwwrun man news uucp puppet user1
When I hardcode "user1" into the regex my test works fine and the file
is removed.
But things like /$variable/ or /\$variable/ or /#{variable}/ just
don't work.
Is it even possible in version 0.25.4?
Using Regex in Embedded Pig in Java
All,
I am using pig embedded in Java and need to use matches in my pig job.
However when I try to use escape characters in the pig line, the
compiler complains. How do I use complex regex while embedding?
Sample code that is throwing errors:
myServer.registerQuery("filtered = FILTER firstcut BY dIP matches
'\Q34.21.12.*\E';");
error: invalid escape sequence.
Thanks,
Matt
Issues with Node Regex
I am trying to match groups of nodes - i.e.
Node: synd1-path2.path2.some.domain
Node: synd2-path2.path2.some.domain
By using either of the node definitions below:
node /^synd\w+\.path2\.some\.domain$/ {
include ibapps
include db
}
Multiline regex matches
Hi,
I need to fail a build if a certain file doesn't match a certain
multiline regex pattern. I tried somethink like
<fail>
<condition>
<resourcecount when="equal" count="0">
<restrict>
<fileset file="${file}"/>
<containsregexp expression="${regex}"/>
</restrict>
</resourcecount>
</condition>
</fail>
but unfortunately containsregexp doesn't perform multiline matches.
Specifying "(?m:${regex})" doesn't work.
If the <matches> condition would support resources, I could use
that,
but it only supports the string attribute.
Any other ideas?
-- Niklas Matthies
A question about android regex implementation
Hi Jesse and All, I have written some simple benchmarks for harmony regex and find the performance of harmony is poor compared to RI. For example, Mathcer.find() only reach 60% of that of RI. I heard Android use icu4jni re-implement this module. Since icu4jni use native code I think it may has higher performance than harmony. I am trying to use icu4jni as the back-end of harmony regex but find icu4jni has no functions related to regex operations. I know there are some android guys in our community. So can anyone tell me some detail info for android's regex, like if it re-implement the regex logic using native code by android itself rather than icu4jni and really get higher performance compared to harmony regex? Thanks a lot!
client-side password validation using regex
Hi all,
I was wondering if it's possible to validate a <html:password> field
on client-side by using a regular expression.
A look at validateMask.js told me that the only field types supported are
'hidden', 'text', 'textarea' and 'file'.
Code:
if ((field.type == 'hidden' ||
field.type == 'text' ||
field.type == 'textarea' ||
field.type == 'file') &&
(field.value.length > 0)) {
if (!jcv_matchPattern(field.value, oMasked[x][2]("mask")))
{
if (i == 0) {
focusField = field;
}
fields[i++] = oMasked[x][1];
isValid = false;
}
}
Is this the exspected behavior? Is there any reason for not supporting
'password' fields?
If so, how would I validate a password field by using a regex (without
changing the js file on my own :))?
Cheers,
Ref. 324 * Geoinformationszentrum
Tel. 0211 9449-6310 * Fax: 0211 9449-6610
Email: stephan.### @it.nrw.de<mailto:stephan.k### @it.nrw.de>
REGEX - Long running thread - stuck at RE.java
Hi,
We are facing high CPU usage in our application hosted on Tomcat. After
getting thread dumps, I see the following information. Seems like the
RE.java is getting processed continuously and due to this few threads in
Tomcat are stuck forever. This pushes the CPU usage above 90% and making
the application very unstable.
Please advice.
Below is the info from thread dump:
TP-Processor5396" daemon prio=10 tid=0x022cff28 nid=0x1f91b runnable
[0x4dcfb000..0x4dcffc70]
at org.apache.regexp.RE.matchNodes(RE.java:860)
at org.apache.regexp.RE.matchNodes(RE.java:1376)
at org.apache.regexp.RE.matchNodes(RE.java:1376)
at org.apache.regexp.RE.matchNodes(RE.java:1376)
at org.apache.regexp.RE.matchNodes(RE.java:1376)
at org.apache.regexp.RE.matchNodes(RE.java:1376)
at org.apache.regexp.RE.matchNodes(RE.java:1376)
at org.apache.regexp.RE.matchNodes(RE.java:1376)
at org.apache.regexp.RE.matchNodes(RE.java:1376)
at org.apache.regexp.RE.matchNodes(RE.java:1376)
at org.apache.regexp.RE.matchNodes(RE.java:1376)
at org.apache.regexp.RE.matchNodes(RE.java:1376)
at org.apache.regexp.RE.matchNodes(RE.java:1376)
at org.apache.regexp.RE.matchNodes(RE.java:1376)
at org.apache.regexp.RE.matchNodes(RE.java:1376)
at org.apache.regexp.RE.matchNodes(RE.java:1376)
at org.apache.regexp.RE.matchNodes(RE.java:1376)
at org.apache.regexp.RE.matchNodes(RE.java:1376)
at org.apache.regexp.RE.matchNodes(RE.java:1376)
at org.apache.regexp.RE.matchNodes(RE.java:1376)
at org.apache.regexp.RE.matchNodes(RE.java:1376)
at org.apache.regexp.RE.matchNodes(RE.java:1376)
at org.apache.regexp.RE.matchNodes(RE.java:1376)
at org.apache.regexp.RE.matchNodes(RE.java:1376)
at org.apache.regexp.RE.matchNodes(RE.java:1376)
at org.apache.regexp.RE.matchNodes(RE.java:1376)
at org.apache.regexp.RE.matchNodes(RE.java:1376)
at org.apache.regexp.RE.matchNodes(RE.java:1376)
at org.apache.regexp.RE.matchNodes(RE.java:1376)
at org.apache.regexp.RE.matchNodes(RE.java:1376)
at org.apache.regexp.RE.matchNodes(RE.java:1376)
at org.apache.regexp.RE.matchNodes(RE.java:1376)
at org.apache.regexp.RE.matchNodes(RE.java:1376)
at org.apache.regexp.RE.matchNodes(RE.java:1376)
at org.apache.regexp.RE.matchNodes(RE.java:1376)
at org.apache.regexp.RE.matchNodes(RE.java:1376)
at org.apache.regexp.RE.matchNodes(RE.java:1376)
at org.apache.regexp.RE.matchNodes(RE.java:1376)
at org.apache.regexp.RE.matchNodes(RE.java:1376)
at org.apache.regexp.RE.matchNodes(RE.java:1376)
at org.apache.regexp.RE.matchNodes(RE.java:1376)
at org.apache.regexp.RE.matchNodes(RE.java:1376)
at org.apache.regexp.RE.matchNodes(RE.java:1376)
at org.apache.regexp.RE.matchNodes(RE.java:1376)
at org.apache.regexp.RE.matchNodes(RE.java:1376)
at org.apache.regexp.RE.matchNodes(RE.java:1376)
at org.apache.regexp.RE.matchNodes(RE.java:1376)
at org.apache.regexp.RE.matchNodes(RE.java:1376)
at org.apache.regexp.RE.matchNodes(RE.java:1376)
at org.apache.regexp.RE.matchNodes(RE.java:1376)
at org.apache.regexp.RE.matchNodes(RE.java:1376)
at org.apache.regexp.RE.matchNodes(RE.java:1376)
at org.apache.regexp.RE.matchNodes(RE.java:1376)
at org.apache.regexp.RE.matchNodes(RE.java:1376)
at org.apache.regexp.RE.matchNodes(RE.java:1376)
at org.apache.regexp.RE.matchNodes(RE.java:1376)
at org.apache.regexp.RE.matchNodes(RE.java:1376)
at org.apache.regexp.RE.matchNodes(RE.java:1376)
at org.apache.regexp.RE.matchNodes(RE.java:1376)
at org.apache.regexp.RE.matchAt(RE.java:1448)
at org.apache.regexp.RE.match(RE.java:1498)
at org.apache.regexp.RE.match(RE.java:1468)
at org.apache.regexp.RE.match(RE.java:1561)
at
javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
at
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(Applica
tionFilterChain.java:290)
at
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilt
erChain.java:206)
at
org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValv
e.java:233)
at
org.apache.catalina.core.StandardContextValve.invoke(StandardContextValv
e.java:175)
at
org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java
:128)
at
org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java
:102)
at
org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.
java:109)
at
org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:2
86)
at
org.apache.jk.server.JkCoyoteHandler.invoke(JkCoyoteHandler.java:190)
at
org.apache.jk.common.HandlerRequest.invoke(HandlerRequest.java:283)
at
org.apache.jk.common.ChannelSocket.invoke(ChannelSocket.java:767)
at
org.apache.jk.common.ChannelSocket.processConnection(ChannelSocket.java:
697)
at
org.apache.jk.common.ChannelSocket$SocketConnection.runIt(ChannelSocket.
java:889)
at
org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool
.java:690)
at java.lang.Thread.run(Thread.java:595)
Here is the regex related code in our application :
try{
RE r = new
RE("^[\\w\\-]+(\\.)?[\\w\\-]+@[\\w\\-\\.]+(\\.([a-z]){2,4})$");
RE r1 = new RE("^\\w{5,65}$");
match = r.match(userID);
if(!match)
match = r1.match(userID);
}catch(Exception ex){
throw new BusinessException(ex);
}
Any thoughts????
Do you really need to print this email? Help preserve our environment!
Devez-vous vraiment imprimer ce courriel? Pensons a l'environnement!
Created: (HIVE-1483) Update AWS S3 log format deserializer regex
Update AWS S3 log format deserializer regex
Odd Behavior
I am a total newbie with ANT so any ideas as to what is causing the following would be awesome. I added a couple Selenium jars to my build lib and when I run ANT it reverts my ANT version to 1.6.5 (per calling ant -version) whereas it is actually 1.7.1? When I remove the jars the version goes back to 1.7.1?! Is that bizarre or what?
Questions about WS-RM behavior in CXF
Hi CXF-experts, Some days ago, I asked my question about the expected behavior of the WS-RM client. I am confused that the network exception is passed back to the client application, while the RetransmissionInterceptor on the client keeps retransmitting the message. I expected that the exception would be handled by one of the RM interceptors so that the client would not get the network exception directly. (my original question http://mail-archives.apache.org/mod_m### @mail.gmail.com>) Looking further into the code today, I see that the exception is passed back to the client because it is set both in message's content and in its exchange map at the PhaseInterceptorChain's doIntercept method below: message.setContent(Exception.class, ex); boolean isOneWay = false; if (message.getExchange() != null) { message.getExchange().put(Exception.class, ex); isOneWay = message.getExchange().isOneWay(); } unwind(message); Later, the existence of the exception object is checked by the ClientImpl class in its processResult method and if found, this throws this exception to the client. Here I have two questions. 1. why does my oneway method initiated by port.greetMeOneWay method of the demo sample invoke the ClientImpl that calls the processResult method? Isn't the processResult method only needed for request-response processing? 2. If the processResult method is called for oneway calls, should the RetransmissionInterceptor's handleFault method remove the exception object from the message and its exchange map? If this is done, the exception would not be removed during the unwind method of the doInterceptor method above and the original exception would not be forwarded to the client application. This seems to work for me. I would appreciate if someone can answer my questions. Thanks. Regards, aki
Help with filter behavior
I am trying to build a route using Java DSL and I'm getting a confusing
error
in my IDE (IntelliJ). Here's what I'm trying to do:
1. Receive a message from a JMS Queue
2. Enrich the message by querying a database to retrieve additional
content
(claim check pattern)
3. Filter the messages to exclude any 'test' messages
4. Print to the console
Here's my Java DSL:
public class MyRouteBuilder extends RouteBuilder {
public void configure() throws Exception {
from("jms:xmlOrders")
.bean(enricher, "enrichData")
.filter().xpath("/order[not(@test)]")
.to("stream:out"); // ERROR on this line in IDE
}
}
The IDE highlights the last line (.to("stream:out");) as an error and I'm
having a hard time understanding why. If I remove the bean doing the
enrichment it works fine. ie:
from("jms:xmlOrders")
//.bean(enricher, "enrichData") COMMENTED OUT
.filter().xpath("/order[not(@test)]")
.to("stream:out"); // NOW everything is fine
I also tried replacing the bean with a new Processor that does the same
thing in case the issue has to do with keeping the Exchange in tact but it
still didn't make the error go away.
I'm sure this is how it's supposed to work and is due to a lack of my
understanding. I would be grateful if anyone could help me understand why
this is happening!
Surprised by a wsdl2java behavior
Embedded in my WSDL I have a schema: <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" targetNamespace=" http://util.basistech.com" version="1.0"> ... </xs:schema> That TNS is nothing like the overall TNS of the WSDL: urn:basistech.com: rosette:analysis. Yet, the following codegen invocation generates all of the code into one package: com.basistech.rosette.analysis I have this idea that I used to know why, but I am currently stumped. <plugin> <groupId>org.apache.cxf</groupId> <artifactId>cxf-codegen-plugin</artifactId> <version>${cxf-version}</version> <executions> <execution> <id>generate-sources</id> <configuration> <sourceRoot>${project.build.directory}/generated/cxf</sourceRoot> <wsdlOptions> <wsdlOption> <wsdlArtifact> <groupId>com.basistech.jug</groupId> <artifactId>rex-ws</artifactId> <version>${project.version}</version> </wsdlArtifact> </wsdlOption> </wsdlOptions> </configuration> <goals> <goal>wsdl2java</goal> </goals> </execution> </executions> </plugin>
Puppet Standalone Behavior
If I do
1) puppet --modulepath=/home/abc/puppet/modules
OR
2) puppet --modulepath=/home/abc/puppet/modules --manifest=/home/abc/
puppet/site.pp
(...where site.pp has import "nodes.pp", and nodes.pp has a default
node definition that includes basic modules defined under /home/abc/
puppet/modules)
OR
3) 2) with confdir set as /home/abc/puppet with a puppet.conf just
pointing to the var, ssl and other directories.
, then I do not get any output (or anything in the logfile with the
logdest set) whatsoever even with trace, logdest, debug and verbose
options set.
If however I explicitly do
4) puppet -e node default { include xyz include pqr} --modulepath=/
home/abc/puppet/modules
,then the modules are applied fine.
Any pointers regarding this behavior of the standalone executable ?
Suggestions/tips for better understanding its working ?
weird apache behavior
Hi all. Our Apache (v2.0) is running on Windows Server 2003 and I'm running into some strange behavior that I can't figure out. I'm currently testing an Alias, and it only seems to work up to a certain point. In my httpd.conf, I've tested the following using the URL http://blah.blah.com/cfide/administrator : DocumentRoot "D:/MyStuff/webroot" SUCCESS! Alias /cfide/administrator "D:/" (goes to correct file located in D:/index.cfm) SUCCESS! Alias /cfide/administrator "D:/MyStuff" (goes to correct file located in D:/MyStuff/index.cfm) SUCCESS! Alias /cfide/administrator "D:/MyStuff/CFIDE" (goes to correct file located in D:/MyStuff/CFIDE/index.cfm) FAIL! Alias /cfide/administrator "D:/MyStuff/CFIDE/administrator" (goes to D:/MyStuff/webroot/CFIDE/administrator/index.cfm???) It never tried looking under DocumentRoot in my first 3 tests so why would it start now? Is there a bug that prevents mapping an alias to a physical directory with the same name? Thanks! Brendan Wong Web Developer Office of Graduate Studies 530-754-9473 "Saving the world one pdf at a time"
bad behavior of my Cassandra cluster
Hi, I have a 4-node cassandra cluster. And I find when the 4 nodes are flushing memtable and gc at the very similar moment, the throughput will drop and latency will increase rapidly and the nodes are dead and up frequently .... You could download the IOPS variance of data disk (sda here) and system logs of these nodes from http://docs.google.com/leaf?id=0ByKuS...t=list&num=50 (if you can't download it, just tell me.) What happed to the cluster? How could I avoid such scenario? * Storage configuration All of nodes act as seed node Random partitioner is used, so that the data is evenly located in the 4 nodes memtable thresholds: DiskAccessMode?: auto (in fact is mmap) MemtableThroughputInMB: 1024 MemtableOperationsInMillions?: 7 MemtableFlushAfterMinutes?: 1440 DiskAccess mode: Auto (mmap in fact) * While JVM options are: JVM_OPTS="-ea \ -Xms8G \ -Xmx8G \ -XX:+UseParNewGC \ -XX:+UseConcMarkSweepGC \ -XX:+CMSParallelRemarkEnabled \ -XX:SurvivorRatio=8 \ -XX:+UseLargePages \ -XX:LargePageSizeInBytes=2m \ -XX:+PrintGCDetails -XX:+PrintGCTimeStamps -XX:+PrintHeapAtGC -Xloggc:/tmp/cloudstress/jvm.gc.log \ -XX:MaxTenuringThreshold=1 \ -XX:+HeapDumpOnOutOfMemoryError \ -Dcom.sun.management.jmxremote.port=8080 \ -Dcom.sun.management.jmxremote.ssl=false \ -Dcom.sun.management.jmxremote.authenticate=false"
setMaxRows and database behavior
Hi, all! When I use setMaxRows() in JDBC, I know it limits the number of rows delivered through JDBC. I just wanted to confirm that when I use this, Derby doesn't still scan through all rows and then deliver maxRows number of rows to JDBC - that it only actually goes through the first N rows (assuming my query uses an index). e.g. SELECT id FROM mytable with setMaxRows(5) Derby will only go through the first 5 rows in the index... right? Thanks! David http://www.linkedin.com/in/davidvc http://davidvancouvering.blogspot.com http://twitter.com/dcouvering | |||||
(18 lines) Sep 3, 2010 18:19
(27 lines) Sep 3, 2010 18:33
(34 lines) Sep 3, 2010 18:37