Understanding Regex replace method call involving delegate

Hello,
I am trying to understand the $regex.replace static method call below (I came across this code snippet in the cookbook).
$replacer = {
param($match)
$chars = $match.Groups[0].Value.ToCharArray()
[Array]::Reverse($chars)
$chars -join ''
$regex = [Regex] "\w+"
$regex.Replace("Hello World wide", $replacer)
What I do not understand is the below overloaded definitions for replace method do not seem to match the above replace call. So how exactly is this working? The above call has 2 parameters passed where as none of the below overloads have less than
3 parameters.
PS C:\WINDOWS> [regex]::replace
OverloadDefinitions
static string Replace(string input, string pattern, string replacement)
static string Replace(string input, string pattern, string replacement, System.Text.RegularExpressions.RegexOptions options)
static string Replace(string input, string pattern, string replacement, System.Text.RegularExpressions.RegexOptions options, timespan matchTimeout)
static string Replace(string input, string pattern, System.Text.RegularExpressions.MatchEvaluator evaluator)
static string Replace(string input, string pattern, System.Text.RegularExpressions.MatchEvaluator evaluator, System.Text.RegularExpressions.RegexOptions options)
static string Replace(string input, string pattern, System.Text.RegularExpressions.MatchEvaluator evaluator, System.Text.RegularExpressions.RegexOptions options, timespan
matchTimeout)

What you are looking at are the static methods ([regex]::) and their appropriate parameters which in this case have a minimum of 3 parameters to properly perform the Replace using the input, pattern and replacement
value. If you were to use the constructor of [regex] to create a pattern like this:
$Regex = [regex]'\w'
You will see that the Replace method here allows for only 2 parameters because you have already satisfied the pattern when you created the Regex object.
$Regex.Replace
OverloadDefinitions
string Replace(string input, string replacement)
string Replace(string input, string replacement, int count)
string Replace(string input, string replacement, int count, int startat)
string Replace(string input, System.Text.RegularExpressions.MatchEvaluator evaluator)
string Replace(string input, System.Text.RegularExpressions.MatchEvaluator evaluator, int count)
string Replace(string input, System.Text.RegularExpressions.MatchEvaluator evaluator, int count, int startat)
Boe Prox
Blog |
Twitter
PoshWSUS |
PoshPAIG | PoshChat |
PoshEventUI
PowerShell Deep Dives Book

Similar Messages

  • RegEx replacement

    I'm trying to make a small parsing engine that does the following:
    1. reads an HTML document
    2. searches for special tags of the form [key]
    3. looks up the key in a hashmap or something
    4. replaces [key] with value from the hashmap
    I'm storing the HTML document line by line as strings in an ArrayList (any better way to do this?). I iterate through each line, replacing each tag with its corresponding value. The thing is, however, that I'd like to use RegEx as much as possible.
    The java.lang.String.matches(String regex) method tells me, through a boolean return value, whether the current line actually contains any tag at all , while the java.lang.String.replaceFirst(String regex, String replacement) method solves the replacement part. What the String class methods don't provide me with is a method for returning the actual substring that was found during the java.lang.String.matches(String regex) call. Is there any such method out there? Right now I'm doing this manually, using the String class' indexOf(...) and lastIndexOf(..) methods.
    In short, what I'm looking for is a method something like String find(String text, String regex) that would return "salary" when called as find("<h1>[salary]</h1>", ".*\\[.*\\].*")
    Thanks for your help!

    You must use Patterns and Matchers (java.util.regex.*).
    In short, what I'm looking for is a method something like String find(String text, String >regex) that would return "salary" when called as find("<h1>[salary]</h1>", ".*\\[.*\\].*")Let's
    String html
    be your input.
    Pattern p = Pattern.compile("(?im)<h1>(.*?)</h1>");
    Matcher m = p.matcher(html);
    if( m.find() ){
    // the whole matching substring is in m.group();
    // the string within the h1's is in m.group(1)
    }

  • Null reference method call behaving oddly

    Hi all, and a very happy new year!!
    My question concerns the null reference; simply, why does the following code chooses to call any other method than the Object version (try it out). No matter what type i choose to replace the current String version with... I have not paid much thought to this, but i would have guessed the null reference calls the Object version in such a situation.
    If i leave only the Object method and comment out all others, the code compiles fine and calls the Object version at runtime - but in case there are sub class versions, those will be called. WHY?
    (im running jre 1.4.1).
    The code:
    public class NullTest {
         public void method(Object o) {
              System.out.println("Object Version");
         public void method(String s) {
              System.out.println("String Version");
         public static void main(String args[]) {
    NullTest nullTest = new NullTest();
              nullTest.method(null);
    }

    schapel, the question related specifically to
    null, in a context where no runtime type can be
    inferred. It wasn't about overloading in general.Yes, I understand that. But here is the rule from the JLS:
    "If more than one method declaration is both accessible and applicable to a method invocation, it is necessary to choose one to provide the descriptor for the run-time method dispatch. The Java programming language uses the rule that the most specific method is chosen."
    Note that it does not refer specifically to a null argument.
    The question is "why is the most specific method called?" The reason is that there are only a few possibilities for this rule:
    1. The least specific method should be called. In this case, overloaded methods with more specific types could not be called.
    2. If there is more than one method, it is a compile time error. Again, this would cause overloading to be useless.
    3. The most specific method is called. It is only with this rule that overloading works. That's why Java uses this rule.

  • Taskflow Method call receiving null parameter.

    Hi all,
    I am using 11.1.1.6. I have created in my application an extra project which is pure Java objects and exposed a master class as a POJO DC. In my application, I have a taskflow where I have dragged and dropped one method from my POJO DC - 2 of the parameters of this methods are coming from an application scope bean. I have debugged the application, and made sure that the object being returned by the getter of my app scope bean is not null. So basically, when the breakpoint is in the return statement of my getter the oject is not null and it has been correctly initialized. Just after that, the next breakpoint is in the class receiving the parameter in my POJO DC class. In there, the object is NULL.
    Does anyone knows wat could be the reason??

    Hi Frank Nimphius-Oracle,
    That is precisely the problem.  The object is being passed as to the taskflow as an input parameter (getting it from my application scope bean). If I access the pageFlowScope inside my taskflow I see it and its there, correctely intialized. However, when I call a method call activity that consumes that object as parameter, all what it gets is null.
    The method that consumes this object is in a separate project, and its exposed in a POJO DC. I don't know if it has to be with the complexity of the object I am passing or what but I don't understand why its not being passed correctly to the DC Method.

  • I don't understand the thing you call live bookmarks never used it, and most forums I have used notify VIA E-mail not giving out my E-mail address information when a reply has been made to the thread in question.

    So how do I get notified of updates in this forum? As I said: I don't understand the thing you call LIVE BOOKMARKS I have never used them, and most forums I have used notify VIA E-mail not giving out my E-mail address, or other private information when a reply has been made to the thread in question, so how do I get notified of updates in this forum? I have seen no normal options for setting my viewing preferences used for this forum. Thank You.

    Thanks for your reply via email/msg. He wrote:
    If you are interested in the actual design data for the Xeon processor, go to the Intel site and the actual CPU part numbers are:
    Xeon 4 core - E5.1620v2
    Xeon 6 core - E5.1650v2
    Xeon 8 core - E5.1680v2
    Xeon 12 core - E5.2697v2
    I read that the CPU is easy to swap out but am sure something goes wrong at a certain point - even if solderedon they make material to absorb the solder, making your work area VERY clean.
    My Question now is this, get an 8 core, then replace with 2 3.7 QUAD CHIPS, what would happen?
    I also noticed that the 8 core Mac Pro is 3.0 when in fact they do have a 3.4 8 core chip, so 2 =16? Or if correct, wouldn't you be able to replace a QUAD CHIP WITH THAT?  I;M SURE THEY ARE UO TO SOMETHING AS 1) WE HAVE SEEN NO AUDIO FPU OR PERHAPS I SHOULD CHECK OUT PC MAKERS WINDOWS machines for Sisoft Sandra "B-E-N-C-H-M-A-R-K-S" -
    SOMETHINGS UP AND AM SURE WE'LL ALL BE PLEASED, AS the mac pro      was announced Last year, barely made the December mark, then pushed to January, then February and now April.
    Would rather wait and have it done correct than released to early only to have it benchmarked in audio and found to be slower in a few areas- - - the logical part of my brain is wondering what else I would have to swap out as I am sure it would run, and fine for a while, then, poof....
    PEACE===AM SURE APPLE WILL BLOW US AWAY - they have to figure out how to increase the power for 150 watts or make the GPU work which in regard to FPU, I thought was NVIDIA?

  • Error on /SafeMode: error while trying to run project uncaught exception thrown by method called

    i try run VS 2012 with /SafeMode. I create new empty Winform. When I start debug, I got:
    "error while trying to run project uncaught exception thrown by method called through reflection"

    Hi Matanya Zac,
    Did you restart your machine? How about installing the VS2012 update 4?
    >>error while trying to run project uncaught exception thrown by method
    Did you install the VS update in your VS IDE? I met this issue before which was related to the VS update:
    https://social.msdn.microsoft.com/Forums/vstudio/en-US/5ead8ee9-ea09-4060-88b0-ee2e2044ff82/error-while-trying-to-run-a-project-uncaught-exception-thrown-by-method-called-through-reflection?forum=vsdebug
    If still no help, I suggest you repair your VS, and then restart your machine, test the result.
    Best Regards,
    Jack
    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click
    HERE to participate the survey.

  • AcquireConnection method call to the connection manager Excel connection Manager failed

    I used VS Studio 2008 (BIDS version 10.50.2500.0) on an WinXp machine (v 5.1.2600 SP3 Build 2600) to create a package that writes multiple query results to different tabbed sheets of a single excel spreadsheet. The package was working just fine and has run
    successfully multiple times, but all of a sudden when opening the project, every single Data Flow task with an Excel Connection Manager displayed error icons. Each raises the following error message when attempting to open the Advanced Editor:
    SSIS Error Code DTS_E_OLEDBERROR. An OLE DB error has occurred. Error code: 0x80004005 Description: "Unspecified error". Error at DataFlow task name: SSIS error Code DTS_E_CANNOTACQUIRECONNECTIONFROMCONNECTIONMANAGER. The AcquireConnection method
    call to the connection manager Excel connection Manager failed with error code 0xC0202009. There may be error messages posted before this with more information on why the Acquire Connection method call failed. Exception from HRESULT: 0Xc020801c (Microsoft.SQlServer.DTSPipelineWrap)
    From the time I created the original package (when it worked fine) until now:
     1) I have been using the same computer, the same login account and the same permissions.
     2) I have been writing to the same (32 bit) 2010 Excel file (which I created) in a folder on my local machine.
     3) The filename and location have not changed; a template file is used each time to move and overwrite the previous file. Both are in the same locations.
     4) I can independently open the target Excel file and the template Excel files with no errors.
     6) The ConnectionString has not changed. The Connnection String I am using is
      Provider=Microsoft.ACE.OLEDB.12.0;Data Source=C:\Conversion\Conversion\Results_dt01.xlsx;Extended Properties="EXCEL 12.0 XML;HDR=YES;".
     7) Run64BitRuntime is set to False.
    8)  Delay Validation is set to true
    9) This is not running under a SQL job  
    10) There are no child packages being run
    I CAN create a NEW Excel Connection Manager, assigning it the exact same target Excel spreadsheet, successfully, but when I attempt to assign it to the Data Flow destination this error occurs:
    "Test connection failed because of an error in initializing provider. Unspecified error."
    Thinking that the driver might be corrupt, I opened a second SSIS package, which also uses the Excel Connection Manager (same driver) and this package continues to work fine on the same workstation with no errors.
    I have searched online for causes of this error for many hours and found nothing that helps me to solve this issue.
    Does anyone have any suggestions for me?

    Yes, I have verified that the Excel file is not in use or opened by anyone, including me. It has been two months since I opened this particular package, although I have been working with other packages in this project. I just discovered that another
    package in the same project has the same problem - all Data Flows that output to an Excel Destination now have the same error icons. This second packages outputs to an entirely different Excel file than in the first package.  A summay:
    Package #1 has error on every Excel Destination and uses templateA to overwrite fileA and then writes to fileA
    Package #2 has error on every Excel Desintation and uses templateB to overwrite fileB and then writes to fileB
    Package #3 has no error on any Excel Destination and is linked to multiple files (none are A or B)
    Package #1 and #2 are in the same project, but Package #3 is in a separate project .
    I will try replacing the Excel files with new ones for Package 1 and 2.

  • Best practice for method calling on objects within a collection.

    Hi guys
    As you may be aware, based on my other thread here. I'm designing a card game in Java. I was hoping for some advice on the best practise on how methods should be called on a custom Object contained within a custom Collection.
    I have an instance variable for the Deck class as follows: List<Card> deckWhen creating an instance of the class I use deck = new ArrayList<Card>();So I have a Deck which only holds Card objects. My question is, for the Card methods, should I call them on the Card objects after 'getting' the Cards from the Deck or should I write methods within the Deck class which handles this method calling. Code explanation is as follows:
    Deck standardDeck = new Deck();I want to retrieve the suit value of a card within the deck. Is this the best way to do it this way:
    standardDeck.getCardAt(50).getSuit();
    //getCardAt is a method within the Deck class, getSuit() is a method within the Card classor this way:
    standardDeck.getSuitForCardAt(50);
    //getSuitForCardAt() is a method within the Deck class. This method calls the getSuit() method within its method body.Cheers for any help guys.
    Edited by: Faz_86 on Jul 10, 2010 9:53 AM

    Hey Saish
    Thanks for the response.
    My Card class does indeed override hashCode(), equals() and toString().
    The reason I am asking a card from the deck for its Suit is simply because of the rules of the game being played. The game I made is a 'Card Shredding' game where a player attempts to remove as many cards from their hand during each turn. The first to remove all their cards is the winner.
    When the game starts, two decks are created. A standard 52 card deck and an empty deck. Then 8 cards are dealt to each player and one card is dealt into the empty deck. The suit and value of the card on the empty deck called the 'shredding deck' dictates which moves are valid during each turn; The played card must match the Suit or the Value of the current card on the 'shredding deck'
    For example:
    Card on the empty deck = 8 of Spades
    The only card from a players hand which can be removed are any Spade or an Eight of any suit.
    Going back to the Deck.getSuitOfCardAtIndex(int index) , this method is needed because both the AI player and human player need to have the ability to take a look at the cards which have been added to the 'shredding deck'. Again this is because of the rules of the game. Therefore I need a method to take a look at the Suit and Value for any card in the 'shredding deck'.
    Taking all this into account, so far I have the following in my Deck class. Please comment on my design so far. As you can see I've tried to follow the Law Of Demter by creating many little wrapper methods. I understand totally wh getters and setters are bad but I cannot come up with a design solution to achieve what I need to based on the rules of the game without users getters. - Any tips on this would be great.
         public Card dealCard()
              Card cardToDeal = deck.remove(0);
              return cardToDeal;
         public void addCard(Card usedCard) //This method is used to add 'used' cards to the deck.
              deck.add(usedCard);
         public Card getFaceCard() //Returns the current face up playing card
              Card faceCard = deck.get(deck.size()-1);
              return faceCard;
         public int getFaceCardValue()
              int faceCardValue = deck.get(deck.size()-1).getValue();
              return faceCardValue;
         public int getFaceCardSuit()
              int faceCardSuit = deck.get(deck.size()-1).getSuit();
              return faceCardSuit;
         public String getFaceCardName()
              String faceCardName = deck.get(deck.size()-1).toString();
              return faceCardName;
         public Card getCardAt(int position) //Returns the current face up playing card
              Card card = deck.get(position);
              return card;
         public int getFaceCardValueAt(int position)
              int cardValue = deck.get(position).getValue();
              return cardValue;
         public int getFaceCardSuitAt(int position)
              int cardSuit = deck.get(position).getSuit();
              return cardSuit;
         public String getFaceCardNameAt(int position)
              String cardName = deck.get(position).toString();
              return cardName;
         public int getDeckSize() //When recycling cards, the size of the deck is needed to determine the best time to add more cards.
              return deck.size();
         }

  • Retrieving client identity during method call

    Hy,
    I have written an RMI application wich uses JSSE with client authentication. I would like to get the client Identity (Certificate information) each time the client perform a method call.
    Can anybody help me?

    This is rather complicated but it can be done. You need:
    1. an RMIServerSocketFactory which returns
    2. a wrapper ServerSocket implementation around a real ServerSocket, which delegates everything to the real ServerSocket except for the accept method, which does the delegation but then wraps the result in
    3. a wrapper Socket implementation around the real Socket which delegates everything to the real Socket
    except getInputStream, which does the delegation but then wraps the result in
    4. a wrapper InputStream implementation around the real InputStream, which delegates everything to the real input stream but which registers the underlying Socket (the delegate, not your wrapper) in a ThreadLocal when any read method is called.
    Are you with me so far? ;-)
    The registered Socket will really be an SSLSocket. Now, inside your remote method implementation, you can do threadLocal.get() to get the SSLSocket associated with the current client (because you're in the same thread as in (4), because the socket is actually read for the first time in the method despatching thread. You can now do SSLSocket.getSession() and get hold of the client certificates.
    Sample of (2) to get you started:
    public class WrappedServerSocket extends ServerSocket
    SSLServerSocket serverSocket;
    public WrappedServerSocket(int port) throws IOException
    { this.serverSocket = SSLServerSocketFactory.createServerSocket(port); }
    public Socket accept() throws IOException
      Socket socket = serverSocket.accept();
      return new WrappedSocket(socket);
    // all other methods should delegate to serverSocket
    }EJP

  • Question about method calling (Java 1.5.0_05)

    Imagine for example the javax.swing.border.Border hierarchy.
    I'm writing a BorderEditor for some gui builder, so I need a function that takes a Border instance and returns the Java code. Here is my first try:
    1 protected String getJavaInitializationString() {
    2     Border border = (Border)getValue();
    3     if (border == null)
    4         return "null";
    5
    6     return getCode(border);
    7 }
    8
    9 private String getCode(BevelBorder border) {...}
    10 private String getCode(EmptyBorder border) {...}
    11 private String getCode(EtchedBorder border) {...}
    12 private String getCode(LineBorder border) {...}
    13
    14 private String getCode(Border border) {
    15     throw new IllegalArgumentException("Unknown border class " + border.getClass());
    16 }This piece of code fails. Because no matter of what class is border in line 6, this call always ends in String getCode(Border border).
    So I replaced line 6 with:
    6     return getCode(border.getClass().cast(border));But with the same result. So, I try with the asSubClass() method:
    6     return getCode(Border.class.asSubClass(border.getClass()).cast(border));And the same result again! Then i try putting a concrete instance of some border, say BevelBorder:
    6     return getCode(BevelBorder.class.cast(border));Guess what! It worked! But this is like:
    6     return getCode((BevelBorder)border);And I don't want that! I want dynamic cast and correct method calling.
    After all tests, I give up and put the old trusty and nasty if..else if... else chain.
    Too bad! I'm doing some thing wrong?
    Thank in advance
    Quique.-
    PS: Sorry about my english! it's not very good! Escribo mejor en espa�ol!

    Hi, your spanish is quite good!
    getCode(...) returns the Java code for the given border.
    So getCode(BevelBorder border) returns a Java string that is something like this "new BevelBorder()".
    I want Java to resolve the method to call.
    For example: A1, A2 and A3, extends A.
    public void m(A1 a) {...}
    public void m(A2 a) {...}
    public void m(A3 a) {...}
    public void m(A a) {...}
    public void p() {
        A a = (A)getValue();
        // At this point 'a' could be instance of A1, A2 or A3.
        m(a); // I want this method call, to call the right method.
    }This did not work. So, i've used instead of m(a):
        m(a.getClass().cast(a));Didn't work either. Then:
        m(A.class.asSubClass(a.getClass()).cast(a));No luck! But:
        m(A1.class.cast(a)); // idem m((A1)a);Woks for A1!
    I don't know why m(A1.class.cast(a)) works and m(a.getClass().cast(a)) doesn't!
    thanks for replying!
    Quique

  • Passing a method call to a facelet tag

    Hello,
    I am trying to create a JSF confirmation box that replaces the Javascript confirm() function. I am using Seam and Rich Faces 3.2.1. The confirm box is a facelet tag that pops up a modal box with 'cancel' and a 'continue' buttons. Everything is working correctly except for one crucial piece; passing the method call for continue button.
    Here is the set up for the facelets tag in the main xhtml page:
    <at:confirm
        id="confirm"
        title="Confirm"
        message="Do you want to continue"
        buttonText="Continue"
        backingBean="#{confirmAction}"
        method="testMethodTwo"
    />Here is the code for the button inside the facelets tag:
    <a4j:commandLink
        styleClass="rdSplGr1"
        href="#"
        action="#{backingBean[method]}">
        <s:span>#{buttonText}</s:span>
    </a4j:commandLink>The method simply does nothing when the use clicks the button. I am assuming this is due to the lack of "()" however there does not seem to be a way to get those in there. I have tried the following:
    1) placing the parens like this - method="testMethodTwo()"
    2) placing the parens like this - action="#{backingBean[method]()}"
    The first does nothing, the second causes an EL exception.
    I know that it has nothing to do with the modal as I have also placed a button like this into the modal:
    <a4j:commandLink
        styleClass="rdSplGr1"
        href="#"
        action="#{confirmAction.testMethodOne()}">
         <s:span>MethodOne</s:span>
    </a4j:commandLink>That button as you can see has what I am trying to create dynamically and it works like a charm.
    So how do I pass a method call correctly? Or if that is impossible how do I solve the problem of having a the continue button having a different method assigned to it?
    Thanks for any insight into this.
    Edited by: Rhythmicdevil on Aug 4, 2008 7:57 AM

    I agree, reflection should be a last resort. An
    interface would not be useful if you don't know what
    method you want to invoke at compile time. Interfaces
    are useful when you know the method you want to
    invoke, but not the class.That's not true. This is a really lame-ass example but it shows the point.
    public interface RuntimeMethod
       public void method();
    class AClass {
       public static void main(Sting[] args)
          new AClass.handleAtRuntime(
             Factory.getRuntimeMethod(Integer.parse(args[0])));
       public void handleAtRuntime(RuntimeMethod runtime)
          runtime.method();
    class Factory
       public static getRuntimeMethod(int method)
          switch(method)
             case 0: return new RuntimeMethod
                public void method()
                   methodA();
             case 2: return new RuntimeMethod
                public void method()
                   methodB();
             default:
                throw new IllegalArgumentException("bad input");
    }

  • PrepareForDML method called twice

    Have implemented a typical scenario (search - add - edit jspx pages).
    Within one application module, one view object with dynamically created where criterion is used for searching, and another view object fetching at most one row is used for inserting/updating. The second view object is based on a join of an updatable entity (that has as primary key trigger-generated sequence number) and several referenced readable entities that bring descriptions of the codes of the updatable entity. Have implemented descriptions as output fields in the jspx, settign partialTriggers to the id of the code-field of the updatable entity having autoSubmit=true. Have concentrated business validation logic within the prepareForDML() of the updatable entity implementation.
    Under normal conditions, it works fine.
    Under heavy system load in production, or testing with ADF State Management enabled at work environment, I observe the prepareForDML() called twice instead of once.
    Thus, the first time the insert is commited, the second time the validation rollback, and at last the whole transaction is rollbacked.
    When I commented-out all the fields that bring descriptions and set all autoSubmit=false, prepareForDML() was called once.
    However, my problem is that I have to bring the descriptions, that result from pop-up windows so that the end-user can see them after selecting sthg on his/er screen.
    Why is prepareForDML() called twice, and how can I avoid this?

    (2) Can't change the second trigger-assigned field from DBSequence to simply Number since the Entity Object Editor hides the tab Sequence to declare the sequence from which to get this field's value after insert.
    Please see section "6.6.3.8 Trigger-Assigned Primary Key Values from a Database Sequence" of the ADF Developer's Guide for Forms/4GL Developers on the ADF Learning Center at http://www.oracle.com/technology/products/adf/learnadf.html for more information on this. The "Sequence" tab doesn't have any runtime behavior influence. The sequence number is not assigned by ADFBC, it is assigned by your trigger. ADFBC only worries about:
    1) Providing a temporary unique negative key so that new detail rows can have a temporary foreign key value to point at until the transaction commits
    2) Refreshing the entity object's primary key value from the database-trigger assigned sequence number (however, we really don't know how the trigger populated the value) Theoretically, it may or may not have used a database sequence to assign the number. It would work just the same at the ADFBC level)
    3) Refreshing the temporary negative foreign key values in newly-created detail rows for new, composed details of the new composing master row with the definitive primary key value.
    So, you should safely be able to change this to a Number, with its Refresh after Insert property set.
    (3) Create() on entity implementation was always called once at page load, unexpectedly prepareForDML() always carried on two consequtive rows (either the new row to insert twice or the query's first row retrieved to update and afterwards the new row to insert) having State Management enabled.
    If create() is being called only once, then next you should check the value of the "operation" flag that is passed to prepareForDML() to understand if the method is being called for DML_INSERT or DML_UPDATE. Perhaps somehow an existing row is being inadvertently updated so one of the calls to prepareForDML() might be an update? I don't understand how prepareForDML() could fire twice for two new entity objects if the entity object's create() method is only called once. If you have a testcase that illustrates this, please report it to Worldwide Support via Metalink so they can triage and file a bug for you on it.
    (4) Swapping selectInputText components with SelectOneChoice, thus avoiding the partial page rendering, I managed prepareForDML() to function logically so that to have only one row to insert, but again since I have validation code in my entity implementation that throws JBO-exceptions, another problem occured. The first time the end-user receives an exception (e.g. invalid Tax Number), the second time he/she corrects it, the created row instance at prepareForDML() doesn't get updated with the new valid Tax Number, but continues to hold the old value at second run. To remind that if insert is successful the navigation moves on to the update page, otherwise it remains at the same (navigation outcome is null).
    Are you absolutely sure in this case that a second new row is not getting created?

  • GObject : Replace Method

    Hello. I am working with labview scripting in order to create a script that will replace all selected indicators with an indicator from a ctl file. However, I can't seem to figure out the GObject method "Replace". Attached is my current script. I was wondering if anyone could let me know what I am doing wrong or if what I am trying to do is even possible. Thanks.
    Solved!
    Go to Solution.
    Attachments:
    IndicatorReplace.png ‏17 KB

    A few tips.
    It looks like you are using the selection on the BD, therefore the objects you find will be ControlTerminals.  You need to get the corresponding Control property and call its replace method.
    To handle this, and allow for other random objects in your selection I would use To More Specific Class to cast each object to a ControlTerminal.  If there is no error, then get the Control Property and call the replace method.  If there is an error, simply do nothing.  This way if there is a wire or two in the selection you are ok.
    It also appears that you are using this from the Tools Menu, which is cool.  You can add a check of the VI.FPIsFrontmost property to detect if you are calling from the FP or BD.  If it is the FP, you can simply cast everything in the SelList[] to a Control and for the successful ones call the Replace method.

  • Passing the OUT parameter in method call after connection

    Hi,
        I have created the rfc connection through SAP.net Connector. Now when i want to show all the data of the particular RFC. i need to provide all the fields name and the tables name in method call.
    In that method call i need to provide one paramet which is of type OUT what is that and what i need to provide in that parameter.
    Can anybody suggest on this.
    I can send the code if u need to understand, what exactly i want.
    Regards,
    +Naren

    Its done i am able to connect.

  • Im new to java can someone please help me with external method calls

    I have only been doing java for a couple of months using bluej, I really dont understand external method calls, this is for an assignment and i have managed the bulk of the code, ineed to make external calls to the other classes to return and input data.
    this is the code i have writen so far.
    class CD
    // The fields.
    public Artist performer;
    private String album;
    private String genre;
    private int numberOfTracks;
    private int yearReleased;
    *Please enter CD details, text entry requires quote marks "Greatest Hits"
    public CD (String album_Name){
    album = album_Name;
    numberOfTracks = 0;
    yearReleased = 0;
    performer = new Artist();
    /**blank constructor*/
    public CD ()
    {album = "";
                genre = "";
                numberOfTracks = 0;
                yearReleased = 0;
                performer = new Artist();}
    * accessor methods
    /** method to return album details to the output window*/
    public void print_albumDetails(){
    System.out.println("Album: " + album);
    System.out.println("Genre: " + genre);
    System.out.println("Number of Tracks: " + numberOfTracks);}
    /** accessor method to return the name of the album*/
    public String show_album(){
    return album;}
    /** accessor method to show artist details from artist class*/
    public void print_details(){
    performer.print_details();}
    * mutator methods
    /** mutator method to change album name please enter name with quotes*/
    public void change_album(String newAlbum){
    album = newAlbum;}
    /**mutator method for adding the album year and checking it correct
    * please enter a year between 1900 and 2005*/
    public void album_year (int year){
    if ((year < 1900) || (year > 2005))
    System.out.println("sorry the year is incorrect please enter a year between 1900 and 2005");
    else yearReleased = year;}
    /** mutator method to alter the number of tracks and check if the ammount is greater
    * than zero*/
    public void change_Number_Of_Tracks(int no_Of_Tracks){
    if (no_Of_Tracks > 0)
    numberOfTracks = no_Of_Tracks;
    else System.out.println("you have not entered a correct number");}
    /** mutator method to change the genre and check it has been entered correctly
    * Please enter 1 for Soul
    * 2 for Blues
    * 3 for Jazz*/
    public void change_Genre(int Change_Genre){
    if ((Change_Genre <= 0) || (Change_Genre > 3)){
    System.out.println("You have not entered the correct available genres");
    System.out.println("which are 1 for Soul,2 for Blues or 3 for Jazz");}
    else if (Change_Genre == 1)
    genre = "Soul";
    else if (Change_Genre == 2)
    genre = "Blues";
    else if (Change_Genre == 3)
    genre = "Jazz";
    to this i need to add an external call to the class Artist to be able to enter firstname and second name, I know that external calls use dot notation
    and the instance of Artist is called performer but i cant get the call to these methods in the Artist class to work
    Artist class
    /** mutator method to change or add artist first name, remember to add quotes*/
    public void cName(String name){
    firstname = name;}
    /** mutator method to change or add artist surname remember to add quotes*/
    public void csurName(String surname){
    lastname = surname;}
    can some please give me some help

    Also, if you can't get them to work, what is the error message you are getting?
    Baron Samedi

Maybe you are looking for

  • What format for my external harddrive?

    Hello, I have a 1,5 TB Seagate external harddrive. What format and partitiontype shall it be to be used on both Mac and Windows? Because right now it only works on my mac and the rest of my family uses Windows so i would like to share my ext. hdd wit

  • How can I return to the a previous version of itunes?

    How can I return to the a previous version of itunes?

  • Anyone else having they're notifications repeated?

    So far I've noticed it happening with Instagram, Mailbox and Facebook. 90% of them come form IG, and only once has it happened with the others. It's only been going on for about 3 weeks. All my apps are up-to date. With Instagram, a single 'like' or

  • Ask for help to complete the survey for my master's project

    Hello,every EEers, sorry to take your time. I am a postgraduate from Sheffield University. I am doing my master's project right now, which is about your perception toward the communities. Can you please help me to complete the survey through the foll

  • Shared Calendar

    I am trying to configure Shared Calendar usage, basically according to the section 'Shared Calendar LDAP Lookup Configuration' on the page http://docs.sun.com/app/docs/doc/819-2568/6n4rm7fit?a=view . I have service.wcap.userprefs.ldapproxyauth ="yes"