Click here to Skip to main content
       

Java

 
You must Sign In to use this message board.
Search this forum  
    Spacing  Noise  Layout  Per page  Show 
AdminForum Guidelines - PLEASE READadminChris Maunder28 Jul '09 - 2:36 
When posting your question please:
  1. Choose the correct forum for your message. Posting a VB.NET question in the C++ forum will end in tears.
     
  2. Be specific! Don't ask "can someone send me the code to create an application that does 'X'. Pinpoint exactly what it is you need help with.
     
  3. Keep the subject line brief, but descriptive. eg "File Serialization problem"
     
  4. Keep the question as brief as possible. If you have to include code, include the smallest snippet of code you can.
     
  5. Be careful when including code that you haven't made a typo. Typing mistakes can become the focal point instead of the actual question you asked.
     
  6. Do not remove or empty a message if others have replied. Keep the thread intact and available for others to search and read. If your problem was answered then edit your message and add "[Solved]" to the subject line of the original post, and cast an approval vote to the one or several answers that really helped you.
     
  7. If you are posting source code with your question, place it inside <pre></pre> tags. We advise you also check the "Encode HTML tags when pasting" checkbox before pasting anything inside the PRE block, and make sure "Ignore HTML tags in this message" check box is unchecked.
     
  8. Be courteous and DON'T SHOUT. Everyone here helps because they enjoy helping others, not because it's their job.
     
  9. Please do not post links to your question in one forum from another, unrelated forum (such as the lounge). It will be deleted.
     
  10. Do not be abusive, offensive, inappropriate or harass anyone on the boards. Doing so will get you kicked off and banned. Play nice.
     
  11. If you have a school or university assignment, assume that your teacher or lecturer is also reading these forums.
     
  12. No advertising or soliciting.
     
  13. We reserve the right to move your posts to a more appropriate forum or to delete anything deemed inappropriate or illegal.
 
When answering a question please:
  1. Read the question carefully
     
  2. Understand that English isn't everyone's first language so be lenient of bad spelling and grammar
     
  3. If a question is poorly phrased then either ask for clarification, ignore it, or mark it down. Insults are not welcome
     
  4. If the question is inappropriate then click the 'vote to remove message' button
Insults, slap-downs and sarcasm aren't welcome. Let's work to help developers, not make them feel stupid.
 
cheers,
Chris Maunder
 
The Code Project Co-fou
Questionhow to create timetable schedule using Genetic Algorithmmembermwashahi22 May '13 - 4:40 
hi ,how are you
I have Question ,how to create timetable schedule using Genetic Algorithm for all university
I try with it but it not work with me can any one help me on it?
AnswerRe: how to create timetable schedule using Genetic AlgorithmmemberMember 1006646522 May '13 - 20:31 
Smile | :) hi,I'd like to bring you some useful stuffs,but I really don't know what the concrete problem you are puzzled.So any codes to show me or tell me the concrete topic you are trying to figure out .
GeneralRe: how to create timetable schedule using Genetic Algorithmmembermwashahi22 May '13 - 20:33 
I don't know how to start with JAVA to create random timetable without any conflict in Classes
How to start with it using Genetic Algorithm
SuggestionRe: how to create timetable schedule using Genetic AlgorithmmvpRichard MacCutchan22 May '13 - 21:08 
You need to use Google to find references for this subject. There are many problems to be resolved in creating automatic schedules such as this, and the question is too broad for a technical forum.
Use the best guess

AnswerRe: how to create timetable schedule using Genetic Algorithmmemberdusty_dex22 May '13 - 21:37 
pdf
 
This is a c++ article but should provide enough info to get your own ideas.
Making-a-Class-Schedule-Using-a-Genetic-Algorithm
 
Smile | :)


GeneralRe: how to create timetable schedule using Genetic Algorithmmembermwashahi14hrs 32mins ago 
good example
where I have to define the time to start at 8 instead of 9 in this example
Making a Class Schedule Using a Genetic Algorithm[^]
GeneralRe: how to create timetable schedule using Genetic Algorithmmembermwashahi13hrs 36mins ago 
done
thanks
QuestionServer Socket is closed on client closedmemberIndian Coder198920 May '13 - 22:47 
I want to create a server socket(TCP) in which I want that server shouldn't be closed if
client is closed.
What I'm doing: I'm able to connect to client but when client is closed then server is throwing exception : Connection Reset and crashes
How can I do it?
AnswerRe: Server Socket is closed on client closedmvpRichard MacCutchan20 May '13 - 22:57 
Trap the exception and dispose of it.
Use the best guess

GeneralRe: Server Socket is closed on client closedmemberIndian Coder198920 May '13 - 23:02 
I'm getting this exception:

Exception in thread "main" java.net.SocketException: Connection reset
at java.net.SocketInputStream.read(SocketInputStream.java:189)
at java.net.SocketInputStream.read(SocketInputStream.java:121)
at sun.nio.cs.StreamDecoder.readBytes(StreamDecoder.java:283)
at sun.nio.cs.StreamDecoder.implRead(StreamDecoder.java:325)
at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:177)
at java.io.InputStreamReader.read(InputStreamReader.java:184)
at java.io.BufferedReader.fill(BufferedReader.java:154)
at java.io.BufferedReader.readLine(BufferedReader.java:317)
at java.io.BufferedReader.readLine(BufferedReader.java:382)
at combined.Combined.dostuff(Combined.java:64)
at combined.Combined.main(Combined.java:30)
 

But not getting the way to dispose it.
GeneralRe: Server Socket is closed on client closedmvpRichard MacCutchan21 May '13 - 2:34 
Well, you need to catch it first.
Use the best guess

