Ternary Operator Question (with regex).

Hi, I was learning regex in java and wrote a program which tests a string to see if it is an email address.
import javax.swing.*;
public class IsEmailAddress
     public static void main(String[] args)
          String address = JOptionPane.showInputDialog("Enter an email address");
          if(address.matches("[a-zA-Z0-9\\.]+@\\w+\\.{1}\\w+"))
               JOptionPane.showMessageDialog(null, "It is an email address");
          else
               JOptionPane.showMessageDialog(null, "It is not an email address");
}The above program works correctly. But then I decided to try and make the program only one line inside the main:
import javax.swing.*;
public class IsEmailAddress
     public static void main(String[] args)
          JOptionPane.showInputDialog("Enter an email address").matches("[a-zA-Z0-9\\.]+@\\w+\\.{1}\\w+") ? JOptionPane.showMessageDialog(null, "It is an email address") : JOptionPane.showMessageDialog(null, "It is not an email address");
}I get the compilation error not a statement, what am I doing wrong? Is this even possible?
Thanks for any help

I would never use a piece of code like that as part of a bigger program, I wanted to see if it was possible and maybe to learn something about the ternary operator.
Keeping in mind what you said about the ternary operator having to return something, I was able to make it work:
import javax.swing.*;
public class IsEmailAddress
     public static void main(String[] args)
          int a = JOptionPane.showInputDialog("Enter an email address").matches("[a-zA-Z0-9\\.]+@\\w+\\.{1}\\w+") ? JOptionPane.showOptionDialog(null, "It is an email address","Is it an email Adress?",JOptionPane.CANCEL_OPTION,JOptionPane.PLAIN_MESSAGE,null,null,null) : JOptionPane.showOptionDialog(null, "It is not an email address","Is it an email Adress?",JOptionPane.CANCEL_OPTION,JOptionPane.PLAIN_MESSAGE,null,null,null);
}I chose showOptionDialog because it returns a static int.
Thank you for your help!!!

