Could someone check this simple code.... pleaseee

  while (in.ready()){
              int i = 0;
              line = in.readLine();
               if(line.equals("NAMES"))
                line = in.readLine();
               if (!line.equals("RESULTS")) {
                 if(!line.equals("NAMES")) {
                     teamVector.add(i,new Team(line));
                     i++;
              if(line.equals("RESULTS"))
                break;
           } //closing first in.ready
[/code[
My question is ... at one point when reading in from the file the line = in.readling() will be a string "NAMES"... does that line then get added to the vector ??
WELL IT DOES !!!!!!!!!!
AND I CAN BELIEVE MY EYES !!! HOW CAN IT>>> MY IF"S ARE CORRECT OR GOD TOOK AWAY MY LOGIC !
Please help
Many Thanks to all who do !                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           

Repost....
  while (in.ready()){
              int i = 0;
              line = in.readLine();
               if(line.equals("NAMES"))
                line = in.readLine();
               if (!line.equals("RESULTS")) {
                 if(!line.equals("NAMES")) {
                     teamVector.add(i,new Team(line));
                     i++;
              if(line.equals("RESULTS"))
                break;
           } //closing first in.readyMy question is ... at one point when reading in from the file the line = in.readling() will be a string "NAMES"... does that line then get added to the vector ??
WELL IT DOES !!!!!!!!!! AND I CAN BELIEVE MY EYES !!! HOW CAN IT ???
MY IF"S ARE CORRECT OR GOD TOOK AWAY MY LOGIC !
Please help
Many Thanks to all who do ... i really appreciate it you will save me many bad tempers....

Similar Messages

  • Could someone check this Terminal log for keystroke loggers?

    Last login: Mon Nov  4 16:23:37 on ttys000
    Rebeccas-MacBook-Pro:~ RebeccaMurray$ kextstat -kl | awk '!/com\.apple/{printf "%s %s\n", $6, $7}'
    Rebeccas-MacBook-Pro:~ RebeccaMurray$ sudo launchctl list | sed 1d | awk '!/0x|com\.(apple|openssh|vix)|edu\.mit|org\.(amavis|apache|cups|isc|ntp|postfi x|x)/{print $3}'
    WARNING: Improper use of the sudo command could lead to data loss
    or the deletion of important system files. Please double-check your
    typing when using sudo. Type "man sudo" for more information.
    To proceed, enter your password, or type Ctrl-C to abort.
    Password:
    Sorry, try again.
    Password:
    com.microsoft.office.licensing.helper
    com.google.keystone.daemon
    com.adobe.fpsaud
    Rebeccas-MacBook-Pro:~ RebeccaMurray$ launchctl list | sed 1d | awk '!/0x|com\.apple|edu\.mit|org\.(x|openbsd)/{print $3}'
    com.google.keystone.system.agent
    com.spotify.webhelper
    com.facebook.videochat.RebeccaMurray.updater
    Rebeccas-MacBook-Pro:~ RebeccaMurray$ ls -1A /e*/mach* {,/}L*/{Ad,Compon,Ex,Fram,In,Keyb,La,Mail/Bu,P*P,Priv,Qu,Scripti,Servi,Spo,Sta} * L*/Fonts 2> /dev/null
    /Library/Components:
    /Library/Extensions:
    /Library/Frameworks:
    AEProfiling.framework
    AERegistration.framework
    Adobe AIR.framework
    AudioMixEngine.framework
    NyxAudioAnalysis.framework
    PluginManager.framework
    TSLicense.framework
    iTunesLibrary.framework
    /Library/Input Methods:
    /Library/Internet Plug-Ins:
    AdobePDFViewer.plugin
    AdobePDFViewerNPAPI.plugin
    Flash Player.plugin
    Flip4Mac WMV Plugin.plugin
    JavaAppletPlugin.plugin
    Quartz Composer.webplugin
    QuickTime Plugin.plugin
    SharePointBrowserPlugin.plugin
    SharePointWebKitPlugin.webplugin
    Silverlight.plugin
    flashplayer.xpt
    googletalkbrowserplugin.plugin
    npgtpo3dautoplugin.plugin
    nsIQTScriptablePlugin.xpt
    o1dbrowserplugin.plugin
    /Library/Keyboard Layouts:
    /Library/LaunchAgents:
    com.google.keystone.agent.plist
    /Library/LaunchDaemons:
    com.adobe.fpsaud.plist
    com.google.keystone.daemon.plist
    com.microsoft.office.licensing.helper.plist
    /Library/PreferencePanes:
    Flash Player.prefPane
    Flip4Mac WMV.prefPane
    /Library/PrivilegedHelperTools:
    com.microsoft.office.licensing.helper
    /Library/QuickLook:
    iBooksAuthor.qlgenerator
    iWork.qlgenerator
    /Library/QuickTime:
    AppleIntermediateCodec.component
    AppleMPEG2Codec.component
    Flip4Mac WMV Advanced.component
    Flip4Mac WMV Export.component
    Flip4Mac WMV Import.component
    /Library/ScriptingAdditions:
    Adobe Unit Types.osax
    /Library/Spotlight:
    Microsoft Office.mdimporter
    iBooksAuthor.mdimporter
    iWork.mdimporter
    /Library/StartupItems:
    /etc/mach_init.d:
    /etc/mach_init_per_login_session.d:
    /etc/mach_init_per_user.d:
    Library/Address Book Plug-Ins:
    SkypeABDialer.bundle
    SkypeABSMS.bundle
    Library/Fonts:
    Library/Input Methods:
    .localized
    Library/Internet Plug-Ins:
    FacebookVideoCalling.bundle
    Library/Keyboard Layouts:
    Library/LaunchAgents:
    com.apple.AddressBook.ScheduledSync.PHXCardDAVSource.604394D0-D959-402F-9BA9-EA4 9EC2C3AA7.plist
    com.apple.FolderActions.enabled.plist
    com.apple.FolderActions.folders.plist
    com.facebook.videochat.RebeccaMurray.plist
    com.spotify.webhelper.plist
    Library/PreferencePanes:
    Rebeccas-MacBook-Pro:~ RebeccaMurray$ osascript -e 'tell application "System Events" to get name of every login item' 2> /dev/null
    iTunesHelper, Android File Transfer Agent, Dropbox
    Rebeccas-MacBook-Pro:~ RebeccaMurray$

    I ran it on debug mode and changed it to this? see any problems now? or are they fixed? It looks to me like it took some actions out, I hope that doesn't
    effect it....
    stop();
    addEventListener(Event.ENTER_FRAME, preLoad);
    function preLoad(e:Event):void{
    var bytestoLoad):Number = loaderInfo.bytesTotal;
    var numberLoaded:Number = loaderInfo.bytesLoaded;
    if (bytestoLoad == numberLoaded) {
    removeEventListener)Event.ENTER_FRAME, preLoad)
    gotoAndStop(2);
    i'm kinda new to flash ((I started as a lua scripter (on Roblox)) so I'm a little confused about this. Thanks for the help!!

  • May you check this simple select case...

    Guys, please, can you check this stupid code? I'm totally shattered and maybe I don't see the simple thing...
    with cte as (
    SELECT CORE FROM IMPORTOIL group by core)
    ,cte2 as
    (select core , mps, technology
    from cte xx right join GeneratorTypo gt on xx.core=gt.mps)
    select core, mps, technology , case core when null then 'Import ' else technology end from cte2
    even if I got several core NULL it retrieve for the select case only the technology and never the 'Import'. Pratically, if ( I miss 2012 wit the simple iif) the core is null write the same value that there is in technology otherwise write 'Import'...what's
    wrong with that?

    Please post DDL, so that people do not have to guess what the keys, constraints, Declarative Referential Integrity, data types, etc. in your schema are. Learn how to follow ISO-11179 data element naming conventions and formatting rules. Nothing here is correct! 
    Temporal data should use ISO-8601 formats. Code should be in Standard SQL as much as possible and not local dialect. 
    This is minimal polite behavior on SQL forums. You also need to learn the syntax for a CASE expression: 
    CASE WHEN core IS NULL THEN 'IMPORT ' ELSE technology END
    The CASE expression is an *expression* and not a control statement; that is, it returns a value of one data type. SQL-92 stole the idea and the syntax from the ADA programming language. Here is the BNF for a <case specification>:
     <case specification> ::= <simple case> | <searched case>
     <simple case> ::=
        CASE <case operand>
          <simple when clause>...
          [<else clause>]
        END
     <searched case> ::=
        CASE
          <searched when clause>...
          [<else clause>]
        END
     <simple when clause> ::= WHEN <when operand> THEN <result>
     <searched when clause> ::= WHEN <search condition> THEN <result>
     <else clause> ::= ELSE <result>
     <case operand> ::= <value expression>
     <when operand> ::= <value expression>
     <result> ::= <result expression> | NULL
     <result expression> ::= <value expression>
    The searched CASE expression is probably the most used version of the expression. The WHEN ... THEN ... clauses are executed in left to right order. The first WHEN clause that tests TRUE returns the value given in its THEN clause. And, yes, you can nest CASE
    expressions inside each other. If no explicit ELSE clause is given for the CASE expression, then the database will insert a default ELSE NULL clause. If you want to return a NULL in a THEN clause, then you must use a CAST (NULL AS <data type>) expression.
    I recommend always giving the ELSE clause, so that you can change it later when you find something explicit to return. 
    The <simple case expression> is defined as a searched CASE expression in which all the WHEN clauses are made into equality comparisons against the <case operand>. For example
      CASE iso_sex_code
      WHEN 0 THEN 'Unknown'
      WHEN 1 THEN 'Male'
      WHEN 2 THEN 'Female'
      WHEN 9 THEN 'N/A'
      ELSE NULL END
    could also be written as:
      CASE 
      WHEN iso_sex_code = 0 THEN 'Unknown'
      WHEN iso_sex_code = 1 THEN 'Male'
      WHEN iso_sex_code = 2 THEN 'Female'
      WHEN iso_sex_code = 9 THEN 'N/A'
      ELSE NULL END
    There is a gimmick in this definition, however. The expression
     CASE foo
     WHEN 1 THEN 'bar'
     WHEN NULL THEN 'no bar'
     END
    becomes 
     CASE WHEN foo = 1 THEN 'bar'
          WHEN foo = NULL THEN 'no_bar'  -- error!
          ELSE NULL END 
    The second WHEN clause is always UNKNOWN. 
    The SQL-92 Standard defines other functions in terms of the CASE expression, which makes the language a bit more compact and easier to implement. For example, the COALESCE () function can be defined for one or two expressions by
    1) COALESCE (<value exp #1>) is equivalent to (<value exp #1>) 
    2) COALESCE (<value exp #1>, <value exp #2>) is equivalent to 
       CASE WHEN <value exp #1> IS NOT NULL 
            THEN <value exp #1> 
            ELSE <value exp #2> END
    then we can recursively define it for (n) expressions, where (n >= 3), in the list by 
    COALESCE (<value exp #1>, <value exp #2>, . . ., n), as equivalent to:
       CASE WHEN <value exp #1> IS NOT NULL 
            THEN <value exp #1> 
            ELSE COALESCE (<value exp #2>, . . ., n) 
       END
    Likewise, NULLIF (<value exp #1>, <value exp #2>) is equivalent to:
       CASE WHEN <value exp #1> = <value exp #2> 
            THEN NULL 
            ELSE <value exp #1> END
    It is important to be sure that you have a THEN or ELSE clause with a data type that the compiler can find to determine the highest data type for the expression. 
    A trick in the WHERE clause is use it for a complex predicate with material implications. 
    WHERE CASE 
          WHEN <search condition #1> 
          THEN 1  
          WHEN <search condition #2> 
          THEN 1  
          ELSE 0 END  = 1
    Gert-Jan Strik posted some exampels of how ISNULL() and COALESCE() on 2004 Aug 19
    CREATE TABLE #t(a CHAR(1));
    INSERT INTO #t VALUES (NULL);
    SELECT ISNULL(a,'abc') FROM #t; 
    SELECT COALESCE(a, 'abc') FROM #t; 
    DROP TABLE #t;
    He always use COALESCE, with the exception of the following type of 
    situation, because of its performance consequences: 
    SELECT ..., 
      ISNULL((SELECT COUNT(*)  -- or other aggregate 
               FROM B 
              WHERE B.key = A.key), 0) 
    FROM A;
    Likewise, Alejandro Mesa came up with this example:
    SELECT 13 / COALESCE(CAST(NULL AS INTEGER), 2.00); -- promote to highest type (decimal)
    SELECT 13 / ISNULL(CAST(NULL AS INTEGER), 2.00); -- promote to first type (integer)
    >> if (I miss 2012 with the simple iif) the core is null write the same value that there is in technology otherwise write 'Import'... what's wrong with that? <<
    Why do you want to write non_ANSI/ISO dialect? Do you like your spreadsheets that much? :(
    --CELKO-- Books in Celko Series for Morgan-Kaufmann Publishing: Analytics and OLAP in SQL / Data and Databases: Concepts in Practice Data / Measurements and Standards in SQL SQL for Smarties / SQL Programming Style / SQL Puzzles and Answers / Thinking
    in Sets / Trees and Hierarchies in SQL

  • Could someone answer this please.

    Could someone answer this please. I uploaded all my photo's to the cloud from my mac. I then checked on my iPhone and iPad and i could see all 8000 photo's so I deleted them from the mac pro and then set up my mac book air. now I can only see 500 of the 8000 photo's?

    The following is from this Apple document: iCloud: My Photo Stream FAQ
    Does using My Photo Stream substitute for using iCloud Backup or iTunes to back up the photos in my Camera Roll?
    No. Photos in My Photo Stream are saved on the iCloud server for 30 days. To save or back up these photos, you must copy them from My Photo Stream to your Camera Roll on your iOS device. You can then back up your Camera Roll using iCloud or iTunes.
    You should also review this Apple document: My Photo Stream and iCloud Photo Sharing limits
    Bottom line:  iCloud is not a substitute for a local backup of your files including your iPhoto library.  Time Machine and an external HD is the easiest backup strategy to implement.

  • What's wrong with this simple code?

    What's wrong with this simple code? Complier points out that
    1. a '{' is expected at line6;
    2. Statement expected at the line which PI is declared;
    3. Type expected at "System.out.println("Demostrating PI");"
    However, I can't figure out them. Please help. Thanks.
    Here is the code:
    import java.util.*;
    public class DebugTwo3
    // This class demonstrates some math methods
    public static void main(String args[])
              public static final double PI = 3.14159;
              double radius = 2.00;
              double area;
              double roundArea;
              System.out.println("Demonstrating PI");
              area = PI * radius * radius;
              System.out.println("area is " + area);
              roundArea = Math.round(area);
              System.out.println("Rounded area is " + roundArea);

    Change your code to this:
    import java.util.*;
    public class DebugTwo3
         public static final double PI = 3.14159;
         public static void main(String args[])
              double radius = 2.00;
              double area;
              double roundArea;
              System.out.println("Demonstrating PI");
              area = PI * radius * radius;
              System.out.println("area is " + area);
              roundArea = Math.round(area);
              System.out.println("Rounded area is " + roundArea);
    Klint

  • Hi can someone keep this simple for me! my iPhone is due for a renewal. but my old laptop that it is backed up to no longer works! how do i go about saving all my songs pics etc to a new laptop without losing anything? please help!!!

    hi can someone keep this simple for me! my iPhone is due for a renewal. but my old laptop that it is backed up to no longer works! how do i go about saving all my songs pics etc to a new laptop without losing anything? please help!!!

                     Syncing to a "New" Computer or replacing a "crashed" Hard Drive

  • When running labview's test executive I recieve runtime error: Call to step "PRE-RUN" failed. Could someone explain this error?

    I have a set of vi's that work when run under labview. However, when calling these vi's from labview's test executive I recieve runtime error: Call to step "PRE-RUN" failed. in Assign Connector Pane.vi->Call Test.vi->Execute Pre-Run.vi->Test Executive. Could someone explain this error to me? (or ideally tell me how to fix it?) Thanks.

    Hello,
    There are any number of possible causes to this problem. Which version of Test Executive are you using? Have you upgraded your Test Executive recently? The latest version is 5.1.1. If you have changed anything about Test Executive on your computer recently, I recommend you perform a mass compile of all your VI libraries, as having different versions of the VIs on your system could often result in the "Call to Step XYZ Failed" errors. Also, are you using any DAQ or Analysis VIs in your steps? We have seen problems where the use of DAQ or Analysis VIs in the sequence can cause intermittent "Call to Step...Failed" errors. There are some KnowledgeBase entries on our website that discuss this problem. Are you using the Test Executive in the VI environment, or
    as an executable? Again, there are some problems with using Test Executive as an executable that result in these errors, and there are also KnowledgeBase entries that discuss these problems.
    If you have a pared-down application that demonstrates the problem, feel free to send me your VIs and your .seq file and I will try to reproduce the problem.
    Alternatively, I would suggest you visit www.ni.com/teststand to learn about TestStand, our state-of-the-art Test Sequencing software that completely outperforms Test Executive. It is very easy to use and much more powerful, and we have a top-notch support team available dedicated exclusively to supporting TestStand. As you are probably aware, we are no longer developing Test Executive, and instead are concentrating our efforts on making TestStand the penultimate solution for all our customers' test sequencing needs.
    I appreciate your patience on this issue. Please let me know if I can offer further assistance.
    Have a pleasant weeken
    d.
    Sincerely,
    Darren Nattinger
    Applications Engineer
    National Instruments
    Darren Nattinger, CLA
    LabVIEW Artisan and Nugget Penman

  • Kernel-fglrx-custom: Please could someone check/improve my PKGBUILD

    I decided to share a script as it has been very useful to me.  I have never written a PKGBUILD before and it took some attempts to make a working one, so please could someone check the PKGBUILD over and let me know how horrible it is and what I should do differently
    https://aur.archlinux.org/packages/kern … ustom-git/
    It installs fine on my PC, but I'm pretty sure that I'm not using the PKGBUILD file properly.
    Last edited by windows_me (2013-08-27 17:18:45)

    There's a couple of things I would change:
    1) The name doesn't really tell the user what the package is for. "kernel-fglrx-legacy" would probably be more helpful.
    2) Rather than pulling a script that will then pull down the kernel package, why not use the existing kernel PKGBUILD in the ABS? You can easily modify that PKGBUILD to apply your script/patches.

  • Could anyone check this code for errors for me??

    Hi! Could someone please tell me if you see any problems with this code?? a friend wants me to check it for errors, but can't find any. I just wanted to make sure, because there are probably a lot of better scripters than me reading this. Please answer soon!!
    heres the code:
    stop();
    addEventListener(Event.ENTER_FRAME, preLoad);
    function  preLoad(e:Event):void{
    var bytestoLoad):Number = loaderInfo.bytesTotal; 
    var numberLoaded:Number = loaderInfo.bytesLoaded;
    if (bytestoLoad ==  numberLoaded) {
    removeEventListener)Event.ENTER_FRAME, preLoad) 
    gotoAndStop(2);
    }else {
    preLoader.preLoaderFill.scaleX =  numberLoaded/bytestoLoad;
    preLoader.bytePercent.text = Math.floor  (numberLoaded/bytestoLoad*100) + "%";
    Thanks!!
    -Sammy

    I ran it on debug mode and changed it to this? see any problems now? or are they fixed? It looks to me like it took some actions out, I hope that doesn't
    effect it....
    stop();
    addEventListener(Event.ENTER_FRAME, preLoad);
    function preLoad(e:Event):void{
    var bytestoLoad):Number = loaderInfo.bytesTotal;
    var numberLoaded:Number = loaderInfo.bytesLoaded;
    if (bytestoLoad == numberLoaded) {
    removeEventListener)Event.ENTER_FRAME, preLoad)
    gotoAndStop(2);
    i'm kinda new to flash ((I started as a lua scripter (on Roblox)) so I'm a little confused about this. Thanks for the help!!

  • Beginner Question | The use of modulus in this simple code example.

    Hello everyone,
    I am just beginning to learn Java and have started reading "Java Programming for the absolute beginner". It is quite a old book but seems to be doing the trick, mainly.
    There is a code example which I follow mostly but the use of the modulus operator in the switch condition doesn't make sense to me, why is it used? Could someone shed some light on this for me?
    import java.util.Random;
    public class FortuneTeller {
      public static void main(String args[]) {
        Random randini = new Random();
        int fortuneIndex;
        String day;
        String[] fortunes = { "The world is going to end :-(.",
          "You will have a HORRIBLE day!",
          "You will stub your toe.",
          "You will find a shiny new nickel.",
          "You will talk to someone who has bad breath.",
          "You will get a hug from someone you love.",
          "You will remember that day for the rest of your life!",
          "You will get an unexpected phone call.",
          "Nothing significant will happen.",
          "You will bump into someone you haven't seen in a while.",
          "You will be publicly humiliated.",
          "You will find forty dollars.",
          "The stars will appear in the sky.",
          "The proper authorities will discover your secret.",
          "You will be mistaken for a god by a small country.",
          "You will win the lottery!",
          "You will change your name to \"Bob\" and move to Alaska.",
          "You will discover first hand that Bigfoot is real.",
          "You will succeed at everything you do.",
          "You will learn something new.",
          "Your friends will treat you to lunch.",
          "You will meet someone famous.",
          "You will be very bored.",
          "You will hear your new favorite song.",
          "Tomorrow... is too difficult to predict" };
        System.out.println("\nYou have awakened the Great Randini...");
        fortuneIndex = randini.nextInt(fortunes.length);
        switch (randini.nextInt(7) % 7) {   
          case 0:
            day = "Sunday";
            break;
          case 1:
            day = "Monday";
            break;
          case 2:
            day = "Tuesday";
            break;
          case 3:
            day = "Wednesday";
            break;
          case 4:
            day = "Thursday";
            break;
          case 5:
            day = "Friday";
            break;
          case 6:
            day = "Saturday";
            break;
          default:
            day = "Tomorrow";
        System.out.println("I, the Great Randini, know all!");
        System.out.println("I see that on " + day);
        System.out.println("\n" + fortunes[fortuneIndex]);
        System.out.println("\nNow, I must sleep...");
    }

    randini.nextInt(7) % 7randini.nextInt(7) returns a value in the range 0 <= x < 7, right? (Check the API!) And:
    0 % 7 == 0
    1 % 7 == 1
    2 % 7 == 2
    3 % 7 == 3
    4 % 7 == 4
    5 % 7 == 5
    6 % 7 == 6Looks like superfluous code to me. Maybe originally they wrote:
    randini.nextInt() % 7Note this code has problems, because, for example -1 % 7 == -1

  • Can someone checkout this JDBC code for me?

    I'd be very grateful if an expert out there would check out my code for me, which I am about to use a great deal.
    I've written this to save me some duplicated code, but since I haven't seen this approach much in my travels, I'm wondering if it has any particular flaws.
    A separate DbAccess class is instantiated for any database access work, and once instantiated, getConnection is called and once finished closeConnection must be called.
    You can get a ResultSet instance with just a little code and it's up to the calling programme to close it again.
    The only things left open are the Statements, but they will get garbage collected or at any rate will be closed with the connection (whichever is sooner).
    Is there anything wrong with this code?
    import java.sql.*;
    import javax.naming.*;
    import javax.sql.*;
    public class DbAccess{
         * The chosen datasource for this instance of the class
        private String dataSource;
         * The connection held in this instance (created by calling getConnection())
        private Connection con;
         * Instantiates a DbAccess instance, setting the datasource
        public DbAccess(String datasource){
         this.dataSource = dataSource;
         * Gets a connection to the database chosen in constructor parameter:
         * NB The calling programme MUST call closeConnection() after it's finished with it!
        public void getConnection()
         throws NamingException,
                SQLException{
         Context ctx = new InitialContext();
         DataSource ds = (DataSource)ctx.lookup(dataSource);
         con = ds.getConnection();
        }//end getConnection()
         * Closes the connection previously obtained with getConnection(), this MUST be called when the calling
         * programme has finished using the database.
        public void closeConnection()
         throws SQLException{
         con.close();
        }//end closeConnection()
         * Returns a ResultSet for a simple query, using a plain Statement
         * @param query - the complete database query
         * @return ResultSet for the query in the parameter
         * N.B. The calling programme MUST close the ResultSet after it's finished with it!
        public ResultSet getResultSet(String query)
         throws SQLException{
         Statement stmt = con.createStatement();
         ResultSet rs = stmt.executeQuery(query);
         return rs;
        }//end getResultSet()
         * Returns a ResultSet for a simple query, using a PreparedStatement, and accepting
         * a String parameter that can contain a String for a single setString().
         * @param query - the complete database query
         * @param stringToSet - the String for the preparedStatement's setString() method
         * @return ResultSet for the query in the parameter
         * N.B. The calling programme MUST close the ResultSet after it's finished with it!
        public ResultSet getResultSet(String query, String stringToSet)
         throws SQLException{
         PreparedStatement ps = con.prepareStatement(query);
         ps.setString(1,stringToSet);
         ResultSet rs = ps.executeQuery();
         return rs;
        }//end getResultSet()
    }//end class

    Ok, guys you've thoroughly trashed my code, fine, and
    I half expected it because there's nothing like this
    code about the placeYou're suffering from delusions of grandeur. There are plenty of approaches to that particular itch. The closest to what you're trying to achieve would probably be Spring's JDBCTemplate:
    http://www.springframework.org/docs/api/org/springframework/jdbc/core/JdbcTemplate.html
    Hibernate, iBatis, EJB3, and myriad others tackle the issue in other ways.
    , but are we therefore concluding
    that reducing the jdbc code is virtually impossibile
    - and there's an awful lot of it every time you want
    to do a query?My major objection to your approach is that you introduce a variety of bugs without significantly reducing the amount of JDBC code required. Most of what you're after in your class can be achieved by a convenience method to acquire the Connection object.
    1) If (ok maybe it's a big if) - if I always close
    the connection, the statements aren't being leaked
    right?Not necessarily. To the best of my recollection the spec doesn't mandate this. And even if it does I've certainly encountered drivers that don't clean up statement resources that aren't explicitly released. So there's a theoretical and practical aspect to this.
    2) I'm using Tomcat datasources, for getting the
    connection, and I thought that you just had to call
    con.close() for it to return to the pool. Am I wrong
    on this?No, you're right - but nothing in your class prevents the user from calling getConnection twice and leaking a connection - the least you could do in the circumstances is prevent that by throwing an exception if they try.

  • Could someone confirm this behavior for me

    OK not sure if I've found a bug or if I just need to get some sleep but could someone try the following and report back:
    *Note nothing here should harm your library but if you're squeamish you might want to do this on a test library*
    1. Go into Browser view, select one of the library smart albums, doesn't matter which one.
    2. Click the magnifying icon to open the smart settings window.
    3. Leaving the smart settings window open, select the Photos icon. All your images should be displayed. The top of the smart settings window should read *Smart Settings: Photos*
    4. Which ever check box is selected (most likely its the ratings checkbox) deselect it. The browser window should go blank. Click the x to close the smart settings window.
    5. Now, try to get images back. The search box and filter window attached to the viewer will not bring back the images. Select Projects or anything else and images are displayed just none in the Photos window.
    6. To restore the viewer, select one of the library smart albums, click its smart settings open icon, with the smarts settings window open select the Photos icon. Select the Rating check box, set the ratting to *is greater than of equal to* and set the value to x. All your photos will reappear.
    7. Close the *Smart Settings* window, everything is back to normal.
    The bug here is that the Photos 'album' shouldn't be able to have a *Smart Settings* filter attached to it. The window that opens if you click the search icon at the top of the browser window is a filter. Of course *Smart Settings* windows should only attach to smart albums. Photos isn't a smart album. It's not even an Album (except internally to Aperture).
    If you try this please report back, thanks.

    Thanks Kirby,
    Yeah I managed to do this to myself last night, which is how I ran across it. It was a real pain, I knew my images weren't gone but for a brief second .....
    Anyway I wonder how many reports of libraries disappearing are a result of this? Did you do a report to Apple when you ran across this? I'll send one in today.
    regards

  • How to invoke jdb for this simple code

    up to now i have been debugging by looking at the code, could someone please tell me how
    to invoke jdb for the following example, and how would i look at the local values within x & y
    (without having to rely on JOptionPane):
    //pg73 ex2.16 The x value input must be larger than the y value
    import javax.swing.JOptionPane;
    public class ex2_11
    public static void main(String args[])
    int x =2, y=3;
    JOptionPane.showMessageDialog( null,
    "a x= " x            "\n " +
    "b the value of x+x is " + (x+x) + "\n " +
    "c x= " + "\n " +
    "d " + (x+y) + "= " + (y+x),
    "Results",JOptionPane.PLAIN_MESSAGE);
    System.exit(0);

    I think I have already answered this question somewhere else, but I will reiterate it here.
    If you have compile errors in your source code (i.e. you left the semi-colon off at the end of a statement), a class file will not get generated.
    What you have done is the following:
    1. created a working java source file
    2. compiled that file and generated a class file
    3. then changed the working source file and introduced a compiler error (i.e. you left the semi-colon off at the end of a statement)
    4. then attempted to compile the file (with javac), but due to the compiler error a new class file did not get generated (therefore the old class file from the previous compile still resides on your machine).
    5. Then you ran jdb on the old previously generated class file.
    To confirm what I am saying is true. Delete the class file, then try to generate it again after introducing your compiler error. A new class file will not get generated and therefore you won't be able to use jdb (as jdb requires the class files).
    Hope this helps (and gets me the duke dollars),
    Tim

  • Could Someone check my cabinet???

    Could someone please check my cabinet my postcode is GL528WP

    Hi, at this moment in time your exchange is not currently in the rollout plans, sorry buddy
    If you want to say thanks for a helpful answer, please click on the Ratings star on the left-hand side If the the reply answers your question then please mark as ’Mark as Accepted Solution

  • Could someone verify this please: weird sound problems

    Could someone please verify the following. Plug in your headphone into the headphone (minijack) port on the left. Restart your computer.
    Can you hear the startup sound through the built-in speakers, or not? I don't think you should, but I do. I tried everything (PRAM, PMU reset)... nothing solves it.
    I also hear a quiet clicking sound through the headphones when any sound comes on. It then goes away sometimes, but it comes back with a restart.
    Thanks!

    Hello,
    Could someone please verify the following. Plug in
    your headphone into the headphone (minijack) port on
    the left. Restart your computer.
    I keep speakers plugged into my Mac Mini to get better sound.
    Can you hear the startup sound through the built-in
    speakers, or not? I don't think you should, but I do.
    Yes, this is perfectly normal. This is how the Mac's are designed. They will always play their startup chime through the built-in speaker.
    The external speakers will not do anything until after the machine has booted up completely.
    I tried everything (PRAM, PMU reset)... nothing
    solves it.
    There's nothing to fix. It is working just as it should.
    I also hear a quiet clicking sound through the
    headphones when any sound comes on. It then goes away
    sometimes, but it comes back with a restart.
    This can just be line noise.
    If you are talking about head-phones, then it's possible you are hearing noise from a loose connection. Try wiggling the connector and see if you hear the noise. If so, then it could be that you are inadvertently moving this connection when you move your head around.
    Likewise, see if the noise appears when you move the wire around a little bit. If so, there might be a short in the wire.
    If you are working with external speakers, then it could be that the speakers are amplifying some line noise that they are picking up. This can be noise that is generated on the circuits inside the computer.
    There's any number of things that can cause clicking sounds like this. I would try other speakers, and maybe even a higher-quality audio cable and see what happens.
    Hope this helps.

Maybe you are looking for