Help with code for System.currentTimeMillis()

I need to time how long it takes to do various sorts (selection sort, insertion sort) and was instructed to use System.currentTimeMillis() to accomplish this. Please take a look at the code below and let me know what is wrong. I can get the file to complile but it does not record the time it takes to run the sorts. I'm pretty sure my error is in the below section of code. In order to save space, I've only pasted the snippit of code for this particular function. Let me know if I need to paste more code. Thanks in advance.
case 5:
                         System.out.print("Enter the value to look for: ");
     val = scan.nextInt();
     time1 = System.currentTimeMillis();
     loc = list.linearSearch(val);
     time2 = System.currentTimeMillis();
                         totalTime = time1 - time2;
                         System.out.println("Total time for this search is: " + totalTime);
     if (loc != -1)
                              System.out.println("Found at location " + loc);
     else
                              System.out.println("Not in list");
     break;
                         

It could be that it isn't actually doing anything
though. Either because the data is poorly choosen or
because it isn't actually sorting due to a bug.The name of the method being timed is "linearSearch". That's a really poor name for a method that is supposed to be sorting. But from other aspects of the code I would guess that it is doing a linear search of an array, looking for a particular integer. Even if the integer isn't in the array, comparing 20,000 integers is a trivial exercise.
People don't realize just how long a millisecond is for a computer. If you have a 1 GB processor (not uncommon these days) then you can do one billion (one thousand million) operations per second. That's one million operations per millisecond. So chances are, even realizing that there's a whole lot of overhead in a high-level language, the OP's code runs in less than 1 millisecond.

