Some simple code with error

hello!
i need some help in this code. just cant find the error here.
thanks all!
the problem is in line of the function private linkerCount page(String link,String word). it something with return,
the error is :this method must return a result of type linkerCount/
private linkerCount page(String link,String word) {
    String str=null;
    try
    {//Open the URL for reading
        URL u = new URL(link);
    // TODO Auto-generated method stub
           // buffer the input to increase performance
        InputStream in = new BufferedInputStream(u.openStream());
        // chain the InputStream to a Reader
        InputStreamReader theHTML = new InputStreamReader(in);
        str=StreamToString(theHTML);
        str = str.replaceAll("\\<.*?\\>", "");
        //System.out.println(countSubString(str,word)+link);
        int statistic=countSubString(str,word)/countWord(str);
        linkerCount s=new linkerCount(link,statistic);
        return s;
    catch (MalformedURLException e)
        System.err.println(e);
    catch (IOException e)
        System.err.println(e);
package test;
public class linkerCount {
    public linkerCount(String link, int count) {
        this.link=link;
        this.count=count;
    String link;
    int count;
}

>
Thus, there are paths of execution that do not return a value of the type that the method is declared to return. That's what the compiler error message is telling you.If I'm not mistaken, can't you omit any return statement from within the try block and put one only at the end and it will still work fine? This would be because you only need the return statement at the end. It's not necessarily that there exist "paths" (plural) of execution that do not return a value but moreso that THE path of execution does not end with a return.
The compiler just is not smart enough to know that the area after the try/catch stuff is never going to be called. It can't know that because the format could have been different. For example
try
    stuff
catch (Exception)
more stuff
try
    still more stuff
catch (Exception)
}In code like the above, it is apparent that the grammar allows for situations where you could return at the end of a try but the function overall might still not be covered. Similar to
if(true)
    return 0;
if(true)
    return 1The function that contains only the above will always successfully return an integer, but the compiler doesn't know that.
I apologise if what you said said is contained within my explanation and I've just said the same thing in a different way without realising it. If so, hopefully it at least helps the original poster.

Similar Messages

  • How to replace huge decode statements with lookups to some simple code/key

    I have a legacy PL/SQL application, composed of many very huge decode statements. And the most terribe one is that the guys who develops the application left the company now, leaves no documentation.
    We are trying to read and understand those PL/SQL programs, and I'm asked to replace those huge decode statements with lookups to some simple code/key tables? But I have no idea about how to design such code/key tables. Is there any one who has similar experience may help me? Besides code/key tables, any idea will be welcome.
    Thank you very much!

    Not sure what your data looks like but sometimes decode can be replaced with more appropriate functions, ie;
    SQL> with t as (
       select 'DAY' a, 30 b, null c, null d from dual union all
       select null a, null b, 'MONTH' c, 12 from dual)
    select coalesce(b,d)
    from t
    COALESCE(B,D)
               30
               12
    2 rows selected.
    SQL> with t as (
       select 'DAY' a, 30 b, null c, 0 d from dual union all
       select null a, 0 b, 'MONTH' c, 12 from dual)
    select greatest(b,d)
    from t
    GREATEST(B,D)
               30
               12
    2 rows selected.

  • Client server code with errors could some one please help me!!!

    I am using a random access file to design the two interfaces for my client and my server is this the right thing to do? Oh could some one give me some example code of client server interfaces.
    I got an error in the code for the interfaces and I don't know what it is could some one please help me!!
    Heres the error in the code: This is for RegisterCustomer
    import java.io.*;
    import java.awt.*;
    import java.awt.event.*;
    import javax.swing.*;
    import javax.swing.border.*;
    class RegisterCustomer extends JPanel implements ActionListener
    // Button for registering a customer
    private JButton jbtRegister;
    // Customer information panel
    private CustomerPanel customerPanel; (The error is on this line and it says Field type customer panel is missing)
    // Random access file
    private RandomAccessFile raf;
    Second error: Its in the ViewCustomer:
    import java.awt.*;
    import java.awt.event.*;
    import javax.swing.*;
    import javax.swing.border.*;
    // View customer panel
    class ViewCustomer extends JPanel implements ActionListener
    // Buttons for viewing customer information
    private JButton jbtFirst, jbtNext, jbtPrevious, jbtLast;
    // Random access file
    private RandomAccessFile raf = null;
    // Current customer record
    private Customer customer = new Customer();
    // Create a customer panel
    private CustomerPanel customerPanel = new customerPanel(); (its on this line and it says field type CustomerPanel is missing)
    // File pointer in the random access file
    private long lastPos;
    private long currentPos;
    Heres the code for the customerPanel:
    // Customer Panel.java: Panel for displaying Customer information
    import javax.swing.*;
    import javax.swing.border.*;
    import java.awt.*;
    public class customerPanel extends JPanel
         JTextField jtfRegistrationnumber = new JTextField(30);
         JTextField jtfSeatingcapacity = new JTextField(20);
    JTextField jtfStartdateofhire = new JTextField(20);
    JTextField jtfDurationofhire = new JTextField(10);
    JTextField jtfManufacture = new JTextField(20);
    JTextField jtfModel = new JTextField(15);
         JTextField jtfEnginesize = new JTextField(15);
    JTextField jtfCharge = new JTextField(20);
    JTextField jtfMileage = new JTextField(10);
    // Constuct a customer panel
    public customerPanel()
    // Set the panel with line border
    setBorder(new BevelBorder(BevelBorder.RAISED));
    // Panel p1 for holding all the labels
    JPanel p1 = new JPanel();
    p1.setLayout(new GridLayout(3, 1));
    p1.add(new JLabel("Registration number"));
    p1.add(new JLabel("Seating capacity"));
    p1.add(new JLabel("Start date of hire"));
    p1.add(new JLabel("Duration of hire"));
    p1.add(new JLabel("Manufacture"));
    p1.add(new JLabel("Model"));
    p1.add(new JLabel("Engine size"));
    p1.add(new JLabel("Charge"));
    p1.add(new JLabel("Mileage"));
    // Panel jpRegistration number for registration number
    JPanel jpRegistrationnumber = new JPanel();
    jpRegistrationnumber.setLayout(new BorderLayout());
    jpRegistrationnumber.add(new JLabel("Registration number"), BorderLayout.WEST);
    jpRegistrationnumber.add(jtfRegistrationnumber, BorderLayout.CENTER);
    // Panel jpSeating capacity for holding Seating capacity
    JPanel jpSeatingcapacity = new JPanel();
    jpSeatingcapacity.setLayout(new BorderLayout());
    jpSeatingcapacity.add(new JLabel("Seating capacity"), BorderLayout.WEST);
    jpSeatingcapacity.add(jtfSeatingcapacity, BorderLayout.CENTER);
         // Panel jpStart date of hire for holding start date of hire
    JPanel jpStartdateofhire = new JPanel();
    jpStartdateofhire.setLayout(new BorderLayout());
    jpStartdateofhire.add(new JLabel("Start date of hire"), BorderLayout.WEST);
    jpStartdateofhire.add(jtfStartdateofhire, BorderLayout.CENTER);
    // Panel jpDuration of hire for holding Duration of hire
    JPanel jpDurationofhire = new JPanel();
    jpDurationofhire.setLayout(new BorderLayout());
    jpDurationofhire.add(new JLabel("Duration of hire"), BorderLayout.WEST);
    jpDurationofhire.add(jtfDurationofhire, BorderLayout.CENTER);
    // Panel p2 for holding jpRegistration number and jpSeating capacity and start date of hire and duration of hire
    JPanel p2 = new JPanel();
    p2.setLayout(new BorderLayout());
    p2.add(jpRegistrationnumber, BorderLayout.WEST);
    p2.add(jpSeatingcapacity, BorderLayout.CENTER);
    p2.add(jpStartdateofhire, BorderLayout.CENTER);
    p2.add(jpDurationofhire, BorderLayout.CENTER);
    // Panel p3 for holding jtfManufacture and p2
    JPanel p3 = new JPanel();
    p3.setLayout(new BorderLayout());
    p3.add(jtfManufacture, BorderLayout.CENTER);
    p3.add(p2, BorderLayout.EAST);
    // Panel p4 for holding jtfModel, jtfEngine size, charge and mileage and p3
    JPanel p4 = new JPanel();
    p4.setLayout(new GridLayout(3, 1));
    p4.add(jtfModel);
    p4.add(jtfEnginesize);
    p4.add(jtfCharge);
    p4.add(jtfMileage);
    p4.add(p3);
    // Place p1 and p4 into customerPanel
    setLayout(new BorderLayout());
    add(p1, BorderLayout.WEST);
    add(p4, BorderLayout.CENTER);
    // Get customer information from the text fields
    public Customer getCustomer()
    return new Customer(jtfRegistrationnumber.getText().trim(),
                             jtfSeatingcapacity.getText().trim(),
                                  jtfStartdateofhire.getText().trim(),
                             jtfDurationofhire.getText().trim(),
                             jtfManufacture.getText().trim(),
                             jtfModel.getText().trim(),
                                  jtfEnginesize.getText().trim(),
                             jtfCharge.getText().trim(),
                             jtfMileage.getText().trim());
    // Set customer information on the text fields
    public void setCustomer(Customer s)
    jtfRegistrationnumber.setText(s.getRegistrationnumber());
    jtfSeatingcapacity.setText(s.getSeatingcapacity());
    jtfStartdateofhire.setText(s.getStartdateofhire());
    jtfDurationofhire.setText(s.getDurationofhire());
    jtfManufacture.setText(s.getManufacture());
    jtfModel.setText(s.getModel());
    jtfEnginesize.setText(s.getEnginesize());
    jtfCharge.setText(s.getCharge());
    jtfMileage.setText(s.getMileage());
    Could someone please help me and tell me what these two errors mean and how I could get rid of them

    Can some one take a look at this code and tell me how to get all my jlabels to line up alone side their jtf.
    Because it looks like this the picture in the attached file and this is the code for it:
    public customerPanel()
    // Set the panel with line border
    setBorder(new BevelBorder(BevelBorder.RAISED));
    // Panel p1 for holding labels Name, Street, and City
    JPanel p1 = new JPanel();
    p1.setLayout(new GridLayout(5, 1));
    p1.add(new JLabel("Registration Number:"));
    p1.add(new JLabel("Seating Capacity:"));
    p1.add(new JLabel("Engine Size:"));
    p1.add(new JLabel("Start date of hire"));
    p1.add(new JLabel("Duration of hire"));
    JPanel p2 = new JPanel();
    p2.setLayout(new GridLayout(5, 1));
    p2.add(jtfRegistrationnumber);
    p2.add(jtfSeatingcapacity);
    p2.add(jtfEnginesize);
    p2.add(jtfStartdateofhire);
    p2.add(jtfDurationofhire);
    //JPanel p3 = new JPanel();
    //p3.add(p1, BorderLayout.WEST);
    //p3.add(p2, BorderLayout.NORTH);
    JPanel p4 = new JPanel();
    p4.setLayout(new GridLayout(4, 1));
    p4.add(new JLabel("Manufacture:"));
    p4.add(new JLabel("Model:"));
    p4.add(new JLabel("Mileage:"));
    p4.add(new JLabel("Charge:"));
    JPanel p5 = new JPanel();
    p5.setLayout(new GridLayout(4, 1));
    p5.add(jtfManufacture);
    p5.add(jtfModel);
    p5.add(jtfMileage);
    p5.add(jtfCharge);
    // JPanel p6 = new JPanel();
    // p6.setLayout(new BorderLayout());
    // p6.add(p4, BorderLayout.SOUTH);
    // p6.add(p5, BorderLayout.EAST);
    // Place p1 and p4 into CustomerPanel
    setLayout(new BorderLayout());
    add(p1, BorderLayout.WEST);
    add(p2, BorderLayout.NORTH);
    add(p4, BorderLayout.SOUTH);
    add(p5, BorderLayout.EAST);
    So could someone please help me and correct my code so that each text lable is lined up next to its jtf java text field.

  • How find the ABAP code with Error message

    Hi
    How to  find the ABAP Code for Error Message?
    Example:
    Error Message: ZF026.
    Regards
    Odaiah Pelley
    Edited by: Odaiah Pelley on Aug 22, 2008 4:21 AM

    Hi
    Excellent Answer, I appreciate it.
    My question is with Error Message ZF026.
    How to find ABAP Code ?
    If I go for SE91 I will get same message as if I am getting error message.It is no use.
    Regards
    Odaiah Pelleyu

  • HT204406 When downloading albums some songs stop with error messages..

    Hi, I was trying to download Armin van Buuren "A State of Trance 2011". The individual songs downloaded fine but both continuous dj mixes failed to download, they get right to the end and then stop with error messages. This is the 2nd Armin van Buuren album this has happened to! Please help!
    Dave.

    The 2nd mix still won't play, it just skips to the next track on the album. In my purchases it says it's downloaded, it just won't seem to play.
    It sounds damaged.
    If your country's iTunes Store allows you to redownload purchased tracks, I'd delete your current copy of the track and try redownloading a fresh one. See the following document for instructions:
    Downloading past purchases from the App Store, iBookstore, and iTunes Store
    If you get another -50 on the redownload, perhaps try the "Error -50," "-5000," "8003," "8008," or "-42023"section in the Specific Conditions and Alert Messages: (Mac OS X / Windows) section of the following document:
    iTunes: Advanced iTunes Store troubleshooting

  • I need help with some simple code! Please read!

    hi everyone.
    I'm having problems with a piece of code, and i'd be extremely greatful if somebody could give me a hand with it. I'm totally new to java and have to make a program for my university degree, but i'm finding it extremely difficult, mainly due to my total lack of apptitude for this type of thing. I know this is easy stuff, but the books I have are no use so any help would be greatly appreciated.
    I have to write a program which uses two class files. I want one with the code to produce a simple button, and one to invoke it several times at different locations. I decided to write the program as one class file at first, and thought i'd be able to split it up at later. The program works fine when it is one class file. My book said that to split the two classes up, all i needed to do was change the second class to public, although this seems to not work at all. I'm at my wits end on this, and if anyone could correct my code I'd be eternally greatful.
    Here is the first class... (sorry about the lack of indentation)
    >>>>>>>>>>
    import java.awt.*;
    import java.applet.Applet;
    public class Phone extends Applet {
    private Image image;
    public void init() {
    setLayout(null);
    image = getImage(getDocumentBase(), "phone.jpg");}
    public void paint (Graphics g) {
    g.drawImage(image, 0, 0, 700, 530, this);
    PhoneButton myButton;
    myButton = new PhoneButton(20,20);
    >>>>>>>
    This is the second class....
    >>>>>>>
    public class PhoneButton {
    private Button butt;
    public PhoneButton(int a, int b, int c){
    setLayout(null);
    butt = new Button();
    butt.setBounds(a,b,20,20);
    add(butt);
    >>>>>>>>
    My compiler generates errors relating to Button, but i can't do anything to please it.
    Also, could anyone give me some pointers on how to add a different number or symbol to each button. That is what I added int c for, but i couldn't get it to work.
    Cheers in advance.
    Michael Morgan

    I found that there are 5 error in your code.
    1. You should import the "java.awt" package to the PhoneButton.java
    2. The PhoneButton is not a kind of Component. You cannot not add it to the Phone class
    3. the myButton = new PhoneButton(20, 20) does not provide enough parameters to create PhoneButton
    4. You cannot add a Button to a PhoneButton. Becaue the PhoneButton is not a kind of Container
    Fixed code:
    import java.awt.*;
    public class PhoneButton extends Button {
    public PhoneButton(int a, int b, int c){
         setBounds(a, b, 20, 20);
         setLabel(String.valueOf(c));
    ===========================================
    import java.awt.*;
    import java.applet.Applet;
    public class Phone extends Applet {
    private Image image;
    public void init() {
    setLayout(null);
    image = getImage(getDocumentBase(), "phone.jpg");}
    public void paint (Graphics g) {
    g.drawImage(image, 0, 0, 700, 530, this);
    PhoneButton myButton;
    myButton = new PhoneButton(20,20, 1);
    ======================
    Visual Paradigm for UML - Full Features UML CASE tool
    http://www.visual-paradigm.com/

  • Need help with some simple code

    Hi,
    I'm doing a lab for a class I'm taking and for the most part my code is working properly. It is supposed to accept inputs from the user of ints, doubles, or strings using the Scanner class until the user inputs "quit". It stores each input in array lists of class Integer, Double, and String. It the prints out each element of these in a list and quits the program. The problem is that after I query the user for input, if an int or double is input, the program then requires an input again before it will continue querying. So my question is how do I get it to query only once?
    The code and a copy of what it IS doing, and what it SHOULD do are shown below in bold.
    import java.util.ArrayList;
    import java.util.Scanner;
    import java.lang.Integer;
    import java.lang.Double;
    import java.lang.String;
    public class inputsort
    public static void main()
    int n = 0;
    boolean done = false;
    String quit;
    Scanner sc = new Scanner(System.in);
    ArrayList<Integer> intList = new ArrayList<Integer>();
    ArrayList<Double> doubList = new ArrayList<Double>();
    ArrayList<String> stringList = new ArrayList<String>();
    while(!done)
    System.out.print("Enter an int, double, any random text, or type quit to end: ");
    *if (sc.hasNextInt()){*
    intList.add(sc.nextInt());
    sc.next();
    *} else if (sc.hasNextDouble()){*
    doubList.add(sc.nextDouble());
    sc.next();
    *} else {*               
    quit = sc.next();
    *if (quit.equals("quit")) {*
    done = true;
    *else {*
    stringList.add(quit);
    System.out.println("Integers:");
    while(n < intList.size())
    System.out.print("Integer[" + n + "]: ");
    System.out.print(intList.get(n) + "\n");
    n += 1;
    n = 0;
    System.out.println("Doubles:");
    while(n < doubList.size())
    System.out.print("Double[" + n + "]: ");
    System.out.print(doubList.get(n) + "\n");
    n += 1;
    n = 0;
    System.out.println("Others:");
    while(n < stringList.size())
    System.out.print("Other[" + n + "]: ");
    System.out.print(stringList.get(n) + "\n");
    n += 1;
    Here's what it IS doing:
    Enter an int, double, any random text, or type quit to end: 10
    *10*
    Enter an int, double, any random text, or type quit to end: 1.2
    *1.2*
    Enter an int, double, any random text, or type quit to end: 3.4
    *3.4*
    Enter an int, double, any random text, or type quit to end: 5.6
    *5.6*
    Enter an int, double, any random text, or type quit to end: test
    Enter an int, double, any random text, or type quit to end: monkey
    Enter an int, double, any random text, or type quit to end: quit
    Integers:
    Integer[0]: 5
    Integer[1]: 10
    Doubles:
    Double[0]: 1.2
    Double[1]: 3.4
    Double[2]: 5.6
    Others:
    Other[0]: test
    Other[1]: monkey
    Here is what it SHOULD be doing:
    Enter an int, double, any random text, or type quit to end: 10
    Enter an int, double, any random text, or type quit to end: 1.2
    Enter an int, double, any random text, or type quit to end: 3.4
    Enter an int, double, any random text, or type quit to end: 5.6
    Enter an int, double, any random text, or type quit to end: test
    Enter an int, double, any random text, or type quit to end: monkey
    Enter an int, double, any random text, or type quit to end: quit
    Integers:
    Integer[0]: 5
    Integer[1]: 10
    Doubles:
    Double[0]: 1.2
    Double[1]: 3.4
    Double[2]: 5.6
    Others:
    Other[0]: test
    Other[1]: monkey
    Any help is greatly appreciated!!!
    Thanks!
    Edited by: sublimeph03nix on Jan 21, 2009 7:24 PM

    My professor told me to add sc.next(); because she said when you hit return its reads that in the scanner class too, so it's kinda to clear the buffer I think, I wasn't really sure. It changes nothing on the front end if I remove it.
    As for the thing, it wont let me edit for some reason.  I'll try again in a bit.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       

  • J2ME dictionary code with errors

    Hi,
    i'm getting headache looking for error. im new to J2ME so i don't really understand the real problem. Please healp me to correct the code. i would appreciate very much helps from anyone. Thanks and please help!
    code:
    package util;
    import java.util.*;
    import java.io.*;
    class Word {
    String eng;
    String rus;
    int count;
    public class Dictionary {
    static boolean LARGE_DICTIONARY = true;
    static final int FREQUENCY = LARGE_DICTIONARY ? 0 : 3;
    static final int MAX_LENGTH = LARGE_DICTIONARY ? 64 : 25;
    static final int MAX_FILE_SIZE = 16*1024;
    static int split(int[] words, int[] bestParts, int[] currParts, int offs, int partNo, int minWords) {
    if (++partNo < currParts.length) {
    for (int i = offs+1; i < words.length; i++) {
    currParts[partNo-1] = i;
    minWords = split(words, bestParts, currParts, i, partNo, minWords);
    } else {
    int maxWords = 0;
    for (int i = 0, j = 0; i < currParts.length; i++) {
    int nWords = 0;
    while (j < currParts) {
    nWords += words[j++];
    if (nWords > maxWords) {
    maxWords = nWords;
    if (maxWords < minWords) {
    System.arraycopy(currParts, 0, bestParts, 0, currParts.length);
    minWords = maxWords;
    return minWords;
    public static void main(String[] args) throws Exception {
         BufferedReader in = new BufferedReader(new FileReader("Mueller7GPL.win"));
         String line;
         TreeMap hash = new TreeMap();
    nextLine:
         while ((line = in.readLine()) != null) {
         int i = line.indexOf(' ');
         if (i > 1) {
    for (int j = 0; j < i; j++) {
    char ch = line.charAt(j);
    if (!(ch >= 'a' && ch <= 'z') && !(ch >= 'A' && ch <= 'Z')) {
    continue nextLine;
              Word word = new Word();
              word.eng = line.substring(0, i).toLowerCase();
              boolean firstChar = true;
              int nBrackets = 0;
              StringBuffer buf = new StringBuffer();
              boolean skip = false;
              while (++i < line.length()) {
              char ch = line.charAt(i);
              switch (ch) {
              case '{':
              case '(':
              case '[':
                   nBrackets += 1;
                   continue;
              case '}':
              case ')':
              case ']':
                   nBrackets -= 1;
                   continue;
              case '_':
                   skip = true;
                   continue;
              case ' ':
                   skip = false;
                   if (!firstChar && nBrackets == 0) {
                   buf.append(' ');
                   continue;
              default:
                   if (!skip && nBrackets == 0) {
                   if (Character.isLetter(ch) && ch > 'z') {
                        firstChar = false;
                        buf.append(ch);
                   } else if (!firstChar) {
                        word.rus = buf.toString().trim();
                        int len = word.rus.length();
                        if (len > 2 && len <= MAX_LENGTH ) {
    if (hash.get(word.eng) == null) {
    hash.put(word.eng, word);
                        continue nextLine;
    if (FREQUENCY != 0) {
    byte[] buf = new byte[1025*1024];
    int rc;
    FileInputStream fs = new FileInputStream("samples.txt");
    while ((rc = fs.read(buf)) > 0) {
    for (int i = 0; i < rc; i++) {
    int j = i;
    char ch;
    while (j < rc && (((ch = (char)buf[j]) >= 'a' && ch <= 'z') || (ch >= 'A' && ch <= 'Z'))) {
    j += 1;
    if (j > i) {
    String key = new String(buf, i, j-i).toLowerCase();
    Word word = (Word)hash.get(key);
    if (word != null) {
    word.count += 1;
    i = j;
    if (args.length > 0) {
    int nParts = Integer.parseInt(args[0]);
    int partNo = Integer.parseInt(args[1]);
    Iterator iterator = hash.values().iterator();
    char firstLetter = '\0';
    int[] words = new int[26];
    int i = -1;
    while (iterator.hasNext()) {
    Word word = (Word)iterator.next();
    if (word.eng.charAt(0) != firstLetter) {
    firstLetter = word.eng.charAt(0);
    i += 1;
    words[i] += 1;
    int[] currParts = new int[nParts];
    int[] bestParts = new int[nParts];
    currParts[nParts-1] = words.length;
    split(words, bestParts, currParts, 0, 0, Integer.MAX_VALUE);
    iterator = hash.values().iterator();
    i = 0;
    if (partNo > 1) {
    for (int n = bestParts[partNo-2]; i < n; i++) {
    for (int j = words[i]; --j >= 0;) {
    iterator.next();
    TreeMap subset = new TreeMap();
    for (int n = bestParts[partNo-1]; i < n; i++) {
    for (int j = words[i]; --j >= 0;) {
    Word word = (Word)iterator.next();
    subset.put(word.eng, word);
    hash = subset;
         FileOutputStream index = new FileOutputStream("dictionary.idx");
         FileOutputStream out = new FileOutputStream("volume.1");
         Iterator iterator = hash.values().iterator();
         int n = 0;
         int size = 0;
         int totalSize = 0;
    int id = 1;
    String prevWord = null;
    StringBuffer ib = new StringBuffer();
         while (iterator.hasNext()) {
         Word word = (Word)iterator.next();
         if (word.count >= FREQUENCY) {
              StringBuffer sb = new StringBuffer();
    String thisWord = word.eng;
    if (prevWord == null) {
    ib.append(thisWord);
    ib.append(':');
    sb.append(thisWord);
    } else {
    int prefix;
    int len = thisWord.length() > prevWord.length() ? prevWord.length() : thisWord.length();
    if (len > 9) {
    len = 9;
    for (prefix = 0; prefix < len && thisWord.charAt(prefix) == prevWord.charAt(prefix); prefix++);
    if (prefix > 0) {
    sb.append((char)(prefix + '0'));
    sb.append(thisWord.substring(prefix));
    } else {
    sb.append(thisWord);
              sb.append(':');
              sb.append(word.rus);
              //sb.append('\r');
              sb.append('\n');
              byte[] bytes = sb.toString().getBytes();
    if (size + bytes.length > MAX_FILE_SIZE) {
    ib.append(prevWord);
    ib.append('\n');
    index.write(ib.toString().getBytes());
    ib = new StringBuffer();
    ib.append(thisWord);
    ib.append(':');
    out.close();
    out = new FileOutputStream("volume." + ++id);
    size = 0;
              size += bytes.length;
    totalSize += bytes.length;
              n += 1;
    prevWord = thisWord;
              out.write(bytes);
         out.close();
    ib.append(prevWord);
    ib.append('\n');
    index.write(ib.toString().getBytes());
    index.close();
         System.out.println("Words " + n + ", size " + totalSize);

    Can some one take a look at this code and tell me how to get all my jlabels to line up alone side their jtf.
    Because it looks like this the picture in the attached file and this is the code for it:
    public customerPanel()
    // Set the panel with line border
    setBorder(new BevelBorder(BevelBorder.RAISED));
    // Panel p1 for holding labels Name, Street, and City
    JPanel p1 = new JPanel();
    p1.setLayout(new GridLayout(5, 1));
    p1.add(new JLabel("Registration Number:"));
    p1.add(new JLabel("Seating Capacity:"));
    p1.add(new JLabel("Engine Size:"));
    p1.add(new JLabel("Start date of hire"));
    p1.add(new JLabel("Duration of hire"));
    JPanel p2 = new JPanel();
    p2.setLayout(new GridLayout(5, 1));
    p2.add(jtfRegistrationnumber);
    p2.add(jtfSeatingcapacity);
    p2.add(jtfEnginesize);
    p2.add(jtfStartdateofhire);
    p2.add(jtfDurationofhire);
    //JPanel p3 = new JPanel();
    //p3.add(p1, BorderLayout.WEST);
    //p3.add(p2, BorderLayout.NORTH);
    JPanel p4 = new JPanel();
    p4.setLayout(new GridLayout(4, 1));
    p4.add(new JLabel("Manufacture:"));
    p4.add(new JLabel("Model:"));
    p4.add(new JLabel("Mileage:"));
    p4.add(new JLabel("Charge:"));
    JPanel p5 = new JPanel();
    p5.setLayout(new GridLayout(4, 1));
    p5.add(jtfManufacture);
    p5.add(jtfModel);
    p5.add(jtfMileage);
    p5.add(jtfCharge);
    // JPanel p6 = new JPanel();
    // p6.setLayout(new BorderLayout());
    // p6.add(p4, BorderLayout.SOUTH);
    // p6.add(p5, BorderLayout.EAST);
    // Place p1 and p4 into CustomerPanel
    setLayout(new BorderLayout());
    add(p1, BorderLayout.WEST);
    add(p2, BorderLayout.NORTH);
    add(p4, BorderLayout.SOUTH);
    add(p5, BorderLayout.EAST);
    So could someone please help me and correct my code so that each text lable is lined up next to its jtf java text field.

  • Need help in getting pxi-7854R to build simple code, returns error:-630​40

    Hi 
    Trying to build a labview program, which just reads AIO on the pxi-7854R board that is installed in a PXIe=1062Q
    Can you help?
    below is the error message:
    Error Code: -63040
    NI-RIO:  (Hex 0xFFFF09C0) A connection could not be established to the specified remote device.
    Ensure that the device is on and accessible over the network,
    that NI-RIO software is installed, and that the RIO server is running and properly configured.
    For NI-RIO 2.3 and later, refer to Software>>NI-RIO>>NI-RIO Settings under the system in MAX.
    Prior to NI-RIO 2.3, refer to Software>>NI-VISA>>VISA Options under the system in MAX.

    Which NI-RIO driver version do you have installed? Also, this KnowledgeBase article may be helpful in narrowing down the issue:
    http://digital.ni.com/public.nsf/allkb/83DF7B92455​41FC8862573A100597696?OpenDocument
    Daniel K | NI Applications Engineer | Certified LabVIEW Developer

  • IDOC - process code with error "Application Object Type not planned'

    Hi all,
    I am doing an inbound idoc.... in TCODE we42, i trying to put function module which i created, attached to the process code.
    However, when i put my function module ZIDOC_INBOUND to the process code... it comes out error, 'Application Object Type not planned.'
    Why is this so?
    Please advice...
    Thanks and regards...
    William Wilstroth

    HI all,
    I had solved this problem. I should have gone to we57 to tie the function module.
    thanks.
    William Wilstroth

  • [Beta 6] Camera is crashing on simple code with exit code 101

    First time it was perfect
    Second time application failing with exit code 101
    If I don't use result image. For example remove line: imageView.image = image;
    then it works!
    Any ideas?
    [q]
    - (void)showCamera {
    // Set up the image picker controller and add it to the view
    UIImagePickerController *imagePickerController = [[[UIImagePickerController alloc] init] autorelease];
    imagePickerController.sourceType = UIImagePickerControllerSourceTypeCamera;
    imagePickerController.delegate = self;
    imagePickerController.allowsImageEditing = NO;
    [self presentModalViewController:imagePickerController animated:YES];
    - (void)imagePickerController:(UIImagePickerController *)picker
    didFinishPickingImage:(UIImage *)image
    editingInfo:(NSDictionary *)editingInfo
    [picker dismissModalViewControllerAnimated:YES];
    imageView.image = image;
    [/q]

    did you ever figure this out?
    i am having the same thing, but i assumed it was an out of memory problem...

  • Some simple issues with image stabilization

    Hey there
    I am quite new with Final Cut Pro X and quite impressed already. However I have one basic question:
    After I have done "stabilization" to clip, it has locked the point and shaking of image is removed from picture but now the "frames" around are shaking of course. How do I get rid of that?

    Anyone?

  • [Q] simple page with calculations

    Hi everybody,
    i'm completly new to Oracle APEX and i tested some things with a very simple Applikation at first.
    I can view, edit, delete my data. I tested simple reporting with Diagrams. Everything is working fine.
    Now i thought about a simple Page with some Calculations. I want to select my Data through Comboboxes
    and then doing some simple calculations with a button press.
    Like..
    Selecting a Country -> showing me some values for that contry.. (sales, whatever) -> entering 5% in a textbox
    ->pressing calculate -> and its showing me the result on the screen
    Now I'm completly lost on "How to start"... Is this even possible? I dont want a complete walkthrough..
    Maybe someone can give me just a hint "How to start"..
    Greetings

    Consider placing a LOV to select Country codes and a Text item to capture your percentage within your Report region.
    Then your code would mimic this code where p1_letter would be your Text item and p1_state would be your LOV.
    SELECT a.state_name
      FROM demo_states a
    WHERE     a.state_name LIKE '%' || UPPER (:p1_letter) || '%'
           AND a.st LIKE '%' || UPPER (:p1_state) || '%'Jeff

  • MyRIO simple code compilation FPGA

    Hello,
    I am new to FPGA and I want to compile some simple code. I know that myRIO comes with default FPGA configuration so I want to create new one and compile it. Lets say that I want blinking LED. So I create new VI on FPGA and here is simple code:
    then I add it to build and start compilation
    As compilation goes it says that it will use 30% of FPGA resources:
    Why is that? Whole compilation on cloud server takes more than 20 minutes. I have seen some example videos on CRio FPGA and that simple code should use no more than 2% of resources and shuld compile in 2 to 3 minutes.
    What I am doing wrong?
    Thanks in advice

    Hey Pawhan11,
    There are two main reasons for the FPGA resource consumption.  First is that the FPGA on the myRIO (Zynq Z-7010) is relativly small compared to some other NI targets you may have used.  The second reason that even a simple FPGA application takes ~20% of the FPGA fabric is because some of the FPGA fabric is already being used for other purposes.  For example some NI Real-Time targets implement UARTs, RS232 or even ethernet in the FPGA to ensure consistency between devices. 
    Since myRIO is based on the Xilinx Zynq chip it uses a different toolchain than previous FPGA devices which may cause the difference in compile/synth times.
    -Sam K
    LabVIEW Hacker
    Join / Follow the LabVIEW Hacker Group on google+

  • Interfacing C# code with SolidWorks via Softmotion

    Hi folks,
    I need to interface some C# code with a Solidworks model via LabVIEW/Softmotion, and in the interests of not going up too many blind alleys was wondering if anyone can give me any architectural pointers.
    I can interface LabVIEW itself with the code either as a DLL or a TCP/IP server, my preference is for a DLL but its not vital. What I'm wondering is if Softmotion will still interface with SOlidworks if I compile the LabVIEW project as a DLL? The C# app will be sending control commands to the Solidworks model, and receiving confirmation messages (e.g. prox switch open/closed) back, so the TCP/IP option seems to make more sense from the real-time control perspective.
    ANy pointers would be much appreciated.
    Thanks!

    Hi,
    Sorry in advance for not being particularly helpful, but I'm afraid you just have to try to build a DLL with SoftMotion and try interfacing it with SolidWorks to see if it works. I wasn't able to find any information from previous service requests or any other internal literature on this kind of integration; however, I don't think there would be any reasons why it wouldn't work.
    Regards,
    Imtiaz Chowdhury
    Head of Digital Technologies
    Brand786

Maybe you are looking for

  • Report generation in java

    Hi, Is there any report generation packages or tools equivalent to seagate crystal reports or D2k Report builder in java if so any code sample or reference? Thank you Ranjith.M

  • Movie rental won't work-- playing but screen is gray.

    I rented a movie from itunes for the first time. Podcasts, tv show downloads, purchases have all worked in the past, and they all work today, but this rental is not working. I now have 22 hours to watch a movie I can't see. I've often used Blockbuste

  • My computer has two users and we want to share the same iTunes

    How can I get the two users accounts (My wife and I) to share the same iTunes library?  We have two accounts to keep our emails separate

  • Office X apps unexpectedly quit

    When I launch Word, Excel or Powerpoint by clicking the icon on the dock they will start momentarily then "Unexpectedly Quit". If I double click a document from any of those apps I get a "Operation could not be completed" and an error code -10660. If

  • Migrated single user PS to my new laptop, Serial Number won't accept on new laptop.

    I migrated all data and software onto my new MacBook Pro.  I've also deactivated PS on the old laptop, however Adobe won't register Photoshop on the new machine, saying the serial number in invalid. Any help please?