String help needed.

Hi guys column(below in the SQL) is a Varchar string column. COLUMN has values like ('312049D','312CF45','EDC0645','EDC5679').
Why does SQL2 take more than twice times it takes to return SQL1 . I am learning ways to tune SQL. Please provide your suggestions/experiences to tune the SQL2. I don't understand how does it matter whether it is a 312 or EDC since the column itself is a varchar string column. Thanks in advance.
--SQL1
SELECT COLUMN FROM TABLE
WHERE SUBSTR(COLUMN,1,3) IN ('312')
vs
--SQL2
SELECT COLUMN FROM TABLE
WHERE SUBSTR(COLUMN,1,3) IN ('EDC')

jeneesh wrote:
Nimish Garg wrote:
I would suggets you to create an index on COLUMN, and re-write your query using LIKE and index hint. following may be helpful
http://nimishgarg.blogspot.in/2012/10/index-hints-and-like-clause.html
To use INDEX hint? Do you really mean it?
Do you think orcle is not intelligent enough to decide whether to use index or not?I would also link to the documentation:
http://docs.oracle.com/cd/E11882_01/server.112/e17118/sql_elements006.htm
>
Hints were introduced in Oracle7, when users had little recourse if the optimizer generated suboptimal plans. Now Oracle provides a number of tools, including the SQL Tuning Advisor, SQL plan management, and SQL Performance Analyzer, to help you address performance problems that are not solved by the optimizer. Oracle strongly recommends that you use those tools rather than hints. The tools are far superior to hints, because when used on an ongoing basis, they provide fresh solutions as your data and database environment change.

