Problem with building array inside a case statement

I have a problem with my build array.
Iam trying to construct a build array when ever I see a new element in my parent array during run time.
Using shift registers, search array and If- case structure, inside a while loop. Iam implementing this logic (I dont want to use Event structure).
Iam able to achieve most part of it, but have a problem with the first element. Except the first element of my parrent array, every thing is appending in to the build array. Can any one look at my vi and suggest me what Iam doing wrong here.
Thank you
Attachments:
debug.vi ‏12 KB

I think you need to replace the tunnels (carrying the array) in the for loop with a shift register.
Lynn

Similar Messages

  • Problem with build Array

    Hi,
    when I am trying to save my capacitor values into a file, they are storing as 0. But LCR meter is reading values in pico farads. i m attaching my program. please suggest me necessary changes in my program  
    Attachments:
    Agilent E4980 Capacitor Measurement.vi ‏19 KB

    Hi Guruva,
    change the format specifier of the Write-function to "%g"... And read the help for those format codes!
    Message Edited by GerdW on 12-07-2009 04:03 PM
    Best regards,
    GerdW
    CLAD, using 2009SP1 + LV2011SP1 + LV2014SP1 on WinXP+Win7+cRIO
    Kudos are welcome

  • Trying to clear an array inside a case structure

    Good morning all.  I am trying (unsuccessfully, obviously) to clear an array inside a case structure.  (See case structure at right side of vi, I colored it green to make it easy to find).  Here's (briefly) what I'm trying to do.  I have 6 test probes in the process.  All six probes are connected to the Alcatel Detector through a 6-solenoid manifold.  As I run the test, I want to sample 1/second, for let's say 3 minutes.  For the first 30 seconds, I want to pull a sample from from probe 1, so I turn on solenoid one and leave it open for 30 seconds.  Now all 30 values are tagged as having come from Probe 1, and they're stored in array 1.  I can now compute an average value for probe 1. Then I close solenoid 1 and open solenoid 2, saving the next 30 values to array 2.  (and so-on, until I have measured all 6 probes for 30 seconds each).  Then I wait a pre-determined amount of time and repeat the process.  Here's my problem.  I want to clear out each array as I begin the second iteration, so that I can easily compute the average of the last 30 values.  If I initialize the array by connecting a constant 0 to the shift register on the for loop insid ethe case structure, it does not work, nor does it work to place the 0 outide the overall for loop (the next for loop going out, NOT the OVERALL for loop).  I know my programming skills are still crude, but I'm putting everything into this.  Anyone have any suggestions? 
    Attachments:
    HCMF rev 1 25 Apr.vi ‏485 KB

    Altenbach, I definately understand your approach, and I like it much better than my own.  But I still have no luck making it work.   I get the same result as before (my original attempt).  Value 0 of the array simply changes each iteration, with nothing "saved".  Each new value simply overwrites the last value.  Can you take a look at my new vi, with changes, and see if you can find the error of my ways.  I am but a rookie Jedi in the vast reaches of LabVIEW Space, and you are no doubt a Jedi MASTER
    Attachments:
    HCMF rev 1 25 Apr pm.vi ‏374 KB

  • Decode Statement Inside the Case statement

    Can we use Decode Statement inside a CASE Statement as show below --
    It is giving an error -- Is the a better way to write with out any error
    create or replace
    function test (a varchar2) RETURN VARCHAR2
    is
    m varchar2(20);
    begin
    m :=
    CASE
    WHEN a IN (
    '1009' -- (soon obsolete)
    ,'1010'
    ,'1019'
    ,'1051'
    ,'XGP'
    ,'XSC')
    THEN (SELECT DECODE(v_lef_cd,'NAM','71','GLB','99','01') into m FROM DUAL)
    -- ) THEN '01' -- UNITED STATES OF AMERICA
    WHEN a IN (
    '1069' -- South Africa
    ,'SAO' -- South Africa
    ,'SA' -- South Africa
    ) THEN '26' -- South Africa
    ELSE NULL
    END;
    return m;
    end;

    Hi,
    You can only use DECODE in SQL statements.
    Your SELECT DECODE (...) INTO statement would work anywhere a PL/SQL statement is allowed; but PL/SQL statements are not allowed within CASE expressions.
    Remember, the expression that comes after THEN in a CASE expression must be a single value.
    I would write a function like this using IF ... ELSIF statements. It's a little more typing than CASE, but a lot easier to code, test and maintain.
    If you want to use CASE, here's one way:
    ...     m := CASE
              WHEN  a  IN ('1069', 'SAO', 'SA')
                   THEN  '26'     -- South Africa
              WHEN  a  NOT IN ('1009', '1019', '1051', 'XGP', 'XSC')
              OR    a  IS NULL
                   THEN  NULL
              WHEN  v_lef_cd = 'NAM'
                   THEN  '71'
              WHEN  v_lef_cd = 'GLB'
                   THEN  '99'
                   ELSE  '01'     -- USA
              END;This assumes that you have a variable v_lef_cd defined.
    If you want, you can nest CASE expressions, like this:
    ...     m := CASE
              WHEN  a  IN ('1069', 'SAO', 'SA')
                   THEN  '26'     -- South Africa
              WHEN  a  IN ('1009', '1019', '1051', 'XGP', 'XSC')
                   THEN  CASE  v_lef_cd
                          WHEN  'NAM'
                             THEN  '71'
                          WHEN  'GLB'
                             THEN  '99'
                             ELSE  '01'     -- USA
                         END
              END;Always format your code, so you can see where the CASE expressions and each of the WHEN clauses begin and end.
    When posting formatted text on this site, type these 6 characters:
    (all small letters, inside curly brackets) before and after sections of formatted text, to preserve spacing.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   

  • Problem with an array (Array index out of bounds)

    Hey guys, i have a problem with an array, i just want to print a few things but it won't let me because of this error, here's my code
         public static void MosDat()
              int i;
              for(i=0 ; i<n ; i++);
                   Client [ i ].print1();
                   Client [ i ].print2();
              return;
         }//MosDat
    where "n" is a global variable, and client is .
    I pretty much know how it woks, so i tried it like this and gave "n" the value of "1":
    public static void MosDat()
              int i;
              for(i=0 ; i<n ; i++);
                   Client [ 0 ].print1();
                   Client [ 0 ].print2();
              return;
         }//MosDat
    the printing methods i created worked prefectly when i tried it like that... so i really don't know where the problem could be... thanks anyone who can help me.

    for(i=0 ; i < n ; i++);I spy with my little eye,
    one semicolon too many.Well-spotted. ;-)Practicing on those weird question marks is my secret training.

  • What does a red outline inside a Case Statement mean?

    I'm developing some code, and opened an existing VI that has a Queued Message Handler inside it.  One Message Case ("Shutdown") has a thin red outline on the inner border of the Case "box" -- what does this mean, where did it come from, and what should I do about it (including "How do I get rid of it?")?.
    This code was developed in LabVIEW 2012.  I'm pretty sure I haven't seen this previously.  I should probably mention that I tested this VI, it quit unexpectedly (possibly by throwing an error somewhere), and I'm looking at the "saved VI".

    Thanks to GerdW and tst for the rapid responses.  Some observations (before this "goes away").  First, right-clicking on a blank space inside the Case Statement brings up the Function palette (oops -- I didn't read your reply carefully -- you said to click the Breakpoint Tool, just a sec -- yep, that does it, but I don't think I've ever used the Breakpoint tool, rather I manage Breakpoints by right-clicking on wires and going from there).  Second, I used the Breakpoint Tool to put the breakpoint back on this Case, and brought up the Breakpoint Manager by right-clicking the Error line and choosing Breakpoint Manager.  Sure enough, it popped up a notice saying there was one breakpoint set on a Diagram object.  When I cleared it, it cleared the top left red border and about 15% of the left side border (at the top), but most of the red border remained until I clicked away from this case then clicked back.
    Thanks for the explanation.  Where is this noted?  I did a search for Case Statement, didn't see it.  I suppose if I already knew it was a Breakpoint notification, I could have found it under Breakpoint Help ... (nothing like Knowing the Answer to help you Find the Answer).

  • Performance Problems with intrinsic array multiplikation in Fortran with Su

    Hello,
    I found a serious performance problem in my application with intrinsic array multiplikation. Therefore I wrote a small test program to check if this a general problem or only exists in my code.
    The test program (as seen below) was compiled with Sunstudio12 und Solaris 5.10 on an 64 bit Amd Opteron Machine. First with high optimization (f95 -fast -g), and the second time with out optimization (f95 -O0 -g). In both cases the intrinsic array mupltiplication had a lot of tlb and L2 cache misses (I made some test with the performance analyzer) which caused a huge increase in computation time compared to the explicit loop. In the ideal case the compiler should create the nested loops from the intrinsic statement and both functions should use exactly the same computing time.
    I also tried compiling with Studio11, the problem also occurs there. Maybe its a compiler bug but I'm not sure.
    Greetings
    Michael Kroeger
    program test
    !Test zur Ausfuehrung einer einfachen array Multiplikation
    implicit none
    real,dimension(:,:,:),pointer::check1,check2
    integer i,j,k,ni,nj,nk,status
    ni=1000
    nj=1000
    nk=100
    allocate(check1(0:ni,0:nj,0:nk),STAT=status)
    write(*,*)status
    allocate(check2(0:ni,0:nj,0:nk),STAT=status)
    write(*,*)status
    check1(i,j,k)=25
    check2(i,j,k)=25
    call intrinsic_f(check1)
    call withloop(check2,i,j,k)
    deallocate(check1,check2)
    contains
    subroutine intrinsic_f(check1)
    real, dimension(:,:,:),pointer::check1
    check1=check1*5
    end subroutine intrinsic_f
    subroutine withloop(check2,ni,nj,nk)
    real, dimension(:,:,:),pointer::check2
    integer i,j,k,nk,nj,ni
    do k=0,nk
    do j=0,nj
    do i=0,ni
    check2(i,j,k)=check2(i,j,k)*5
    enddo
    enddo
    enddo
    end subroutine withloop
    end program

    I will try the large pages, but what me puzzles is, that the intrinsic function has cache misses, but the loop function has not. All documentation says, that the compiler would expand the intrinsic function into 3 nested loops, so that both functions should be essential the same (and the compiler says it has created 3 loops from the intrinsic). Since they are not the same, this is a severe problem.
    I have a fairly large code for high performance simulations, and this intrinsic functions are a significant bottle neck. If it is not a compiler bug, I would have to rewrite all intrinsic functions into loops.

  • Issue with TableAdapter Configuration Wizard and CASE statements

    I am having an issue with using any CASE statements in the select clause for the Table Adapter Configuration Wizard (TCW).  I can take any query without a CASE and it will run fine, but inserting any CASE statement in the Select such as:
    SELECT
    (CASE WHEN :ras_sort = 'D' THEN TO_CHAR(a.TRANS_DATE,'YYYYMMDD')
      WHEN :ras_sort = 'C' THEN  c.CLAIMDEP_NAME
      WHEN :ras_sort = 'A' THEN  TO_CHAR(a.ACCOUNT_NUMBER)
      END) sort1
    FROM xxxx
    causes the TCW to error with "error in list of function arguments, 'THEN' not recognized" and several other errors.  I have tried with and without parameters in the CASE and have tried both forms of the CASE statement.  I have tried multiple queries, all that run with no problem outside of TCW and ODP, but this seems to be a real issue
    Is this a known problem and are there any workarounds that will allow use of the TCW?
    Thanks,
    Dave

    Hi Ashish,
    perhaps you launch the Web service wizard from the wrong location (i.e. not selecting the SEI you want to use). Did you strictly follow the steps described in the <a href="http://help.sap.com/saphelp_nwce10/helpdata/en/44/f36fa8fd1d41aae10000000a114a6b/frameset.htm">documentation</a> for creating the web service?

  • Problem with building conditional display items

    Dear All,
    Please help as I am using APEX for the first time.
    This my requirement during form dispaly in tabular format. There is one display item QA_TIER(not a database item). This item value is computed based on the condition below.
    I created a display item with :
    Source Used : Always, replacing any existing value in the session state
    Source Type: PL/SQL Expression or Function
    Source value or expression:
    begin
    if 2<=(select decode(&Leg_Req,'Y',1,0)+decode(&maj_funct_chg,'Y',1,0)+
    decode(&maj_tech_chg,'Y',1,0)+decode(&maj_ui_chg,'Y',1,0)+
    decode(&maj_def_met,'Y',1,0) from dual) then
    if &Customer_Priority = 1 then
    return 1;
    else
    return &Customer_Priority-1;
    end if;
    ELSE return &Customer_Priority; end if;
    end;
    Note : All reference with '&' are the actual field name.
    When running the page i get the following error message:
    ORA-06550: line 2, column 23: PLS-00103: Encountered the symbol "&" when expecting one of the following: ( ) - + case mod new not null others select table avg count current exists max m ORA-06550: line 2, column 48: PLS-00103: Encountered the symbol "&" when expecting one of the following: ( ) - + case mod new not null others table avg count
         Error      ERR-1020 Error in PLSQL item processing (function).
    Can anybody help me with building the display item with conditions as show above.
    Thanks in advance

    hi thanks for the help.
    I tried this time source type SQL Query:
    with both suggestions
    1.
    select (case when
    2<=to_number((select decode(v(Leg_Req),'Y',1,0)+decode(v(maj_funct_chg),'Y',1,0)+
    decode(v(maj_tech_chg),'Y',1,0)+decode(v(maj_ui_chg),'Y',1,0)+
    decode(v(maj_def_met),'Y',1,0) from dual)) then
    (select decode(v(Customer_Priority),1,1,v(Customer_Priority)-1) from dual)
    ELSE v(Customer_Priority) end) from dual
    Result:
    ORA-00904: "CUSTOMER_PRIORITY": invalid identifier
         Error      ERR-1019 Error computing item default value: page=2 name=QA_TIER.
    2.
    select (case when
    2<=to_number((select decode(:Leg_Req,'Y',1,0)+decode(:maj_funct_chg,'Y',1,0)+
    decode(:maj_tech_chg,'Y',1,0)+decode(:maj_ui_chg,'Y',1,0)+
    decode(:maj_def_met,'Y',1,0) from dual)) then
    (select decode(:Customer_Priority,1,1,:Customer_Priority-1) from dual)
    ELSE :Customer_Priority end) from dual
    Result:
    ORA-00932: inconsistent datatypes: expected NUMBER got CHAR
         Error      ERR-1019 Error computing item default value: page=2 name=QA_TIER.
    Both didn't work.

  • Problem with an array

    i have problem with my program i implement saveing method
    but when i open file( game.txt) it does not update my board it return same postion every time i same game
    chess class Jframe(Jfilechooser)(call an board array)---->
    Gui Japplet class( call and board array------------>
    Board(class Jpanel have board array)
    it does not update borad array
    it just call it once in start and return the same value every time
    classChess(){
    ChessPlayer  java = new ChessPlayer();
    public  void saveData()
        File file = null;
       JFileChooser fc = new JFileChooser();
       fc.setCurrentDirectory(new File("."));
        fc.setDialogTitle("Save Text As...");
       int returnVal = fc.showSaveDialog(this);
       if (returnVal == JFileChooser.APPROVE_OPTION)
       { file = fc.getSelectedFile();
         try
         { PrintWriter out =
          new PrintWriter(
         new BufferedWriter(
           new FileWriter(file)));
         //while for all the moves in the array>
    for (int i=0;i<120;i++)
         out.println( java.saveDAta(i));
         out.println("\n");
         out.close();
         catch (IOException e) {
              // Some error has occured while trying to read the file.
                // Show an error message.
             JOptionPane.showMessageDialog(this,
                   "Sorry, some error occurred:\n" + e.getMessage());}
    public static void main(String[] args) {
    JPopupMenu.setDefaultLightWeightPopupEnabled(false);
         JFrame frame = new ChessMan();
         Container content = frame.getContentPane();
         ChessMan f = new ChessMan();
              //japplet
         ChessPlayer  javaAppletication = new ChessPlayer();
            javaAppletication.init();
            javaAppletication.start();
       }Gui
    [Gui]
    class Gui{
    int [] board = new int [120];
         int [] boardcolor = new int [120];     
    Board check = new Board(this,false);
    {public void init()
         {        // Create new Border
         contentPane = getContentPane();
         bboard = new Board(this,false);
    public String saveDAta(int i)
    String l=check. save(i);
    return (l);
    and finally board Jpanel
    class Board extends JPanel
    {public Board (JApplet useapplet,boolean bool) {
       setup();
    { public String  save(int i)
         {  String l;
                   if (color==1)
                 {System.out.println("notpossible");}
               l =  board[i]+"$"+boardColor;
    return l;
    thanks guys

    My Jframe
    public class ChessMan extends JFrame implements ActionListener, WindowListener  {
    JMenuItem saveItem, loadItem, copyItem, pasteItem; 
    JMenu fileMenu, editMenu; 
    JMenuBar bar;
    ChessPlayer  java = new ChessPlayer();
    public ChessMan()  { setTitle("CHESS PLAYER GAME" );
    setSize(200,300);
    System.out.println("\n");      }
    addWindowListener(new java.awt.event.WindowAdapter()
         {      public void windowClosing(java.awt.event.WindowEvent e)
         {        System.exit(0);      }    });
    JMenu fileMenu = new JMenu("File");
    saveItem = new JMenuItem("Save");
    saveItem.setActionCommand("save");
    saveItem.setAccelerator( KeyStroke.getKeyStroke("ctrl S"));
    saveItem.addActionListener(this);
    fileMenu.add(saveItem);
    loadItem = new JMenuItem("Load");
    loadItem.setActionCommand("load");
    loadItem.setAccelerator( KeyStroke.getKeyStroke("ctrl L"));
    loadItem.addActionListener(this);
    fileMenu.add(loadItem);
    JMenu editMenu = new JMenu("About");
    copyItem = new JMenuItem("Help");
    copyItem.setActionCommand("Help");
    copyItem.setAccelerator( KeyStroke.getKeyStroke("ctrl H"));
    copyItem.addActionListener(this);
    editMenu.add(copyItem);
    pasteItem = new JMenuItem("Exit");
    pasteItem.setActionCommand("Exit");
    pasteItem.setAccelerator( KeyStroke.getKeyStroke("ctrl E"));
    pasteItem.addActionListener(this);
    editMenu.add(pasteItem);
    JMenuBar bar = new JMenuBar();
    bar.add(fileMenu);
    bar.add(editMenu);
    setJMenuBar(bar);
    setVisible(true);
    setLocation(0,0);
    public void actionPerformed(ActionEvent e) {
    JMenuItem item = (JMenuItem)e.getSource();
    String    ac   = item.getActionCommand();
    System.out.println("ac = "+ ac);
    // you can use action commands to track menu item events   
    if(ac.equals("save"))
         {System.out.println("ac.equals(\"save\") = "+ ac.equals("save"));
            saveData();}
    if(ac.equals("load"))
    {System.out.println("ac.equals(\"load\") = "+ ac.equals("load"));
                         loadingData();}
       if(ac.equals("Help"))
    {System.out.println("ac.equals(\"load\") = "+ ac.equals("Help"));
    if(ac.equals("Exit"))
    {System.out.println("ac.equals(\"load\") = "+ ac.equals("Exit"));
                         Exit();}                   
    // the event origin  
    if(item == saveItem)
         System.out.println("item = "+ item.toString().substring
         (item.toString().indexOf("text=") + 5, item.toString().lastIndexOf("]")));
    if(item == loadItem)
         System.out.println("item = "+ item);
    //   System.out.print( java.saveDAta());
    public  void saveData()
        File file = null;
       JFileChooser fc = new JFileChooser();
       fc.setCurrentDirectory(new File("."));
        fc.setDialogTitle("Save Text As...");
       int returnVal = fc.showSaveDialog(this);
       if (returnVal == JFileChooser.APPROVE_OPTION)
       { file = fc.getSelectedFile();
         try
         { PrintWriter out =
          new PrintWriter(
         new BufferedWriter(
           new FileWriter(file)));
         //while for all the moves in the array>
    for (int i=0;i<120;i++)
         out.println( java.saveDAta(i));
         out.println("\n");
         out.close();
         catch (IOException e) {
              // Some error has occured while trying to read the file.
                // Show an error message.
             JOptionPane.showMessageDialog(this,
                   "Sorry, some error occurred:\n" + e.getMessage());}
       public  void loadingData()
       File loadfile = null;
       JFileChooser fc = new JFileChooser();
          fc.setDialogTitle("OpenFile...");
       fc.setCurrentDirectory(new File("."));
        int returnVal = fc.showOpenDialog(this);
       if (returnVal == JFileChooser.APPROVE_OPTION)
       { loadfile = fc.getSelectedFile();
          try
         { PrintWriter out =
         new PrintWriter(
         new BufferedWriter(
           new FileWriter(loadfile)));
         //while for all the moves in the array>
            out.println("�����������������");
         out.println("\n");
         out.close();
         catch (IOException e) {
              // Some error has occured while trying to read the file.
                // Show an error message.
             JOptionPane.showMessageDialog(this,
                   "Sorry, some error occurred:\n" + e.getMessage());}
    public void Exit()
    System.exit(0);
    public static void main(String[] args) {
    JPopupMenu.setDefaultLightWeightPopupEnabled(false);
         JFrame frame = new ChessMan();
         Container content = frame.getContentPane();
         ChessMan f = new ChessMan();
         f.setLocation(300,300);
         f.show();
                 ImageIcon customImageIcon = new ImageIcon("ac516.gif");
              Image customImage = customImageIcon.getImage();
              frame.setIconImage(customImage);
                 //japplet
         ChessPlayer  javaAppletication = new ChessPlayer();
         // i could not put my constructor here <Static>     
    javaAppletication.init();
    javaAppletication.start();
    // for(int i=0; i < .length(); i++)
    content.add(javaAppletication, BorderLayout.CENTER);
         frame.getContentPane();
    javaAppletication.setBackground (Color.black);
         frame.setVisible(true);
    frame.show();
    frame.pack(); // invokes getPreferredSize()
    // invokes paint();
    public void windowOpened(WindowEvent e) {
    fileMenu.doClick();
    public void windowClosing(WindowEvent e) {}
    public void windowClosed(WindowEvent e) {}
    public void windowIconified(WindowEvent e) {}
    public void windowDeiconified(WindowEvent e) {}
    public void windowActivated(WindowEvent e) {}
    public void windowDeactivated(WindowEvent e) {}
    My Japplet Class
    class ChessPlayer extends JApplet
         implements ActionListener,MouseListener              
    int c;
         //Reference for new Board
               Board bboard;
         //Reference for Button
             JButton newgame,undo,onePlayer,TwoPlayer,NormalPieceSet,
             FuunyPieceSet,startButton,stopButton;
         //Reference for Label  
              JLabel message;
        //Reference for new Panel
             JPanel buttonpanel2,buttonpanel,messagepanel,buttonpane;
         //Initilize the  Applet
          DemoAnimation Demo;
          Container contentPane;
           Board check = new Board(this,false);
               int [] board = new int [120];
           int [] boardcolor = new int [120];
         public void init()
                   // Create new Border
            contentPane = getContentPane();
         check = new Board(this,false);          
         bboard = new Board(this,false);
         bboard.setPreferredSize(new Dimension(500,400));
        bboard.setBorder(BorderFactory.createLineBorder( Color.red ) ); 
         contentPane.add(bboard);   
         final ImageIcon image = new ImageIcon("ac516.gif");
         bboard.addMouseListener(this);
         bboard.setBackground (Color.black); 
         BorderLayout text=new BorderLayout();
        Demo = new DemoAnimation( this );
         Demo.setPreferredSize(new Dimension(160, 500));
         contentPane.add(Demo);
        // Set Background Black
         contentPane.setBackground (Color.black); 
         contentPane.setLayout (new BorderLayout (50,50));
         // set new Font "TimesRoman"
         Font Text= new Font("TimesRoman", Font.BOLD,15);
         //panel to keep buttons together
         buttonpanel=new JPanel();
         buttonpanel.setLayout(new GridLayout(1,2,6,0));
         buttonpanel.add(newgame=new JButton("new game",image));
         newgame.addActionListener(this);
         buttonpanel.add(undo=new JButton("undo"));
         undo.addActionListener(this);
         // Create new Choice Panel                      
         buttonpanel2 = new JPanel();
         buttonpanel2.setLayout(new GridLayout(6,1,0,10));
         buttonpanel2.add(onePlayer=new JButton("Change Colour"));
         onePlayer.addActionListener(this);
         buttonpanel2.add(TwoPlayer=new JButton("Statistic"));
         TwoPlayer.addActionListener(this);
         buttonpanel2.add(NormalPieceSet=new JButton("Quit"));
         NormalPieceSet.addActionListener(this);
         buttonpanel2.add(FuunyPieceSet=new JButton("Change Piece"));
        FuunyPieceSet.addActionListener(this);
        buttonpanel2.add(startButton = new JButton("Start Animation"));
         startButton.addActionListener(this);
         buttonpanel2.add(stopButton  = new JButton("Stop Animation"));
         stopButton.addActionListener(this);
            contentPane.add(BorderLayout.WEST, demopanel);
    // Set Font For Text Message
         setFont(Text);
         messagepanel=new JPanel();
         messagepanel.setBorder(BorderFactory.createLineBorder( Color.red ) );
         messagepanel.setBackground(Color.black);
    //     essagepanel.setLayout(new GridLayout(1,1));
         // Create new Label
         messagepanel.add(message = new JLabel());               
         setMessage("Welcome");
         // Postion panels in  Layout                
         contentPane.add("North",buttonpanel);
         contentPane.add("East",buttonpanel2);
         contentPane.add ("South",messagepanel);     
         contentPane.add ("Center",bboard);
         contentPane.add("West",Demo);
    public void mouseReleased(java.awt.event.MouseEvent e)
    {  statuseChange();}
    public void mouseClicked(java.awt.event.MouseEvent e)
    public void mouseEntered(java.awt.event.MouseEvent e) {     
    public void mouseExited(java.awt.event.MouseEvent e) {
    public void mouseMoved(java.awt.event.MouseEvent e) {
    statuseChange();
    public void mousePressed(java.awt.event.MouseEvent e)
    {statuseChange();
    public void actionPerformed(ActionEvent e)
         Object source=e.getSource();
         if (source == newgame)
              {  bboard.newgame();
                yellow();
              setMessage("try again");
              pause(100);
              c=add(c);
         else if (source==undo)
                  yellow();
              bboard.undo();
         setMessage("Undo");
         else if (source== TwoPlayer )
              //bboard.setup();
                 yellow(); 
              setMessage("Starting new Game");
         setMessage("Change Color");
         else if(source == FuunyPieceSet)
              {yellow();
              setMessage("game played::" +c);
              bboard.PieceChange();
         else if(source == NormalPieceSet)
              {yellow();
              setMessage("GOODBYE");
              destroy();
          else if(source == startButton)
              {yellow();
              setMessage("Start Animation");
              Demo.start();
         else if(source == stopButton)
              {yellow();
              setMessage("Stop Animation");
              Demo.stop();
              else if(source == onePlayer)
              {setMessage("");
              bboard.changePiece();
              setMessage("Change Color");
           public void statuseChange()
                switch (bboard.gameStatus())
            case 1:
                red();
               setMessage("White won");
           break;
      case 2:
            red();
            setMessage("Black won");
         break;
      case 3:
          red();
           setMessage("DRAW");
         Demo.changeAnimation(2);
           break;
      case 4:
           white();
           setMessage("White Turn");
           Demo.changeAnimation(1);
           break;
      case 5:
           green();
           setMessage("Black turn");
           Demo.changeAnimation(3);
         break;
      case 6:
           red();
            setMessage(" Check");
            Demo.changeAnimation(4);
              break;
      case 7:
           red();
           setMessage("Check");     
            Demo.changeAnimation(4);
            break;
      case 8:
           yellow();
           setMessage("I Hope you enjoyed it");     
    public String saveDAta(int i)
    String l=check.save(i);
    return (l);   
    public void LoadData(String load)
    public void setMessage(String s)
                /*The string s will be shown to the user.*/
         Font Text= new Font("Courier", Font.BOLD,30);
                       message.setText(s);
                       message.setFont(Text);
              public void white()
                   {  message.setForeground(Color.white);}
              public void green()
                     message.setForeground(Color.green);
                   public void red()
                          message.setForeground(Color.red);
                   public void yellow()
                        message.setForeground(Color.yellow);
             //  pause method       
              void pause(int time)
      try {Thread.sleep(time);
    }     catch (InterruptedException e)
         // Create new inset Object
         public Insets getInsets()
         return new Insets(50,220,150,200);
    public void destroy()
    contentPane.remove(buttonpanel2);
    contentPane.remove(buttonpanel);
    contentPane.remove(bboard);
    contentPane.repaint();
    Demo.start();
    public int add(int x)
         { int b=x+1;
          return b;
    }tanx man i dont the other two because they are to long
    my is when i open jframe
    i think Japplet and Jframe can not commuinicate to each other

  • Problems with build in wifi card in DV6-2190us​.

    Hi am trying to see if someone can help me out with a problem am having with my WIFI and also LAN on my laptop.
    The problems am having is with connectivity and speed on WIFI and also problems connecting to a network with a Ethernet cable.
    The problem am having with my wifi is when trying to connect to a network it takes me about 5 to 10 minutes just to try to connect to the network and once connected it will continue to say unidentified network and it will take 5 to 10 minutes to connect to the internet.  Once connected to the network and the internet the connection will start fast and slow down to a crawl even do am 10 to 20 feet away from the wireless router and I have full bars.  After the connection slows down I will get disconnected from the network and it will take me 10 to 20 minutes to get back on it.
    Also when I try to connect to the network using a Ethernet cable I will get connected but if I unplug the cable and try to connected again I won't be able to connect to the network or the internet and I would have to restart the laptop with the cable plugged in.
    All of the drivers on the laptop are up to date and also windows is up to date I really don't know what's going on.
    I have formatted and installed Widows 7 done all of the updates I have also updated all of the drivers for the laptop but the problem continues to come up.
    After talking to some of my IT friends we removed the build in wifi card from the inside of the laptop and changed it with a wifi card of a same model laptop to rule out problems with the card, but the problem continues to happen with the new card installed on the laptop.  The card that came out of the laptop with the wifi problems was installed to the second laptop and the wifi problems came up but after installing the original wifi card the problems went away.
    The thing that trying to figure out is why the card that came out of the working laptop won't work correctly on the laptop that's having problem with.
    If anyone has any ideas on what maybe causing the problems please reply to this post I really need to have this problem fix before I start taking online classes. 
    Thank you for taking the time to read this post.
    Laptop information.
    DV6-2190us
    Windows 7 64bit Home SP1
    i7 1.60
    Ram 8gb
    AVG Pro 2012

    You are posting on an iMac forum. I'd recommend posting a MBA forum, however I think you best bet is taking it into your local Apple store or AASP to determine if the Wi-Fi adapter is damaged and if it is then checking to see what options you have.

  • Problem with cloning Array

    I got a problem with cloning a Point[] Array.
    for example i have 2 Point-Arrays declared as Membervariables:
    Point[] array1;
    Point[] array2;then in the constructor i filled array1 with random Point Objects
    and then
    array2 = (Point[])(array1.clone());then i, for example, add 5 to the x-coordinate of every Point in array2.
    for (int i = 0; i < array2.length; i++)
         array2.x += 5;
    But array1's Point objects are also changed when i do that!
    Shouldnt clone copy the whole array and leave no connection between them?
    Thanks in advance

    so i made a method copyArray where every point object's x and y value is copied into the new Array's new Point Object, but as it seems that isnt where the error comes from.
    (That method works fine, the arrays are identical after that, but shouldnt reference to the same chunk of memory, right?)
    then i run the following method on array2
    array2 = (Point[])addFive(array2);
    Point[] addFive(Point[] array)
                    array[0].x += 5;
              return line;
         }Hence array2[0].x is instead of, e.g., zero 5
    But array1[0] .x is 5 intead of 0 too!
    Where's the mistake, where's the reference left? =X (and how do i fix it? :))

  • Problem to identify values in a case statement.

    Hi Friends,
    Total number of records in my report should be divided by 5 and to be alloted into 5 grades in Grade column.
    This is what I have done so far in my report with following layout.
    S.No - Col A - Col B - Col C - Grade ( Colums A,B,C will be hidden in Report)
    *****Column C will have only 5 values at max ( 0.0, 0.2, 0.4, 0.6, 0.8).The below example is for 6 records in a report.The same will be applied for 7,8,9,10 records.
    In column A: MAX(cast(RCOUNT(1) AS DOUBLE))/5 ( Ex : 6/5 = 1.2)
    In Column B: Truncate(MAX(cast (RCOUNT(1) as double)/5), 0) ( Ex : 6/5 = 1.0)
    In Column C: Col A- Col B ( EX:1.2 - 1.0 =0.2)
    (MAX(cast(RCOUNT(1) AS DOUBLE))/5 - Truncate(MAX(cast (RCOUNT(1) as double)/5), 0))
    Now In Grade coulum I want to use this column C to Grade the records with case statements in it.
    I am trying to use the following case statement for Grade Coulmn
    Case
    when (MAX(cast(RCOUNT(1) AS DOUBLE))/5 - Truncate(MAX(cast (RCOUNT(1) as double)/5), 0)) = 0.0 then .........
    when (MAX(cast(RCOUNT(1) AS DOUBLE))/5 - Truncate(MAX(cast (RCOUNT(1) as double)/5), 0)) = 0.2 then .............
    when (MAX(cast(RCOUNT(1) AS DOUBLE))/5 - Truncate(MAX(cast (RCOUNT(1) as double)/5), 0)) = 0.4 then .............
    when (MAX(cast(RCOUNT(1) AS DOUBLE))/5 - Truncate(MAX(cast (RCOUNT(1) as double)/5), 0)) = 0.6 then ........
    when (MAX(cast(RCOUNT(1) AS DOUBLE))/5 - Truncate(MAX(cast (RCOUNT(1) as double)/5), 0)) = 0.8 then .....
    end
    Case statement works gud for 0.0 but not for other 4 values.
    It is unable to identify other 4values.
    Please tell me, how can I make case statement work for all values in above scenario.
    Thanks in Advance,
    Varsha.
    Edited by: Varsha on Nov 28, 2010 6:23 PM

    In column A: MAX(cast(RCOUNT(1) AS DOUBLE))/5 ( Ex : 6/5 = 1.2)
    In Column B: Truncate(MAX(cast (RCOUNT(1) as double)/5), 0) ( Ex : 6/5 = 1.0)
    In Column C: Col A- Col B ( EX:1.2 - 1.0 =0.2)
    (MAX(cast(RCOUNT(1) AS DOUBLE))/5 - Truncate(MAX(cast (RCOUNT(1) as double)/5), 0))Change the formula a bit by adding the by dim value for the MAX column.
    Column A: MAX(cast(RCOUNT(1) AS DOUBLE) by DimTable.Column)/5
    Column B: Truncate(MAX(cast (RCOUNT(1) as double) by DimTable.Column)/5, 0)
    Column C: MAX(cast(RCOUNT(1) AS DOUBLE) by DimTable.Column)/5 - Truncate(MAX(cast (RCOUNT(1) as double) by DimTable.Column)/5, 0)
    now write a case statement on top column c, based on your logic every 5th record will have a value 0.0
    Note: Dimtable.column is the table.column for which the row count is taken.
    Thanks,
    Vino

  • Problems with building blueprints catalog

    Hi,
    I've got some problems building bp-catalog v 0.8 on a windows 7 machine, GlassFish 3.0.1.
    I've properly changed build.properties file and executed "ant setup" but when I issues the "ant run" command, the compiler can't find packages (JSF packages mainly).
    Why it cannot find jars? The ant script should include glassfish jee jars into classpath...right?
    I've got the same problem with Petstore but since it's a netbeans ready project, I easily imported it and configured the runtime to GlassFish, and this solved the problem.
    With the bp catalog, it could be pretty handy to build and deploy all the projects, without to import one by one in netbeans and manually solve the missing references problems.
    Many thanks in advance:
    E:\user\My Documents\Learning\SoftwareEngineering\JavaProjects\bpcatalog-ee5-ea-0.8>ant run
    Buildfile: E:\user\My Documents\Learning\SoftwareEngineering\JavaProjects\bpcatalog-ee5-ea-0.8\build.xml
    default:
    default:
    default-ear:
    -pre-compile:
    bpp-actual-compilation:
    [echo] Compiling bp-ui-5
    [javac] Compiling 61 source files to E:\user\My Documents\Learning\SoftwareEngineering\JavaProjects\bpcatalog-ee5-ea-0.8\components\ui\build\classes
    [javac] E:\user\My Documents\Learning\SoftwareEngineering\JavaProjects\bpcatalog-ee5-ea-0.8\components\ui\src\java\com\sun\javaee\blueprints\components\ui\autocompl
    ompleteComponent.java:14: package javax.faces.component.html does not exist
    [javac] import javax.faces.component.html.HtmlInputText;
    [javac] ^
    [javac] E:\user\My Documents\Learning\SoftwareEngineering\JavaProjects\bpcatalog-ee5-ea-0.8\components\ui\src\java\com\sun\javaee\blueprints\components\ui\autocompl
    ompleteComponent.java:15: package javax.faces.context does not exist
    [javac] import javax.faces.context.FacesContext;
    [javac] ^
    [javac] E:\user\My Documents\Learning\SoftwareEngineering\JavaProjects\bpcatalog-ee5-ea-0.8\components\ui\src\java\com\sun\javaee\blueprints\components\ui\autocompl
    ompleteComponent.java:16: package javax.el does not exist
    [javac] import javax.el.MethodExpression;
    [javac] ^
    [javac] E:\user\My Documents\Learning\SoftwareEngineering\JavaProjects\bpcatalog-ee5-ea-0.8\components\ui\src\java\com\sun\javaee\blueprints\components\ui\autocompl
    ompleteComponent.java:45: cannot find symbol
    [javac] symbol: class HtmlInputText
    [javac] public class AutoCompleteComponent extends HtmlInputText {
    [javac] ^
    [javac] E:\user\My Documents\Learning\SoftwareEngineering\JavaProjects\bpcatalog-ee5-ea-0.8\components\ui\src\java\com\sun\javaee\blueprints\components\ui\autocompl
    ompleteComponent.java:47: cannot find symbol
    [javac] symbol : class MethodExpression
    [javac] location: class com.sun.javaee.blueprints.components.ui.autocomplete.AutoCompleteComponent
    [javac] private MethodExpression completionMethod;
    [javac] ^

    Hi,
    I've got some problems building bp-catalog v 0.8 on a windows 7 machine, GlassFish 3.0.1.
    I've properly changed build.properties file and executed "ant setup" but when I issues the "ant run" command, the compiler can't find packages (JSF packages mainly).
    Why it cannot find jars? The ant script should include glassfish jee jars into classpath...right?
    I've got the same problem with Petstore but since it's a netbeans ready project, I easily imported it and configured the runtime to GlassFish, and this solved the problem.
    With the bp catalog, it could be pretty handy to build and deploy all the projects, without to import one by one in netbeans and manually solve the missing references problems.
    Many thanks in advance:
    E:\user\My Documents\Learning\SoftwareEngineering\JavaProjects\bpcatalog-ee5-ea-0.8>ant run
    Buildfile: E:\user\My Documents\Learning\SoftwareEngineering\JavaProjects\bpcatalog-ee5-ea-0.8\build.xml
    default:
    default:
    default-ear:
    -pre-compile:
    bpp-actual-compilation:
    [echo] Compiling bp-ui-5
    [javac] Compiling 61 source files to E:\user\My Documents\Learning\SoftwareEngineering\JavaProjects\bpcatalog-ee5-ea-0.8\components\ui\build\classes
    [javac] E:\user\My Documents\Learning\SoftwareEngineering\JavaProjects\bpcatalog-ee5-ea-0.8\components\ui\src\java\com\sun\javaee\blueprints\components\ui\autocompl
    ompleteComponent.java:14: package javax.faces.component.html does not exist
    [javac] import javax.faces.component.html.HtmlInputText;
    [javac] ^
    [javac] E:\user\My Documents\Learning\SoftwareEngineering\JavaProjects\bpcatalog-ee5-ea-0.8\components\ui\src\java\com\sun\javaee\blueprints\components\ui\autocompl
    ompleteComponent.java:15: package javax.faces.context does not exist
    [javac] import javax.faces.context.FacesContext;
    [javac] ^
    [javac] E:\user\My Documents\Learning\SoftwareEngineering\JavaProjects\bpcatalog-ee5-ea-0.8\components\ui\src\java\com\sun\javaee\blueprints\components\ui\autocompl
    ompleteComponent.java:16: package javax.el does not exist
    [javac] import javax.el.MethodExpression;
    [javac] ^
    [javac] E:\user\My Documents\Learning\SoftwareEngineering\JavaProjects\bpcatalog-ee5-ea-0.8\components\ui\src\java\com\sun\javaee\blueprints\components\ui\autocompl
    ompleteComponent.java:45: cannot find symbol
    [javac] symbol: class HtmlInputText
    [javac] public class AutoCompleteComponent extends HtmlInputText {
    [javac] ^
    [javac] E:\user\My Documents\Learning\SoftwareEngineering\JavaProjects\bpcatalog-ee5-ea-0.8\components\ui\src\java\com\sun\javaee\blueprints\components\ui\autocompl
    ompleteComponent.java:47: cannot find symbol
    [javac] symbol : class MethodExpression
    [javac] location: class com.sun.javaee.blueprints.components.ui.autocomplete.AutoCompleteComponent
    [javac] private MethodExpression completionMethod;
    [javac] ^

  • Problem  with build file

    Hi All,
    I have an unique problem.
    I have a build file which is runnin successfully on a local but not on the server.The error is class not found, so definitely problem with classpath.
    but acc. to my knowledge the build file is setting up the classpath in the file only, so its independent of my classpath settings in the system.
    Please help
    the snippet fo build file
    <project
        name = "SqlcSamples"
        default = "bundle"
        basedir = ".">
        <property file = "build-sqlc-eu.properties"/>
        <taskdef name = "sqlc" classname = "com.pavelvlasov.sqlc.StatementCompilerTask">
            <classpath>
                <fileset dir = "${project.components.lib}" includes = "**/*.jar"/>
                <fileset dir = "${sqlc.home}/jars" includes = "**/*.jar"/>
            </classpath>
        </taskdef>
    [/code]
    its saying 'com.pavelvlasov.sqlc.StatementCompilerTask' class not able to found                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               

    Best is to use the ant documentation; I often need it.
    ant without options will use build.xml, as "makefile".
    In the build.xml you define your default target.
    project basedir="." default="all"
    property name="src.dir" value="."/
    property name="classes.dir" value="../build/classes"/
    target depends="compile" description="Build everything." name="all"
    mkdir dir="${classes.dir}"/
    javac debug="${debug}" deprecation="${deprecation}" destdir="${classes.dir}" srcdir="${src.dir}"
    classpath
    pathelement location="${libs.dir}/jdom.jar"/
    /classpath
    /javac

Maybe you are looking for