• Member Avatar for JamesCherrill
    JamesCherrill

    Replied To a Post in help to compare file with virus signature

    It depends on what kind of anti-virus. If you are just scanning files for suspicious content on demand, then Java is perfectly suitable. If, on the other hand, you want …
  • Member Avatar for JamesCherrill
    JamesCherrill

    Edited virus scanning file ..please help

    in the signature based scanning I couldn't understand how to find virus when it is in the body of the file..do i need to compare file content with virus signature …
  • Member Avatar for JamesCherrill
    JamesCherrill

    Replied To a Post in java

    Then write one, and read the Daniweb member rules before posting again
  • Member Avatar for JamesCherrill
    JamesCherrill

    Replied To a Post in error: class, interface, or enum expected

    I don't have access to a PC at the moment, but I suspect the error with the import may have concealed any following error such as two public classes. Certainly …
  • Member Avatar for JamesCherrill
    JamesCherrill

    Replied To a Post in error: class, interface, or enum expected

    Line 30 is an import statement that comes after a class def. that's an error, imports must come at the beginning of the file.
  • Member Avatar for JamesCherrill
    JamesCherrill

    Replied To a Post in Decrypt data help

    0x7F. Or just 127
  • Member Avatar for JamesCherrill
    JamesCherrill

    Replied To a Post in Decrypt data help

    Java chars are 16 bit UniCode, ans include Hebrew, Arabic, Chinese... all kinds of symbols. Ordinary English text can be encoded in just 7 bits (values 0 - 127 or …
  • Member Avatar for JamesCherrill
    JamesCherrill

    Replied To a Post in jbotton

    English is not your first language? OK. But that sentence does not make sense. Please try to explain with more detail.
  • Member Avatar for JamesCherrill
    JamesCherrill

    Replied To a Post in Read by chunks from binary with java

    There's nothing wrong with new Scanner(File), but line 10 has a new Scanner(Scanner) and that's completely wrong (and unnecessary). Also, the the delimiter is wrong. Your delimiter is not the …
  • Member Avatar for JamesCherrill
    JamesCherrill

    Replied To a Post in Instant Messenger

    Yes, just the usual try/catch structure. Create the ServerSocket inside the try, and catch any `BindException` ps: I'm about to disappear on holiday for a week, so don't be surprised …
  • Member Avatar for JamesCherrill
    JamesCherrill

    Replied To a Post in Instant Messenger

    I don't like the way that connection is updated in different methods - makes it hard to follow its value (especially if connectToPeer is sucessful). Personally I would prefer to …
  • Member Avatar for JamesCherrill
    JamesCherrill

    Replied To a Post in Instant Messenger

    OK, I can see that would work, although you will presumably need some way of updating that file. Remember that if you have two servers in the same LAN behind …
  • Member Avatar for JamesCherrill
    JamesCherrill

    Replied To a Post in Instant Messenger

    Closing it in task manager will do the trick - and just by looking in TM you'll see if there are any ghost instances. How will a new instance know …
  • Member Avatar for JamesCherrill
    JamesCherrill

    Replied To a Post in Instant Messenger

    Don't have a 87 line listing. There's an 81 line listing, but line 18 of that is `whileChatting();` so if that's it, it looks like the same as the other …
  • Member Avatar for JamesCherrill
    JamesCherrill

    Replied To a Post in Instant Messenger

    In that case one needs to be the client and the other the server. You can't do anything with just 2 clients or just 2 servers. If you want to …
  • Member Avatar for JamesCherrill
    JamesCherrill

    Replied To a Post in Getting confused

    so in order to stop that i placed break; keyword yes, but did you see my comment "You probably intended to break after finding a match."? YOur break is after …
  • Member Avatar for JamesCherrill
    JamesCherrill

    Replied To a Post in elementary java homework

    To read lines, just use a BufferedReader's readLine() method. Simpler, handles exceptions properly, no risk of side effects. Did you consider the case where there are multiple 1's and multiple …
  • Member Avatar for JamesCherrill
    JamesCherrill

    Replied To a Post in Instant Messenger

    Are you trying to do the server and the client in the same program? That's going to cause problems. Don't you want multiple clients and one server? Of course, if …
  • Member Avatar for JamesCherrill
    JamesCherrill

    Replied To a Post in elementary java homework

    ... except ... Scanner is an overkill way to read lines from a text file and the algorithm you describe is in no way a solution to the requiremnt as …
  • Member Avatar for JamesCherrill
    JamesCherrill

    Replied To a Post in Instant Messenger

    No, no need for any of that at all... just ServerSocket serverSocket = new ServerSocket(... Socket clientSocket; while (true) { clientSocket = serverSocket.accept(); new Thread(new ClientHandler(clientSocket)).start(); } then in the …
  • Member Avatar for JamesCherrill
    JamesCherrill

    Replied To a Post in Java Graphics: How to make self-typing code

    OK You'll need: a Javax.swing.Timer that will run a small method at regular intervals. This is key component that controls the speed of your animation. See the API doc for …
  • Member Avatar for JamesCherrill
    JamesCherrill

    Replied To a Post in elementary java homework

    There are lots of people here who will freely give their time to help you become the best Java programmer you can be. There's nobody here who is interested in …
  • Member Avatar for JamesCherrill
    JamesCherrill

    Replied To a Post in Read by chunks from binary with java

    Is the rest of the file just text? If so, just read the file using a Scanner with your D2A7 bytes as the delimiter https://docs.oracle.com/javase/7/docs/api/java/util/Scanner.html
  • Member Avatar for JamesCherrill
    JamesCherrill

    Replied To a Post in Java Graphics: How to make self-typing code

    It looks like you draw all the strings at the same position. You need to draw each string at increasing y coordinates so they appear one below another
  • Member Avatar for JamesCherrill
    JamesCherrill

    Replied To a Post in Decrypt data help

    I see some negative number.that mean is not char? chars are alwaya positive - see tha Java Language Specification WHAT IF people encode only char there is not some wired …
  • Member Avatar for JamesCherrill
    JamesCherrill

    Replied To a Post in Getting confused

    Look at line 33. As soon as you test a name that's not in the very first element of the array you break from the loop and stop looking. You …
  • Member Avatar for JamesCherrill
    JamesCherrill

    Replied To a Post in Decrypt data help

    I would structure it like (pseudo code) for (int key = 0 to 255) { // try every key String decoded = decode(encoded, key) // decode encrypted data using key …
  • Member Avatar for JamesCherrill
    JamesCherrill

    Replied To a Post in how to get the file signature in java?

    I think the original post (with example) is pretty clear that it's the signature in the first few bytes he wants, but yes, you are right that the the Java …
  • Member Avatar for JamesCherrill
    JamesCherrill

    Replied To a Post in Instant Messenger

    You have an initial Thread that is a simple loop waiting for new connections to the ServerSocket. When it gets one it opens a Socket and hands that over to …
  • Member Avatar for JamesCherrill
    JamesCherrill

    Replied To a Post in Decrypt data help

    You will need to know something about the file so you can see if it decrypted correctly. Many file types have a standard header ("magic number") at the start, eg …
  • Member Avatar for JamesCherrill
    JamesCherrill

    Replied To a Post in to build a java multiple math game

    What I described is a highly over-simplified version of "use case modelling", which is often used as the first step in specifying and designing object-oriented software. I use this in …
  • Member Avatar for JamesCherrill
    JamesCherrill

    Replied To a Post in Easiest way to implement this in Java

    I doubt that you will sensibly find a better approach than parsing into some kind of RPN then evaluating it from the resulting stack. 100+ lines of code sounds pretty …
  • Member Avatar for JamesCherrill
    JamesCherrill

    Replied To a Post in to build a java multiple math game

    Write down a brief description of what the game is - its rules etc. Write down a few examples of how it would look when a user uses it. (Use …
  • Member Avatar for JamesCherrill
    JamesCherrill

    Replied To a Post in random array i need help

    You just copy/pasted your assignment without even a moment taken to explain what help you need. That's highly disrepestectful to the many people who give their time to help others …
  • Member Avatar for JamesCherrill
    JamesCherrill

    Replied To a Post in Decrypt data help

    If there are only 256 possible keys, just try each one in a loop until you get one that works.
  • Member Avatar for JamesCherrill
    JamesCherrill

    Replied To a Post in I Cant get the Scrollbars in JPanel, which is placed in JDialog

    Line 39, l2 is uninitialised, so its value is `null` - you create the scroll pane with null as its content Lines 42,43 you initialise l2, but it's too late.
  • Member Avatar for JamesCherrill
    JamesCherrill

    Replied To a Post in How to perform calculation in java

    That's not enough information for anyone to help. You need to post the whole code, and the complete text of any error messages. If there are no error messages but …
  • Member Avatar for JamesCherrill
    JamesCherrill

    Created Why should I learn Java?

    [This article](http://lifehacker.com/the-top-programming-languages-ranked-by-job-demand-po-1601752302) will give you at least one good reason...
  • Member Avatar for JamesCherrill
    JamesCherrill

    Replied To a Post in Draw graphics on label click

    Oops! My mistake... I forgot that \n doesn't work in the drawString method. Sorry about that. The simplest solution is to keep the \n characters separating the lines, and add …
  • Member Avatar for JamesCherrill
    JamesCherrill

    Replied To a Post in Draw graphics on label click

    That's because you replaced the original text - you didn't add it like I said lozinka = lozinka + "\n" + "ASDFGHJKL";
  • Member Avatar for JamesCherrill
    JamesCherrill

    Replied To a Post in Draw graphics on label click

    You could try adding the new text to whatToDraw, instead of replacing its previous value. Use a newline character "\n" to start a new line.
  • Member Avatar for JamesCherrill
    JamesCherrill

    Replied To a Post in Draw graphics on label click

    sigh... No, more like String whatToDraw = "Verificiranje na akauntot !"; public void paint(final Graphics g) { ... g2.drawString(whatToDraw, 20, 130); } private void jLabel3MouseClicked(java.awt.event.MouseEvent evt) { whatToDraw = "This …
  • Member Avatar for JamesCherrill
    JamesCherrill

    Replied To a Post in Draw graphics on label click

    If you don't yet know how to create String variable then there's no way you should even think about Swing events or painting. You need to go back to the …
  • Member Avatar for JamesCherrill
    JamesCherrill

    Replied To a Post in Draw graphics on label click

    Java will call your paint method when necessary. You can use the repaint() method to let Java know that a new paint is needed. Instead of the literal on line …
  • Member Avatar for JamesCherrill
    JamesCherrill

    Replied To a Post in reading an unknow ascii key

    The game "Scrabble" needs a list of valid English words. If you search the web you will find downloadable files with suitable word lists.
  • Member Avatar for JamesCherrill
    JamesCherrill

    Replied To a Post in how to get the file signature in java?

    Those are the first bytes in the file, yes? Just open a FileInputStream with that file and read the first 4 bytes into a 4 byte array where you can …
  • Member Avatar for JamesCherrill
    JamesCherrill

    Replied To a Post in Question

    I'm not going to say it again...
  • Member Avatar for JamesCherrill
    JamesCherrill

    Replied To a Post in Question

    "now it works"? With the data you just posted there's no way permissions[operation] will fail with operation == 4. Anyway, earlier you said permissions[0] gives "Alice", but that data is …
  • Member Avatar for JamesCherrill
    JamesCherrill

    Replied To a Post in Update objects on the "Client side" from the "Server"

    I have absolutely no idea where that code is going! You have something called "model" but it's an instance of "GUI" and has table layouts and some such. That seems …
  • Member Avatar for JamesCherrill
    JamesCherrill

    Replied To a Post in Question

    I keep saying "print the permissions array"! It's obviously not what you expect, but if you see what it really is then you can work out why it's wrong.

The End.