Similar Messages

  • Trying to make a class to read in strings, help needed

    hello
    i have this class that reads in numbers here is the code
    import java.io.*;
    public class readNumber {
         public static int readlnt()
              throws java.io.IOException
              BufferedReader str= new BufferedReader(new InputStreamReader(System.in));
              String input;
              int res = 0;
              Integer num = new Integer(res);//create integer object
              input = str.readLine();//read input and return a string
              return num.parseInt(input);//convert String to an int and return
              }// end of read method
         }//end of class numberi was trying to makr one to read in words i have this so far
    import java.io.*;
    public class readWord {
         public static int readlnt()
              throws java.io.IOException
              BufferedReader str= new BufferedReader(new InputStreamReader(System.in));
              String input;
              String res = null;
              String word = new String(res);
              input = str.readLine();
              return word.parseword(input);
              }// end of read method
         }//end of class numberi need a little help with the readWord class, any advice you can give would be great
    thanks alot
    Anthony

    Your basic logic is probably going to be something like this:
    (a) read from the stream until you get a letter. (discard spaces at the beginning of a line, or between words)
    (b) create a string or a string buffer that contains the letter you just read.
    (c) read from the stream as long as you're getting letters, appending them to the end of the string or string buffer. When you get a character that isn't a letter, discard it, and return what you've built up.
    This assumes you want to discard punctuation marks, spaces, carriage returns, etc.

  • Double byte characters in a String - Help needed

    Hi All,
    Can anyone tell me how to find the presence of a double byte ( Japanese ) character in a String. I need to check whether the String contains a Japanese character or not. Thanx in advance.
    Ramya

    /** returns true if the String s contains any "double-byte" characters */
    public boolean containsDoubleByte(String s) {
      for (int i=0; i<s.length(); i++) {
        if (isDoubleByte(s.charAt(i)) {
          return true;
      return false;
    /** returns true if the char c is a double-byte character */
    public boolean isJapanese(char c) {
      if (c >= '\u0100' && c<='\uffff') return true;
      return false;
    // simpler:  return c>'\u00ff';
    /** returns true if the String s contains any Japanese characters */
    public boolean containsJapanese(String s) {
      for (int i=0; i<s.length(); i++) {
        if (isJapanese(s.charAt(i)) {
          return true;
      return false;
    /** returns true if the char c is a Japanese character. */
    public boolean isJapanese(char c) {
      // katakana:
      if (c >= '\u30a0' && c<='\u30ff') return true;
      // hiragana
      if (c >= '\u3040' && c<='\u309f') return true;
      // CJK Unified Ideographs
      if (c >= '\u4e00' && c<='\u9fff') return true;
      // CJK symbols & punctuation
      if (c >= '\u3000' && c<='\u303f') return true;
      // KangXi (kanji)
      if (c >= '\u2f00' && c<='\u2fdf') return true;
      // KanBun
      if (c >= '\u3190' && c <='\u319f') return true;
      // CJK Unified Ideographs Extension A
      if (c >= '\u3400' && c <='\u4db5') return true;
      // CJK Compatibility Forms
      if (c >= '\ufe30' && c <='\ufe4f') return true;
      // CJK Compatibility
      if (c >= '\u3300' && c <='\u33ff') return true;
      // CJK Radicals Supplement
      if (c >= '\u2e80' && c <='\u2eff') return true;
      // other character..
      return false;
    /* NB CJK Unified Ideographs Extension B not supported with 16-bit unicode. Source: http://www.alanwood.net/unicode */
    }

  • Troubleshoting help needed:  My iMac keeps crashing and restarting with a report detail: "spinlock application timed out"  What can I do to fix this?timed out"

    Troubleshooting help needed:  My iMac keeps crashing and restarting with a notice: "Spinlock application timed out"  What can I do?

    Launch the Console application in any of the following ways:
    ☞ Enter the first few letters of its name into a Spotlight search. Select it in the results (it should be at the top.)
    ☞ In the Finder, select Go ▹ Utilities from the menu bar, or press the key combination shift-command-U. The application is in the folder that opens.
    ☞ Open LaunchPad. Click Utilities, then Console in the page that opens.
    Select the most recent panic log under System Diagnostic Reports. Post the contents — the text, please, not a screenshot. In the interest of privacy, I suggest you edit out the “Anonymous UUID,” a long string of letters, numbers, and dashes in the header and body of the report, if it’s present (it may not be.) Please don't post shutdownStall, spin, or hang reports.

  • Help needed in constructing a tree

    Help needed in constructing a tree. I was wondering if some one can suggest me how to add messages in the second column for both the parent node and child elements.
    I was able to create a tree succefully, but want to add some description in the second column for the first column elements, for both parent and child elements.
    Please suggest me how to add the arrays to second column for parent and child nodes.
    Solved!
    Go to Solution.
    Attachments:
    Tree_fix.vi ‏15 KB

    The Child Text parameter is the one you are searching for. It accepts a 1D string array for the following columns.
    hope this helps,
    Norbert
    CEO: What exactly is stopping us from doing this?
    Expert: Geometry
    Marketing Manager: Just ignore it.

  • HELP NEEDED PLEASE

    Hi everyone
    Programming help needed here. Any advice would be greatly appreciated!!!
    I have been assigned some work for a program called Processing 1.0 availale at http://processing.org/download
    I was give the 9 individual programs I needed to make however they were converted to Java files from .pde files. The program is based on Java but only runs .pde files and NOTHING else!
    I decompiled the files and got the source code, but it is a slight variation of the original someone made in processing, and needs some tidying to get it to run.
    I think the programs are very simple for a programmer, although I AM NOT.
    CODE is BELOW
    // Decompiled by DJ v3.10.10.93 Copyright 2007 Atanas Neshkov Date: 02/05/2009 13:15:00
    // Home Page: http://members.fortunecity.com/neshkov/dj.html http://www.neshkov.com/dj.html - Check often for new version!
    // Decompiler options: packimports(3)
    // Source File Name: Assign2_1.java
    import processing.core.PApplet;
    public class Assign2_1 extends PApplet
    public Assign2_1()
    SquareSide = 20;
    Rank = Nums.length;
    Side = SquareSide * Rank;
    Green = color(0, 255, 0);
    Yellow = color(255, 255, 0);
    BG = Yellow;
    public void setup()
    size(Side, Side);
    background(BG);
    fill(Green);
    for(int i = 0; i < Rank; i++)
    rect(i * SquareSide, 0.0F, SquareSide, SquareSide * Nums);
    public static void main(String args[])
    PApplet.main(new String[] {
    "--bgcolor=#ece9d8", "Assign2_1"
    int Nums[] = {
    6, 14, 8, 9, 2, 3, 4, 2, 8, 3,
    9, 2, 0, 5
    int SquareSide;
    int Rank;
    int Side;
    int Green;
    int Yellow;
    int BG;
    Edited by: chevy1 on May 2, 2009 7:32 AM

    HELP NEEDED PLEASEShouting is a good way ensure you don't get help. Also you should give a meaningful subject.
    Any advice would be greatly appreciated!!!I suggest you ask a question after providing enough information to be able to answer it.
    Also use CODE tags when posting code as it make the code more readable.
    We are more likely to help people who are trying to learn Java rather than someone who might be looking for an easy way out of doing an assignment.

  • Help needed:Printing HTML file using javax.print

    Hi
    I am using the following code which i got form the forum for rpinting an HTML file.
    The folllowing code is working fine, but the problem is the content of HTML file is not getting printed. I am geeting a blank page with no content. What is the change that is required in the code? ALso is there any simpler way to implement this. Help needed ASAP.
    public boolean printHTMLFile(String filename) {
              try {
                   JEditorPane editorPane = new JEditorPane();
                   editorPane.setEditorKit(new HTMLEditorKit());
                   //editorPane.setContentType("text/html");
                   editorPane.setSize(500,500);
                   String text = getFileContents(filename);
                   if (text != null) {
                        editorPane.setText(text);                    
                   } else {
                        return false;
                   printEditorPane(editorPane);
                   return true;
              } catch (Exception tce) {
                   tce.printStackTrace();
              return false;
         public String getFileContents(String filename) {
              try {
                   File file = new File(filename);
                   BufferedReader br = new BufferedReader(new FileReader(file));
                   String line;
                   StringBuffer sb = new StringBuffer();
                   while ((line = br.readLine()) != null) {
                        sb.append(line);
                   br.close();
                   return sb.toString();
              } catch (Exception tce) {
                   tce.printStackTrace();
              return null;
         public void printEditorPane(JEditorPane editorPane) {
                   try {
                        HTMLPrinter htmlPrinter = new HTMLPrinter();
                        htmlPrinter.printJEditorPane(editorPane, htmlPrinter.showPrintDialog());
                   } catch (Exception tce) {
                        tce.printStackTrace();
         * Sets up to easily print HTML documents. It is not necessary to call any of the setter
         * methods as they all have default values, they are provided should you wish to change
         * any of the default values.
         public class HTMLPrinter {
         public int DEFAULT_DPI = 72;
         public float DEFAULT_PAGE_WIDTH_INCH = 8.5f;
         public float DEFAULT_PAGE_HEIGHT_INCH = 11f;
         int x = 100;
         int y = 80;
         GraphicsConfiguration gc;
         PrintService[] services;
         PrintService defaultService;
         DocFlavor flavor;
         PrintRequestAttributeSet attributes;
         Vector pjlListeners = new Vector();
         Vector pjalListeners = new Vector();
         Vector psalListeners = new Vector();
         public HTMLPrinter() {
              gc = null;
              attributes = new HashPrintRequestAttributeSet();
              flavor = null;
              defaultService = PrintServiceLookup.lookupDefaultPrintService();
              services = PrintServiceLookup.lookupPrintServices(flavor, attributes);
              // do something with the supported docflavors
              DocFlavor[] df = defaultService.getSupportedDocFlavors();
              for (int i = 0; i < df.length; i++)
              System.out.println(df.getMimeType() + " " + df[i].getRepresentationClassName());
              // if there is a default service, but no other services
              if (defaultService != null && (services == null || services.length == 0)) {
              services = new PrintService[1];
              services[0] = defaultService;
         * Set the GraphicsConfiguration to display the print dialog on.
         * @param gc a GraphicsConfiguration object
         public void setGraphicsConfiguration(GraphicsConfiguration gc) {
              this.gc = gc;
         public void setServices(PrintService[] services) {
              this.services = services;
         public void setDefaultService(PrintService service) {
              this.defaultService = service;
         public void setDocFlavor(DocFlavor flavor) {
              this.flavor = flavor;
         public void setPrintRequestAttributes(PrintRequestAttributeSet attributes) {
              this.attributes = attributes;
         public void setPrintDialogLocation(int x, int y) {
              this.x = x;
              this.y = y;
         public void addPrintJobListener(PrintJobListener pjl) {
              pjlListeners.addElement(pjl);
         public void removePrintJobListener(PrintJobListener pjl) {
              pjlListeners.removeElement(pjl);
         public void addPrintServiceAttributeListener(PrintServiceAttributeListener psal) {
              psalListeners.addElement(psal);
         public void removePrintServiceAttributeListener(PrintServiceAttributeListener psal) {
              psalListeners.removeElement(psal);
         public boolean printJEditorPane(JEditorPane jep, PrintService ps) {
                   if (ps == null || jep == null) {
                        System.out.println("printJEditorPane: jep or ps is NULL, aborting...");
                        return false;
                   // get the root view of the preview pane
                   View rv = jep.getUI().getRootView(jep);
                   // get the size of the view (hopefully the total size of the page to be printed
                   int x = (int) rv.getPreferredSpan(View.X_AXIS);
                   int y = (int) rv.getPreferredSpan(View.Y_AXIS);
                   // find out if the print has been set to colour mode
                   DocPrintJob dpj = ps.createPrintJob();
                   PrintJobAttributeSet pjas = dpj.getAttributes();
                   // get the DPI and printable area of the page. use default values if not available
                   // use this to get the maximum number of pixels on the vertical axis
                   PrinterResolution pr = (PrinterResolution) pjas.get(PrinterResolution.class);
                   int dpi;
                   float pageX, pageY;
                   if (pr != null)
                        dpi = pr.getFeedResolution(PrinterResolution.DPI);
                   else
                        dpi = DEFAULT_DPI;
                   MediaPrintableArea mpa = (MediaPrintableArea) pjas.get(MediaPrintableArea.class);
                   if (mpa != null) {
                        pageX = mpa.getX(MediaPrintableArea.INCH);
                        pageY = mpa.getX(MediaPrintableArea.INCH);
                   } else {
                        pageX = DEFAULT_PAGE_WIDTH_INCH;
                        pageY = DEFAULT_PAGE_HEIGHT_INCH;
                   int pixelsPerPageY = (int) (dpi * pageY);
                   int pixelsPerPageX = (int) (dpi * pageX);
                   int minY = Math.max(pixelsPerPageY, y);
                   // make colour true if the user has selected colour, and the PrintService can support colour
                   boolean colour = pjas.containsValue(Chromaticity.COLOR);
                   colour = colour & (ps.getAttribute(ColorSupported.class) == ColorSupported.SUPPORTED);
                   // create a BufferedImage to draw on
                   int imgMode;
                   if (colour)
                        imgMode = BufferedImage.TYPE_3BYTE_BGR;
                   else
                        imgMode = BufferedImage.TYPE_BYTE_GRAY;
                   BufferedImage img = new BufferedImage(pixelsPerPageX, minY, imgMode);
                   Graphics myGraphics = img.getGraphics();
                   myGraphics.setClip(0, 0, pixelsPerPageX, minY);
                   myGraphics.setColor(Color.WHITE);
                   myGraphics.fillRect(0, 0, pixelsPerPageX, minY);
                        java.awt.Rectangle rectangle=new java.awt.Rectangle(0,0,pixelsPerPageX, minY);
                   // call rootView.paint( myGraphics, rect ) to paint the whole image on myGraphics
                   rv.paint(myGraphics, rectangle);
                   try {
                        // write the image as a JPEG to the ByteArray so it can be printed
                        Iterator writers = ImageIO.getImageWritersByFormatName("jpeg");
                        ImageWriter writer = (ImageWriter) writers.next();
                                       // mod: Added the iwparam to create the highest quality image possible
                        ImageWriteParam iwparam = writer.getDefaultWriteParam();
                        iwparam.setCompressionMode(ImageWriteParam.MODE_EXPLICIT) ;
                        iwparam.setCompressionQuality(1.0f); // highest quality
                        ByteArrayOutputStream out = new ByteArrayOutputStream();
                        ImageOutputStream ios = ImageIO.createImageOutputStream(out);
                        writer.setOutput(ios);
                        // get the number of pages we need to print this image
                        int imageHeight = img.getHeight();
                        int numberOfPages = (int) Math.ceil(minY / (double) pixelsPerPageY);
                        // print each page
                        for (int i = 0; i < numberOfPages; i++) {
                             int startY = i * pixelsPerPageY;
                             // get a subimage which is exactly the size of one page
                             BufferedImage subImg = img.getSubimage(0, startY, pixelsPerPageX, Math.min(y - startY, pixelsPerPageY));
                                                 // mod: different .write() method to use the iwparam parameter with highest quality compression
                             writer.write(null, new IIOImage(subImg, null, null), iwparam);
                             SimpleDoc sd = new SimpleDoc(out.toByteArray(), DocFlavor.BYTE_ARRAY.JPEG, null);
                             printDocument(sd, ps);
                             // reset the ByteArray so we can start the next page
                             out.reset();
                   } catch (PrintException e) {
                        System.out.println("Error printing document.");
                        e.printStackTrace();
                        return false;
                   } catch (IOException e) {
                        System.out.println("Error creating ImageOutputStream or writing to it.");
                        e.printStackTrace();
                        return false;
                   // uncomment this code and comment out the 'try-catch' block above
                   // to print to a JFrame instead of to the printer
                   /*          JFrame jf = new JFrame();
                             PaintableJPanel jp = new PaintableJPanel();
                             jp.setImage( img );
                             JScrollPane jsp = new JScrollPane( jp );
                             jf.getContentPane().add( jsp );
                             Insets i = jf.getInsets();
                             jf.setBounds( 0, 0, newX, y );
                             jf.setDefaultCloseOperation( JFrame.DISPOSE_ON_CLOSE );
                             jf.setVisible( true );*/
                   return true;
              * Print the document to the specified PrintService.
              * This method cannot tell if the printing was successful. You must register
              * a PrintJobListener
              * @return false if no PrintService is selected in the dialog, true otherwise
              public boolean printDocument(Doc doc, PrintService ps) throws PrintException {
                   if (ps == null)
                   return false;
                   addAllPrintServiceAttributeListeners(ps);
                   DocPrintJob dpj = ps.createPrintJob();
                   addAllPrintJobListeners(dpj);
                   dpj.print(doc, attributes);
                   return true;
              public PrintService showPrintDialog() {
                   return ServiceUI.printDialog(gc, x, y, services, defaultService, flavor, attributes);
              private void addAllPrintServiceAttributeListeners(PrintService ps) {
                   // add all listeners that are currently added to this object
                   for (int i = 0; i < psalListeners.size(); i++) {
                   PrintServiceAttributeListener p = (PrintServiceAttributeListener) psalListeners.get(i);
                   ps.addPrintServiceAttributeListener(p);
              private void addAllPrintJobListeners(DocPrintJob dpj) {
                   // add all listeners that are currently added to this object
                   for (int i = 0; i < pjlListeners.size(); i++) {
                   PrintJobListener p = (PrintJobListener) pjlListeners.get(i);
                   dpj.addPrintJobListener(p);
              // uncomment this also to print to a JFrame instead of a printer
              /* protected class PaintableJPanel extends JPanel {
                   Image img;
                   protected PaintableJPanel() {
                        super();
                   public void setImage( Image i ) {
                        img = i;
                   public void paint( Graphics g ) {
                        g.drawImage( img, 0, 0, this );
    Thanks
    Ram

    Ram,
    I have had printing problems too a year and a half ago. I used all printing apis of java and I still find that it is something java lacks. Now basically you can try autosense. To check whether your printer is capable of printing the docflavor use this PrintServiceLookup.lookupPrintServices(flavor, aset); . If it lists the printer then he can print the document otherwise he can't. I guess that is why you get the error.
    Regards,
    Kevin

  • Search help needs more records than 500 or 5000

    I have a requirement to create search help on a non primary key field . So I need to work on search help exit to remove all the repeating and blank values . The problem I am facing rite now is that search help gets only 500 records by default and 5000 if we leave the restriction field blank . I need to get all the records which is approx more than 100000 and get only the unique values .
    Please let me know how I can increase the number of record more than 5000
    Regards,
    Tashi

    Hi Tashi,
    The following approach might work out in y our case by overwriting the data fetch functionality of the standard Search help
    1. Define internal table of desired structure, in the way you get the data from DB table
    2. use your custom function module / class method or select statement to get the desired data into the newly
        defined   internal table
    3. apply required sorting / filtering / formatting as per the requirements
    3. loop through the resultant data in the internal table and append the records to standard internal
        table / parameter  RECORD_TAB of the Search help exit. Please make a note that RECORD_TAB has the
        structure field STRING which needs to be populated with the correct offsetting..for example, if the first field
         is of 10 characters and second field of 5 characters, it should be populated in the following way
    loop at itab into ls_itab.
    wa_record-string+0 = ls_itab-field1.
    wa_record-string+10 = ls_itab-field2.
    wa_record-string+15 = ls_itab-field3.
    append wa_record to record_tab.
    clear wa_record.
    endloop.
    EXIT.
    Please try this approach and let us know.
    hope this helps.
    -Sajan Joseph.

  • Help needed with java

    Hello everyone
    I'm a Student and new to java and I have been given a question which I have to go through. I have come across a problem with one of the questions and am stuck, so I was wondering if you guys could help me out.
    here is my code so far:
    A Class that maintains Information about a book
    This might form part of a larger application such
    as a library system, for example.
    @author (your name)
    *@version (a version number or a date)*
    public class Book
    // instance variables or fields
    private String author;
    private String title;
    Set the author and title when the book object is constructed
    public Book(String bookAuthor, String bookTitle)
    author = bookAuthor;
    title = bookTitle;
    Return The name of the author.
    public String getAuthor()
    return author;
    Return The name of the title.
    public String getTitle()
    return title;
    and below are the questions that I need to complete. they just want me to add codes to my current one, but the problem is I don't know where to put them and how I should word them, if that makes sense.
    Add a further instance variable/field pages to the Book class to store the number of pages in the book.
    This should be of type int and should be set to 0 in the Constructor.
    Add a second Constructor with signature
    public Book(String bookAuthor, String bookTitle, int noPages) so it has a third parameter passed to it as well as the author and title;
    this parameter is used - obviously?? - to initialise the number of pages.
    Note: This is easiest done by making a copy of the existing Constructor and adding the parameter.
    Add a getPages() accessor method that returns the number of pages in the book.
    Add a method printDetails() to your Book class. This should print out the Author title and number of pages to the Terminal Window. It is your choice as to how the data is formatted, perhaps all on one line, perhaps on three, and with or without explanatory text. For instance you could print out in the format:
    Title: Robinson Crusoe, Author: Daniel Defoe, Pages:226
    Add a further instance variable/field refNumber() to your Book class. This stores the Library's reference number. It should be of type String and be initialised to the empty String "" in the constructor, as its initial value is not passed in as a parameter. Instead a public mutator method with the signature:
    public void setRefNumber(String ref) should be created. The body of this method should assign the value of the method parameter ref to the refNumber.
    Add a corresponding getRefNumber() accessor method to your class so you can check that the mutator works correctly
    Modify your printDetails() method to include printing the reference number of the book.
    However the method should print the reference number only if it has been set - that is the refNumber has a non-zero length.
    If it has not been set, print "ZZZ" instead.
    Hint Use a conditional statement whose test calls the length() method of the refNumber String and gives a result like:
    Title: Jane Eyre, Author: Charlotte Bronte, Pages:226, RefNo: CB479 or, if the reference number is not set:
    Title: Robinson Crusoe, Author: Daniel Defoe, Pages:347, RefNo: ZZZ
    Modify your setRefNumber() method so that it sets the refNumber field only if the parameter is a string of at least three characters. If it is less than three, then print an error message (which must contain the word error) and leave the field unchanged
    Add a further integer variable/field borrowed to the Book class, to keep a count of the number of times a book has been borrowed. It should (obviously??) be set to 0 in the constructor.
    Add a mutator method borrow() to the class. This should increment (add 1 to) the value of borrowed each time it is called.
    Include an accessor method getBorrowed() that returns the value of borrowed
    Modify Print Details so that it includes the value of the borrowed field along with some explanatory text
    PS. sorry it looks so messey

    1. In the future, please use a more meaningful subject. "Help needed with java" contains no information. The very fact that you're posting here tells us you need help with Java. The point of the subject is to give the forum an idea of what kind of problem you're having, so that individuals can decide if they're interested and qualified to help.
    2. You need to ask a specific question. If you have no idea where to start, then start here: [http://home.earthlink.net/~patricia_shanahan/beginner.html]
    3. When you post code, use code tags. Copy the code from the original source in your editor (NOT from an earlier post here, where it will already have lost all formatting), paste it in here, highlight it, and click the CODE button.

  • About Java 2 opaque font color question, help needed!

    About Java 2 opaque font color question, help needed!
    I was trying to test opaque font (the string has a foreground color and a background color), but i can't find the method for doing that.
    i can change foreground by Graphics2D.setPaint(Color.black).
    Anybody know how to change the background of the string?
    Thanks!

    Hi. The way I'd do it would be to use the font metrics to find the length of a string and draw a rectangle and then drawstring over the rectangle. If you want an example, I can post it although I suspect theres a better way.

  • JCmboBox setSelectedIndex help needed !!!!!!!!!!!!

    hi,
    I hope it's a trivial question but I am not able to solve it so need your help plz. I have a demo program if you run it you will see what I mean. Actually I am adding items to my JComboBox dynamically. My problem is that if I add the items with the same name and then explicitly set them selected my first item with same name is always highlighted and selected even though I say to select the last item which I add. But when I pull down the comboBox my first item with the same name is selected and highlighted not the last one. Please run the program and see. How can I solve this problem help needed.
    import java.awt.*;
    import java.awt.event.*;
    import javax.swing.*;
    public class ComboBoxDemo extends JPanel {
    JButton picture;
    public ComboBoxDemo() {
    String[] petStrings = { "Bird", "Cat", "Dog", "Rabbit", "Pig" };
    // Create the combo box, select the pig
    final JComboBox petList = new JComboBox(petStrings);
    picture = new JButton("ADD");
    picture.addActionListener(new ActionListener() {
    public void actionPerformed(ActionEvent e) {
    petList.addItem("TEST ");
                   int nodeTotal =     petList.getItemCount();
                   petList.setSelectedIndex(nodeTotal-1);
    setLayout(new BorderLayout());
    add(petList, BorderLayout.NORTH);
    add(picture, BorderLayout.SOUTH);
    setBorder(BorderFactory.createEmptyBorder(20,20,20,20));
    public static void main(String s[]) {
    JFrame frame = new JFrame("ComboBoxDemo");
    frame.addWindowListener(new WindowAdapter() {
    public void windowClosing(WindowEvent e) {System.exit(0);}
    frame.setContentPane(new ComboBoxDemo());
    frame.pack();
    frame.setVisible(true);
    I want to select the last item I add even if there exists an item with same name.
    Any help is greatly appreciated.
    Thanks.

    never mind I got the answer.
    Tnaks

  • Expression -puzzling(help needed)

    Hi All,
    Is there a possibility that my expression fails on the first run trying to load into a column in the table having truncation error,but ultimately runs at the second time(having that column alone empty while populating other columns?).
    Help needed...ANy help on this topic wil be much helpful!!

    Hi ssislara,
    If I understand correctly, a derived column with expression fails in the first time when execution the package, but it works fine after change the source column to another column that has more length with empty. For example, use the expression (DT_WSTR,4)[column_name]
    as the derived column, the original column is nchar(10) with value like ‘abcd’, the later column is nvarchar(50) with value like ‘abcd’.
    If in this scenario, the issue you said is possible. Because nchar(10) is Fixed-length Unicode string data, nvarchar(50) is Variable-length Unicode string data. The expression (DT_WSTR,4)[column_name] can cause truncation error when the column with nchar(10)
    data type.
    If I have something misunderstood, please provide us more information about the issue. If possible, provide us some screenshots about the package design, error message, expression and column information. So that we can make further analysis and help you
    out.
    Thanks,
    Katherine Xiong
    Katherine Xiong
    TechNet Community Support

  • Help needed for writing query

    help needed for writing query
    i have the following tables(with data) as mentioned below
    FK*-foregin key (SUBJECTS)
    FK**-foregin key (COMBINATION)
    1)SUBJECTS(table name)     
    SUB_ID(NUMBER) SUB_CODE(VARCHAR2) SUB_NAME (VARCHAR2)
    2           02           Computer Science
    3           03           Physics
    4           04           Chemistry
    5           05           Mathematics
    7           07           Commerce
    8           08           Computer Applications
    9           09           Biology
    2)COMBINATION
    COMB_ID(NUMBER) COMB_NAME(VARCHAR2) SUB_ID1(NUMBER(FK*)) SUB_ID2(NUMBER(FK*)) SUB_ID3(NUMBER(FK*)) SUBJ_ID4(NUMBER(FK*))
    383           S1      9           4           2           3
    384           S2      4           2           5           3
    ---------I actually designed the ABOVE table also like this
    3) a)COMBINATION
    COMB_ID(NUMBER) COMB_NAME(VARCHAR2)
    383           S1
    384           S2
    b)COMBINATION_DET
    COMBDET_ID(NUMBER) COMB_ID(FK**) SUB_ID(FK*)
    1               383          9
    2               383          4
    3               383          2
    4               383          3
    5               384          4
    6               384          2          
    7               384          5
    8               384          3
    Business rule: a combination consists of a maximum of 4 subjects (must contain)
    and the user is less relevant to a COMB_NAME(name of combinations) but user need
    the subjects contained in combinations
    i need the following output
    COMB_ID COMB_NAME SUBJECT1 SUBJECT2      SUBJECT3      SUBJECT4
    383     S1     Biology Chemistry      Computer Science Physics
    384     S2     Chemistry Computer Science Mathematics Physics
    or even this is enough(what i actually needed)
    COMB_ID     subjects
    383           Biology,Chemistry,Computer Science,Physics
    384           Chemistry,Computer Science,Mathematics,Physics
    you can use any of the COMBINATION table(either (2) or (3))
    and i want to know
    1)which design is good in this case
    (i think SUB_ID1,SUB_ID2,SUB_ID3,SUB_ID4 is not a
    good method to link with same table but if 4 subjects only(and must) comes
    detail table is not neccessary )
    now i am achieving the result by program-coding in C# after getting the rows from oracle
    i am using oracle 9i (also ODP.NET)
    i want to know how can i get the result in the stored procedure itsef.
    2)how it could be designed in any other way.
    any help/suggestion is welcome
    thanks for your time --Pradeesh

    Well I forgot the table-alias, here now with:
    SELECT C.COMB_ID
    , C.COMB_NAME
    , (SELECT SUB_NAME
    FROM SUBJECTS
    WHERE SUB_ID = C.SUB_ID1) AS SUBJECT_NAME1
    , (SELECT SUB_NAME
    FROM SUBJECTS
    WHERE SUB_ID = C.SUB_ID2) AS SUBJECT_NAME2
    , (SELECT SUB_NAME
    FROM SUBJECTS
    WHERE SUB_ID = C.SUB_ID3) AS SUBJECT_NAME3
    , (SELECT SUB_NAME
    FROM SUBJECTS
    WHERE SUB_ID = C.SUB_ID4) AS SUBJECT_NAME4
    FROM COMBINATION C;
    As you need exactly 4 subjects, the columns-solution is just fine I would say.

  • Help needed I have a canon 40D. I am thinking of buying a canon 6D.But not sure that my len

    Hi all help needed I have a canon 40D. I am thinking of buying a canon 6D.
    But not sure that my lenses will work.
    I have a 170mm/ 500mm APO Sigma.
    A 10/20 ex  Sigma   HSM  IF.
    And a 180 APO Sigma Macro or do I have to scrap them and buy others.
    ALL Help will be greatly received. Yours  BRODIE

    In short, I love it. I was going to buy the 5DMark III. After playing with it for a while at my local Fry's store where they put 5DMII, 5DMIII and 6D next to each other, using the same 24-105L lens, I decided to get the 6D and pocket the different for lens later.
    I'm upgrading from the 30D. So I think you'll love it. It's a great camera. I have used 5DMII extensively before (borrowing from a close friend).
    Funny thing is at first I don't really care about the GPS and Wifi much. I thought they're just marketing-gimmick. But once you have it, it is actually really fun and helpful. For example, I can place the 6D on a long "monopod", then use the app on the phone to control the camera to get some unique perspective on some scenes. It's fun and great. GPS is also nice for travel guy like me.
    Weekend Travelers Blog | Eastern Sierra Fall Color Guide

  • Help needed! Raid degraded again!

    Hi!
    Help needed! I hava made bootable RAID with two S-ATAII 250Gb HDD and its not working! Every now and then at bootup I get a message RAID -> DEGRADED... Must be seventh time! Rebuild takes its own time!
    What am I doing wrong!
    T: Ekku
    K8N Neo4 Ultra
    AMD 64 4200+
    2 Gb RAM
    2 x 250 Gb HDD (Maxtor)
    nVidia RAID (in mb)
    P.S. I wery SORRY with my poor language!

    I'm going to blame the nVRAID because I've seen issues with it in the past. If your motherboard has another non-nVidia RAID solution, use that instead. Using the nVidia SATA ports as BASE or JBOD is fine and dandy but RAIDing always had issues. It's not even a driver issue I think it's just instability. Latest drivers and even boxed drivers never helped. Granted, some will report success with their rig. But on a professional level I've seen nForce issues on different motherboards and different hard drives that had RAID disaster stories.
    Good luck and if you don't have another RAID solution, my suggestion would be to buy a dedicated RAID controller card.
    LPB

Maybe you are looking for