Copy(string1, string2)

Hi,
In Forms pl/sql you can use this command to copy between two strings, where you can dybnamically build the string names. It doesn't seem to be in database pl/sql, anyone know how to do this in database pl/sql please ??????
TIA
Tony

Note the this has been answered in the Database-General forum
Re: copy(string1, string2)
Justin
Distributed Database Consulting, Inc.
http://www.ddbcinc.com/askDDBC

Similar Messages

  • Bash: "expr index string1 string2" gives "syntax error"

    In a bash script, I was trying to use the command
    expr index string1 string2
    to find the position of string2 in string1, but this does not work on OS X while it works ok on several Linux machines. Reading the man page, I realized expr does something quite different on OS X than on Linux.
    Can anybody suggest which command I should use to get the same functionality of the above on OS X?
    Thanks
    Andreas

    Hi Ken,
       Wow! That's something you don't see every day; I'm really impressed. I had had a tough day too. Later I thought of a funny answer in which I blamed everything on the crazy shell I use. The difference between the two answers is just the flow of karma but stopping the flow of negative by saying something is a real and difficult choice and yours shows character. I'm sorry for going on too much but such things matter more than machines.
       On the other hand, you're a royal pain in the ... just kidding. You're a strict task master but right; I read in the man page about it returning zero and forgot. However, mathematically it isn't too difficult; you just have to use modular arithmetic. In zsh, (I can learn) it would look like:
    test=aabbcc
    echo $(( ( ${#test%%[bc]*} + 1 )%( ${#test} + 1 ) ))
    In bash, it would look like:
    test=aabbcc
    testtmp=${test%%[bc]*}
    echo $(( ( ${#testtmp} + 1 )%( ${#test} + 1 ) ))
    Gary
    ~~~~
       In science it often happens that scientists say, 'You know that's a really good argument; my position is mistaken,' and then they actually change their minds and you never hear that old view from them again. They really do it. It doesn't happen as often as it should, because scientists are human and change is sometimes painful. But it happens every day. I cannot recall the last time something like that happened in politics or religion.
             -- Carl Sagan, 1987 CSICOP keynote address

  • String1 === string2 make me confuse

    ------------------------A-------------
    String s1="hello "; //string "hello " ended with a blank
    String s2="world";
    String s3="hello world";
    s1+=s2;
    System.out.println(s3==s1);
    ------------------------B------------
    String ss1="hello world";
    String ss2="hello world";
    System.out.println(ss1==ss2);
    if the output of statement - A is false then why the output of statement - B is true?
    plz ans...
    thnx

    To be honest, I can't tell you the underlying
    mechanics,Strings are pooled internally meaning that only one copy of a String literal, such as "hello", is ever stored. So each String literal is uniquely define by an object reference. If you know what you're doing you can utilize this fact to use == to compare Strings. So even thought this "feature" has it's roots in an implementation technique (pooling) the bahaviour is defined by the language. This means, again if you know what you're doing, it'ss a perfectly kosher way to compare Strings using ==.
    Pooling is also used by some Java implementations to store small Integer literals. Sun for example pools -127 to 128 I think.
    Integer i1 = new Integer(5); // an object reference
    Integer i2 = new Integer(5); // another object reference
    if (i1==i2)  // my god they're equal ?
      System.out.println("Small Integer literals are pooled");The above == comparision "should" be false but istn't because of pooling.
    The difference is that this behaviour is an implementation artefact and NOT part of the language so it can never be utilized the way String pooling can.

  • ?? (string1 == string2) ??

    Can someone please explain the rules here
    public class A {
    public static void main(String args[]) {
    String s1 = "abc";
    String s2 = "abc";
    System.out.println(s1 == s2);
    String s3 = new String("abc");
    System.out.println(s1 == s3);
    I was expecting "false" "false" but the first was is true - WHY?

    As joeldi pointed out, if they are both pointing to (referencing) the same bit of memory, they are equal (==), like so:
    String s1 = "abc";
    String s2 = s1;
    System.out.println(s1==s2);This will return true.
    Doing this isn't so different.
    String s1 = "abc";
    String s2 = "abc";Because s1 and s2 are being given exactly the same value, the compiler is smart enough to save memory and point them both at the same "abc" literal (is this what they mean by interning?). And since Strings are immutable (can't be changed) it doesn't matter in the slightest, since s1 can't possibly upset the data in s2.
    Cheers,
    Radish21

  • How to find the first occurrence of a string2 in string1

    Hello
    I've got a string, and I want to know where '-' occurs
    the first time. I mean, in 'hello-world', the first
    one is position 5.
    In C++, I've got:
    Result      = strcspn(string1, string2);
    How can I do it in Java?
    Thank you very much.

    String.indexOf()...read the API.

  • Shift string1 by 3 places right.

    code ->
    data: string1(10) type c value 'abcdefghij',
          string2 like string1.
    write:  / 'Before Manipulations : ',
            / 'string1 = ',string1,
            / 'string2 = ',string2.
    string2 = string1.
    shift string1.
    write : / 'after one shift first letter is gone :-) (leftShift)',
              ' ', string1.
    write : / 'after the shift operation there is a permanent change in',
              'the field value of string1'.
    shift string1 by 3 places right.
    write : / 'after shifting 3 places on the right-', string1,
            / 'DOUBT - only ij has gone, but hij should have gone right ?'.
    write : / 'string2 also has same as string1 had initially-', string2.
    shift string2 by 3 places right.
    write : / 'after shifting 3 places on the right-', string2.
    Doubt has been marked in the code itself. This is my first post. Please do explain me concept , in the above code,if i am wrong.

    It works in STRING2 because you never did an initial shift to the left. 
    If you did want this to work in the string... you would have to find out the length of the string and then shift on that offset.
    data: stlen type i.
    shift string2.
    stlen = strlen( string2 ).
    shift string2+0(stlen) by 3 places right.
    Regards,
    Rich Heilman

  • Problem in getting last value of a string in Function Module

    Hi,
    I am working on FM in which i have to put highfen mark which is working ok,but the problem if there is when the value of string finds a space it should not insert highfen in it and i am not able to put the condition in it as it showing the higfen even when the word is full in the first line.i want to show highfen where the word is not able to display complete. here is d code which i am using right now. plzz provide me guidlines to solve this problem.
    here's d code:-
    FUNCTION Z_STRING_LENGTH1.
    *"*"Local Interface:
    *"  IMPORTING
    *"     VALUE(I_STRING) TYPE  STRING
    *"     VALUE(LENGTH) TYPE  I
    *"  EXPORTING
    *"     VALUE(E_STRING) TYPE  STRING
    data: STRING_F type string, "Stores the value in string format
          STRING_LENGTH type i, "Length of the string
          DIFF type i,          "Difference among the value
          DIFF1 TYPE C,
          STRING1 type string,  "Stores the 1st String
          STRING2 type string,  "Stores the 2nd String
          STRING3 type string,  "Stores the 3rd String
          STRING4 type string,  "Stores the 3rd String
          STRING5 type string,  "Stores the 3rd String
          LENGTH2 type I.
    STRING_F = I_STRING.
    STRING_LENGTH = STRLEN( I_STRING ).
    DIFF = STRING_LENGTH - LENGTH.
    IF DIFF LE 0.
      DIFF = 0.
    ENDIF.
    IF LENGTH LE STRING_LENGTH.
      STRING1 = STRING_F(LENGTH).
    ELSE.
      STRING1 = STRING_F(STRING_LENGTH).
    ENDIF.
    IF LENGTH LE STRING_LENGTH.
      STRING2 = STRING_F+LENGTH(DIFF).
    ELSE.
      STRING2 = STRING_F+STRING_LENGTH(DIFF).
    ENDIF.
    length2 = length - 1.
    STRING3 = STRING1+length2(1).
    STRING4 = STRING2+0(1).
    IF LENGTH LE STRING_LENGTH AND STRING3 NE SPACE AND STRING4 NE SPACE.
      concatenate STRING1 '-' STRING2  into STRING5.
      e_string = STRING5.
    ELSE.
      concatenate  STRING1 STRING2 into STRING5.
      e_string = STRING5.
    ENDIF.
    ENDFUNCTION.
    Edited by: ricx .s on May 12, 2009 5:20 AM

    Hi,
    I checked your code... its working fine except for some cases it is giving dumps for which I have added certain if conditions....
    Please check the modified code below... have optimized it as well by removing one extra if condition....
    you can copy and paste the code below...
    DATA: STRING_F TYPE STRING, "Stores the value in string format
          STRING_LENGTH TYPE I, "Length of the string
          DIFF TYPE I,          "Difference among the value
          DIFF1 TYPE C,
          STRING1 TYPE STRING,  "Stores the 1st String
          STRING2 TYPE STRING,  "Stores the 2nd String
          STRING3 TYPE STRING,  "Stores the 3rd String
          STRING4 TYPE STRING,  "Stores the 3rd String
          STRING5 TYPE STRING,  "Stores the 3rd String
          LENGTH2 TYPE I.
    STRING_F = I_STRING.
    STRING_LENGTH = STRLEN( I_STRING ).
    DIFF = STRING_LENGTH - LENGTH.
    IF DIFF LE 0.
      DIFF = 0.
    ENDIF.
    IF LENGTH LE STRING_LENGTH.
      STRING1 = STRING_F(LENGTH).
      STRING2 = STRING_F+LENGTH(DIFF). " added this statement in this if itself instead of one extra if
    " which is not required
    ELSE.
      STRING1 = STRING_F(STRING_LENGTH).
      STRING2 = STRING_F+STRING_LENGTH(DIFF).
    ENDIF.
    IF LENGTH IS NOT INITIAL.
      LENGTH2 = LENGTH - 1.
    ENDIF.
    " put this if condition as there is a dump occuring at this place.
    " Dump occurs when you give the length value as 0
    " Say for example the value of I_STRING, I passed it as SIDDARTH
    " and the length I passed as 0, then it gives me a dump
    STRING3 = STRING1+LENGTH2(1).
    IF STRING2 IS NOT INITIAL.
      STRING4 = STRING2+0(1).
    ENDIF.
    " put this if condition as there is a dump occuring at this place.
    " Dump occurs when you give the length value greater than or equal to
    " the string length
    " Say for example the value of I_STRING, I passed it as SIDDARTH
    " and the length I passed as 8, then it gives me a dump
    IF LENGTH LE STRING_LENGTH AND STRING3 NE SPACE AND STRING4 NE SPACE.
      CONCATENATE STRING1 '-' STRING2  INTO STRING5.
      E_STRING = STRING5.
    ELSE.
      CONCATENATE  STRING1 STRING2 INTO STRING5.
      E_STRING = STRING5.
    ENDIF.

  • Display .gif In Applet Problem

    I have been making a game. Very simply, the game has a main class and another truely important class that extends JFrame, it is the map. In it i need to upload .gif files and display them. It worked up until recently because i needed to make a sepperate class. I know how to use the getImage() for Images and the the way for ImageIcons, but for some reason, they never display (they display just whiteness). My Code is as follows
    import java.awt.*;
    import java.awt.event.*;
    import java.util.*;
    import javax.swing.*;
    import java.io.*;
    // when this puppy reads from a file, it'll be able to have 55 15 x 15 terrains per row
    // 35 15 x 15 terrains per column
    // arrows by everythign that u would need to consider in finding the problem
    // this is not the main class
    public class GameMap extends JPanel implements MouseListener, MouseMotionListener, KeyListener{
         public static final int MAX_BULLETS = 200;
         public static final int MAX_PLAYERS = 50;
         public static final int SPLAT_SIZE = 15;
         public static final int PLAYER_SIZE = 15;
         public static final int MAX_MESSAGES = 10;
         public static final int ROBOT_SIZE = 15;
         private static final int rowTerrains = 35;
         private static final int columnTerrains = 55;
         private static int currentBullets = 0;
         private static int currentPlayers = 0;
         private static int bulletRotation = 0;
         private static int aimX, aimY;
         private boolean mapLoaded;
         private boolean writingMessage;
         private boolean imagesLoaded;
         private int messageRotation;
         private int tileCoord;
         private String messageText = "";
         private String currentMap;
        private Bullet bullet[] = new Bullet[MAX_BULLETS];
        private Player player[] = new Player[MAX_PLAYERS];
        private Message message[] = new Message[MAX_MESSAGES];
        private Color backgroundColor = new Color(81, 141, 23);
        private Image offscreenMap; // offscreen image of map
        private Graphics mapGraphics;
         private ImageIcon yellowSplat1, yellowSplat2, yellowSplat3, yellowSplat4, yellowSplat5, bluePlayerBack, bluePlayerFront, bluePlayerRight, bluePlayerLeft, grass, tree, mountain, robot1;
         private Terrain terrain[] = new Terrain[(rowTerrains * columnTerrains)];
         public GameMap(){
              this(800, 450);
         public GameMap(int width, int height){
              addMouseListener(this);
              addMouseMotionListener(this);
              addKeyListener(this); // use method requestFocusInWindow() for this to work
              setPreferredSize(new Dimension(width, height));
              setBackground(backgroundColor);
              for (int x = 0; x < bullet.length; x++){
                   bullet[x] = new Bullet();
              for (int x = 0; x < player.length; x++){
                   player[x] = new Player();
              for (int x = 0; x < message.length; x++){
                   message[x] = new Message();
              for (int x = 0, currentX = 0, currentY = 0; x < (rowTerrains * columnTerrains); x++){
                   terrain[x] = new Terrain();
                   terrain[x].setX(currentX);
                   terrain[x].setY(currentY);
                   currentX += 15;
                   if (currentX > columnTerrains * 15){
                        currentX = 0;
                        currentY += 15;
              player[0].drawPlayer(0, 0);
              //loadMap("Map1.txt"); // this is called to load the map right when this object is initialized
         public void paintComponent(Graphics g){
              super.paintComponent(g);
              Graphics2D g2d = (Graphics2D)g;
              Composite originalComposite = g2d.getComposite();
              if (imagesLoaded == false){
                   yellowSplat1 = new ImageIcon("yellow1.gif");
                   yellowSplat2 = new ImageIcon("yellow2.gif");
                   yellowSplat3 = new ImageIcon("yellow3.gif");
                   yellowSplat4 = new ImageIcon("yellow4.gif");
                   yellowSplat5 = new ImageIcon("yellow5.gif");
                   bluePlayerBack = new ImageIcon("BlueBack.gif");
                   bluePlayerFront = new ImageIcon("BlueFront.gif");
                   bluePlayerLeft = new ImageIcon("BlueLeft.gif");
                   bluePlayerRight = new ImageIcon("BlueRight.gif");
                   grass = new ImageIcon("Grass.gif");
                   tree = new ImageIcon("Tree.gif");
                   mountain = new ImageIcon("Mountain.gif");
                   robot1 = new ImageIcon("Robot1.gif");
              if (mapLoaded == false){ // so a map is loaded when game is started
                   loadMap("Map1.txt");
                   mapLoaded = true;
              g.drawImage(offscreenMap, 0, 0, this);
              for (int x = 0; x < bullet[0].totalBullets; x++){
                   if (bullet[x].getArrived()){
                        //find splat type and display it
                        g2d.setComposite(makeComposite(0.5f));
                        switch (bullet[x].getSplatType()){
                             case 0:
                                  yellowSplat1.paintIcon(this, g2d, bullet[x].getDestX() - SPLAT_SIZE / 2, bullet[x].getDestY() - SPLAT_SIZE / 2);
                                  break;
                             case 1:
                                  yellowSplat2.paintIcon(this, g2d, bullet[x].getDestX() - SPLAT_SIZE / 2, bullet[x].getDestY() - SPLAT_SIZE / 2);
                                  break;
                             case 2:
                                  yellowSplat3.paintIcon(this, g2d, bullet[x].getDestX() - SPLAT_SIZE / 2, bullet[x].getDestY() - SPLAT_SIZE / 2);
                                  break;
                             case 3:
                                  yellowSplat4.paintIcon(this, g2d, bullet[x].getDestX() - SPLAT_SIZE / 2, bullet[x].getDestY() - SPLAT_SIZE / 2);
                                  break;
                             case 4:
                                  yellowSplat5.paintIcon(this, g2d, bullet[x].getDestX() - SPLAT_SIZE / 2, bullet[x].getDestY() - SPLAT_SIZE / 2);
                                  break;
                   else{
                        g2d.setComposite(originalComposite);
                        g2d.setColor(Color.yellow);
                        g2d.fillOval(bullet[x].getX(), bullet[x].getY(), 3, 3);
              g2d.setComposite(originalComposite);
              g.setColor(Color.yellow);
              for (int x = 0; x < player[0].totalPlayers; x++){
                   if (player[x].getPlayerPosition().equals("Back")){
                        bluePlayerBack.paintIcon(this, g2d, player[x].getX(), player[x].getY());
                   else if (player[x].getPlayerPosition().equals("Right")){
                        bluePlayerRight.paintIcon(this, g2d, player[x].getX(), player[x].getY());
                   else if (player[x].getPlayerPosition().equals("Left")){
                        bluePlayerLeft.paintIcon(this, g2d, player[x].getX(), player[x].getY());
                   else if (player[x].getPlayerPosition().equals("Front")){
                        bluePlayerFront.paintIcon(this, g2d, player[x].getX(), player[x].getY());
                   else{
                        g2d.fillOval(player[x].getX(), player[x].getY(), 15, 15);
              if (writingMessage){
                   g2d.setColor(new Color(0, 0, 130));
                   g2d.setComposite(makeComposite(0.5f));
                   g2d.draw3DRect(8, 7, 800, 17, true);
                   g2d.setComposite(originalComposite);
                   g2d.setColor(Color.yellow);
                   g2d.drawString(messageText, message[0].getX(), 20);
              for (int x = 0; x < MAX_MESSAGES; x++){
                   if (message[x].isDisplayed()){
                        g2d.drawString(message[x].getMessage(), message[x].getX(), message[x].getY());
         private AlphaComposite makeComposite(float alpha) {
              int type = AlphaComposite.SRC_OVER;
              return(AlphaComposite.getInstance(type, alpha));
         public void drawBullet(int aimX, int aimY){
              bullet[bulletRotation].drawBullet(player[0].getX() + PLAYER_SIZE / 2, player[0].getY() + PLAYER_SIZE / 2, aimX, aimY);
              player[0].setPlayerPosition(bullet[bulletRotation].getPlayerPosition());
              bulletRotation++;
              if (bulletRotation >= MAX_BULLETS){
                   bulletRotation = 0;
         public void loadMap(String map){
              mapLoaded = false;
              currentMap = map;
              try{
                   BufferedReader in = new BufferedReader(new FileReader(map));
                   String input, string1, string2;
                   for (int x = 0; x < terrain.length; x++){
                        terrain[x].setFilled(false);
                   for (int x = 0, currentArray; x < terrain.length; x++){
                        if ((input = in.readLine()) != null) {
                             StringTokenizer st = new StringTokenizer(input);
                             currentArray = Integer.parseInt(st.nextToken());
                             terrain[currentArray].setTerrainType(st.nextToken());
                             terrain[currentArray].setFilled(true);
                        else{
                             break;
                   in.close();
                   offscreenMap = createImage(size().width, size().height);
                   mapGraphics = offscreenMap.getGraphics();
                   //mapGraphics.clearRect(0, 0, size().width, size().height);
                   // everything from here down is to be painted to mapGraphics... but it doesn't get this far cuz of an error
                   for (int x = 0; x < terrain.length; x++){
                        if (terrain[x].getTerrainType().equals("Grass")){
                             grass.paintIcon(this, mapGraphics, terrain[x].getX(), terrain[x].getY());
                             System.out.println("terrain(" + x + ") is Grass");
                        else if (terrain[x].getTerrainType().equals("Tree")){
                             tree.paintIcon(this, mapGraphics, terrain[x].getX(), terrain[x].getY());
                             System.out.println("terrain(" + x + ") is Tree");
                        else if (terrain[x].getTerrainType().equals("Mountain")){
                             mountain.paintIcon(this, mapGraphics, terrain[x].getX(), terrain[x].getY());
                             System.out.println("terrain(" + x + ") is Mountain");
              catch (FileNotFoundException e){
                   System.out.println("Map not found");
              catch (IOException e){
                   System.out.println("IOException Error!");
              // **** mouse Listener ****//
         public void mouseClicked(MouseEvent e){}
         public void mousePressed(MouseEvent e){}
         public void mouseReleased(MouseEvent e){
              if (e.getButton() == 1){
                   //System.out.println("player[0].movePlayer(" + e.getX() + ", " + e.getY() + ")");
                   aimX = e.getX();
                   aimY = e.getY();
                   movePlayer(aimX, aimY);
              else if (e.getButton() == 3){
                   aimX = e.getX();
                   aimY = e.getY();
                   drawBullet(aimX, aimY);
         public void mouseEntered(MouseEvent e){
              if (isFocusOwner() != true){
                   requestFocusInWindow();
         public void mouseExited(MouseEvent e){}
         // **** end mouse listener ****//
         // **** mouse motion listener ****//
         public void mouseDragged(MouseEvent e){}
         public void mouseMoved(MouseEvent e){}
         // **** end mouse motion listener ****/
         public void keyPressed(KeyEvent e){}
         public void keyReleased(KeyEvent e){}
         public void keyTyped(KeyEvent e){}
    }I removed a few unnecessary methods from this code to make it easier to view. EVERYTHING works except for the images displaying. The reason i'm having this problem now is i just redid my workspace and copied the code and i think some glitch stopped it from compiling correctly all along so now i experience this problem in the applet viewer. Though, even before, i couldn't get anything to display in an applet.
    And yes, everything is in the same place as the html file.
    Thanks for your help!

    Here's a way to keep track of and paint images with a simple Rectangle array. And also a way to remove lengthy initialization code blocks from paintComponent. Move the images by moving the rectangles.
    import java.awt.*;
    import java.awt.event.*;
    import java.io.*;
    import java.net.*;
    import javax.imageio.ImageIO;
    import javax.swing.*;
    public class GameMapRx
        public static void main(String[] args)
            JFrame f = new JFrame();
            f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
            f.getContentPane().add(new GameMapPanel());
            f.setSize(400,400);
            f.setLocation(200,200);
            f.setVisible(true);
    class GameMapPanel extends JPanel
        Image[] images;
        Rectangle[] rects;
        boolean firstTime;
        final int PAD;
        public GameMapPanel()
            loadImages();
            firstTime = true;
            PAD = 20;
        protected void paintComponent(Graphics g)
            super.paintComponent(g);
            Graphics2D g2 = (Graphics2D)g;
            int w = getWidth();
            int h = getHeight();
            if(firstTime)
                initializeGameMap(w, h);
            for(int i = 0; i < rects.length; i++)
                Rectangle r = rects;
    g.drawImage(images[i], r.x, r.y, this);
    g2.draw(r);
    private void loadImages()
    String path = "images/duke/";
    String ext = ".gif";
    images = new Image[10];
    for(int i = 0; i < images.length; i++)
    try
    URL url = getClass().getResource(path + "T" + (i + 1) + ext);
    images[i] = ImageIO.read(url);
    catch(MalformedURLException mue)
    System.out.println("Bad URL: " + mue.getMessage());
    catch(IOException ioe)
    System.out.println("Unable to read: " + ioe.getMessage());
    private void initializeGameMap(int w, int h)
    rects = new Rectangle[images.length];
    int imageWidth = images[0].getWidth(this);
    int imageHeight = images[0].getHeight(this);
    int cols = (w - 2*PAD) / imageWidth;
    int xInc = imageWidth + (w - cols * imageWidth) / (cols + 1);
    int x0 = (w - cols * imageWidth -
    (cols - 1) * ((w - cols * imageWidth) / (cols + 1))) / 2;
    for(int i = 0; i < images.length; i++)
    int x = x0 + xInc * (i % cols);
    int rows = i / cols;
    int y = PAD + (imageHeight + PAD) * rows;
    rects[i] = new Rectangle(x, y, imageWidth, imageHeight);
    firstTime = false;

  • Problems with JList (multiple selection)

    hi!
    i have a simple question.. why does this construct not work? i recieve a Casting Exception!
    recList is a JList!
    if(source == send){
         String[] rec = (String[])recList.getSelectedValues();
         String message = messageArea.getText();
    thx,
    chris

    You can only cass an Object array to a String array if the array was created as a String array.
    Object[] o = new String[] { "string1", "string2" };
    String[] s = (String[])o; // this works fineIf it was created as an Object array, then you will get a ClassCastException:
    Object[] o = new Object[] { "string1", "string2" };
    String[] s = (String[])o; // throws ClassCastExceptionSo either you have to cast each Object element to a String, or copy all the elements to a String array like this:
    Object[] o = new Object[] { "string1", "string2" };
    String[] s = new String[o.length];
    System.arraycopy(o, 0, s, 0, o.length); // or copy them in a for-loop which may be faster for small arraysReturning you an Object array that was created as an Object array is the easiest way for the JList to return you the selected values. So that's why you can't just cast it to a String array even though YOU know they are all String objects.

  • Short, basic VB script works on 2003 Server but not on 2012 R2 server

    Hello all,
    Hopefully I'm posting this in the right place. I have a legacy VB script that I need to keep, but I'm having trouble getting it to work on Server 2012 R2.
    The script reads a file called "Test.txt" that contains the following string:
    String1|String2
    Part of the VB script is to read this "Test.txt" file and parse this line into 2 separate elements based upon the "|" delimeter:
    On Error Resume Next
    Dim FSI, inputFile, String, f, WshShell,WshNetwork, WshFSO, StringArray
    inputFile = "Test.txt"
    CONST ForReading = 1, ForWriting = 2, ForAppending = 8
    Set FSI = CreateObject("Scripting.FileSystemObject")
    Set f = FSI.OpenTextFile(inputFile, ForReading, True)
    Set WshShell=WScript.CreateObject("WScript.Shell")
    '********* Read the file ********
    String = f.ReadLine
    msgbox("String: "&string)
    '********* Split the line *******
    StringArray = Split(String,"|", -1, 1)
    msgbox("stringarray(0): "&stringarray(0))
    msgbox("stringarray(1): "&stringarray(1))
    The variables in this script when ran on Server 2003 are:
    string = String1|String2
    stringarray(0) = String1
    stringarray(1) = String2
    So this script parses the String1|String2 line perfectly on Server 2003. However, running this same VB script on Server 2012 R2 results in very strange output:
    The variables in this script when ran on Server 2012 R2 are:
    string = ӱƥt
    stringarray(0) = ӱƥt
    stringarray(1) =
    Is there anything on Server 2012 R2 that I need to install to get this to work in VB, or what is the issue with Server 2012 R2 and visual basic? I'd LOVE to redo this in PowerShell but I need to keep it Visual Basic for legacy reasons for a few more months.

    Hmm interesting. I tried using the 3 different "format" parameters for the OpenTextFile method, and none of them worked on Server 2012 R2:
    http://msdn.microsoft.com/en-us/library/aa265347(v=vs.60).aspx
    However, I copied the text file directly from the 2003 server and placed it on the 2012 R2 server, and then the script worked great!
    Thanks for steering me in the right direction Bill!

  • BPEL-Instanz dies silent if switch case is true boolean

    Hello,
    it is very curios. I have the following switch case:
    xp20:compare('string1', 'string2') = 0
    or
    string(xp20:compare('string1', 'string2')) = '0'
    The validation is ok, and the compiler compiles with 0 errors / 0 warnings.
    If I try to invoke the process, the instance dies silent.
    If i write 'string1' = 'string' the behavior is as expected and the instance is running.
    What's the reason
    I am using the last stable release version.
    Best regards
    Harald
    Message was edited by:
    user570114
    Message was edited by:
    user570114

    i just tested your case in 10.1.3.x, it works fine for me. i can see "'two strings do not match" in output variable as expected. can you please copy and past your entire switch block.
    here is my test case ( i took the Switch.bpel sample under references directory):
    <switch>
    <case condition="xp20:compare('string1', 'string2') = 0">
    <assign>
    <copy>
    <from expression="'Value is greater than zero'"/>
    <to variable="output" part="payload" query="/tns:resultMsg/tns:valueResult"/>
    </copy>
    </assign>
    </case>
    <otherwise>
    <assign>
    <copy>
    <from expression="'two strings do not match'"/>
    <to variable="output" part="payload" query="/tns:resultMsg/tns:valueResult"/>
    </copy>
    </assign>
    </otherwise>
    </switch>

  • How can i improve this function?i need your help....

    Hi guys,
    i'm a pratical question for you.
    I've developed a jas application that reads a txt file and convert it
    into an array of byte,fro putting it into a blob field of a db mysql.
    With big file i go in heap size memory!
    I want to improve my function that makes it,but i'm a bit
    inexpert...can you help me?
    I have a file so made...
    Each line has the same number of value,but i know this number only when
    i read the file
    string1 string2 string3................
    stringx double double......(ever double)
    stringy double double......(ever double)
    and other lines equals to them from the second.
    Only the first line has only strings.
    I have read this file using a string array to read the first line and
    an arraylist of "Riga" object to read the others lines.....i've used a
    vector to store partial data from lines reading and at the end i've
    created an array of byte in which i copy the vector.
    Can you help me improving my code?
    The file has about 50000 rows......so i go in heap memory size...
    i know my code isn't too optimized.....can you help me?Please,i'm a
    newbie,help me with code if possible...
    When i encode the objects i've created into an array of byte i use a
    whitespace to separe different value and a ; to separe different lines.
    I've done it because in a second moment i've to read the array of byte.
    Thanks...this is my code
    public class MyBean {
            private UploadedFile myFile;
            private ArrayList rows = new ArrayList();
        private List lines = new ArrayList();
        public MyBean(){
        public List getLines(){
            return lines;
        public void setLines(List lines){
            this.lines=lines;
    public boolean insRighe(Riga nuovo){
               return rows.add(nuovo);
        public UploadedFile getMyFile() {
            return myFile;
        public void setMyFile(UploadedFile myFile) {
            this.myFile = myFile;
        public ArrayList getRows() {
                    return rows;
            public void setRows(ArrayList rows) {
                    this.rows = rows;
        public String carica() throws IOException {
            Riga r;
            Double val[];
            Head h;
            int col=0;
            int row=0;
            byte middlerow=' ';
            byte endrow=';';
            byte[] data=null;
            Vector temp=new Vector();
            int numberOfNumericColumns=0;
            String geneid=null;
            String g=null;
            String[]intest=null;
            BufferedReader br = new BufferedReader(new
    InputStreamReader(myFile.getInputStream()));
                    String line = null;
            while ((line = br.readLine()) != null) {
                    line = line.replace (',', '.');
                    StringTokenizer st = new StringTokenizer(line);
                    numberOfNumericColumns = (st.countTokens()-1);
                    col=(numberOfNumericColumns+1);
                //se siamo nella prima riga(contatore segna 0)
                    if(row==0){
                            intest=new String[col];
                            int j=0;
                            while(st.hasMoreTokens()){
                                    intest[j]=(st.nextToken().trim());
                                    j++;
                            h=new Head(intest);//crei l'oggetto head
                            String []qa=h.getHvalues();
                            String asd="";
                        for(int i=0;i<=qa.length-1;i++){
                            asd=asd.concat(qa[i]+" ");
                        System.out.println("head "+asd);//stampo contenuto
    dell' head
                        row=1;
                    }//fine if
                    else
                            Double[] values=new Double[numberOfNumericColumns];
                        int z=0;
                        geneid=st.nextToken();
                        while (st.hasMoreTokens()) {
                            String app=st.nextToken();
                            values[z]=Double.valueOf(app);
                            z++;
                        r=new Riga(geneid,values); //crei l'oggetto riga
                        System.out.println("riga");
                        System.out.println(r.getgeneid());
                        values=r.getvalues();
                        for(int e=0;e<values.length;e++){
                            System.out.println(values[e]);
                        insRighe(r); //aggiungi
                    row++;
                    int i = 0;
                    while (i < intest.length) {
                            byte[] bytesnew = intest.getBytes();
    // temp.addAll(bytesnew);
    // memorizza in byte un elemento del vettore alla volta
    for (byte b : bytesnew)
    temp.add(new Byte(b)); // provare Byte
    // temp.addElement(intest[i].getBytes());
    temp.addElement(Byte.valueOf(middlerow));
    i++;
    temp.addElement(Byte.valueOf(endrow));
    System.out.println("Intestazione convertita in byte");
    for (int l = 0; l < rows.size(); l++) {
    r = (Riga) rows.get(l);
    g = r.getgeneid();
    // temp.addElement(g.getBytes());
    byte[] byte2 = g.getBytes();
    for (byte c : byte2)
    temp.add(new Byte(c));
    temp.addElement(Byte.valueOf(middlerow));
    val = r.getvalues();
    byte[] tempByte1;
    for (int e = 0; e <= val.length - 1; e++) {
    // Returns a string representation of the double argument.
    tempByte1 = Double.toString(val[e]).getBytes();
    for (int j = 0; j < tempByte1.length; j++) {
    temp.addElement(Byte.valueOf(tempByte1[j]));
    temp.addElement(Byte.valueOf(middlerow));
    temp.addElement(Byte.valueOf(endrow));
    data = new byte[temp.size()];
    for (int t = 0; t < temp.size(); t++) {
    data[t] = (((Byte) temp.elementAt(t)).byteValue());
    return data;
    public class Riga{
         private String geneid=null;
         private Double[] values=null;
         public Riga(String idGene,Double[] x ) {
    this.geneid=idGene;
    this.values=x;
         public String getgeneid(){
              return this.geneid;
         public void setgeneid(String idGene){
              this.geneid=idGene;
         public Double[] getvalues(){
              return this.values;
         public void setvalues(Double[] x){
              this.values=x;
    Message was edited by:
    giubat

    Maybe I didn't understand you, but why are you putting a file with 50000 rows as one single BLOB into a DB? Don't you think it's time for a new table?

  • Stopping Spam Emails

    Hi,
    I have the following bit of code in my contact page:
    <input type="hidden"
    name="recipient" value="[email protected]">
    But now am continually getting spam messages due to this. I
    have seen other bits of code like:
    <script language="JavaScript" type="text/javascript">
    <!--
    var string1 = "info";
    var string2 = "@";
    var string3 = "blah.com";
    var string4 = string1 + string2 + string3;
    document.write("<a href=" + "mail" + "to:" + string1 +
    string2 + string3 + ">" + string4 + "</a>");
    //-->
    </script>
    to stop robots picking up the email, but how do I incorporate
    this into the first bit of code?
    Thanks in advance.

    #!/usr/bin/perl --
    # A simple Perl-based CGI email handler.
    # Copyright 2004 Boutell.Com, Inc. Compatible with our
    earlier C program.
    # Released under the same license terms as Perl 5 itself.
    # We ask, but do not require, that you link to
    http://www.boutell.com/email/
    when using this script or a
    # variation of it.
    use CGI;
    my $sendmail = "/usr/sbin/sendmail";
    # A text file containing a list of valid email recipients and
    the web pages to
    # which the user should be redirected after email is sent to
    each, on
    # alternating lines. This allows one copy of the script to
    serve multiple
    # purposes without the risk that the script will be abused to
    send spam.
    # YOU MUST CREATE SUCH A TEXT FILE AND CHANGE THE NEXT LINE
    TO ITS
    # LOCATION ON THE SERVER.
    my $emailConfPath = "/home/public_html/email.conf";
    # Parse any submitted form fields and return an object we can
    use
    # to retrieve them
    my $query = new CGI;
    my $Email = &veryclean($query->param('Email'));
    my $recipient =
    &veryclean($query->param('recipient'));
    my $subject = &veryclean($query->param('subject'));
    my $Comments = &veryclean($query->param('Comments'));
    my $Sub = &veryclean($query->param('Sub'));
    #newlines allowed
    if (!open(IN, "$emailConfPath")) {
    &error("Configuration Error",
    "The file $emailConfPath does not exist or cannot be " .
    "opened. Please read the documentation before installing " .
    "email.cgi.");
    my $returnpage;
    my $ok = 0;
    while (1) {
    my $recipientc = <IN>;
    $recipientc =~ s/\s+$//;
    if ($recipientc eq "") {
    last;
    my $returnpagec = <IN>;
    $returnpagec =~ s/\s+$//;
    if ($returnpagec eq "") {
    last;
    if ($recipientc eq $recipient) {
    $ok = 1;
    $returnpage = $returnpagec;
    last;
    close(IN);
    if (!$ok) {
    &error("Email Rejected",
    "The requested destination address is not one of " .
    "the permitted email recipients. Please read the " .
    "documentation before installing email.cgi.");
    # Open a pipe to the sendmail program
    open(OUT, "|$sendmail -t");
    # Use the highly convenient <<EOM notation to include
    the message
    # in this script more or less as it will actually appear
    print OUT <<EOM
    To: $recipient
    Subject: $subject $Sub
    Reply-To: $Email
    [This message was sent through a www-email gateway.]
    Email Add. : $Email
    Comments : $Comments
    EOM
    close(OUT);
    # Now redirect to the appropriate "landing" page for this
    recipient.
    print $query->redirect($returnpage);
    exit 0;
    sub clean
    # Clean up any leading and trailing whitespace
    # using regular expressions.
    my $s = shift @_;
    $s =~ s/^\s+//;
    $s =~ s/\s+$//;
    return $s;
    sub veryclean
    # Also forbid newlines by folding all internal whitespace to
    # single spaces. This prevents faking extra headers to cc
    # extra people.
    my $s = shift @_;
    $s = &clean($s);
    $s =~ s/\s+$/ /g;
    return $s;
    sub error
    # Output a valid HTML page as an error message
    my($title, $content) = @_;
    print $query->header;
    print <<EOM
    <html>
    <head>
    <title>$title</title>
    </head>
    <body>
    <h1 align="center">$title</h1>
    <p>
    Email Add. : $Email
    Comments : $Comments
    </p>
    EOM
    exit 0;

  • Using Instr in Cursors or Loops...?

    Can anyone suggest me how to use "Instr" to find one parameter string in another parameter string, finding if one string is present in another using loops..??
    Edited by: user11339127 on Jul 1, 2009 11:04 PM

    You can use INSRT to find the position of your string in a given string.
    e.g:  select instr('navnit','av') from dual;  --sql
    PL/SQL--
    declare
       pos number;
    begin
      pos := instr('<string1>','<string2'>; or you can write in case of forms as pos:=instr('<:datablock>.<item>','<string to found');
      if pos = <some value> then
          <do something
      end if;
    end;  
    {coe}
    Similarly , you can extend your code.
    Hope it helps.
    +Please mark answer as helpful / correct, if it helps you+
    Navnit                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   

  • Pacman - his error messages - and clarity

    first
    [root@gateway ~]# pacman -Syu
    :: Synchronizing package databases...
    current [################] 100% 41K 12.7K/s 00:00:03
    extra [################] 100% 164K 19.9K/s 00:00:08
    Targets: abiword-2.0.12-1 dbh-1.0.20-1 doxygen-1.3.9.1-1 evolution-2.0.2-2
    evolution-data-server-1.0.2-1 flac-1.1.1-1 gaim-1.0.1-1 gal-2.2.3-1
    gdm-2.6.0.5-2 gimp-2.0.5-1 glib2-2.4.7-1 gmp-4.1.4-1
    gnome-panel-2.8.1-1 heimdal-0.6.2-1 gnome-vfs-2.8.2-1 gqview-1.4.5-1
    jack-audio-connection-kit-0.99.0-1 gst-plugins-0.8.5-1
    gstreamer-0.8.7-1 gtk2-2.4.13-1 gtkhtml-3.2.3-1 imagemagick-6.1.1-1
    imlib-1.9.15-1 iptables-1.2.11-3 libogg-1.1.2-1 libsoup-2.2.1-1
    libtiff-3.6.1-4 libvorbis-1.1.0-1 man-pages-1.69-1 mozilla-1.7.3-1
    mozilla-firefox-0.10.1-2 nautilus-2.8.1-1 perl-html-parser-3.36-1
    reiserfsprogs-3.6.19-1
    Total Package Size: 94.8 MB
    Proceed with upgrade? [Y/n]
    :: Retrieving packages from current...
    abiword-2.0.12-1 [################] 100% 3683K 29.3K/s 00:02:05
    doxygen-1.3.9.1-1 [################] 100% 1278K 23.1K/s 00:00:55
    gaim-1.0.1-1 [################] 100% 3964K 27.2K/s 00:02:25
    gimp-2.0.5-1 [################] 100% 10290K 25.7K/s 00:02:24
    glib2-2.4.7-1 [################] 100% 1082K 25.8K/s 00:00:41
    gmp-4.1.4-1 [################] 100% 240K 32.0K/s 00:00:07
    gqview-1.4.5-1 [################] 100% 298K 25.1K/s 00:00:11
    gtk2-2.4.13-1 [################] 100% 6229K 24.6K/s 00:04:13
    imagemagick-6.1.1-1 [################] 100% 4317K 24.9K/s 00:02:53
    imlib-1.9.15-1 [################] 100% 535K 36.3K/s 00:00:14
    iptables-1.2.11-3 [################] 100% 243K 23.2K/s 00:00:10
    libogg-1.1.2-1 [################] 100% 19K 14.6K/s 00:00:01
    libtiff-3.6.1-4 [################] 100% 450K 23.6K/s 00:00:19
    libvorbis-1.1.0-1 [################] 100% 451K 24.2K/s 00:00:18
    man-pages-1.69-1 [################] 100% 3638K 28.5K/s 00:02:07
    mozilla-firefox-0.10.1-2 [################] 100% 11678K 27.3K/s 00:02:52
    reiserfsprogs-3.6.19-1 [################] 100% 441K 29.7K/s 00:00:14
    :: Retrieving packages from extra...
    dbh-1.0.20-1 [################] 100% 25K 7.9K/s 00:00:03
    evolution-2.0.2-2 [################] 100% 10527K 15.9K/s 00:02:31
    evolution-data-server-1. [################] 100% 1330K 12.0K/s 00:01:50
    flac-1.1.1-1 [################] 100% 587K 20.6K/s 00:00:28
    gal-2.2.3-1 [################] 100% 1326K 16.9K/s 00:01:18
    gdm-2.6.0.5-2 [################] 100% 2805K 28.6K/s 00:01:38
    gnome-panel-2.8.1-1 [################] 100% 2705K 24.5K/s 00:01:50
    heimdal-0.6.2-1 [################] 100% 1297K 17.6K/s 00:01:13
    gnome-vfs-2.8.2-1 [################] 100% 1479K 27.2K/s 00:00:54
    jack-audio-connection-ki [################] 100% 186K 26.6K/s 00:00:07
    gst-plugins-0.8.5-1 [################] 100% 1940K 19.0K/s 00:01:42
    gstreamer-0.8.7-1 [################] 100% 1511K 21.9K/s 00:01:09
    gtkhtml-3.2.3-1 [################] 100% 1246K 20.7K/s 00:01:00
    libsoup-2.2.1-1 [################] 100% 222K 29.2K/s 00:00:07
    mozilla-1.7.3-1 [################] 100% 16636K 25.8K/s 00:02:12
    nautilus-2.8.1-1 [################] 100% 4109K 10.0K/s 00:02:35
    perl-html-parser-3.36-1 [################] 100% 78K 24.1K/s 00:00:03
    checking package integrity... done.
    loading package data... done.
    checking for file conflicts...
    error: the following file conflicts were found:
    heimdal: /usr/man/man8/rshd.8.gz: exists in filesystem
    errors occurred, no packages were upgraded.
    [root@gateway ~]# pacman -Ql /usr/man/man8/rshd.8.gz
    Package "/usr/man/man8/rshd.8.gz" was not found.
    [root@gateway ~]# pacman -Qo /usr/man/man8/rshd.8.gz
    /usr/man/man8/rshd.8.gz is owned by netkit-rsh 0.17-2
    [root@gateway ~]# pacman --version
    .--. Pacman v2.9.2
    / _.-' .-. .-. .-. Copyright (C) 2002-2004 Judd Vinet <[email protected]>
    '--' This program may be freely redistributed under
    the terms of the GNU General Public License
    [root@gateway ~]#
    Little addon ... maybe pacman could say something about "overwriting" files...
    if its intended to.. or should never ever happen... whatever.. maybe with msg's the pkg-distributer made himself (cuz at least he should know WHY of IF it should happen )
    this could be achieved by putting info in the pgk that there will be files to overwrite... so the user still is able to say "oh no don't touch it!" if he doesn't want pac'y to do that...
    like:
    REWORKDESTINATION=" /usr/man/man8/rshd.8.gz  /foo/bar"
    REWORKMESSAGE="1. just cuz im funny... <split> 2. heavy bugs fixed"
    [root@gateway ~]# pacman -S heimdal
    Targets: heimdal-0.6.2-1
    Total Package Size: 1.3 MB
    Proceed with upgrade? [Y/n]
    checking package integrity... done.
    loading package data... done.
    checking for file conflicts...
    error: the following file conflicts were found:
    heimdal: /usr/man/man8/rshd.8.gz: exists in filesystem
    reworkinfo: Just cuz im funny...
    do you want to overwrite? (YES/no) :_
    so you could also -f pac'y and he simply overwrites exept things on the <b>HoldPkg !</b> (so you still feel save with some things )
    secondly
    it would be nice to make pacman capable to download/install pgk with given versions... but as far as i see there are a lot threats about that
    thirdly
    it would also be nice if a pkg you install could add things to the pacman.conf like NoUpgrade and HoldPkg. ... eg. updating cups ... it saves the configfiles.. yeah... but as .pacsave and cups is after restarting the deamons unuseable cuz it loads with the new ones ... the other way round would be nicer...
    so if you install cups the first time the pkg it self writes into pacman.conf:
    NoUpgrade /etc/cups/cupsd.conf /etc/cups/classes.conf /etc/cups/client.conf /etc/cups/mime.convs /etc/cups/mime.types /etc/cups/printes.conf
    maybe with a update function like:
    Syntax: update(file, method, string1, string2);
    example:
    update(pacman.conf,add,"NoUpdate NoUpgrade /etc/cups/cupsd.conf /etc/cups/classes.conf /etc/cups/client.conf /etc/cups/mime.convs /etc/cups/mime.types /etc/cups/printes.conf, )
    and when you remove the pkg it does automatically:
    update(pacman.conf, remove, "NoUpgrade /etc/cups/cupsd.conf /etc/cups/classes.conf /etc/cups/client.conf /etc/cups/mime.convs /etc/cups/mime.types /etc/cups/printes.conf", )
    this could also work with a substitute-method so in pkg-updates you can also update pacman.
    i think that would heavily increase the power of pacman - wich already is a realy mighty thing

    I like 1 and 3.... very good ideas - especially number 1.. it'd be nice to have overwrite functionality in packages
    about number 2 - this issue has been brought up ad nauseum.... Arch is considered by users and developers a "bleeding edge distro" - that is, Arch uses the newest packages, assuming they work.  allowing users to manually grab a non-bleeding edge package, or even downgrade their packages is, for lack of a better phrase, against policy.  If something is not functional in a given package, then Arch as a whole should be downgraded until the package is working.  If a new version replaces the old with differing functionality, the packages should be installed side-by-side (as is the case with gtk1 & gtk2, imlib & imlib2, and many more).
    In a bleeding edge distro, downgrading a package simply because a user "likes SomePackage 0.9 better than 1.0" is not worthwhile.  Package management would become so much more difficult and require much more space.
    If there is a problem with a package (i.e. "I upgraded to Blah 0.6.5 from 0.6.3 and it doesn't work now") then the problem is most likely on your system and should be fixed.  Blame the developers, blame yourself, whatever... the fact of the matter is you need to expect this sort of thing with Arch...

Maybe you are looking for

  • Unable to get phone line working - next appointmen...

    Hi I moved home a few day before Christmas and the phone and broadband were due to be activated on the 7th January which was fully understandable. Nothing happened on that day so after calling the helpdesk I was told it should be done on the 9th. On

  • Lenovo s650 won't boot, USB doesn't work

    I bought this phone and installed a root app. I may delete some system files with root app. Since that, the phone won't boot. I tried Smart Phone Flash Tool but the Firmware won't be updated as USB doesn't work. What can I do at this point? Please he

  • ME22N Show Numerator for Conversion of Order Price Unit into Order Unit

    I hide Price in Me22n, when we do this, system hide the "Numerator for Conversion of Order Price Unit into Order Unit",  but i want show this field on screen. This field is : in Me22n -> view "Quantites/Weights "->"Order Unit <-> Ord. Price Unit". Ho

  • TS1702 Applications do not download

    The applications that I won't to download don't download

  • IPhone upgrade to 2.0 error

    After doing some research online, it seems that other people are getting errors while upgrading their original iPhone to 2.0. Would anyone happen to know what error code -6971 is, because this is the code I get when trying to upgrade my phone. I've s