Similar Messages

  • Re:Help with code for server client

    Hi i am struggling to adapt code for UDPServer and client programs.
    how can i adapt the following server code to add a message before replying to the client?
    import java.net.*;
    import java.io.*;
    public class UDPServer2{
    public static void main(String args[]){
         DatagramSocket aSocket = null;
              try{
              aSocket = new DatagramSocket(9000);
                             // create socket at agreed port
                   byte[] buffer = new byte[1000];
                   while(true){
                        DatagramPacket request = new DatagramPacket(buffer, buffer.length);
                        aSocket.receive(request);
                   DatagramPacket reply = new DatagramPacket(request.getData(), request.getLength(),
                        request.getAddress(), request.getPort());
                             aSocket.send(reply);
              }catch (SocketException e){System.out.println("Socket: " + e.getMessage());
              }catch (IOException e) {System.out.println("IO: " + e.getMessage());
              }finally {if(aSocket != null) aSocket.close();}
    any help would be much appreciated i have tried altering the aSocket.send(reply) line but to no avail.
    thank you in advance

    Hi i am struggling to adapt code for UDPServer and
    client programs.
    how can i adapt the following server code to add a
    message before replying to the client?What do you want to add before replying to the client?

  • Help with code for inserting horizontal scroll bar in photo gallery in Business Catalyst site?

    Hi,
    I am using Business Catalyst and Dreamweaver to create a trial site.
    I am not sure if this is the correct forum to post this request but anyway I have inserted a photo gallery module at the bottom of the sidebar in the homepage of my test site.
    Can anyone advise on whether jquery or any other code can be inserted into the page or module code that will replace the "next" hyperlink below the first 4 photos with a horizontal scroll bar at bottom of the gallery so users can just scroll through all 12 images ?
    Kind Regards, Matt.
    http://craftime-bs6.businesscatalyst.com/

    Alyssa,
    Have you tried putting this rule back as it was originally:
    /* Submenu that is showing with class designation MenuBarSubmenuVisible, we set left to auto so it comes onto the screen below its parent menu item */
    ul.MenuBarHorizontal ul.MenuBarSubmenuVisible
        left: auto; /*was 9px*/
        color: #EF9CCF;
        background-color: #FFF;
    That is, changing your 9px back to auto.
    And giving  us a link (as you did) is much better than printing out the code for us! Thanks!
    Beth

  • Help with code for score-keeping with dynamic text box

    Hi All,
    I'm having an actionscript 2.0 problem with keeping score.
    I have a dynamic text box with a variable called score.
    I have the following action code for that variable:
    _root.score = 0;
    For the correct answer button I have this action:
    _root.score = Number (score) +10;
    This works fine to increase the score by 10 for each correct answer.
    The problem is that I can't get an if statement to work for when the score reaches 150 to gotoAndPlay a certain frame. I've tried various syntax, I've tried it on the action for a button and an action for the timeline with: 
    onRelease = function () {
    (My learning game is set up to allow for users to answer up to four extra questions to reach the score of 150).
    Nothing works. Any suggestions please?
    Pam

    Below is a link to a small sample file.  See if you can find anything different between your file and the one linked that might cause yours to not work as desired.
    http://www.nedwebs.com/Flash/AS2_score_sample.fla

  • Urgent-Need help with code for Master data enhancement

    hi Experts,
    I have appended YMFRGR field(Table MARC) to 0MAT_PLANT_ATTR datasource.
    The key fields in the MARC table are MATNR and WERKS.Can anybody help with the user exit to populate this field,as am pretty new to ABAP.
    Thanks in advance

    Hi,
    go through this link which has the similar problem:
    https://forums.sdn.sap.com/click.jspa?searchID=1331543&messageID=2794783
    hope it helps.
    Thanks,
    Amith

  • Need help with code for adding dates to form

    Hello forum goers
    I'm new to making forms and figured out how to auto add the date, however I need the form to change the date for every copy made.
    For example today is 06/08/2012 if I print 10 copies of the form it will output 10 pages ranging from 06/08/2012 to 06/17/2012. If code exists to do this I would be very gratefull to whoever helps, I also wouldn't mind if that is not possible for manually inputing the start / end dates.
    Currently I print 15-30 copies of the form and hand write each of the dates but I'm just getting to busy to do that. I also cannot print one a day it must be in batches.
    Thanks in advanced.

    What you are asking for is more complex than just setting the current date. Each time the form prints it has to know that it has to change the date. I would suggest doing this.
    First, setup a document level script to set the date to the current date. I suspect that you have already done this?
    Next, Create a "DidPrint" document action to increment the date.  To do this the script will need to scan the current text value of the date, add one day to it, and then reformat it.  You'll find information on this type of scripting in these articles:
    http://acrobatusers.com/tutorials/working-with-date-and-time-in-acrobat-javascr
    ipt
    http://acrobatusers.com/tutorials/working-with-date-and-time-in-acrobat-javascr
    ipt-part-2
    http://acrobatusers.com/tutorials/working-with-date-and-time-in-acrobat-javascr
    ipt-part-3
    Since the increment happenes in the Did Print you will need to print each copy individually. If you enter 10 copies in the print dialog it won't work. You have to print one at a time.  You can automate this activity with a console script.
    One of the advantages of incrementing in the DidPrint is that you can also manually enter a date and it will increment from there.
    Thom Parker
    The source for PDF Scripting Info
    pdfscripting.com
    The Acrobat JavaScript Reference, Use it Early and Often
    Then most important JavaScript Development tool in Acrobat
    The Console Window (Video tutorial)
    The Console Window(article)
    Having trouble, Why Doesn't my Script Work?

  • Help with code for Selection Box

    Hi All,
    I have written the below code in the Data Section of the infoset
    BEGIN OF IT_TYP-SALE OCCURS 0,
      LTEXT TYPE TVKOT-VTEXT,
    END OF IT_TYP-SALE.
    DATA: IT_RETURN LIKE DDSHRETVAL OCCURS 0 WITH HEADER LINE.
    The code works fine, but when the user presses F4 in the box which opens the header displayed is 'Name' which is the header for TVKOT-VTEXT. I would like to know how i can define a custom header Eg: 'Company Name'.
    Hope my problem is clear, await assitance.
    Vivek

    Hi,
    Thanks for the inputs, what i really need is how i can define a custom text. As the header i want to display is not a standard field header. So in that case how should i declare?
    Note: The Company Name was only a example.
    Any suggestion on how i can have a custom name appearing as the header instead of the table field header?
    Edited by: Vivek on Jan 8, 2008 9:35 PM

  • Please help with code for a program

    Write a program which comutes the value of an investment over a 5 year period.The porgrm should display the value of an investment for each of the 5years were the initial investment and interest rate are to be specified by the user.It should compute and present value in the first year,compute and display value for the second year up to the last year(use a while or do...while loop).While there are more years to process ask the user for the next input,compute the value for the next year and output.

    jverd wrote:
    So what you're saying is that you're a lazy, stupid, unethical cheater and you want someone else to do your homework for you so that you can take credit you don't deserve and get a grade you didn't earn.
    Go to hell.But he's willing to pay big bucks (10 duke stars!) for this, so let's race to get those precious dukes.

  • Unable to create new structure code for System Items flexfield

    Hi
    I installed the R12 with Vision. In the System Items flexfield, I find one structure code "SYSTEM_ITEMS". But I am not able to create new code as I am getting the error. "FRM-41051 - Cannot create new records here ". Also the New icon is disabled.
    Is this how it is supposed to work? Cant we create new structure code for System Items flexfield in Vision Database? Please help me to resolve this.
    Regards
    Reem

    Hi Everyone,
    Lets address your exact problem ::
    I installed the R12 with Vision. In the System Items flexfield, I find one structure code "SYSTEM_ITEMS". But I am not able to create new code as I am getting the error. "FRM-41051 - Cannot create new records here ". Also the New icon is disabled.
    Is this how it is supposed to work? Cant we create new structure code for System Items flexfield in Vision Database? Please help me to resolve this.
    Yes ! The answer is that this is exactly how it is supposed to work.
    In Inventory :: [ System Items KFF ] is supposed to be single structure whereas Item-Categories has Multi-Structure option.
    For every Single Instance :: It is like this only ~ as a standard functionality.
    And this becomes very very challenging ( but a very fruitful & long lasting ) exercise.
    Thrash it with the clients :: Why should you ever have 2-3 different Item codification schemas when its the same enterprise ?
    They might respond with different intelligence incorporated in the Item Codes.
    Most of the Intelligence can be shifted to the Item-Categories as they are not long lasting.
    &&&& This means that either you can push for non-significant part numbering schema or the partial intelligence.
    Keep it small & simple !!
    Ajay Kuma, 510-456-5322

  • Combo box and Check box..help with code please?

    Here is my problem...i have a list of check boxes and according to which one is checked, i need combo boxes to populate different choices.
    as an easy example im only using 2 check boxes and two combo boxes.
    the check boxes are named Choice 1or2 with export values of 1 and 2
    the Combo Boxes are named List A and List B..
    both containing options that say you checked box 1 and you checked box 2
    any help would be greatly appreciated

    Implode wrote:
    "Help with code please."
    In the future, please use a meaningful subject. Given that you're posting here, it's kind of a given that you're looking for help with the code. The whole point of the subject is to give people a high level idea of what KIND of help with what KIND of code you need, so they can decide if they're interested and qualified to help.
    Exception in thread "main" java.lang.NumberFormatException: For input string: "fgg"
         at java.lang.NumberFormatException.forInputString(Unknown Source)
         at java.lang.Integer.parseInt(Unknown Source)
         at java.lang.Integer.parseInt(Unknown Source)
         at assignment1.Game.Start(Game.java:120)
         at assignment1.RunGame.main(RunGame.java:18)This error message is telling you exactly what's wrong. At line 120 of Game.java, in the Start method (which should start with lowercase "s" to follow conventions, by the way), you're calling Integer.parseInt, but "fgg" is not a valid int.

  • Help with updates for CS6

    I need help installing latest updates for CS6.  I have Win 7 and have tried updating from the Help - Updates menu.  The error is:  U43M1D207.

    Thanks for your response.  I am in the United States in So. Arizona.
    Date: Fri, 5 Oct 2012 12:21:45 -0600
    From: [email protected]
    To: [email protected]
    Subject: Help with updates for CS6
    Re: Help with updates for CS6 created by Jeff A Wright in Downloading, Installing, Setting Up - View the full discussion
    Crunkle1 you are welcome to work directly with our support team for guided assistance.  If you go to http://www.adobe.com/ and select Help and Contact Us you should be given the option to contact our support team via telephone.  Which country/region are you in?
    Please note that the Adobe Forums do not accept email attachments. If you want to embed a screen image in your message please visit the thread in the forum to embed the image at http://forums.adobe.com/message/4752605#4752605
    Replies to this message go to everyone subscribed to this thread, not directly to the person who posted the message. To post a reply, either reply to this email or visit the message page: http://forums.adobe.com/message/4752605#4752605
    To unsubscribe from this thread, please visit the message page at http://forums.adobe.com/message/4752605#4752605. In the Actions box on the right, click the Stop Email Notifications link.
    Start a new discussion in Downloading, Installing, Setting Up by email or at Adobe Community
    For more information about maintaining your forum email notifications please go to http://forums.adobe.com/message/2936746#2936746.

  • I need help with TransparentBackgrounds for a school project

    So i had found the transparentBackground class
    * @(#)TransparentBackground.java
    * @author
    * @version 1.00 2010/2/26
    import javax.swing.*;
    import java.awt.*;
    import java.awt.event.*;
    import java.awt.image.*;
    import java.text.NumberFormat;
    public class TransparentBackground extends JComponent implements ComponentListener, WindowFocusListener, Runnable{
        private JFrame frame;
        private Image background;
         private long _lastUpdate = 0;
         private boolean _refreshRequested = true;
         public Robot rbt;
         public Toolkit tk;
         public Dimension dim;
         public Point pos;
         public Point offset;
         long total;
         long used;
    public TransparentBackground(JFrame frame) {
        this.frame = frame;
        updateBackground();
        frame.addComponentListener(this);
         frame.addWindowFocusListener(this);
        new Thread(this).start();
    public void updateBackground( ) {
        try {
             total = Runtime.getRuntime().totalMemory();
             used  = (Runtime.getRuntime().totalMemory() - Runtime.getRuntime().freeMemory())/1024;
             System.out.println("updateBackground() Run: Memory Usage: " + used +" MB");
            rbt = new Robot();
            tk = Toolkit.getDefaultToolkit( );
            dim = tk.getScreenSize( );
            background = rbt.createScreenCapture(
            new Rectangle(0,0,(int)dim.getWidth( ),
                              (int)dim.getHeight( )));
        } catch (Exception ex) {
    public void paintComponent(Graphics g) {
         System.out.println("paintComponent() Run");
        pos = this.getLocationOnScreen();
        offset = new Point(-pos.x,-pos.y);
        g.drawImage(background,offset.x,offset.y,null);
    protected void refresh() {
              if (frame.isVisible() && this.isVisible()) {
                   repaint();
                   _refreshRequested = true;
                   _lastUpdate = System.currentTimeMillis();
              System.out.println("refresh() Run");
    // ComponentListener -------------------------------------------------------
         public void componentHidden(ComponentEvent e) {
         public void componentMoved(ComponentEvent e) {
              repaint();
         public void componentResized(ComponentEvent e) {
              repaint();
         public void componentShown(ComponentEvent e) {
              repaint();
         // WindowFocusListener -----------------------------------------------------
         public void windowGainedFocus(WindowEvent e) {
              refresh();
         public void windowLostFocus(WindowEvent e) {
              refresh();
    public void run() {
              try {
                   while (true) {
                        Thread.sleep(10);
                        long now = System.currentTimeMillis();
                        if (_refreshRequested && ((now - _lastUpdate) > 100)) {
                             if (frame.isVisible()) {
                                  Point location = frame.getLocation();
                                  frame.setLocation(-frame.getWidth(), -frame.getHeight());
                                  updateBackground();
                                  frame.setLocation(location);
                                  refresh();
                             _lastUpdate = now;
                             _refreshRequested = false;
                             System.out.println("run() END------------");
              } catch (InterruptedException e) {
                   e.printStackTrace();
    }In have like 8 - 12 of these "panels" in my program. They are not running simultaneously but each one is created everytime I press a button.
    I have A button ing main class (x) and another class (y)
    Class y
    public JFrame Frame;
    public TransparentBackground Panel;
    class y()
    public void makeMe()
    Frame = new JFrame(" ");
         Panel= new TransparentBackground(Frame);
      ///   ....all the combining
       // and then
       frame.setVisible(true);
    public void hideMe()
         frame.setVisible(false);
    }When press A which has only one instanciation of class y:
    it calls
    y.makeMe()
    and then it when I press it again
    it calls
    y.hideMe()
    and then this same process goes on for like 8 times before it starts to show this
    updateBackground() Run: Memory Usage: 248606 MB
    Exception in thread "Thread-25" java.lang.OutOfMemoryError: Java heap space
        at sun.awt.windows.WRobotPeer.getRGBPixels(WRobotPeer.java:46)
        at java.awt.Robot.createScreenCapture(Robot.java:329)
        at TransparentBackground.updateBackground(TransparentBackground.java:45)
        at TransparentBackground.run(TransparentBackground.java:104)
        at java.lang.Thread.run(Thread.java:619)
    paintComponent() Run
    refresh() Run
    paintComponent() RunBTW: the x and y class are just skeletal classes, but the actual ones I use in the programs are filled with Images and all that good stuff..
    So my ulimate question is..
    Why dose it make that error?
    and i also tried to increase the heap space, but it still showed the same error.
    I am just a newbie, so i would appreciate if the explainations are easier to understand for beginners
    thank you for reading and taking interest

    I don't understand you GUI approach at all: you are making a very basic board game. You need not even do an animation loop as a continuously running process. While I have not gone over your code extensively, what your errors and glimpsing at your code says to me is that you don't have your objects being disposed of because they are running--your "while(true)" loop is not being canceled/stopped.
    You need to make a very basic animation loop and look at making your events happen accordingly. You can easily paint your cards/messages over portions of the playing screen and have them age off with a timer or other triggered events--this removes the need of your while(true) loops and runnable objects.
    On the other hand, you do not need to implement runnable nor have a running animation loop with a basic GUI. When you have your "cards" pop up, they need not be objects that implement runnable either, but just basic GUI components.
    Anyways, I'm just at a loss as to your need to have everything implement runnable.

  • Need some help with code.. No idea what's wrong! I'm new..(J2ME related)

    Hey there,
    I've just started programming J2ME using Netbeans using the java mobility pack, trying to create a program which interacts with a php webserver..
    I created some code which accessed my php script on my server and returned the contents of the page back, and successfully got it working. However, i did a bit of treaking, and then tried to remove it all.. and now my code won't work. I've been examining it for a good hour and can't seem to find the error! It's annoying me pretty badly.. I'm not liking J2ME already.
    Could someone please look at my code and help me out? I really really want to get this working..
    * VisualMidlet.java
    * Created on 26 October 2007, 19:37
    import java.io.*;
    import javax.microedition.io.*;
    import javax.microedition.lcdui.*;
    import javax.microedition.midlet.*;
    * @author Will
    public class VisualMidlet extends MIDlet{
    /** Creates a new instance of VisualMidlet */
    private Display display;
    private Command Submit;
    private Command okCommand2;
    private Command Submit1;
    private Form Form1;
    private StringItem stringItem1;
    String url = "http://people.bath.ac.uk/wal20/testGET.php?type=3";
    public VisualMidlet() {
    System.out.println("initialized");
    display = Display.getDisplay(this);
    Connect();
    public void startApp() {
    public void Connect(){
    try {getViaStreamConnection(url);}
    catch (IOException e) {
    System.out.println("IOException " + e);
    e.printStackTrace();
    public void getViaStreamConnection(String url) throws IOException {
    StreamConnection streamConnection = null; //declares a stream connection
    InputStream inputStream = null; // declares an input Stream
    StringBuffer b = new StringBuffer();
    TextBox textBox = null;
    try {
    System.out.println("Establishing stream");
    streamConnection = (StreamConnection)Connector.open(url);
    System.out.println("Stream established");
    inputStream = streamConnection.openInputStream();
    int ch;
    while((ch = inputStream.read()) != -1) {
    b.append((char) ch);
    textBox = new TextBox("Simple URL Fetch", b.toString(), 1024, 0);
    } finally {
    if(inputStream != null) {
    inputStream.close();
    if(streamConnection != null) {
    streamConnection.close();
    display.setCurrent(textBox);
    public void pauseApp() {   }
    public void destroyApp(boolean unconditional) {  }
    /** This method initializes UI of the application.
    private void initialize() {                     
    getDisplay().setCurrent(get_Form1());
    * This method should return an instance of the display.
    public Display getDisplay() {                        
    return Display.getDisplay(this);
    * This method should exit the midlet.
    public void exitMIDlet() {                        
    getDisplay().setCurrent(null);
    destroyApp(true);
    notifyDestroyed();
    /** This method returns instance for Submit component and should be called instead of accessing Submit field directly.
    * @return Instance for Submit component
    public Command get_Submit() {
    if (Submit == null) {                     
    // Insert pre-init code here
    Submit = new Command("Submit", Command.OK, 1);
    // Insert post-init code here
    return Submit;
    /** This method returns instance for okCommand2 component and should be called instead of accessing okCommand2 field directly.
    * @return Instance for okCommand2 component
    public Command get_okCommand2() {
    if (okCommand2 == null) {                     
    // Insert pre-init code here
    okCommand2 = new Command("Ok", Command.OK, 1);
    // Insert post-init code here
    return okCommand2;
    /** This method returns instance for Submit1 component and should be called instead of accessing Submit1 field directly.
    * @return Instance for Submit1 component
    public Command get_Submit1() {
    if (Submit1 == null) {                      
    // Insert pre-init code here
    Submit1 = new Command("Submit", Command.OK, 1);
    // Insert post-init code here
    return Submit1;
    /** This method returns instance for Form1 component and should be called instead of accessing Form1 field directly.
    * @return Instance for Form1 component
    public Form get_Form1() {
    if (Form1 == null) {                     
    // Insert pre-init code here
    Form1 = new Form(null, new Item[] {get_stringItem1()});
    // Insert post-init code here
    return Form1;
    /** This method returns instance for stringItem1 component and should be called instead of accessing stringItem1 field directly.
    * @return Instance for stringItem1 component
    the code for the php script is:
    <?php
    $response = "Hello";
    if (isset($_GET)) {
    switch ($_GET["type"]) {
    case 1: $response = "Good Morning"; break;
    case 2: $response = "Good Afternoon"; break;
    case 3: $response = "Good Evening"; break;
    default: $response = "Hello"; break;
    echo $response;
    ?>
    I would be grateful for any reply
    Thank you in advance
    -Will

    sorry! i'll repost the code in code format
    * VisualMidlet.java
    * Created on 26 October 2007, 19:37
    import java.io.*;
    import javax.microedition.io.*;
    import javax.microedition.lcdui.*;
    import javax.microedition.midlet.*;
    * @author Will
    public class VisualMidlet extends MIDlet{
    /** Creates a new instance of VisualMidlet */
    private Display display;
    private Command Submit;
    private Command okCommand2;
    private Command Submit1;
    private Form Form1;
    private StringItem stringItem1;
    String url = "http://people.bath.ac.uk/wal20/testGET.php?type=3";
    public VisualMidlet() {
    System.out.println("initialized");
    display = Display.getDisplay(this);
    Connect();
    public void startApp() {
    public void Connect(){
    try {getViaStreamConnection(url);}
    catch (IOException e) {
    System.out.println("IOException " + e);
    e.printStackTrace();
    public void getViaStreamConnection(String url) throws IOException {
    StreamConnection streamConnection = null; //declares a stream connection
    InputStream inputStream = null; // declares an input Stream
    StringBuffer b = new StringBuffer();
    TextBox textBox = null;
    try {
    System.out.println("Establishing stream");
    streamConnection = (StreamConnection)Connector.open(url);
    System.out.println("Stream established");
    inputStream = streamConnection.openInputStream();
    int ch;
    while((ch = inputStream.read()) != -1) {
    b.append((char) ch);
    textBox = new TextBox("Simple URL Fetch", b.toString(), 1024, 0);
    } finally {
    if(inputStream != null) {
    inputStream.close();
    if(streamConnection != null) {
    streamConnection.close();
    display.setCurrent(textBox);
    public void pauseApp() { }
    public void destroyApp(boolean unconditional) { }
    /** This method initializes UI of the application.
    private void initialize() {
    getDisplay().setCurrent(get_Form1());
    * This method should return an instance of the display.
    public Display getDisplay() {
    return Display.getDisplay(this);
    * This method should exit the midlet.
    public void exitMIDlet() {
    getDisplay().setCurrent(null);
    destroyApp(true);
    notifyDestroyed();
    /** This method returns instance for Submit component and should be called instead of accessing Submit field directly.
    * @return Instance for Submit component
    public Command get_Submit() {
    if (Submit == null) {
    // Insert pre-init code here
    Submit = new Command("Submit", Command.OK, 1);
    // Insert post-init code here
    return Submit;
    /** This method returns instance for okCommand2 component and should be called instead of accessing okCommand2 field directly.
    * @return Instance for okCommand2 component
    public Command get_okCommand2() {
    if (okCommand2 == null) {
    // Insert pre-init code here
    okCommand2 = new Command("Ok", Command.OK, 1);
    // Insert post-init code here
    return okCommand2;
    /** This method returns instance for Submit1 component and should be called instead of accessing Submit1 field directly.
    * @return Instance for Submit1 component
    public Command get_Submit1() {
    if (Submit1 == null) {
    // Insert pre-init code here
    Submit1 = new Command("Submit", Command.OK, 1);
    // Insert post-init code here
    return Submit1;
    /** This method returns instance for Form1 component and should be called instead of accessing Form1 field directly.
    * @return Instance for Form1 component
    public Form get_Form1() {
    if (Form1 == null) {
    // Insert pre-init code here
    Form1 = new Form(null, new Item[] {get_stringItem1()});
    // Insert post-init code here
    return Form1;
    /** This method returns instance for stringItem1 component and should be called instead of accessing stringItem1 field directly.
    * @return Instance for stringItem1 component
    }

  • I need help with my operating system

    Okay, little bit of background:
    I bought the iMac second hand from a family friend who we no longer have contact with, the operating system etc was already installed.
    The disk drive on the mac is broke (I dont have the disks anyway, so it would be no use)
    I never purchased the operating system, like I said, it was pre-loaded.
    A few programmes weren't running correctly and the computer was just generally running slowly, so I decided to just restore the system as there was no important data on it and it would run faster in the end, and I figured the programmes would run properly again once restored.
    Anyway, I unknowingly deleted the operating system in the process of the restore (I thought it would only delete personal data like it does on my windows PC)
    I have no restore disk (a broken disk drive anyway), my apple ID was not used to buy the operating system, so therefore it cant be used to restore the operating system, I also never backed up the harddrive externally so it cant be reinstalled from that.
    My problem: I have no operating system and no way of recovering it. I read about Mavericks and because its free, I decided to try and download it, but with no operating system, the mac can only run 'Safari' and wont save things I try to download to the harddrive (it just says theres no space and the download doesnt happen). I also tried to access the App Store from Safari to try to download OS X lion on my apple ID, but once again, when using Safari on a mac without an operating system, it is very restrictive and I cant access the download page.
    I have no idea what to do and live miles away from the nearest apple store.
    Thanks in advance for any help provided by anyone.
    Jordan.
    Additional information:
    Its a 2007 iMac which was running OS X Lion 10.7.4 (I think, it was definitely Lion though).
    Serial No. is W8*******X85
    <Edited by Host>

    Ah. Well, then you have an itty-bitty problem. You need to backup your files to start with. You will need your retail Snow Leopard installer DVD which your friend should have provided to you. If he did not then ask him to bring it to you. It belongs to you along with the original distribution discs that came with computer when it was new.
    Do the following once you have the Snow Leopard DVD:
    Clean Install of Snow Leopard
    Be sure to make a backup first because the following procedure will erase
    the drive and everything on it.
         1. Boot the computer using the Snow Leopard Installer Disc or the Disc 1 that came
             with your computer.  Insert the disc into the optical drive and restart the computer.
             After the chime press and hold down the  "C" key.  Release the key when you see
             a small spinning gear appear below the dark gray Apple logo.
         2. After the installer loads select your language and click on the Continue
             button. When the menu bar appears select Disk Utility from the Utilities menu.
             After DU loads select the hard drive entry from the left side list (mfgr.'s ID and drive
             size.)  Click on the Partition tab in the DU main window.  Set the number of
             partitions to one (1) from the Partitions drop down menu, click on Options button
             and select GUID, click on OK, then set the format type to MacOS Extended
             (Journaled, if supported), then click on the Apply button.
         3. When the formatting has completed quit DU and return to the installer.  Proceed
             with the OS X installation and follow the directions included with the installer.
         4. When the installation has completed your computer will Restart into the Setup
             Assistant. Be sure you configure your initial admin account with the exact same
             username and password that you used on your old drive. After you finish Setup
             Assistant will complete the installation after which you will be running a fresh
             install of OS X.  You can now begin the update process by opening Software
             Update and installing all recommended updates to bring your installation current.
    Download and install Mac OS X 10.6.8 Update Combo v1.1.
    Upgrading to Lion
    You can purchase Lion at the Online Apple Store. The cost is $19.99 (as it was before) plus tax.  It's a download. You will get an email containing a redemption code that you then use at the Mac App Store to download Lion. Save a copy of that installer to your Downloads folder because the installer deletes itself at the end of the installation.
         Lion System Requirements
           1. Mac computer with an Intel Core 2 Duo, Core i3, Core i5, Core i7,
               or Xeon processor
           2. 2GB of memory
           3. OS X v10.6.6 or later (v10.6.8 recommended)
           4. 7GB of available space
           5. Some features require an Apple ID; terms apply.
    After you sign into your App Store account with your Apple ID click on the Redeem option under Quick Links to download your copy of Lion.
    As an aside to this: All actual 2007 iMacs are able to run Mavericks. So rather than buying Lion you may prefer to upgrade to Mavericks which is Free.

  • I need help with my for loop in this array

    Ok well, I can't get my code to work. Also, please remember that this is just my draft so it isnt pretty. I will fix it up later so please look at it. The thing I want to do is look into the array for a time that matches what the user entered and return the toString() of that one. I know there is something wrong with my for loop but I cant figure how to fix it. please help. here is what i have so far:
    import javax.swing.JOptionPane;
    public class Runner
        public static void main (String[] args)
            String timeStr;
            int time, again, optiStr;
            Inbound[] in = new Inbound[25];
             in[0]=new Inbound ("",0,"On Time num0");
             in[1]=new Inbound ("",2,"On Time num1");
             in[2]=new Inbound ("",3,"Delayed num2");
             in[3]=new Inbound ("",4,"On Time");
             in[4]=new Inbound ("",5,"On Time");
             in[5]=new Inbound ("",6,"Canceled");
             in[6]=new Inbound ("",1,"Canceled num6");
             in[7]=new Inbound ("",8,"On Time");
             in[8]=new Inbound ("",9,"Delayed");
             in[9]=new Inbound ("",10,"On Time");
             in[10]=new Inbound ("",11,"Delayed");
             in[11]=new Inbound ("",12,"On Time");
             in[12]=new Inbound ("",13,"Delayed");
             in[13]=new Inbound ("",14,"On Time");
             in[14]=new Inbound ("",15,"On Time");
             in[15]=new Inbound ("",16,"On Time");
             in[16]=new Inbound ("",17,"Canceled");
             in[17]=new Inbound ("",18,"On Time");
             in[18]=new Inbound ("",19,"On Time");
             in[19]=new Inbound ("",20,"Canceled");
             in[20]=new Inbound ("",21,"On Time");
             in[21]=new Inbound ("",22,"Delayed");
             in[22]=new Inbound ("",23,"On Time");
             in[23]=new Inbound ("",24,"Cancled");
             in[24]=new Inbound ("",7,"On Time num24");
            do{
                timeStr = JOptionPane.showInputDialog ("In military time, what hour do you want?");
                time = Integer.parseInt(timeStr);
                if (time<=0 || time>24)
                 JOptionPane.showMessageDialog (null, "Error");
                 optiStr = JOptionPane.showConfirmDialog (null, "If you want Incoming flights click Yes, but if not click No");
                if (optiStr==JOptionPane.YES_OPTION)
    //(ok this is the for loop i am talking about )
                    for (int index = 0; index < in.length; index++)
                      if ( time == Inbound.getTime())
                   JOptionPane.showMessageDialog (null, Inbound.tostring());  //return the time asked for
    //               else JOptionPane.showMessageDialog (null, "else");
                }//temp return else if failed to find time asked for
    //             else
    //               if (optiStr==JOptionPane.CANCEL_OPTION)
    //                 JOptionPane.showMessageDialog(null,"Canceled");
    //              else
    //                {Outbound.run();
    //                JOptionPane.showMessageDialog (null, "outbound");}//temp
                  again=JOptionPane.showConfirmDialog(null, "Try again?");
            while (again==JOptionPane.YES_OPTION);
    }any help would be greatly appriciated.

    rumble14 wrote:
    Ok well, I can't get my code to work. Also, please remember that this is just my draft so it isnt pretty. I will fix it up later so please look at it. The thing I want to do is look into the array for a time that matches what the user entered and return the toString() of that one. I know there is something wrong with my for loop but I cant figure how to fix it. please help. here is what i have so far:
    >//(ok this is the for loop i am talking about )
    for (int index = 0; index < in.length; index++)
    if ( time == Inbound.getTime())
    JOptionPane.showMessageDialog (null, Inbound.tostring());  //return the time asked for
    Inbound.getTime() is a static method of your Inbound class, that always returns the same value, I presume? As opposed to each of the 25 members of your array in, which have individual values?
    Edited by: darb on Mar 26, 2008 11:12 AM

Maybe you are looking for

  • How do i get back my ringtones after upgrade

    I downloaded some ringtones after I upgraded my phone to Ios 6 then I restore my contacts using itunes then when i look at my ringtones after restoring it, all my ringtones and photos are lost. Can you help me get back my photos and ringtones please.

  • Hyperlink in cells of WDALV ?

    Hi, I am creating a hyperlink in Cells of ALV Output for a URL .but it not working Here is the code from component controller if  'TPLSIZE' ne 0.         data:         v_link_to_url type ref to cl_salv_wd_uie_link_to_url.         create object v_link

  • External file imported in flash

    I need urgent help I need to import the hyperlinks from a text file into my swf file at run time can anyone help me on tht

  • No row returned message

    Hi, I have a report that some times doesn't have results. When it happens, I get a message "No row returned"...is it possible to change or delete this message? many thanks in advance, Miguel

  • Playcount sync with WMP10- ZEN MI

    Hi, OK, i use WMP0 and have firmware 2.20.05- since the upgrade I have been using the improved functions of WMP0 a lot to create auto-playlists, a number of which revolve around how recently I listed to the tracks (eg 4* rated not heard for a month..