AND in a regexp?

Hi
How I simulate an AND in a regexp.
e.g.
I have the text:
Once apone the time, there was a wonderful
forum, known as the watercooler.
But then the evil Sun Monster killed it.
I want the regexp of
monster AND watercooler
The best I can work out is
((.*\Qmonster\E.*)|(.*watercooler.*))|((.*watercooler.*)|(.*\Qmonster\E.*))
which sucks.
Please help.
Thanks mlk

All righty then..hows about this?
This:
(\A*(x)*)&&(\A*(y)*)
Should match a string containing x and y in any order (I think). The \A modifier starts the search at the beginning of the input. (One problem I can already see is that x might be contained within y and you don't want to count that as two matches).
You can generate a regex using a Vector of entries like this:/**
* Generates a regular expression that matches a String containing
* each String in the given Vector.
* @param vec Vector of Strings to match
* @return regex String or null on failure
private String getRegex(Vector vec){
  if((vec == null) || (vec.size() < 1)) return null;
  String expression = "(\\A*(" + (String)vec.firstElement()+ ")*)";
  for(int i=1; i<vec.size(); i++){ //generate regex for entire group
    expression += "&&(\\A*(" + (String)vec.elementAt(i)+ ")*)";
  return expression;
}It's a start at least.

Similar Messages

  • Regular Expressions and variables OR RegExp and var

    Sorry about that, my browser hiccuped and sent three
    times....

    Newlines are only a problem if you're reading the
    text line-by-line and applying the regexp to each
    line. It wouldn't catch expressions that span
    lines.
    @sabre150: your note re: CharSequence -- so what
    you're suggesting is to implement a CharSequence that
    wraps the file contents, and then use the regexps on
    the whole thing? I like the idea but it seems like
    it would only be easy to implement if the file uses a
    fixed-width character set. Or am I missing
    something...?You are correct for the most basic implementation. It is very easy to create a char sequence for fixed width character sets using RandomAccessFile. Once you go to character sets such as UTF-8 then more effort is required.
    While ever the regex is moving forward thought the CharSequence one char at a time there is no problem because one can wrap a Reader but once it backtracks then one needs random access and one will need to have a buffer. I have used a ring buffer for this which seems to work OK but of course this will not allow the regex to move to any point in the CharSequence.
    'uncle_alice' is the regex king round here so listen to him.
    :-( I should read further ahead next time!
    Message was edited by:
    sabre150
    Message was edited by:
    sabre150

  • How to find and replace the text present in the url

    I have a column of type NCLOB with some text having url's in between as shown below:
    ========================================================================
    This text is for testign purpose.This text is for testign purpose.
    <A PL/SQL <U PL/SQL </U> </A>
    Thsi text is also for testign purpose.This text is for testign purpose.
    <A http://forums.oracle.com> <U oracle metalink> </U> </A>
    This text is for testign purpose.This text is for testign purpose.This text is for testign purpose.This text is for testign purpose.This text is for testign purpose.This text is for testign purpose.This text is for testign purpose.This text is for testign purpose.
    ========================================================================
    Requirement:
    ========
    Requirement is to implement the find and replace functionality.
    I just need to check whether the search text is present in the url or not?
    Suppose if search for orcale.com, since its part of the url so the search should be successful otherwise search should be unsuccessful.
    Here I can give you the hint like, always the url lies between the anchor tags *(<A </A>).*
    Tahnks in Advance.

    I had I think a similiar question the other day thay I Frank and Michaels answered for me.
    not sure if I totally have what you want but.
    WITH t
            AS (SELECT '<A PL/SQL <U PL/SQL Thsi text is also for testign purpose.This text is for testign purpose.
    <A http://forums.oracle.com> This text is for testign purpose.This text is for testign purpose.This text is for testign purpose.This text is for testign purpose.This text is for testign purpose.This text is for testign purpose.This text is for testign purpose.This text is for testign purpose.
                          txt
                  FROM DUAL)
    SELECT REGEXP_SUBSTR (REGEXP_REPLACE (txt, '(.*<A)|(</A>.*)'), 'oracle.com')
      FROM tthe first part the regexp replace part gets the text between a start and end point you mentioned that would be <A and </A>
    the regexp substr just looks for the phrase oracle.com in the text between those two points.
    Edited by: pollywog on Oct 6, 2010 8:26 AM

  • Regular Expressions and String variables

    Hi,
    I am attempting to implement a system for searching text files for regular expression matches (similar to something like TextPad, etc.).
    Looking at the regular expression API, it appears that you can only match using string variables. I just wanted to make sure this is true. Some of these files might be large and I feel uneasy about loading them into ginormous Strings. Is this the only way to do it? Can I make a String as big as I want?
    Thanks,
    -Mike

    Newlines are only a problem if you're reading the
    text line-by-line and applying the regexp to each
    line. It wouldn't catch expressions that span
    lines.
    @sabre150: your note re: CharSequence -- so what
    you're suggesting is to implement a CharSequence that
    wraps the file contents, and then use the regexps on
    the whole thing? I like the idea but it seems like
    it would only be easy to implement if the file uses a
    fixed-width character set. Or am I missing
    something...?You are correct for the most basic implementation. It is very easy to create a char sequence for fixed width character sets using RandomAccessFile. Once you go to character sets such as UTF-8 then more effort is required.
    While ever the regex is moving forward thought the CharSequence one char at a time there is no problem because one can wrap a Reader but once it backtracks then one needs random access and one will need to have a buffer. I have used a ring buffer for this which seems to work OK but of course this will not allow the regex to move to any point in the CharSequence.
    'uncle_alice' is the regex king round here so listen to him.
    :-( I should read further ahead next time!
    Message was edited by:
    sabre150
    Message was edited by:
    sabre150

  • Problems with string encoding - need the text content in char* format.

    The problem is non ASCII-characters, which comes out as some sort of unicode I need to desipher.
    Here's what I got:
    A text frame object with the TextString "Agnartjørna"
    I get the text content of this object into an ai::UnicodeString the following way:
    AIErr
    VMGetTextOfTextArt( AIArtHandle textArt, ai::UnicodeString &ucStr)
        ASUnicode *textBuffer = NULL;
        AITRY {
            TextFrameRef ateTextRef;
            AIX( sAITextFrame->GetATETextFrame( textArt, &ateTextRef));
            ATE::ITextFrame ateText( ateTextRef);
            ATE::ITextRange ateRange = ateText.GetTextRange( true);
            ASInt32 textLen = ateRange.GetSize();
            AIX( sSPBlocks->AllocateBlock( (textLen+2) * sizeof( ASUnicode), nil, (void**) &textBuffer));
            ateRange.GetContents( textBuffer, (ASInt32) textLen+1);
            /* trim off trailing newlines */
            if ((textBuffer[textLen] == '\n') || (textBuffer[textLen] == '\r'))
                 textBuffer[textLen] = 0;
            ucStr.clear();
            ucStr.append( ai::UnicodeString( textBuffer, textLen));
            sSPBlocks->FreeBlock( textBuffer);
            textBuffer = NULL;
           AIRETURN;
        AICATCH {
            if (textBuffer) sSPBlocks->FreeBlock( textBuffer);
           AIPROPAGATE;
    Now, the next step is to convert it into a form that I can use to call regexp.
    Baiscally, I want to detect the ending "tjørna" (meaning small lake) on a map label, and apply a standard abbevriation "tj^a" (with "a" superscripted).
    So the problem is to obtain the regexp pattern and the text content in same encoding.  And since the regexp library is old *char based, I would like to convert the text content in to plain old *char.
    Hence the following code:
    static AIErr
    VMAbbreviateTextArt( AIArtHandle textArt,
                             vmTextAbbrevEffectParams *params)
        AITRY {
        /* first obtain the text contents of the textArt */
           ai::UnicodeString ucText;
          const int kTextLen = 256;
          char textContent[kTextLen];
          AIX( VMGetTextOfTextArt( textArt, ucText));
          ucText.as_Roman( textContent, kTextLen);
    But textContent now has the value "Agnartj\xbfnna"  (According to XCode),
    which will not get a match on the pattern "tj([øe][rn])na\\" (with  backslash matching the end of the string)
    Any other ways to convert the textContent to a plain *char string?

    Thank you very much, your method will work fine. with
    the "UTF-8" parameter the byte[].length is double,
    cause every valid byte is preceeded by an -62, but I
    will just filter the valid bytes into a new array.
    Thanks again,
    StefanActually what you need to do is to find the character encoding that your device expects, and then you can code your strings in Arabic.
    That's the way Java does things; Strings and char values are always in UNICODE (see www.unicode.org) (which means \u600 to \u6ff for arabic) and uses a specified character encoding when translating these to and from a byte stream.
    Each national character encoding has a name. Most of them are identical to ASCII for 0-127 and code their national characters in 128-255.
    Find the encoding name for your display and, odds are, the JRE has it in the library.
    BTW the character encoding ISO-8859-1 simply maps UNICODE characters 0-255 on to bytes.

  • How can I disable synchronization of search input fields between different applications?

    Hi
    This feature, as I'm assuming it is, is really starting to rub me a very wrong way...
    Whenever I write anything in the search field of what seems to be any application in OS X, the input I write in the search field is being copied to any other application's search field. E.g., I'm searching in iTerm for text in log outputs, then I go to Sublime Text and write a regexp in the search field. The search field there now already contains what I wrote to iTerm's search field. The regexp I start writing likewise migrates to iTerm's search input whenever I return to it, destroying my search session there. I then go to Safari to search the Perl regexp documentation to help me with the expression I'm currently assembling in Sublime's find input. When I return to Sublime, my regexp is wiped with the input I made in Safari's search input, so that I have to start over completely creating my regular expression.
    It's incredibly frustrating, and I'm really hoping that this "feature" can be turned off, but I cannot figure out where, if at all?
    Does any one of you know?
    TIA,
    Daniel

    Hello,
    Here is the Oracle Forms forum, and your question has really nothing to do with this product.
    Please, send this kind of question in the database forum, you would increase your chances to get the appropriate answer.
    Francois

  • How to Validate the Text Field in JSF

    Hi,
    I am facing a issue to validate the text field where the below code accepts (space' ',underscore'_',pipe'|') symbol as a first character and last character.Where by it can accept in the middle.
    It should not accept special characters also. Below code is working properly for special characters.
    <tr>
    <td width="30%" align="right"><b><h:outputText id="aAccrualType" value="Accrual Type" /> </b> <span style="color:red">*</span></td>
    <td width="50%">: <h:inputText id="accrualType" value="#{accrualTypeMast.accrualType}" required="true" >          
    <t:validateRegExpr pattern="^[(a-z)||(A-Z)||(0-9)||(_)||(\s)||(/)]+$" />     
    <f:validateLength minimum="1" maximum="50"/>     
    </h:inputText>
    <h:message for="accrualType" showDetail="true" style="color:red" />
    </td>
    </tr>
    The thing is i dont have much knowledge in regular expression.
    Is there any other way to do this.
    Could anyone help me in this.
    Thanks,
    Ambika&#9786;

    This has nothing to do with JSF.
    I suggest you to read the Pattern API documentation [1]. You can easily create a small Java Application and test the regexp using String#matches() as it uses the same regexp guidelines.
    public static void main(String[] args) {
        String regexp = "^[a-z]+$";
        String value = "foo";
        boolean match = value.matches(regexp);
        System.out.println(value + " matches " + regexp + ": " + match);
    }[1] http://java.sun.com/j2se/1.5.0/docs/api/java/util/regex/Pattern.html

  • AS 3 Convert button event to key enter event

    I'm learning how to use regular expressions in ActionScript
    3, and can get an input to be tested by regular expressions, and an
    answer delivered, if a button is clicked after text is entered.
    But darn if I can figure how to code it so they just click
    the enter key after typing what they like. In the following code
    punk is a button, and there are two text fields, buzzo the input,
    and tester the answer to the input. The array questo contains the
    regular expressions, the array anso contains the responses.
    I need code to replace the bottom line with a line that
    relates to key enter being typed. Thanks for any ideas.
    Sally

    This will work if the code is on the timeline:
    var quest0:RegExp = /i was/i
    var quest1:RegExp =/\bbud(dy)?|mate/i
    var quest2:RegExp =/how old|\bage\b/i
    for(i=0;i<3;i++){
    questo.push(this["quest"+i])
    trace(questo[1])
    Another method might be to add your RegExp objects to a
    Object, and then
    iterate the Object's properties and add the RegExp objects to
    your array:
    import flash.utils.getQualifiedClassName;
    var RegExpContainer:Object = new Object();
    RegExpContainer.quest0:RegExp = /i was/i;
    RegExpContainer.quest1:RegExp =/\bbud(dy)?|mate/i;
    RegExpContainer.quest2:RegExp =/how old|\bage\b/i;
    for(var p in RegExpContainer){
    var o = RegExpContainer[p];
    if (getQualifiedClassName(o) == "RegExp"){
    questo.push(o);

  • Time format hours ("hh24") delim (.or,) (1/4) hour values as decimal value

    Dear all,
    What I need is a client (browser) site validation of values for a time recording system. The format should be as
    <hh24><Delimiter>(.(or),) 1/4 hours as decimal value (e.g. 15 minutes = 0.25). So as a result valid entrys should be. 00.00 as min., 24.00 as max.
    The "minutes"-part should only except full 1/4 hour values: 00, 25, 50, 75 or blank.
    More valid variation could be:
    .75 (45 minutes) should be considered as 00.75.
    1.25 , 9 ( = 9 hours)
    A colleague helped me and created the regexp pattern.
    (?<=\A)(([01]?[0-9]|2[0-4])[\.,]?)?([\.,](0{1,2}|25|50|75))?(?=(\z))
    It works perfect in "The Regex Coach", but sadly it does not work in a java script.
    My hope is, that someon already has a solution for this or a similar task.
    If so, please let me know and give me a hint.
    Thank you very much in advance.
    and best regards.
    Andre

    Hi Ben,
    thank you for your response.
    since I not only want to ask for help, I will let you konw our solution. It has been a little mind twisting
    However, Just in case someone is interestet in...
    function xaChk_TimeDecimalFormat(pItem)
       var check = $v(pItem);
       var regexpval = "^((([01]?[0-9])|(2[0-4]))?([,\.](00?))?|(([01]?[0-9])|(2[0-3]))?([,\.](00|25|50|5|75))?)$";
       if (check.search(regexpval,"g") < 0)
       {alert ('Ungültiges Zeiterfassungs-Format. \n gültig Werte sind: \n max. 24h und nur volle 1/4 Stunden als Decimalwert z.B. 0.25 für 15 Min.') };
    function xaChk_TimeClockFormat(pItem)
       var check = $v(pItem);
       var regexpval = "^((([01]?[0-9])|(2[0-4]))?([,\.](00))?|(([01]?[0-9])|(2[0-3]))?([,\.](00|15|30|45))?)$";
       if (check.search(regexpval,"g") < 0)
       {alert ('Ungültiges Zeiterfassungs-Format. \n gültig Werte sind: \n max. 24h und nur volle 1/4 Stunden als Minuten z.B. 0.15.') };
    ;Thanks again to all how wasted any thought on this. :-)
    Best Regards
    Andre

  • Collector questions

    Hello Everybody!
    I would like to ask some questions about creating a collector. I
    modified the Apache Agent (utility) to tail -F logfile_path | awk
    '{print($0); fflush()}' | $SOCAT_BIN -d -u - $SOCAT_OPTIONS & to send
    the logfile to the Sentinel. I will check, but the point is that it
    transfer the lines.
    The Collector look for a Matching rule and I saw it in the debugger and
    also in the Sentinel web interface that I got the event/logfile. I also
    see in the debugger that the s_RXBufferString is exists. So I have to
    use the safesplit or split methods on this.s_RXBufferString, right? Or
    Should I use //.exec()? Or it is totally up to me to use whatever I
    want?
    If I saw it right, the /()()/.exec() makes/eval the regex and We got
    RegExp.$1-$9. If I use the /()()/.test() it will just give me wether the
    result of the regex is true or false. Right?
    When is it allowed to use field assignment (e.InitiatorUserName =
    this.username?
    What is the effect when I put the instance.SEND_EVENT into an another
    function for example normalize()? Or it is still OK to put elsewhere the
    send_event untill it is in one of the preparse(),parse(),normalize()
    functions?
    Do I have to create a variable like var empty_str or it is enough to do
    the this.emptry_str? The preparse(),parse(),normalize() are prototype
    javascript function so if I read it well, it is ok to use
    this.empty_str. Or will the this.empty_str dissappear after it jumps to
    the next function (because of the scope)?
    How can I decide when to use RXMapp and when s_RXBufferString? What if I
    don't see the s_Body, but have s_RXBufferString? I know that
    s_RXBufferString is line-oriented, but is i possible that my syslog/file
    data will be in the RXMap?
    What if i set the this.dun="testuser"; and in the Rec2Evt.map I add the
    UserTargetName,dun pair? It should be always present the TargetUserName
    when I look it in the Sentinel web interface, right?
    Are there any other source to learn how to create collector?
    Thank you for your answers!
    woodspeed
    woodspeed's Profile: https://forums.netiq.com/member.php?userid=7232
    View this thread: https://forums.netiq.com/showthread.php?t=51349

    woodspeed;246692 Wrote:
    > Hello Everybody!
    >
    >
    > I would like to ask some questions about creating a collector. I
    > modified the Apache Agent (utility) to tail -F logfile_path | awk
    > '{print($0); fflush()}' | $SOCAT_BIN -d -u - $SOCAT_OPTIONS & to send
    > the logfile to the Sentinel. I will check, but the point is that it
    > transfer the lines.
    > The Collector look for a Matching rule and I saw it in the debugger and
    > also in the Sentinel web interface that I got the event/logfile. I also
    > see in the debugger that the s_RXBufferString is exists. So I have to
    > use the safesplit or split methods on this.s_RXBufferString, right? Or
    > Should I use //.exec()? Or it is totally up to me to use whatever I
    > want?
    > If I saw it right, the /()()/.exec() makes/eval the regex and We got
    > RegExp.$1-$9. If I use the /()()/.test() it will just give me wether the
    > result of the regex is true or false. Right?
    > When is it allowed to use field assignment (e.InitiatorUserName =
    > this.username?
    > What is the effect when I put the instance.SEND_EVENT into an another
    > function for example normalize()? Or it is still OK to put elsewhere the
    > send_event untill it is in one of the preparse(),parse(),normalize()
    > functions?
    > Do I have to create a variable like var empty_str or it is enough to do
    > the this.emptry_str? The preparse(),parse(),normalize() are prototype
    > javascript function so if I read it well, it is ok to use
    > this.empty_str. Or will the this.empty_str dissappear after it jumps to
    > the next function (because of the scope)?
    > How can I decide when to use RXMapp and when s_RXBufferString? What if I
    > don't see the s_Body, but have s_RXBufferString? I know that
    > s_RXBufferString is line-oriented, but is i possible that my syslog/file
    > data will be in the RXMap?
    > What if i set the this.dun="testuser"; and in the Rec2Evt.map I add the
    > UserTargetName,dun pair? It should be always present the TargetUserName
    > when I look it in the Sentinel web interface, right?
    > Are there any other source to learn how to create collector?
    >
    > Thank you for your answers!
    Argh formatting! Let me take this from the top, and hopefully I
    won't miss anything:
    1) favor exec() over test(). Test is slower, can only handle a very
    small number of captures (9), where exec is generally same or better
    speed, I haven't hit a limit to the matches, and returns a consistent
    indexed array.
    2) I personally favor using e.FieldName over using the rec2evt.map,
    because especially as a programmer I find it gives better flow control.
    That goes against documented guidance a bit, but as long as you're okay
    with the possibility of needing to
    do a larger find and replace in the event of a schema name change, it's
    really not that big of a deal (and if you use notepad++, it's really a
    non-issue)
    3) instance.SEND_EVENT is a global variable, so you're fine to set
    it...anywhere. You can also just call e.send() and return false()
    from any of the primary functions (parse(), preparse(), normalize() and
    the custom versions of the same), although once again, you risk a
    breaking change later, but once again, if you have a good editor, it's
    not a big deal.
    4) Javascript in general favors use of var over setting properties on
    objects, and in my own code I tend to follow that rule. However, if
    you need a value to transit between the Record methods, putting it on
    the this object isn't a bad idea at all.
    5) RXMap is only populated if a value coming in from the connector does
    not follow the s_<propname>, i_<propname> nomenclature, or if it's one
    of a few special fields that we happen to want at the top of the
    metadata. For syslog stuff, you can generally safely not mess with
    it.
    6) So there are three fields that hold the "message string" for most
    connectors:
    s_raw_message_2 - the original and completely unfiltered string
    s_RXBufferString - for most collectors, same as above, for syslog we
    clean it up to be syslog RFC-friendly.
    s_body - we strip off the syslog header.
    Which field you parse depends on what you need. For an RFC-compliant
    syslog stream, s_Body is the most convenient because it has all the
    'standard' stuff parsed out and available through other connector
    metafields; s_RXBufferString is generally good, but for some exceptional
    event sources, our "clean up" actually is a bad thing, which leaves
    s_raw_message_2. As a general rule for your use case, I would
    recommend s_RXBufferString unless you find that s_Body gives you a clean
    value.
    7) for your Rec2Evt.map question, well yes - assumign that this.dun was
    present and p
    8) https://www.novell.com/developer/dev..._sentinel.html is the best
    place to start and it's our main resource. If you need more of an A-Z
    training, our training services group does offer a training class that
    you may want to look into.
    brandon.langley
    brandon.langley's Profile: https://forums.netiq.com/member.php?userid=350
    View this thread: https://forums.netiq.com/showthread.php?t=51349

  • [JS] Reg Exp Error when using *

    Hello everyone,
    I get a syntax error when executing a script which contains RegExp handling strings with "*".
    ie:
    var x = /\*\*\*ABC/;
    alert (RegExp(x)); //*** WORKS because x is defined as an EXPRESSION
    var x = "\*\*\*ABC";
    alert (RegExp(x)); //*** SYNTAX ERROR when executing
    var x = "***ABC";
    alert (RegExp(x)); //*** SYNTAX ERROR when executing
    My problem is I have to build the expression using strings. So I was hoping to concatenate the string portionsa and use New RegExp to create my expression. Unfortunately, if we have STARS (*) in the string you get an error. Which as forced me to HARDCODE and I whish not to.
    ie:
    alert (yyy.search(/\*\*\*ABC/);
    FYI: I have expample in HTML where ".value" is used. But it does not work w/ InDesign???
    ie:
    var re = new RegExp(document.demoMatch.regex.value);
    if (document.demoMatch.subject.value.match(re))
    alert("Successful match");
    else
    alert("No match");
    Any suggestions?

    Yes it works!!!
    To look for 3 stars and "ABC", I have to define like this
    var a="\\*\\*\\*ABC";
    var patt1=new RegExp(a);
    alert(patt1.test("abcd*ABCefg"));
    So when I build the string I have to use 2 backslashes!!!
    Thank you so much.
    FYI: Using ".source" work too. Still working on how to add a flag (/i)
    var y = "xxx***ABCyyyxxx***ABCyyyxxx***ABCyyy";
    var x = /\*\*\*/;
    var x = new RegExp(x.source + "ABC");
    alert (RegExp(x));
    var z = x.exec(y);
    if (z != null)
    alert ("Found at position "+z.index+"\nHow many: "+z.length);
    var z = y.match(x);
    if (z != null)
    alert ("Found at position "+z.index+"\nHow many: "+z.length);

  • How to Create a multiefield in CQ with custom type?

    Please can anyone guide me to create a multiefield component with custom xtypes...

    Hi Karthi,
    Bellow you find some example code for custom multifield
    * @class CQ.wcm.QuestionsBlock
    * @extends CQ.form.CompositeField
    * The filter rule field lets the user select "include" or "exclude" and enter a regexp
    * @constructor
    * Creates a new QuestionsBlock.
    * @param {Object} config The config object
    CQ.wcm.QuestionsBlock = CQ.Ext.extend(CQ.form.CompositeField, {
         * @private
         * @type CQ.Ext.form.TextField
        hiddenField: null,
         * @private
         * @type CQ.Ext.form.TextField
        questionsblocktitle: null,
         * @private
         * @type CQ.Ext.form.NumberField
        questionsnumber: null,
        constructor: function(config) {
            var formCfg = {"trackLabels":true,"type":"form"};
            config = config || { };
            var defaults = {
                    "border": true,
                    "layout":  formCfg,
                    "padding": "7px",
                    "stateful": false,
                    "autoWidth": true,
                    "align": "left"
            config = CQ.Util.applyDefaults(config, defaults);
            CQ.wcm.QuestionsBlock.superclass.constructor.call(this, config);
        // overriding CQ.Ext.Component#initComponent
        initComponent: function() {
            CQ.wcm.QuestionsBlock.superclass.initComponent.call(this);
            this.hiddenField = new CQ.Ext.form.Hidden({
                "name": this.name,
                "stateful": false
            this.add(this.hiddenField);
            this.questionsblocktitle= new CQ.Ext.form.TextField({
                "fieldLabel": "Question Block Title",
                "allowBlank":false,
                "stateful": false,
                "mode": 'local',
                "name": 'questionsblocktitle',
                "width": '230px',
                'labelStyle': 'width:120px;'
            this.add(this.questionsblocktitle);
            this.questionsnumber= new CQ.Ext.form.NumberField({
                "fieldLabel": "Question Number",
                "stateful": false,
                "allowBlank":false,
                "mode": 'local',
                "name": 'questionsnumber',
                'labelStyle': 'width:120px;',
                "width": '230px'
            this.add(this.questionsnumber);
        // overriding CQ.form.CompositeField#setValue
        setValue: function(value) {
            var vArray = value.split(";");
            this.questionsblocktitle.setValue(vArray[0]);
            this.questionsnumber.setValue(vArray[1]);
        // overriding CQ.form.CompositeField#getValue
        getValue: function() {
            return this.getRawValue();
        // overriding CQ.form.CompositeField#getRawValue
        getRawValue: function() {
            var questionsblocktitle= this.questionsblocktitle.getValue();
            var questionsnumber= this.questionsnumber.getValue();
            var value = questionsblocktitle+ ";" + questionsnumber;
            this.hiddenField.setValue(value);
            return value;
         * Loads the options of the selection if an optionsProvider is available.
         * This method is usually called solely by {@link CQ.Dialog} after its
         * content has been loaded.
         * @param {String} path content path (optional)
         * @private
        processPath: function(path) {
            var dialogPath = this.findParentByType("dialog").path;
            this.doLayout();
    // register xtype
    CQ.Ext.reg('questionsblock', CQ.wcm.QuestionsBlock);
    Regards,
    kasq

  • Ultra heavy DB access (INSERTS)

    Well, I knew this day would come... I have an application that I originaly wrote in PHP, that writes to a MySQL DB every time an advertisment gets an impression. Using the Zend optimizer I have managed to keep up with demand fairly well. However the day of reconong is upon me so to speak and Im thinking about redevloping that part of the app in Java... Dose any one have any sugestions that would help the application stand up to 20 million+ updates per day? Its handling around 6 mill now and running on a dedicated intell based Linux dist.

    Thanks, atehrani_java
    actually I have thought about using a flat file as a "go between" for the data. But with so much simultaneous access I was worried about issues with locking. also I'm not sure that it would be faster to 1. open read/write access to the file go through it line by line till I find the record I'm looking for then increment that value by one. I have also thought about using files that contained a single line and using a regexp to locate the data for the update, but that's just to ugly :) the other option is loading the table into memory on the server ( like the old RAM drives :) that's a lot faster but I loose the data if a reboot occurs so I will have to import every hour... that's where I'm leaning right now.
    I'm using the Resin JDBC driver and TomCat/Jakarta ( I'm not sure if Jakarta is good for this volume, any input? )
    Thanks again.
    Richard Corsale

  • Transfering to laptop (machine-independent replication)

    Is it possible, without a reinstall, to merely transfer the install from a desktop to a laptop?
    For example, transfering an installed, configured and customized MOSXS (Mac OS X Server) 10.3 from a G4 350 to a much more powerful Macbook or Dual G5?
    The alternative of reinstalling, then reconfiguring, then repopulating with content and user's data, simply seems ridicilous!
    Essentially the concept of machine-independent replication.

    I disagree with the naive part. While there are aspects that may be hard-coded to specific IP addresses, basic regexp can update every IP dependecy in an entire system with proper system administration methodologies. Thus if a firewall rule, IP-based virtual host, a hosts file, a round-robin DNS setup, and an smtp junk table all refer to a given IP, they can all be replaced with a variable and/or a regexp tool at the time of migration.
    In fact, it makes little sense to edit each individual file manually with an IP address - makes far more sense to simply utilise a system-wide IP address tool that updates all the variables on the administrator's behalf.
    I think it silly, naive, and a waste of time, to hard-code manually IP addresses, such they can change, should change, and are rarely in control of a given organization to whom they may be allocated to - and far too often are upstream dependant. Unless you own your own /8, in that case, please hire me!

  • Cfdocument problem with textarea linebreaks

    Hi,
    I am using cfdocument to generate pdf. There are some
    <textarea> input type fields as well, and if the data of
    those textarea fields contains any linebreaks, then the generated
    pdf shows empty boxes.
    Any help is appriciated. I am using CF 8.1.31

    before you use the textarea's value in cfdocument, replace
    all CR & LF
    characters with <br />.
    there are couple of cf functions you can use to do it:
    replace(somestring, chr(10) & chr(13), "<br />",
    "all")
    rereplace(somestring, "\r\n", "<br />", "all")
    listchangedelims(somestring, "<br />", chr(10) &
    chr(13))
    [cf representation of CR and LF chars is chr(10) and chr(13);
    \r and \n
    are regexp character classes for CR and LF]
    hth
    Azadi Saryev
    Sabai-dee.com
    http://www.sabai-dee.com/

Maybe you are looking for