Best unofficial Apache Server developers community |
| |||||
| Jul 6, 2010 | |||||
|
Christian Casar |
|
||||
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}"
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
}
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>
Created: (HIVE-1483) Update AWS S3 log format deserializer regex
Update AWS S3 log format deserializer regex
Help with variables
Hi, I need some help in creating the following steps in a test that I want to automate. I have a situation where a user logs in who is already assigned to a particular course. There are many different courses so do I need to create a list of courses in a csv file? The next situation is that the user is assigned a fixed number of mandatory courses and then needs to select optional courses. This all ties in to the fee that the user will see on completion of registration. Can anyone give me a few tips please on how to achieve this? And preferably no links to the manual please... I'm not a coder so a lot of the stuff metioned makes little or no sense to me. Brian
transitive() fails with POM variables
Hi when using transitive for maven artifacts buildr fails in case when POM uses maven variables example buildfile: repositories.remote << "http://repository.jboss.com/maven2/" transitive("org.hibernate:hibernate-ehcache:jar:3.3.1.GA") POM contains dependency: <dependency> <groupId>${groupId}</groupId> <artifactId>hibernate-core</artifactId> <version>${version}</version> </dependency> and the trace is: Downloading :hibernate-core:pom: Buildr aborted! RuntimeError : Failed to download :hibernate-core:pom:, tried the following repositories: http://repository.jboss.com/maven2// /opt/workspaceSMM/smm-web/gui/buildfile:14 /usr/lib/ruby/gems/1.8/gems/buildr-1.4.1/lib/buildr/core/application.rb:398:in `raw_load_buildfile' /usr/lib/ruby/gems/1.8/gems/buildr-1.4.1/lib/buildr/core/application.rb:218:in `load_buildfile' /usr/lib/ruby/gems/1.8/gems/buildr-1.4.1/lib/buildr/core/application.rb:213:in `load_buildfile' So it seems that ${groupId} and ${version} variables are not resolved Jacek
DO NOT REPLY Can passenv variables who's name contain '(' or ')'
https://issues.apache.org/bugzilla/show_bug.cgi?id=46751
Nick Kew <ni### @webthing.com> changed:
What |Removed |Added
Setting collection variables from Lua
Is there a way to set a collection variable from a Lua script? Perhaps something like m.setvar. Alternatively, can I return the value I want to set in a collection value to modsec and use the rules language to set a collection variable? Thanks
Rails, fcgid and environment variables
Is there a way to make environment variables stay set when using mod_fcgid?
I have the following section in an apache config:
<VirtualHost x.x.x.x:80>
ServerName local.domain
DocumentRoot /var/www/myapp/charts
RewriteEngine On
<Directory />
AuthName "Charts"
AuthType Basic
AuthBasicProvider ldap
AuthLDAPBindDN ldap### @local.domain
AuthLDAPBindPassword xxx
AuthLDAPUrl ldap://x.x.x.x:3268/?sAMAccountName,memberOf?sub
AuthzLDAPAuthoritative off
Require ldap-group cn=Charts,ou=Groups,dc=hrcsb,dc=org
Require ldap-group cn=IT,ou=Groups,dc=hrcsb,dc=org
Require valid-user
</Directory>
RewriteCond %{ENV:AUTHENTICATE_MEMBEROF} (.*cn=(charts|it),.*) [NC]
RewriteCond %{QUERY_STRING} ^(?!(.*batches=true.*))
RewriteRule ^/charts
https://charts.local.domain/charts/?batches=true [L]
RewriteCond %{ENV:AUTHENTICATE_SAMACCOUNTNAME} (.+)
RewriteCond %{ENV:AUTHENTICATE_MEMBEROF} ^(?!(.*cn=(charts|it),.*))
[NC]
RewriteCond %{QUERY_STRING} (.*batches=true.*) [NC]
RewriteRule ^/charts https://charts.local.domain/charts/? [L]
</VirtualHost>
The problem is that with fcgid, the environment variables get unset for
some requests so my rewrites don't work.
Any ideas?
DO NOT REPLY New: c:set does not remove variables from ELContext VariableMapper
https://issues.apache.org/bugzilla/show_bug.cgi?id=49526
Summary: c:set does not remove variables from ELContext
VariableMapper
Product: Taglibs
Version: 1.2.0
Platform: PC
Status: NEW
Severity: normal
Priority: P2
Component: Standard Taglib
AssignedTo: de### @tomcat.apache.org
ReportedBy: jbo### @apache.org
The sequence
<c:set var="hello" value="hello"/>
<c:set var="x" value="#{hello}"/>
<c:set var="x" value="world"/>
<c:out value="${x}"/>
generates "hello" rather than "world"
The commented out code at SetSupport#138 appears to be needed.
Re: Creating a libRedis / refactoring global variables
On Tue, Jul 27, 2010 at 10:05:37AM -0700, Jak Sprats said: How are you gonna handle multiple threads doing background dumps (in parallel), or writing to the AOF file(in parallel). Well, the original plan wasn't to make Redis multi threaded, just to allow dlopen-ed plugins. So the short answer is: I'm not. Longer answer: once the separation is done it might be possible to go in a wrap various operations with a mutex (probably wrapped in a macro so that multithreading is a compile time option). But that's in the future.
DO NOT REPLY No AUTHENTICATE_* environment variables from mod_authz_ldap
https://issues.apache.org/bugzilla/show_bug.cgi?id=45584
Eric Covener <cov### @gmail.com> changed:
What |Removed |Added
Passing variables between thread groups in a test plan
Hello - I was wondering if it is possible to pass a variable from one thread group to another in a JMeter Test Plan? For example, my first thread group calls another test via an Include Controller, and then uses variables that were extracted via RegEx from that test, in that thread group (user name, email). I then want to have a new thread group (in the same test plan) use one of the variables that were extracted from the included test and used in the first thread group. Is that possible at all? Thanks in advance. Janine
Re: Mapper Reducer : Unit Test and mocking with static variables
FYI I am on Hadoop 0.20.2, JUnit 4 Varene Olivier a écrit : Hello to all, first of all many thanks for this great piece of software you are all contributing to :) I am actually creating a program in Hadoop MapReduce, but I intend to massively use JUnit Tests to validate my code. To test a Mapper, I mock a Mapper.Context object and run the Mapper.map function with it, but inside my Mapper.map function, I am using Counters to maintain internal statistics. The update of those counters make the test fails with a null pointer (JavaNullPointerException). There is an issue "Counters" of variable visibility from my test ... Do you have any idea how to mock/validate/overcome this issue ? Thanks a lots Best Regards Olivier Varene : Code : -------- private static enum Counters {NBLINES}; private static IntWritable one = new IntWritable(1); private static LongWritable oneL = new LongWritable(1); // Mapper /** * outputs 1 for each line encountered */ public static class LCMapper extends Mapper<LongWritable, Text, IntWritable, LongWritable> { private final static IntWritable one = new IntWritable(1); private final static LongWritable oneL = new LongWritable(1); /** * for each line encountered outputs 1 for the key 1 */ public void map(LongWritable p_key, Text p_inputs, Context p_context) throws IOException, InterruptedException { p_context.getCounter(Counters.NBLINES).increment(1); p_context.write(one,oneL); } // end map } // end Mapper : Test : -------- @Test public void testLCMapper() throws IOException, InterruptedException { LCMapper mapper = new LCMapper(); Text value = new Text("ligneA\nlignB\n"); // mock the map job execution context Context context = mock(Context.class); try { mapper.map(null, value, context); } catch (NullPointerException e) { // exception raised by context.getCounter(...) null pointer // HOW TO MOCK ??? // Counter is a static enum from the englobing class ... // issue with variable visibility (from map function) in this test } // verify that the Mapper issued (one,oneL) pair verify(context).write(one,oneL); } // end testLCMapper
PATCH/puppet 1/1] [#4269] Undef variables interpolate to empty string
This fixes double-quoted strings to interpolate undef variables
as an empty string. This is the behavior present in 0.25.x.
Signed-off-by: Nick Lewis <ni### @puppetlabs.com>
---
lib/puppet/parser/ast/leaf.rb | 5 ++++-
spec/unit/parser/ast/leaf_spec.rb | 31 +++++++++++++++++++++++++++++++
2 files changed, 35 insertions(+), 1 deletions(-)
diff --git a/lib/puppet/parser/ast/leaf.rb b/lib/puppet/parser/ast/leaf.rb
index 49f4302..781fc4b 100644
--- a/lib/puppet/parser/ast/leaf.rb
+++ b/lib/puppet/parser/ast/leaf.rb
@@ -77,7 +77,10 @@ class Puppet::Parser::AST
class Concat < AST::Leaf
def evaluate(scope)
- @value.collect { |x| x.evaluate(scope) }.join
+ @value.collect do |x|
+ val = x.evaluate(scope)
+ val == :undef ? '' : val
+ end.join
end
def to_s
diff --git a/spec/unit/parser/ast/leaf_spec.rb
b/spec/unit/parser/ast/leaf_spec.rb
index d21cbf5..2843567 100755
--- a/spec/unit/parser/ast/leaf_spec.rb
+++ b/spec/unit/parser/ast/leaf_spec.rb
@@ -107,6 +107,37 @@ describe Puppet::Parser::AST::String do
end
end
+describe Puppet::Parser::AST::Concat do
+ describe "when evaluating" do
+ before :each do
+ @scope = stub_everything 'scope'
+ end
+ it "should interpolate variables and concatenate their values" do
+ one = Puppet::Parser::AST::String.new(:value => "one")
+ one.stubs(:evaluate).returns("one ")
+ two = Puppet::Parser::AST::String.new(:value => "two")
+ two.stubs(:evaluate).returns(" two ")
+ three = Puppet::Parser::AST::String.new(:value => "three")
+ three.stubs(:evaluate).returns(" three")
+ var = Puppet::Parser::AST::Variable.new(:value => "myvar")
+ var.stubs(:evaluate).returns("foo")
+ array = Puppet::Parser::AST::Variable.new(:value => "array")
+ array.stubs(:evaluate).returns(["bar","baz"])
+ concat = Puppet::Parser::AST::Concat.new(:value =>
[one,var,two,array,three])
+
+ concat.evaluate(@scope).should == 'one foo two barbaz three'
+ end
+
+ it "should transform undef variables to empty string" do
+ var = Puppet::Parser::AST::Variable.new(:value => "myvar")
+ var.stubs(:evaluate).returns(:undef)
+ concat = Puppet::Parser::AST::Concat.new(:value => [var])
+
+ concat.evaluate(@scope).should == ''
+ end
+ end
+end
+
describe Puppet::Parser::AST::Undef do
before :each do
@scope = stub 'scope'
| |||||
(21 lines) Jul 6, 2010 12:00
(36 lines) Jul 6, 2010 12:51
(30 lines) Jul 6, 2010 13:03
(36 lines) Jul 7, 2010 02:20