Similar Messages

  • 9.0 JSP EL Compliance (ternary operator problem)

    I've run into a problem porting an application from Tomcat 5.5 to WL 9 that I haven't been able to find any references to in any of the standard haunts. The problem is in reference to the handling of the arguments to the ternary operator that is part of the JSP 2.0 EL spec. Here is a dumbed down example of the problem that I am running into:
              ---------- START SAMPLE JSP -----------
              <%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
              <%
              pageContext.setAttribute("fookmi", "fookmi");
              pageContext.setAttribute("fooku", "fooku");
              %>
              <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
              <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
              <html>
              <head>
              <title>My JSP 'forEachTest.jsp' starting page</title>
              </head>
              <body>
                   <c:out value="${fooku}"/>
                   <c:out value="${fookmi}"/>
                   <c:out value="${(true) ? 'fooku' : 'fookmi'}"/>
                   <c:out value="${(true) ? fooku : fookmi}"/>
              </body>
              </html>
              ---------- END SAMPLE JSP -----------
              Paying close attention to the last 2 c:out tags. (Note: I use c:out in the example but the results are the same regardless of the tag context, i've got examples in forEach and others)
              The server will not be able to compile the given jsp page and will error with the following:
              ----------------- BEGIN ERROR --------------
              forEachTest.jsp:19:15: No match was found for method setValue() in type org.apache.taglibs.standard.tag.rt.core.OutTag.
                   <c:out value="${(true) ? fooku : fookmi}"/>
              ^--------------------------^
              ----------------- END ERROR ---------------
              So if we take a look at the java source being rendered by the compiler you will see the following (extraneous info clipped).
              -------------- START FIRST COUT -----------
              if (__tag0== null )__tag0 = new org.apache.taglibs.standard.tag.rt.core.OutTag ();
              __tag0.setPageContext(pageContext);
              __tag0.setParent( null );
              __tag0.setValue(( java.lang.Object ) javelin.jsp.el.ExpressionEvaluatorImpl.evaluate("${fooku}",java.lang.Object.class,pageContext,_jspx_fnmap));
              activeTag=_tag0;
              __result__tag0 = __tag0.doStartTag();
              -------------- END FIRST COUT -----------
              -------------- START SECOND COUT -----------
              if (__tag1== null )__tag1 = new org.apache.taglibs.standard.tag.rt.core.OutTag ();
              __tag1.setPageContext(pageContext);
              __tag1.setParent( null );
              __tag1.setValue(( java.lang.Object ) javelin.jsp.el.ExpressionEvaluatorImpl.evaluate("${fookmi}",java.lang.Object.class,pageContext,_jspx_fnmap));
              activeTag=_tag1;
              __result__tag1 = __tag1.doStartTag();
              -------------- END SECOND COUT -----------
              -------------- START THIRD COUT -----------
              if (__tag2== null )__tag2 = new org.apache.taglibs.standard.tag.rt.core.OutTag ();
              __tag2.setPageContext(pageContext);
              __tag2.setParent( null );
              __tag2.setValue(( java.lang.Object ) javelin.jsp.el.ExpressionEvaluatorImpl.evaluate("${(true) ? \'fooku\' : \'fookmi\'}",java.lang.Object.class,pageContext,_jspx_fnmap));
              activeTag=_tag2;
              __result__tag2 = __tag2.doStartTag();
              -------------- END THIRD COUT -----------
              -------------- START FOURTH COUT -----------
              if (__tag3== null )__tag3 = new org.apache.taglibs.standard.tag.rt.core.OutTag ();
              __tag3.setPageContext(pageContext);
              __tag3.setParent( null );
              __tag3.setValue();
              activeTag=_tag3;
              __result__tag3 = __tag3.doStartTag();
              -------------- END FOURTH COUT -----------
              Notice that in the last c:out the __tag3.setValue() call does not provide any parameters and thus the compilation error we saw reported.
              My question is, am I doing something wrong here or is this possibly a bug in the WL 9 2.0 EL support?
              Final Note: This construct works fine in Tomcat 5.5.

    TÃtulo: Quer mudar sua vida??Leia com atenção!
              Autor: LUIZ
              Data: 19/11/2005
              Cidade: Boa Vista
              Estado: RR
              PaÃs: Brasil
              COMO ACABAR COM A DIFICULDADE FINANCEIRA
              ACABE COM A DIFICULDADE FINANCEIRA
              GANHE MUITO DINHEIRO COM APENAS 6 REAIS
              HONESTIDADE, INTELIGENCIA E EFICÁCIA
              POR FAVOR, LEIA COM BASTANTE ATENÇÃO, VALE A PENA!
              COMO TRANSFORMAR 6 (SEIS) REAIS EM NO MINIMO 6.000(SEIS MIL REAIS) !! : VOCÊ É CAPAZ, APENAS FAÇA FUNCIONAR.!
              Eu achei uma mensagem sobre esse assunto e não dei muita atenção por ser um texto muito longo e parecer ser presente de papai Noel, más resolvi arriscar e deu certo. Vou tentar resumir para que vc tbm não ache esse texto cansativo e se quiser mais informções mande-me um e-mail – [email protected].
              Funciona assim:
              PASSO 1: Separe 6 meias folhas de papel e escreva em cada uma, o seguinte bilhete: " POR FAVOR, PONHA-ME EM SUA LISTA DE REMETENTES" colocando seu nome e endereço logo abaixo. Agora adquira 6 notas de R$ 1,00 e envolva cada uma em um dos bilhetes que você acabou de escrever. Em seguida, envolva cada um deles novamente com um papel escuro, para evitar que alguém veja a nota e viole o envelope, roubando o dinheiro. Então coloque cada um dentro de um envelope e lacre. A lista abaixo contém 6 nomes com endereços e você tem 6 envelopes lacrados. Você deve REMETER PELO CORREIO, um envelope para cada um dos nomes da lista. Faça isto, anotando corretamente o nome e o endereço nos envelopes, depositando em seguida no correio. A lista se encontra no final desse texto : PASSO 2: Elimine o primeiro nome da lista (#1). Reordene a lista de 1 a 5, ou seja (2 torna-se 1), (3 torna-se 2), etc.. Coloque o SEU nome e endereço como o 6º(sexto) da lista. :
              PASSO 3: Após feitas as alterações acima, coloque este artigo em pelo menos 200 fóruns e newsgroups.Você pode modificar o texto deste artigo, mas por favor, mantenha a integridade da mensagem. Isto é importante. LEMBRE-SE, quanto mais mensagens nos fóruns, newsgroups e livros de visitas você colocar, mais dinheiro você ganhará!
              O retorno será melhor se você colocar um bom tÃtulo ( ou esse mesmo), que fique visÃvel para todos.
              Agora, coloque o artigo modificado (ou esse mesmo).Existem milhares de fóruns e newsgroups. Você só precisa de 200. Então mãos à obra, LEMBRE-SE Toda vez que alguém agir como você, salvando esta mensagem, seguindo e executando corretamente todas as instruções, 6 pessoas estão sendo beneficiadas com R$ 1,00 cada e seu nome subirá na lista. Assim as listas multiplicam-se rapidamente e seu nome vai subindo até atingir a primeira posição. Desta forma quando seu nome alcançar a #1 posição, você já terá recebido milhares de reais em DINHEIRO VIVO! Lembre-se que você só investiu R$6.00. Envie agora os envelopes, suba o nome dos participantes da lista e adicione seu próprio nome na sexta posição da lista, poste-a nos fóruns e você está no negócio!
              COMO POSTAR NOS NEWSGROUPS --------
              Etapa 1) Copie e salve este artigo em seu editor de texto. (selecione o texto, clique em Editar e Copiar, abra seu editor de texto e clique em Editar e Colar, depois clique em Arquivo e Salvar como .txt) Etapa 2) Faça as devidas alterações neste artigo, incluindo seu nome na sexta posição da lista. Etapa 3) Salve novamente o arquivo. Clique em Editar e Selecionar tudo. Clique novamente em Editar e Copiar. Etapa 4) Abra seu navegador, Netscape, Internet Explorer ou algum outro qualquer e procure vários newsgroups (fóruns on-line, cadernos de mensagens, locais de conversa, discussões) e poste uma mensagem nova em cada MURAL ou ÁREA, ou algo similar. Etapa 5) Para postar entre nesses newsgroups. No campo destinado para digitar o texto ou mensagem a ser enviada para o newsgroups, clique com o botão direito do mouse. Em seguida clique em Colar. Como Assunto ou tÃtulo, digite um nome que chame a atenção, como o meu, ou invente algo parecido. Clique em enviar e pronto, você acabou de enviar sua primeira mensagem! Parabéns...Etapa 6) Selecione outro newsgroups e repita o passo 5. Faça isso no mÃnimo para 200 newsgroups. **QUANTO MAIS MENSAGENS VOCÊ ENVIAR AOS NEWSGROUPS MAIS CHANCES VOCÊ TERÁ DE GANHAR MAIS DINHEIRO ** Pronto! Você logo começará a receber dinheiro pelo correio. Se você deseja ficar anônimo, você pode inventar um nome para usar na lista, contanto que o endereço esteja certo para que você receba o dinheiro. **CONFIRA SEU ENDEREÇO!!!.
              ------- PORQUE RENDE TANTO DINHEIRO --------
              Agora vamos ver POR QUE rende tanto dinheiro: Fazendo uma análise bastante pessimista, vamos supor que de cada 200 mensagens, apenas 5 dêem retorno. Assim das minhas 200 mensagens, receberei apenas R$5,00 referentes ao meu nome na #6 posição. Agora, cada uma das 5 pessoas que me enviaram R$1.00 postaram mais 200 mensagens cada uma. Se apenas 5 de cada 200 retornarem, receberei R$ 25,00 referentes ao meu nome na #5 posição. Agora, cada uma das 25 pessoas que me enviaram R$1.00 postaram mais 200 mensagens cada uma. Se apenas 5 de cada 200 retornarem, receberei R$ 125,00 referentes ao meu nome na #4 posição. LEMBRE-SE ! Estamos considerando um exemplo extremamente fraco. Agora, cada uma das 125 pessoas que me enviaram R$1.00 postaram mais 200 mensagens cada uma. Se apenas 5 de cada 200 retornarem, receberei R$ 625,00 referentes ao meu nome na #3 posição. Agora, cada uma das 625 pessoas que me enviaram R$1.00 postaram mais 200 mensagens cada uma. Se apenas 5 de cada 200 retornarem, receberei então R$ 3.125,00 referentes ao meu nome na #2 posição. Agora, cada uma das pessoas que me enviaram R$1.00 postaram mais 200 mensagens cada uma. Se apenas 5 de cada 200 retornarem, receberei nesta última fase R$ 15.625,00 referentes ao meu nome na #1 posição. INCRÍVEL! Com um investimento original de apenas R$6,00, cria-se uma oportunidade gigantesca. Estima-se que entre 20.000 e 50.000 novas pessoas se juntem à Internet todos os dias e vão para os chats e fóruns. "O que são seis reais para tentar uma chance milionária que pode dar certo?" As chances são grandes quando milhões de pessoas honestas como você estão se juntando a esse grupo?? Lembre-se, a HONESTIDADE faz parte deste jogo. MANDE UM DÓLAR AO INVÉS DE UM REAL PARA OS ESTRANGEIROS .
              IMPORTANTE: O envio das cartas contendo o bilhete e R$1,00, é que torna honesto e prospero o sistema, assim o sistema sobrevive, pois tudo que é desonesto, mais cedo ou mais tarde, fracassa certamente.
              NÓS SOMOS RICOS, NÓS SOMOS PROSPEROS, NÓS ESTAMOS CHEIOS DE SAÚDE E HARMONIA.
              **** SE VC DESEJA PARTICIPAR DESSA CORRENTE DE SOLIDARIEDADE E AO MESMO TEMPO FICAR RICO, MANDE (1 REAL) PARA CARA UM DOS NOMES ABAIXO******
              ENDEREÇOS DAS PESSOAS QUE VC DEVE ENVIAR R$1,00 JUNTO COM O BILHETE:
              1)Luiz Carlos Rodrigues - Av. Dr. Nilo Peçanha,252 - Marapé.
              CEP: 11070-050 SANTOS - SP
              2)Renato Pontes Eller - Rua Ranulfo Alves,709 Vila Isa.
              Cep: 35044-220 Governador Valadares - MG
              3)Dalton Sampaio - Rua Senador Máximo, 75 - Centro.
              Cep: 57250-000 Campo Alegre – AL
              4)Samuel Rodrigues P. Junior – Av. Ernani do Amaral Peixoto, 195 Apt 701 - Centro.
              Cep: 24020-071 Niterói - RJ
              5)PatrÃcia A de Barros Silva – Rua Maria Teresa Assunção 479 A –Penha
              CEP:03609.000 –São Paulo-SP
              6) Luiz Faustino – Rua Ágata, 238 – Jóckey Club
              CEP: 69313-108 – Boa Vista - RR
              NÃO PERCA TEMPO COMECE JÁ A ENVIAR SUAS CARTAS E POSTAR!!!QUANTO ANTES MELHOR, MAIS RAPIDO COMECARA A RECEBER AS SUAS CARTAS!!!!

  • Find Replace from Textfile with regex

    Hello.
    I'm wondering if anyone knows about an existing script that does a find/replace by list like the script "FindChangeByList.jsx" that comes with every InDesign installation.
    This consists of tow parts, the script itself with the functionality and a simple textfile where you have simple one-liners capable of find/replace with regex.
    the Textfile:
    //FindChangeList.txt
    //A support file for the InDesign CS4 JavaScript FindChangeByList.jsx
    //This data file is tab-delimited, with carriage returns separating records.
    //The format of each record in the file is:
    //findType<tab>findProperties<tab>changeProperties<tab>findChangeOptions<tab>description
    //Where:
    //<tab> is a tab character
    //findType is "text", "grep", or "glyph" (this sets the type of find/change operation to use).
    //findProperties is a properties record (as text) of the find preferences.
    //changeProperties is a properties record (as text) of the change preferences.
    //findChangeOptions is a properties record (as text) of the find/change options.
    //description is a description of the find/change operation
    //Very simple example:
    //text          {findWhat:"--"}          {changeTo:"^_"}          {includeFootnotes:true, includeMasterPages:true, includeHiddenLayers:true, wholeWord:false}          Find all double dashes and replace with an em dash.
    //More complex example:
    //text          {findWhat:"^9^9.^9^9"}          {appliedCharacterStyle:"price"}          {include footnotes:true, include master pages:true, include hidden layers:true, whole word:false}          Find $10.00 to $99.99 and apply the character style "price".
    //All InDesign search metacharacters are allowed in the "findWhat" and "changeTo" properties for findTextPreferences and changeTextPreferences.
    //If you enter backslashes in the findWhat property of the findGrepPreferences object, they must be "escaped"
    //as shown in the example below:
    //{findWhat:"\\s+"}
    grep          {findWhat:"  +"}          {changeTo:" "}          {includeFootnotes:true, includeMasterPages:true, includeHiddenLayers:true, wholeWord:false}          Find all double spaces and replace with single spaces.
    grep          {findWhat:"\r "}          {changeTo:"\r"}          {includeFootnotes:true, includeMasterPages:true, includeHiddenLayers:true, wholeWord:false}          Find all returns followed by a space And replace with single returns.
    grep          {findWhat:" \r"}          {changeTo:"\r"}          {includeFootnotes:true, includeMasterPages:true, includeHiddenLayers:true, wholeWord:false}          Find all returns followed by a space and replace with single returns.
    grep          {findWhat:"\t\t+"}          {changeTo:"\t"}          {includeFootnotes:true, includeMasterPages:true, includeHiddenLayers:true, wholeWord:false}          Find all double tab characters and replace with single tab characters.
    grep          {findWhat:"\r\t"}          {changeTo:"\r"}          {includeFootnotes:true, includeMasterPages:true, includeHiddenLayers:true, wholeWord:false}          Find all returns followed by a tab character and replace with single returns.
    grep          {findWhat:"\t\r"}          {changeTo:"\r"}          {includeFootnotes:true, includeMasterPages:true, includeHiddenLayers:true, wholeWord:false}          Find all returns followed by a tab character and replace with single returns.
    grep          {findWhat:"\r\r+"}          {changeTo:"\r"}          {includeFootnotes:true, includeMasterPages:true, includeHiddenLayers:true, wholeWord:false}          Find all double returns and replace with single returns.
    text          {findWhat:" - "}          {changeTo:"^="}          {includeFootnotes:true, includeMasterPages:true, includeHiddenLayers:true, wholeWord:false}          Find all space-dash-space and replace with an en dash.
    text          {findWhat:"--"}          {changeTo:"^_"}          {includeFootnotes:true, includeMasterPages:true, includeHiddenLayers:true, wholeWord:false}          Find all dash-dash and replace with an em dash.
    The script:
    //FindChangeByList.jsx
    //An InDesign CS5.5 JavaScript
    @@@BUILDINFO@@@ "FindChangeByList.jsx" 3.0.0 15 December 2009
    //Loads a series of tab-delimited strings from a text file, then performs a series
    //of find/change operations based on the strings read from the file.
    //The data file is tab-delimited, with carriage returns separating records.
    //The format of each record in the file is:
    //findType<tab>findProperties<tab>changeProperties<tab>findChangeOptions<tab>description
    //Where:
    //<tab> is a tab character
    //findType is "text", "grep", or "glyph" (this sets the type of find/change operation to use).
    //findProperties is a properties record (as text) of the find preferences.
    //changeProperties is a properties record (as text) of the change preferences.
    //findChangeOptions is a properties record (as text) of the find/change options.
    //description is a description of the find/change operation
    //Very simple example:
    //text          {findWhat:"--"}          {changeTo:"^_"}          {includeFootnotes:true, includeMasterPages:true, includeHiddenLayers:true, wholeWord:false}          Find all double dashes and replace with an em dash.
    //More complex example:
    //text          {findWhat:"^9^9.^9^9"}          {appliedCharacterStyle:"price"}          {include footnotes:true, include master pages:true, include hidden layers:true, whole word:false}          Find $10.00 to $99.99 and apply the character style "price".
    //All InDesign search metacharacters are allowed in the "findWhat" and "changeTo" properties for findTextPreferences and changeTextPreferences.
    //If you enter backslashes in the findWhat property of the findGrepPreferences object, they must be "escaped"
    //as shown in the example below:
    //{findWhat:"\\s+"}
    //For more on InDesign scripting, go to http://www.adobe.com/products/indesign/scripting/index.html
    //or visit the InDesign Scripting User to User forum at http://www.adobeforums.com
    main();
    function main(){
              var myObject;
              //Make certain that user interaction (display of dialogs, etc.) is turned on.
              app.scriptPreferences.userInteractionLevel = UserInteractionLevels.interactWithAll;
              if(app.documents.length > 0){
                        if(app.selection.length > 0){
                                  switch(app.selection[0].constructor.name){
                                            case "InsertionPoint":
                                            case "Character":
                                            case "Word":
                                            case "TextStyleRange":
                                            case "Line":
                                            case "Paragraph":
                                            case "TextColumn":
                                            case "Text":
                                            case "Cell":
                                            case "Column":
                                            case "Row":
                                            case "Table":
                                                      myDisplayDialog();
                                                      break;
                                            default:
                                                      //Something was selected, but it wasn't a text object, so search the document.
                                                      myFindChangeByList(app.documents.item(0));
                        else{
                                  //Nothing was selected, so simply search the document.
                                  myFindChangeByList(app.documents.item(0));
              else{
                        alert("No documents are open. Please open a document and try again.");
    function myDisplayDialog(){
              var myObject;
              var myDialog = app.dialogs.add({name:"FindChangeByList"});
              with(myDialog.dialogColumns.add()){
                        with(dialogRows.add()){
                                  with(dialogColumns.add()){
                                            staticTexts.add({staticLabel:"Search Range:"});
                                  var myRangeButtons = radiobuttonGroups.add();
                                  with(myRangeButtons){
                                            radiobuttonControls.add({staticLabel:"Document", checkedState:true});
                                            radiobuttonControls.add({staticLabel:"Selected Story"});
                                            if(app.selection[0].contents != ""){
                                                      radiobuttonControls.add({staticLabel:"Selection", checkedState:true});
              var myResult = myDialog.show();
              if(myResult == true){
                        switch(myRangeButtons.selectedButton){
                                  case 0:
                                            myObject = app.documents.item(0);
                                            break;
                                  case 1:
                                            myObject = app.selection[0].parentStory;
                                            break;
                                  case 2:
                                            myObject = app.selection[0];
                                            break;
                        myDialog.destroy();
                        myFindChangeByList(myObject);
              else{
                        myDialog.destroy();
    function myFindChangeByList(myObject){
              var myScriptFileName, myFindChangeFile, myFindChangeFileName, myScriptFile, myResult;
              var myFindChangeArray, myFindPreferences, myChangePreferences, myFindLimit, myStory;
              var myStartCharacter, myEndCharacter;
              var myFindChangeFile = myFindFile("/FindChangeSupport/FindChangeList.txt")
              if(myFindChangeFile != null){
                        myFindChangeFile = File(myFindChangeFile);
                        var myResult = myFindChangeFile.open("r", undefined, undefined);
                        if(myResult == true){
                                  //Loop through the find/change operations.
                                  do{
                                            myLine = myFindChangeFile.readln();
                                            //Ignore comment lines and blank lines.
                                            if((myLine.substring(0,4)=="text")||(myLine.substring(0,4)=="grep")|| (myLine.substring(0,5)=="glyph")){
                                                      myFindChangeArray = myLine.split("\t");
                                                      //The first field in the line is the findType string.
                                                      myFindType = myFindChangeArray[0];
                                                      //The second field in the line is the FindPreferences string.
                                                      myFindPreferences = myFindChangeArray[1];
                                                      //The second field in the line is the ChangePreferences string.
                                                      myChangePreferences = myFindChangeArray[2];
                                                      //The fourth field is the range--used only by text find/change.
                                                      myFindChangeOptions = myFindChangeArray[3];
                                                      switch(myFindType){
                                                                case "text":
                                                                          myFindText(myObject, myFindPreferences, myChangePreferences, myFindChangeOptions);
                                                                          break;
                                                                case "grep":
                                                                          myFindGrep(myObject, myFindPreferences, myChangePreferences, myFindChangeOptions);
                                                                          break;
                                                                case "glyph":
                                                                          myFindGlyph(myObject, myFindPreferences, myChangePreferences, myFindChangeOptions);
                                                                          break;
                                  } while(myFindChangeFile.eof == false);
                                  myFindChangeFile.close();
    function myFindText(myObject, myFindPreferences, myChangePreferences, myFindChangeOptions){
              //Reset the find/change preferences before each search.
              app.changeTextPreferences = NothingEnum.nothing;
              app.findTextPreferences = NothingEnum.nothing;
              var myString = "app.findTextPreferences.properties = "+ myFindPreferences + ";";
              myString += "app.changeTextPreferences.properties = " + myChangePreferences + ";";
              myString += "app.findChangeTextOptions.properties = " + myFindChangeOptions + ";";
              app.doScript(myString, ScriptLanguage.javascript);
              myFoundItems = myObject.changeText();
              //Reset the find/change preferences after each search.
              app.changeTextPreferences = NothingEnum.nothing;
              app.findTextPreferences = NothingEnum.nothing;
    function myFindGrep(myObject, myFindPreferences, myChangePreferences, myFindChangeOptions){
              //Reset the find/change grep preferences before each search.
              app.changeGrepPreferences = NothingEnum.nothing;
              app.findGrepPreferences = NothingEnum.nothing;
              var myString = "app.findGrepPreferences.properties = "+ myFindPreferences + ";";
              myString += "app.changeGrepPreferences.properties = " + myChangePreferences + ";";
              myString += "app.findChangeGrepOptions.properties = " + myFindChangeOptions + ";";
              app.doScript(myString, ScriptLanguage.javascript);
              var myFoundItems = myObject.changeGrep();
              //Reset the find/change grep preferences after each search.
              app.changeGrepPreferences = NothingEnum.nothing;
              app.findGrepPreferences = NothingEnum.nothing;
    function myFindGlyph(myObject, myFindPreferences, myChangePreferences, myFindChangeOptions){
              //Reset the find/change glyph preferences before each search.
              app.changeGlyphPreferences = NothingEnum.nothing;
              app.findGlyphPreferences = NothingEnum.nothing;
              var myString = "app.findGlyphPreferences.properties = "+ myFindPreferences + ";";
              myString += "app.changeGlyphPreferences.properties = " + myChangePreferences + ";";
              myString += "app.findChangeGlyphOptions.properties = " + myFindChangeOptions + ";";
              app.doScript(myString, ScriptLanguage.javascript);
              var myFoundItems = myObject.changeGlyph();
              //Reset the find/change glyph preferences after each search.
              app.changeGlyphPreferences = NothingEnum.nothing;
              app.findGlyphPreferences = NothingEnum.nothing;
    function myFindFile(myFilePath){
              var myScriptFile = myGetScriptPath();
              var myScriptFile = File(myScriptFile);
              var myScriptFolder = myScriptFile.path;
              myFilePath = myScriptFolder + myFilePath;
              if(File(myFilePath).exists == false){
                        //Display a dialog.
                        myFilePath = File.openDialog("Choose the file containing your find/change list");
              return myFilePath;
    function myGetScriptPath(){
              try{
                        myFile = app.activeScript;
              catch(myError){
                        myFile = myError.fileName;
              return myFile;
    This is a very useful and easy to maintain script which even people who cant write scripts (but know how to use regex) can do complex search replace mass replacements.
    Would love to find something like this for FrameMaker 12 (as i can't write scripts myself).
    regards
    daniel

    I have visited that site. The first item in the external link says: "You can also configure Firefox to automatically search for text when you type any characters outside of a text field. When typing in a text field these characters should show up in the text field and not trigger the Quick Find bar. "
    What I am looking for is the exact opposite. Once my first search is entered in the text box, and the info comes back, I want to start typing the next symbol, and have it automatically show up in the text box, not the Quick Find box. That is how it was working up until a couple of months ago.

  • Conditional operator question?

    Hello,
    Quick question, are we not allowed to use the conditional operator this way... see code below:
    char volatile ProgString_[] = "\
    {Fan code} \
    12 <Limit11> [C1_ACM2]_[B1] _AND_ \
    bla bla \
    unsigned char UPC_SYSZ_EndOfTable(unsigned long i){ // Find the double '*' in string
    char volatile *u;
    u = &ProgString_[i];
    if(!(strncmp("*", u, 1))){
    i++;
    u = &ProgString_[i];
    if(!(strncmp("*", u, 1))){
    return TRUE;
    else {
    return FALSE;
    else
    return FALSE;
    void UPC_SYSZ_Parse(){
    unsigned char volatile iOCntr = 0;
    unsigned long volatile i;
    for(i=0; i<200; i++){
    (UPC_SYSZ_EndOfTable(i))?(break):(continue); //<<<<< Invalid expression ??
    I would of used the following compact line:
    (UPC_SYSZ_EndOfTable(i))?(break):(continue);    //<<<<< Invalid expression ??
    to periodically test the end of the string by fetching the "EndOfTable() function and evaluating if the double star is detected.
    If detected, I would break out of the for loop, if not then I would continue.
    Is it possible to do it this way?
    thanks for all help!
    r

    Think of it along the lines of each of the operands of the ternary operator must produce a value (which of course break and continue being statements cannot do).
    Based on your brief example here is what I would do
    for(i=0; i<200; i++){
    if (UPC_SYSZ_EndOfTable(i)) break;
    // doesn't make any sense to put more code down here anyway, so no real point to continue}

  • Hey, I'm doing some cross browser testing and i want to know Is there any difference between the behavior of Firefox in an operating system 64bit & operating system with 32bit. (like windows7/windows vista...)

    ''duplicate of https://support.mozilla.com/en-US/questions/905881''
    Hey, I'm doing some cross browser testing and i want to know Is there any difference between the behavior of Firefox in an operating system 64bit & operating system with 32bit. (like windows7/windows vista...)

    Hi Kossa,
    You can also check if the issue occurs in
    Clean Boot. If the issue disappears in the Clean Boot environment, you can continue to narrow down which entry is causing the issue.
    Besides, uninstall it and re-download
    a fresh copy of FireFox to check the result. If the issue still exists, create a new user account to see if it occurs.
    If the issue persists, you can contact Mozilla Support directly and use Internet Explorer (IE) during the time.
    J
    Please Note: The third-party product discussed here is manufactured by a company that is independent of Microsoft. We make no warranty, implied or otherwise,
    regarding this product's performance or reliability.
    Regards,
    Linda

  • How do I reset my apple id security question with out a rescue email

    How do I reset my apple id security question with out a rescue email?

    You need to ask Apple to reset your security questions; ways of contacting them include clicking here and picking a method for your country, phoning AppleCare and asking for the Account Security team, and filling out and submitting this form.
    They wouldn't be security questions if they could be bypassed without Apple verifying your identity.
    (101013)

  • Safari, chrome and firefox cannot verify identity of secure websites after upgrading to 10.7.4,  apple engineers have tried multiple things including operating system with no success

    safari, chrome and firefox cannot verify identity of secure websites after upgrading to 10.7.4,  apple engineers have tried multiple things including operating system with no success

    There are several threads about this problem, most notably one called 'Invalid Certificates' is over 4 pages long.  Many of us have experienced difficulty connecting to banking and other secure sites.  On my Macbook Pro, I cannot get to my banking site with any browser, however I can get there on my iMac using Safari, but get the 'Invalid Certificate' notice with FF and Chrome.  The problem started after the installation of 10.7.4.  I have sent a message to Apple--they will be dismayed to hear that I cannot complete an order at their online store!

  • HT1923 I have a Vista Operating system with 2 users.  Somehow I got two different play lists each with one user.  One is too big for the storage and has a vast amount of duplicates.  Can I delete the one that is twice as large and then access the other li

    I have a Vista operating system with 2 users.  Somehow I got two diffent libraries for the users.  How can I delete the one and then access the correct library on the other users profile?

    Use the trackpad to scroll, thats what it was designed for. The scroll bars automatically disappear when not being used and will appear if you scroll up or down using the trackpad.
    This is a user-to-user forum and most people will post on here if they have problems. You very rarely get people posting to say there update went smooth. The fact is the vast majority of Mountain Lion users will not be experiencing any major problems with the OS, or maybe with apps which are not compatible, but thats hardly Apple's fault if developers don't update their apps.

  • Error when deploying EAR file: Operation failed with error: java:/app/jdbc/

    I created application using JDeveloper 11g, and have the deploy file EAR read to deploy to oracle application server 10g, but I am encouting the error of Operation failed with error: java:/app/jdbc/jdbc/HRConnDS not found
    Below is the log. What did i do wrong? I have created the datasource of HRConnDS, and it shows in EM.
    Nov 6, 2009 10:06:12 AM] Application Deployer for hra1 STARTS.
    [Nov 6, 2009 10:06:12 AM] Copy the archive to /u01/OraHome_app1/j2ee/home/applications/hra1.ear
    [Nov 6, 2009 10:06:12 AM] Initialize /u01/OraHome_app1/j2ee/home/applications/hra1.ear begins...
    [Nov 6, 2009 10:06:12 AM] Unpacking hra1.ear
    [Nov 6, 2009 10:06:12 AM] Done unpacking hra1.ear
    [Nov 6, 2009 10:06:12 AM] Unpacking webapp2.war
    [Nov 6, 2009 10:06:12 AM] Done unpacking webapp2.war
    [Nov 6, 2009 10:06:12 AM] Initialize /u01/OraHome_app1/j2ee/home/applications/hra1.ear ends...
    [Nov 6, 2009 10:06:12 AM] Starting application : hra1
    [Nov 6, 2009 10:06:12 AM] Initializing ClassLoader(s)
    [Nov 6, 2009 10:06:12 AM] Initializing EJB container
    [Nov 6, 2009 10:06:12 AM] Loading connector(s)
    [Nov 6, 2009 10:06:12 AM] Starting up resource adapters
    [Nov 6, 2009 10:06:12 AM] application : hra1 is in failed state
    [Nov 6, 2009 10:06:12 AM] Operation failed with error: java:/app/jdbc/jdbc/HRConnDS not found
    Thank you very much for your help.

    How did you create your datasource, can you post the content, without passwords of course.
    Greetings.

  • Basic questions with respect to ABAP WebDynpro Application

    Hi All,
    I have two basic questions with respect to an ABAP WebDynpro application :
    a) If an ABAP WebDynpro application has been developed, how could it be made available to the end user?
    b) Can an ABAP WebDynpro application be developed in ECC or is it only applicable for version 4.6c?
    Thanks & Regards,
    Sushanth Hulkod

    Sushanth Hulkod wrote:
    > a) If an ABAP WebDynpro application has been developed, how could it be made available to the end user?
    >
    > b) Can an ABAP WebDynpro application be developed in ECC or is it only applicable for version 4.6c?
    a) If an ABAP WebDynpro application has been developed, how could it be made available to the end user?
    Answer - By providing direct link of the WD application created in SE80, creating iView for webdynpro abap application in the portal environment and  NWBC environment
    b) Can an ABAP WebDynpro application be developed in ECC or is it only applicable for version 4.6c?
    Answer - Yes it can be developed in ECC. Webdynpro ABAP is introduced in NW 2004s (SAP NetWeaver 7.0 or ECC 6.0)
    Thanks,
    Chandra

  • How to use ternary operator in JSF using EL expression

    how to use ternary operator in JSF using EL expression

    I want to use ternary operator for h:datatable columnclasses attribute like as below
    <h:datatable
    columnClasses="#{booleanExpression ? style1,style2 : style3,style4}"
    />
    But it's not working.Is there any other alternative to do this?

  • I cannot purchase anything at the itunes store because I am being ask for my security questions, but I don't remember them. How do you change you security questions with out knowing them?

    I cannot purchase anything at the itunes store because I am being ask for my security questions, but I don't remember the answers. I tried going to appleied.apple.com but I won't allow me to change my security answerswithout answering the original questions. How do you change you security questions with out knowing them? I need help.

    Welcome to the Apple Community.
    Start here, and reset your security questions, you will receive an email to your rescue address, use the link in the email and reset your security questions.
    If that doesn't help or you don't have a rescue address, you might try contacting Apple through iTunes Store Support

  • [DC2] An net use or LsaPolicy operation failed with error 67 - Moving AD from 2003R2 to Server 2012

    Hello, i hope someone can help me with this tricky situation.
    The plan is to move AD from 2003R2 name "DC" to a server 2012 "DC2"
    I have made all the adjustments and transferred all the role to the new 2012 server, and both are now GC servers.
    The problem is "transferring" the netlogon share.
    in DCDIAg on the new server i get:
    Directory Server Diagnosis
    Performing initial setup:
       Trying to find home server...
       Home Server = DC2
       * Identified AD Forest. 
       Done gathering initial info.
    Doing initial required tests
       Testing server: Default-First-Site-Name\DC2
          Starting test: Connectivity
             ......................... DC2 passed test Connectivity
    Doing primary tests
       Testing server: Default-First-Site-Name\DC2
          Starting test: Advertising
             ......................... DC2 passed test Advertising
          Starting test: FrsEvent
             There are warning or error events within the last 24 hours after the
             SYSVOL has been shared.  Failing SYSVOL replication problems may cause
             Group Policy problems. 
             ......................... DC2 passed test FrsEvent
          Starting test: DFSREvent
             ......................... DC2 passed test DFSREvent
          Starting test: SysVolCheck
             ......................... DC2 passed test SysVolCheck
          Starting test: KccEvent
             ......................... DC2 passed test KccEvent
          Starting test: KnowsOfRoleHolders
             ......................... DC2 passed test KnowsOfRoleHolders
          Starting test: MachineAccount
             ......................... DC2 passed test MachineAccount
          Starting test: NCSecDesc
             ......................... DC2 passed test NCSecDesc
          Starting test: NetLogons
             Unable to connect to the NETLOGON share! (\\DC2\netlogon)
             [DC2] An net use or LsaPolicy operation failed with error 67,
             The network name cannot be found..
             ......................... DC2 failed test NetLogons
          Starting test: ObjectsReplicated
             ......................... DC2 passed test ObjectsReplicated
          Starting test: Replications
             ......................... DC2 passed test Replications
          Starting test: RidManager
             ......................... DC2 passed test RidManager
          Starting test: Services
                NtFrs Service is stopped on [DC2]
             ......................... DC2 failed test Services
          Starting test: SystemLog
             ......................... DC2 passed test SystemLog
          Starting test: VerifyReferences
             ......................... DC2 passed test VerifyReferences
       Running partition tests on : ForestDnsZones
          Starting test: CheckSDRefDom
             ......................... ForestDnsZones passed test CheckSDRefDom
          Starting test: CrossRefValidation
             ......................... ForestDnsZones passed test
             CrossRefValidation
       Running partition tests on : DomainDnsZones
          Starting test: CheckSDRefDom
             ......................... DomainDnsZones passed test CheckSDRefDom
          Starting test: CrossRefValidation
             ......................... DomainDnsZones passed test
             CrossRefValidation
       Running partition tests on : Schema
          Starting test: CheckSDRefDom
             ......................... Schema passed test CheckSDRefDom
          Starting test: CrossRefValidation
             ......................... Schema passed test CrossRefValidation
       Running partition tests on : Configuration
          Starting test: CheckSDRefDom
             ......................... Configuration passed test CheckSDRefDom
          Starting test: CrossRefValidation
             ......................... Configuration passed test CrossRefValidation
       Running partition tests on : dom1
          Starting test: CheckSDRefDom
             ......................... domain passed test CheckSDRefDom
          Starting test: CrossRefValidation
             ......................... domain passed test CrossRefValidation
       Running enterprise tests on : domain.xxxxx.no
          Starting test: LocatorCheck
             ......................... domain.xxxxx.no passed test LocatorCheck
          Starting test: Intersite
             ......................... domain.xxxx.no passed test Intersite
    I have as a last option the burflags issue, i tried this with the option D2, but i think i have done it wrong, because the netlogon share is gone on the old DC. i took a backup of the files and folders before
    i did this. http://support.microsoft.com/kb/290762/en-us But i am a little confused on which server i am going to set the D4 value on now? COuld someone help? Best regards Aksel

    Hello Dirk
    And thank you for your answer, in regards of the KB, do i have to follow the steps regarding:
    Global vs. replica set specific reinitialization
    You can locate the replica set specific
    BurFlags
    registry key by determining the GUID for the replica set that you want to configure. To determine which GUID
    corresponds to which replica set and configure a restore, follow these steps:
    Click Start, and then click Run.
    In the Open box, type cmd and then press ENTER.
    In the Command box, type net stop ntfrs.
    Click Start, and then click Run.
    In the Open box, type regedit and then press ENTER.
    To determine the GUID that represents the replica set that you want to configure, follow these steps:
    Locate the following key in the registry:
    KEY_LOCAL_MACHINE\System\CurrentControlSet\Services\NtFrs\Parameters\Replica Sets
    Below the Replica Sets subkey, there are one or more subkeys that are identified by a GUID. In the left pane, click the GUID, and then in the right
    pane note the Data that is listed for the Replica Set Root value. This file system path will indicate which replica set is represented by this GUID.
    Repeat step 4 for each GUID that is listed below the Replica Sets 
    And so on?
    I have only thos 2 DC's in the network...

  • How do you resets your apple I'd security question with out calling apple

    How do you resets your apple I'd security question with out calling apple

    See Kappy's great User Tips.
    See my User Tip for some help: Some Solutions for Resetting Forgotten Security Questions: Apple Support Communities https://discussions.apple.com/docs/DOC-4551
    Rescue email address and how to reset Apple ID security questions
    http://support.apple.com/kb/HT5312
    Send Apple an email request for help at: Apple - Support - iTunes Store - Contact Us http://www.apple.com/emea/support/itunes/contact.html
    Call Apple Support in your country: Customer Service: Contacting Apple for support and service http://support.apple.com/kb/HE57
     Cheers, Tom

  • ACE HTTP Probe with regex

    ACE HTTP Probe with regex
    Hi,
    I'm trying to setup a HTTP probe with expected string rather then a code (config below). I do a GET for the page then a search for a string in the response however it's not working, as probe appears as failed.
    I've tested the connection to the server by using telneting and then looking at the page displayed to make sure the string I want to match is in the response.
    probe http HTTP-PROBE
    port 43050
    interval 30
    passdetect interval 30
    passdetect count 1
    request method get url /action=help
    open 43050
    expect regex action=help
    Q. Is there anything wrong with this configuration and what I'm trying to achive?
    Thanks,
    Pritesh

    Use "expect status" under probe config. expect regex doesnt work if expect status is not configured.
    expect regex work flawlessly with static pages. It doesnt work all the time with dynamic pages.
    Specially if "content-length" header is missing from Server response.
    Hope it helps
    Syed Iftekhar Ahmed

Maybe you are looking for

  • How to post gr without purchase order fi-mm

    Dear All I need one requirement in integration fi-mm how to configure exces quantity against po quantity po quantity 100 gr 105 while posted gr system gettign error E 147(M8) ACCOUNT DETERMINATION FOR ENTRY 9000. I NEED CONFIGURATION HOW TO DO IT

  • Defining more parameters than a query needs

    Hi. When I run the following code, I get the error "ORA-01036: illegal variable name/number" . The problem is that I currently define more parameters than the query needs. Thats because I don't know how many bind variables the query uses, and I would

  • Deployement of package in sun one web server 6.1

    I m using Sun One Web Server 6.1 but i m facing one problem in deploying my application. I deployed the application but the packages i have written are not found. How to add packages to the application. Can anybody tell me. Thanks.

  • Mass PO price change

    Hi, I want to change price of a number of PO's. In mass maintenence T Code:  MEMASSPO, net price NETPR is not available. Any other ways to change price of a number PO's Thanks NDS

  • Android ics 4.0 xperia

    hey people all i can say about this whole deel with verizon holding back this updateit is just stupiid they had better put ics on xperia sony has stated that ics willl be out by the end of march