AnswerRe: Server Socket is closed on client closedmemberjschell21 May '13 - 7:57 
Indian Coder1989 wrote:
I want to create a server socket(TCP) in which I want that server shouldn't be
closed if
client is closed.

 
As stated that of course is illogical. Once the client terminates, regardless of how it happened, the server side connection can no longer be used.
GeneralRe: Server Socket is closed on client closedmemberIndian Coder198921 May '13 - 17:29 
OfCourse the server will be disconnected and connection will be closed but program shouldn't be crashed.
Isn't it possible that next time when client will again connected there will not be a need to start the server again(means server shouldn't be crashed)?
GeneralRe: Server Socket is closed on client closedmvpRichard MacCutchan21 May '13 - 21:15 
I already told you twice what to do: catch the exception and dispose it, so the server continues to listen in an idle state. How do you think the rest of the internet works?
Use the best guess

AnswerRe: Server Socket is closed on client closedmemberMember 1006646522 May '13 - 1:30 
I think you should make a loop in your server code.
Just like the test code below.
import java.io.PrintWriter;
import java.net.ServerSocket;
import java.net.Socket;
 
public class Test {
    public static void main(String[] args) throws Exception {
        ServerSocket server = new ServerSocket(888);
        while(true) {
            Socket s = server.accept();
            Processer p = new Processer(s);
            Thread t = new Thread(p);
            t.start();
        }
    }
}
 
class Processer implements Runnable {
    private Socket socket;
    
    public Processer(Socket s) {
        // TODO Auto-generated constructor stub
        this.socket = s;
    }
    @Override
    public void run() {
        try {
            PrintWriter out=new PrintWriter(socket.getOutputStream(),true);
            out.println("HTTP/1.0 200 OK");
            out.println("Content-Type:text/html;charset=utf-8");
            out.println();
            out.println("<h1> web service test sucess!</h1>");
            out.close();
        } catch(Exception ex) {
            ex.printStackTrace();
        } finally {
            try {
                socket.close();
            } catch (Exception e) {
                e.printStackTrace();
            }
        }
        
    }
}
To test the result,using http://127.0.0.1:888 in yor brower
 
Smile | :) Try it !
GeneralRe: Server Socket is closed on client closedmemberIndian Coder198922 May '13 - 2:10 
Thanks!
This is the thing, I was looking for.
Let me try this in my project.
Questiontomcat and eclipsememberprithaa20 May '13 - 0:50 
Hello,
 
I have installed tomcat 6 with eclipse but now i want to install tomcat 7 with eclipse . But I keep getting the error
The Apache Tomcat installation at this directory is version 6. A tomcat 7 installation is expected.
 

Any idea how should i go about it.
Pritha
AnswerRe: tomcat and eclipseprofessionalPrasad Khandekar21 May '13 - 4:31 
Hello Pritha,
 
You may find this tutorial useful in solving your issue. Also check whether CATALINA_HOME or TOMCAT_HOME environment variables are set and are pointing to wrong directory.
 
Regards,
Prasad P. Khandekar
Knowledge exists, man only discovers it.

QuestionWindows Media PlayermemberMAYNUL18 May '13 - 10:28 
Hi,
      I have to made Windows Media Player. Can anybody suggest me how can I work on it!!
Thanx in advance
May
AnswerRe: Windows Media PlayermvpRichard MacCutchan18 May '13 - 21:20 
Start researching the Java sound interfaces[^].
Use the best guess

Questionanalysing utterancesmemberHopePerson14 May '13 - 18:09 
Hi Guys,
 
just wanted to know how I can build lexical and syntacitc analysis using Jlex in eclipse for generating texts !!!
 
any one can help me please I am stuck ??!!
 
Thanks in advance
QuestionRe: analysing utterancesmvpRichard MacCutchan14 May '13 - 21:26 
HopePerson wrote:
I am stuck
With what? You need to give specific details of your problem if you want some useful suggestions.
Use the best guess

QuestionJList is returning null valuememberIndian Coder198913 May '13 - 20:15 
I'm showing or selecting images from a list.
My code for listselectionlistener is:
 listener = new ListSelectionListener() {
 
            @Override
            public void valueChanged(ListSelectionEvent e) {
    
          index = imageList.getSelectedIndex();
            imageList.setSelectedIndex(index);
                  o = imageList.getSelectedValue();
                if (o instanceof BufferedImage) {
                    imageView.setIcon(new ImageIcon((BufferedImage)o));
                   
            }
 
            }
  
        };
 
       imageList.addListSelectionListener(listener);
 
 
to get next item in JList (imageList) I'm coding like this:
public void nextimage() 
      {
         index ++;
 
imageList.addListSelectionListener(listener);
 
       imageList.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); 
       imageList.setSelectedIndex(index); -----here is error: Null Pointer Exception
 
}
I initialize index as int index=0;
 
Program in starting returning right value but after 4 or 5 images it's not working.
How can I change the Item in this list?
Please suggest your opinions.
AnswerRe: JList is returning null valuememberTorstenH.13 May '13 - 21:36 
You need to check if the JList does contain so much values.
 
You're not coding safe. You need to take more care.
You can never expect a value to be there as you need it - always check if the value is valid before you use it!
regards Torsten
When I'm not working

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Rant Rant    Admin Admin   


Advertise | Privacy | Mobile
Web04 | 2.6.130523.1 | Last Updated 25 May 2013
Copyright © CodeProject, 1999-2013
All Rights Reserved. Terms of Use
Layout: fixed | fluid