Question about Alerttypes (code included)

Hi,
I have this code where I'm comparing two dates, if its outdated then the program will exit. That works perfectly. But when the program is outdated a screen is supposed to be shown to the user and prompt a text. I can only get this screen to show very very quick, what I'd really want is for this screen to be shown and have the user press like "OK" or any key for that matter to exit the program, just to make sure they actually get a chance to read it. I thought my code (shown below) would do that, but apparently it doesnt .. so .. please help me with an advice on how to fix it =)
     if (todayNum > endDate) {
          Alert alert = new Alert("Demo version outdated", "This demoversion is outdated. Please request a new version.", null, AlertType.CONFIRMATION);
          Display.getDisplay(this).setCurrent(alert);
     // Program done, exit now
          destroyApp(true);
          notifyDestroyed();
     }

I meant a custom CommandListener, not alert, i hope that doesnt confuse things
quick example, without checking the API (but to give an idea of what i mean) would be something like:
Alert endAlert = new Alert("Demo version outdated", "This demoversion is outdated. Please request a new version.", null, AlertType.CONFIRMATION);
endAlert.addCommand(new Command("ok", Command.OK, 1));
endAlert.setCommandListner(new CommandListener() {
public void commandAction(Command c, Displayable d) {
destroyApp(true);
notifyDestroyed();
Display.getDisplay(this).setCurrent(alert);

Similar Messages

  • Some question about sql code

    for example:
    select
    from testtable
    outputs below results:
    item_desc
    950gapple(z)110ml*40
    650gbanana(z)215ml 1x18
    make above example outputs below result:
    item_desc
    a950gapplez110ml40
    a650gbananaz215ml1x18
    how to write above sql code?
    who can help me?
    thanks

    Jameel Provided solution to one of your other thread
    a question about sql code
    Try the below query. You can modify the TRANSLATE function to add the characters you want to remove from the string.
    select 'a'||replace(translate(str,'()* ','`'),'`') from testtable

  • Ucs question about major code F0283 and dce interfac and chassis number?

    dear,
    Introductions:
    one 6120 connect  chassis 1 one 2104-1 and   chassis 2 one 2104-1
    chassis 1 have sever 3/4/5/6/7/8  (all sever is B200 M3,two 2104)
    chassis 2 have sever 1/2/3/4/5/7 (sever 1/2/3/4 is B200 M3,two 2104)
    question
    1.major code F0283
    all server have  major code F0283 ,but all sever  still can use.what this? How I did it?
    affected object:sys/chassis-1/blade-6/fabric-A/path-1/vc-722
    description: ether vif 1/6 a-722 down,reason: unknown
    chassis 1 have sever 3/4/5/6/7/8
    chassis 2 have sever 1/2/3/4/5/7
    i shutdown all ,and start the problem is also.
    affected 
    i shutdown all ,and start the problem is also.
    2.on chassis 1 sever-1 adapter 1 dce interface (dce interfac 1 and dce interface 5)
    ony one use? 
    3.
    chassis 1 have sever 3/4/5/6/7/8
    chassis 2 have sever 1/2/3/4/5/7
    but i reboot ,
    chassis 2 have sever 3/4/5/6/7/8
    chassis 1 have sever 1/2/3/4/5/7
    so the profile is disorder
    i shtdown all,and start chassis 1 ok ,later chassis 2
    the problem is ok..what this ?

    Hi Hailing,
    The transport VIF for server is down.The Cisco UCS Manager raises this fault when any of the following scenario occur:
    •Endpoint(switch/fabric  interconnect) reports the connectivity state on virtual interface as  one of: a.down, b.errored, c.unavailable.
    Verify  that the blade discovery was completed successfully. Check the states  on all of the communicating ports in an end to end manner.
    If connectivity seems correct, recommision the server.
    Also, please make sure you are using the correct drivers of the OS installed in the server as Padma recommended you.
    I hope this helps.
    David

  • Quick Question About Javascript Code

    I'm trying to write some code in JavaScript so that a different image will display every time someone loads my homepage. I have come across a section called
    'imgct' what does "ct" stand for?
    Please excuse the stupid question but this is my first time!
    If anyone could point me in the right direction of how to do this aswell I would be extremely grateful!
    Thanks
    Kyra

    I'm so sorry about this, it just doesn't seem to be working, I did what you suggested but it still doesn't show up in my browser. :S
    The is the code view of my page now:
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title>Untitled Document</title>
    <link href="Style_sheet.css" rel="stylesheet" type="text/css" />
    <script src="SpryAssets/SpryMenuBar.js" type="text/javascript"></script>
    <link href="SpryAssets/SpryMenuBarHorizontal.css" rel="stylesheet" type="text/css" />
    <script type="text/javascript">
    homeImg = newArray(
    "Images/Homepage/Image1.jpg",
    "Images/Homepage/Image2.jpg",
    "Images/Homepage/Image3.jpg",
    "Images/Homepage/Image4.jpg",
    "Images/Homepage/Image5.jpg"
    ImgCt=homeImg.length;
    function swapImg() {
        if (document.images) {
            randomNum=Math.floor((Mathrandom()*ImgCt));
            document.images ["homePicture"].src = homeImg[randomNum];
    window.onload = swapImg()
    </script>
    </head> 
    <body>
    <div class="container">
      <div class="header">
    *//There is a spry menu bar that goes here//*
        <!-- end .header --></div>
      <div class="content">
      <img src="" name="homePicture" width="627" height="250" id="homePicture" /> </div>
      <noscript><img src="Images/Homepage/Image2.jpg"/></noscript>
    As you can see I have also tried to add in a 'noscript' tag incase someone doesn't have javascript enabled etc. although when I preview it in IE I see both 'Image2' and the image placholder where teh random image is meant to appear, but doesn't.
    I'm very grateful for all the help you are giving me!
    Thank you
    Kyra

  • LAST QUESTION ABOUT MY CODE (promise)

    Here is my final code for the 6/49 lottery game (it's a more simplified version so don't mind that there is no Bonus Number) sorry for the long code...
    I'll just post my question here for those who don't want to go through all of this.
    I want to throw an exception and let it catch it after the first input box appears. So let's say I entered text or a null value in the first input box then it would loop back to the beginning of the program and output a message saying "You entered a wrong value!"
    But in the code that I have, even if I enter text or just press enter without inputting anything, it just moves on to the next input box, until on the 6th input box it says "invalid value".
    So how would I proceed in doing this?
    THANKS!
    import java.util.Random;
    import javax.swing.*;
    public class Game
         public static void main (String args[])     
              mGame();
         }//end main
         public static void mGame()
              JOptionPane.showMessageDialog(null, "Ali Uz\n110231263", "About", JOptionPane.PLAIN_MESSAGE);
              Random randomNumbers = new Random();
              String sInput,
                      win = "";
              int iNumber1=0,
                   iNumber2=0,
                   iNumber3=0,
                   iNumber4=0,
                   iNumber5=0,
                   iNumber6=0,
                   match=0,
                   randNumber,
                   prize=0;
             int array [] = new int [50];
              try
                        //get the numbers from the user
                        sInput=JOptionPane.showInputDialog ("Enter winning number 1.");
                        sInput=JOptionPane.showInputDialog ("Enter winning number 2.");
                        sInput=JOptionPane.showInputDialog ("Enter winning number 3.");
                        sInput=JOptionPane.showInputDialog ("Enter winning number 4.");
                        sInput=JOptionPane.showInputDialog ("Enter winning number 5.");
                        sInput=JOptionPane.showInputDialog ("Enter winning number 6.");
                        //convert strings to integers
                        iNumber1=Integer.parseInt(sInput);
                        iNumber2=Integer.parseInt(sInput);
                        iNumber3=Integer.parseInt(sInput);
                        iNumber4=Integer.parseInt(sInput);
                        iNumber5=Integer.parseInt(sInput);
                        iNumber6=Integer.parseInt(sInput);
             }//end try
              catch (Exception e)
                        System.out.println ("Invalid input please try again");
                        System.exit (0);
              }//end catch
              for (int i=1; i<=6; i++)
                   randNumber = 1 + randomNumbers.nextInt(49);
                   array [randNumber] = randNumber;
                   if (randNumber==iNumber1)
                             match++;
                   else
                             if (randNumber==iNumber2)
                                       match++;
                             else
                                       if (randNumber==iNumber3)
                                                 match++;
                                       else
                                                 if (randNumber==iNumber4)
                                                           match++;
                                                 else
                                                           if (randNumber==iNumber5)
                                                                     match++;
                                                           else
                                                                     if (randNumber==iNumber6)
                                                                               match++;
                   if (match==3)
                        prize = 10;
                        if (match==4)
                             prize = 1000;
                             if (match==5)
                                  prize = 10000;
                                  if (match==6)
                                       prize = 1000000;
              for ( int counter = 1; counter < array.length; counter ++)
                      if (counter % 7 == 0)
                                System.out.printf("%s\n", array [counter]);
                     else
                            System.out.printf("%s ",  array [counter]); 
                   if (match >= 3)
                             System.out.println ("You have gotten " + match + "/6 correct\nYou have won $" + prize);
                   else
                             System.out.println ("You have gotten " + match + "/6 correct\nSorry you have lost! Please try again");     
    }//end class Assignment1

    Your problem here as that the exception you want to
    throw takes place here
    iNumber1=Integer.parseInt(sInput);
    public void showMessage(int number){
    try{
    sInput=JOptionPane.showInputDialog ("Enter
    nter winning number " + number);
    iNumber1=Integer.parseInt(sInput);
    }catch(Exception e){
    System.out.println ("Invalid input please try
    e try again");
    System.exit (0);
    }then call this method from inside a for loop:
    for(int i=1; i <=6; i++){
    showMessage(i);
    }Hope that helps you a littleOnly catch NumberFormatException there, though.

  • Questions about the music included in iMovie/iLife

    Hi guys!
    Im making a small presentation movie for my small companies website. I've added some tunes from the library in iMovie (I know there is free royalty-free music of there but i didnt find what I was looking for). From what i've heard the songs are royalty-free, right? But not maybe for commercial use?
    Then i read something on this link (http://www.google.com/support/forum/p/youtube/thread?tid=3846f9dc40458d5a&hl=en) meaning that I am allowed to use the tracks in movies or in Garageband arrangements for commercial use, but as long as the music clips are no longer than 30 seconds, and that i write some kind of credits to the artist or Apple.
    Is this true? Anyone with an answer? I've searched for more license notes about iMovie but have'nt found anything.
    Thank you so much guys for helping me of here!

    I would add that sometimes a record company will claim ownership of one of the Apple jingles. YOu can contest this with YouTube, but do not say that you own the music. Say that you are licensed to use the track by Apple Computer and attach a link to 2C above.
    Use of credits or attribution in the YouTube comments may help, but usually the process of the record company claiming it is automated. The comments will help only after YouTube reviews it.
    I found that some minor rap artist was using one of the Apple Jingles in his rap record and the record company was flagging all videos that used this jingle. I was never able to convince YouTube that I had a right to this music. Very frustrating. You only get one chance to explain to YouTube why you have the right. After that, if the record company still contests it, YouTube will assume the record company is right and offer you a path that includes going to federal court to prove your case.
    Youtube is horrible on this, but maybe they have to be given the large number of videos added every day.

  • Vim newbie question about formatting code

    I just started learning vim and am wondering how I can get it to auto format some code.  For example:
    check() {
    for i in $nodes; do
    ping -c 1 $i > /dev/null
    if [ $? -eq 0 ]; then
    echo "Looks like $i is up so initializing the cluster on it."
    ssh $i "\$HOME/bin/cluster-setup.sh"
    fi
    done
    I have tabstop=3 in my ~/.vimrc and I'd just like to apply formatting to that code block so it looks like:
    check() {
    for i in $nodes; do
    ping -c 1 $i > /dev/null
    if [ $? -eq 0 ]; then
    echo "Looks like $i is up so initializing the cluster on it."
    ssh $i "\$HOME/bin/cluster-setup.sh"
    fi
    done
    I read about =i{ but it has no effect for me.
    Thanks!
    Last edited by graysky (2011-06-18 14:32:18)

    graysky,
    If you want vim to autoindent while typing, customize your ~/.vimrc file. I posted mine here: http://linuxandsuch.wordpress.com/2011/06/19/my-vimrc/ a few days back. I recommend all the options.
    However, if you want to indent an already existing file use the indent program. Install with
    sudo pacman -S indent
    And then, to indent your file, run:
    indent myfile.c
    I'd recommend reading the manpage for indent to learn to tweak it to your coding style though .

  • Question about byte code instructions

    Dear All,
    A method invocation (e.g., invokevirtual) needs its arguments to be prepared by the instructions above the method invocation instruction.
    As we know, some instructions pop objects out of the stack (eg, putfield), some instructions push objects onto the stack (eg, getfield), and some instructions do not change the state of the stack.
    My question is: are the instructions corresponding each argument preparation only those instruction that can push objects onto the stack, or could be any other?
    Thank you very much,
    -- Sunny

    When you say that arguments need to be prepared "above" the method invocation, it's more accurate to say before the method invocation.
    Typically, the stack is prepared with parameters which have been pushed onto it. But that's not just for method invocation. Simple operations such as "c = a + b" do not invoke any class methods, they are implemented by bytecode operations. If you had "myTestMethod ( a + b )", then the parameters preparation also includes calculations, the results of which are left on the stack for the method invocation.
    regards,
    Owen

  • Question about error code

    I have been having problems when I try to open applications such as IPhotos or Photoshop. They keep on quitting. I did the Hardware Test and it showed error code 2MEM/5/4:DIMM1/J31. Does anyone know what it means and what I should do? I do not have a warranty anymore and now I wondered if I am gonna have to get the coverage plan (my budget is tight right now). Thank you for any help you can give me.

    Either the module has failed or has come loose. At this time I'd open up your computer and make sure it's still locked in place. Afterwards, no need to run the hardware test, just check with System Profiler to see if you were able to nudge it back into position.
    Once in a while RAM modules do fail, but not very often.
    Edit-
    Since you apparently did not purchase this from Apple, it probably is still under lifetime warranty by the seller, so look up your original order number on the invoice and fill out an RMA request on the website of your supplier, or of the manufacturer (brand) itself. If they don't have a Support section or warranty or RMA section, you'll have to email them.
    Put off thinking about eBay until you find out if it will be replaced under warranty.
    [If you had an extra 1GB of memory, that is not going to be a bargain on eBay, as many are just now upgrading and trying to buy that size, but if you had an extra 512MB, then that is what can be found for a fraction of the price you'd have to pay for new anywhere else. If you're really lucky you can find someone with a relatively new iBook or PowerBook who might be looking to sell what hardly had any use. Caution in shipping is required, as the biggest cause of RAM failure is mishandling of the module between manufacture and packaging.]

  • Question about Byte Code

    Hello...can anyone tell me how I write a java program, compile it and get my byte code written into another file??
    Thanks in advance!

    I am looking to write my bytecode into a .bc file and
    open it and actually be able to read the bytecode
    instruction...(stuff like iload_2, i2d etc.,)I see... that was not clear from your first question. What you want is a disassembler. The SDK comes with one called 'javap': http://java.sun.com/j2se/1.4.1/docs/tooldocs/windows/javap.html

  • Question about error-code in web.xml

    Can you use pattern matching for error-codes?
    Instead of
    <error-code>401</error-code>
    <error-code>403</error-code>
    <error-code>404</error-code>
    etc..
    you could just do
    <error-code>4*</error-code>

    I don't know a replacement for this, but I recommend to post this questione into Servlets section to get more chances for receiving answers...
    Regards,
    Mohammed Saleem

  • Questions about byte code

    1.How can a java program mutate and kill itself after running a certain times?
    i think the argorithm is to modify the byte code, but i don't know the structure of the byte code.
    for example:
    "int i=1156;
    victim.seek(i);
    int changed_byte=(int)victim.readUnsignedByte()+1;
    victim.seek(i);
    victim.writeByte(changed_byte);"
    how can i know that 1156 is the place that count the running times of the program. please help me and give the relevent pages to read, many thanks!

    In Mustang, the java.lang.instrument API has been extended to allow not only redefinition of classes, but also retransformation (without / with original bytes, respectively), so you could hook up a Java agent to transform classes at will. You could use this with 5.0, but you can't get the actual bytes for the current class from the JVM when retransforming classes. See http://java.sun.com/j2se/1.5.0/docs/api/java/lang/instrument/package-summary.html#package_description and http://download.java.net/jdk6/docs/api/java/lang/instrument/package-summary.html#package_description for more on instrumentation in 5.0 and (provisionally) 6.0.
    You might find a tool I've been working on lately useful: http://jen.dev.java.net/ - It basically presents a mutable class with a collections-ish interface and allows you to generate as bytes or a Class. It can be used in regular code, in agents, with .class files, byte arrays, java.lang.Classes, and so on.
    However, I would question your motivation here, particularly since you're using names like 'victim' and 'attacker'. You will struggle to do any of this is the user really doesn't want you to, since the platform is designed pretty well against it.

  • Question about JS code hinting

    When dreamweaver codehints javascript the code options have a little icon to the left
    i have seen red squares, hollow green circles, and yellow squares balanced on on it's its corners.
    what do these symbols mean?

    Company code is create  for legal requirement purpose.
    ex:  You have create A Comapany. company act 1956 every comapny has submmited the financial years Balance sheet and profit loss a/c govtment.
    Business area:  to veiw the divisional wise balance sheet and profit loss a/cit is mainpurpose of business area.

  • Question about changing code progammatically

    In our code base there are many pkgs, procedures, and functions that have an email in the exception block. This email needs to be removed/updated.
    Can these objects be updated in a loop? Would you use execute immediate to re-compile? Would a cursor be used to determine from all_source which objects needed to be updated?
    Has anyone done this before or do we need to re-compile each, one at a time?

    Something like that could work:
    begin
       for c in
          (select object_name,
                  replace (dbms_metadata.get_ddl (object_type, object_name),
                           '[email protected]',
                           '[email protected]'
                          ) stmt
             from user_objects
            where object_type in ('PROCEDURE', 'PACKAGE', 'FUNCTION', 'TRIGGER')
              and dbms_metadata.get_ddl (object_type, object_name) like
                                                             '%[email protected]%')
       loop
          execute immediate cast (c.stmt as long);
       end loop;
    end;

  • Important question about my code

    Okay so here's the deal, I have been working on creating the 6/49 lottery game and so far everything works fine, however I have one problem with how the program runs.
    The instructions are as follows: The program generates 6 random numbers from 1 to 49, then it asks the user to input 6 numbers, and if they guess the generated random numbers they win a prize.
    This is where the problem's at, the program generates 6 random numbers, let's say for this topic's sake : 1,2,3,4,5,6. Now if the user inputs let's say 12,34,56,6,9,11 the program should say 1/6 correct since the user guessed the number 6. However since the user entered 6 as the 4th number, it says that the user has gotten 0/6 correct!
    Tell me what I'm doing wrong here please... here's my code.
    import java.util.Random;
    import javax.swing.*;
    import java.util.*;
    public class GameBeta
         public static void main (String args[])     
              mGame();
         }//end main
    public static void mGame()
              Random randomNumbers = new Random();
                String sInput,
                          win = "";
              int iNumber=0,
                    match=0,
              randNumber,
              prize=0;
    int array [] = new int [50];
         for (int i=1; i<=6; i++)
                   randNumber = 1 + randomNumbers.nextInt(49);
                   array [randNumber] = randNumber;
                             try
                   //get the numbers from the user
                   sInput=JOptionPane.showInputDialog ("Enter winning number");
                   //convert strings to integers
                  iNumber=Integer.parseInt(sInput);
                   catch (NumberFormatException nfe)
                        System.out.println ("Invalid input please try again");
                        System.exit (0);
                  }//end catch
                   if (match==3)
                        prize = 10;
                        if (match==4)
                             prize = 1000;
                             if (match==5)
                                  prize = 10000;
                                  if (match==6)
                                       prize = 1000000;
              for ( int counter = 1; counter < array.length; counter ++)
                      if (counter % 7 == 0)
                                System.out.printf("%s\n", array [counter]);
                     else
                            System.out.printf("%s ",  array [counter]); 
         System.out.println ("You have got: " + match + " correct answers!");
    }//end class Assignment1

    Is there a specific reason your using a static method to run your app?
    I modified your code slightly so that it will run as a app and you shouldn't get the cannot access non-static method from a static context...
        public static void main(String args[])
            GameBeta gm = new GameBeta();  // create a new instance of your game
            gm.mGame();  //  run the game
            gm = null;  // release the object to gc
            System.exit(0);  //  exit gracefully
        }//end main
        public void mGame() {
        //  the rest of your code....I hope it gives you some insight..
    J

Maybe you are looking for

  • Printing notes similarly to comments in Word

    Hello, I have a PDF document which I commented extensively. When I print it, my comments that are on the printed page cover too much space - the orginal text is not easily readable (lowering opacity is not helping). Therefore, I would like to print m

  • Workflow for EP without SAP R/3

    Hi WF Expert, I am new to SAP EP Workflow, currently working on my first project. This is a project for a University, wherein we have to implement students admission process for distance education . We have to using WebDynpro tool for this portal and

  • Is it safe to upgrade Quicktime?

    I only ask this because every time I see an upgrade for Quicktime it seems not a week goes by another program is offered to UNDO the upgrade. I am left wondering if this is standard practice....or if Quicktime updates are not the best thing for the h

  • Anomaly in Forms6.0 (Especially for Date Field)

    Dear all OTN Members, I Don't have any idea of this "anomaly" happened in my Dev2K. My problem is When I run my form with f60run.exe, everything run as normal as it is. But sometimes, when I get my cursor focused in one field, which have Date datatyp

  • Open stand by database to run scripts

    hello all, I am having one physical stand by database which is synchronized with production database.Now i am have some scripts which extracts data.But i want to run this scripts on stand by database which is in recovery mode.Now i want to make the s