• Member Avatar for JamesCherrill
    JamesCherrill

    Replied To a Post in Sort according to frequency

    <3 hours later> Found a little time and confirmed just two bugs to be fixed: append correct number of chars to output deal with unused array members when removing chars …
  • Member Avatar for JamesCherrill
    JamesCherrill

    Replied To a Post in Sort according to frequency

    OK, I thought you had tried a different algorithm. Unfortunately I don't have the time to plough through uncommented code that defies all normal Java coding conventions, has misleading variable …
  • Member Avatar for JamesCherrill
    JamesCherrill

    Replied To a Post in Sort according to frequency

    Without seeing the actual code I cannot know anything about why it didn't work.
  • Member Avatar for JamesCherrill
    JamesCherrill

    Replied To a Post in Sort according to frequency

    It can be done using loops like that, but you have to do something like: while some input remains... find the most frequent character (like in your code) add the …
  • Member Avatar for JamesCherrill
    JamesCherrill

    Replied To a Post in Error returning a boolean from method

    It's just the limited intelligence of the compiler. You and I can see that you always return a boolean, but the compiler sees that you may exit the for loop …
  • Member Avatar for JamesCherrill
    JamesCherrill

    Replied To a Post in Quebec's plan to ban religious symbols

    > A lack of tolerance, not just in the religious sense, is at the heart of most of the problems in the world today ... I value true neutrality While …
  • Member Avatar for JamesCherrill
    JamesCherrill

    Replied To a Post in brexit

    It has a "backstop" clause to maintain an open border in Ireland. This clause only comes into effect if no other solution is found during the future relationship negotiation process. …
  • Member Avatar for JamesCherrill
    JamesCherrill

    Replied To a Post in "Cannot find symbol method getArea();

    If you really have put it all in the main method then you will have no non-static variables, so you cannot get the same message about non-static variables!. Let's see …
  • Member Avatar for JamesCherrill
    JamesCherrill

    Replied To a Post in I cannot input string in the code for some reason.

    Don't worry, it's not really your fault. You are roughly the one millionth person to be trapped by this stupidity in the design of the Scanner clsss. Here's the explanation …
  • Member Avatar for JamesCherrill
    JamesCherrill

    Replied To a Post in "Cannot find symbol method getArea();

    That's right. The only thing the PriceCalculator class does is to run a test case. You can put all that into the main method. There's no need to create an …
  • Member Avatar for JamesCherrill
    JamesCherrill

    Replied To a Post in "Cannot find symbol method getArea();

    Line 107 getArea is a method in the RoomDimension class, but you try to call it using an instance of RoomFlooring (and vice-versa for the material costs) ps Line 102 …
  • Member Avatar for JamesCherrill
    JamesCherrill

    Replied To a Post in Java - remove most frequent characters in a string!

    Hints: The `String` class has a method to convert into an array of chars The `Arrays` class has a method to sort arrays of chars The `String` class has a …
  • Member Avatar for JamesCherrill
    JamesCherrill

    Replied To a Post in perl to java code conversion

    If it's so important and urgent then I assume you must have have already started to work on it yourself. Surely you're not waiting for someone else to do it …
  • Member Avatar for JamesCherrill
    JamesCherrill

    Gave Reputation to mytamhuyet in Default Filter Download

    Why do I always get the default filter of recommended every time I open dw? I am quite capable of decidling if I want a filter or not. How can …
  • Member Avatar for JamesCherrill
    JamesCherrill

    Replied To a Post in Using Stack and Queue to check a text file for Palindromes

    You need to remove all the spaces (and maybe other punctuation or non-alphabetic characters) from the input before testing for being a palindrome.
  • Member Avatar for JamesCherrill
    JamesCherrill

    Replied To a Post in Using Stack and Queue to check a text file for Palindromes

    Lots of people can. If you can't it's because you haven't bothered to try. Try to do it. If you get stuck post your code here with an explanation of …
  • Member Avatar for JamesCherrill
    JamesCherrill

    Replied To a Post in Different between !.equals and !=

    == and != for objects test for RH and LH expressions both referring to exactly the same object (or not). The `equals` method tests that the two objects are equivalent …
  • Member Avatar for JamesCherrill
    JamesCherrill

    Replied To a Post in Palindrome Checker

    That regex is almost right. It removes everything that's not a word character, but regex defines a "word character" as being made of any letters *or numbers or underscores*. (Presumably …
  • Member Avatar for JamesCherrill
    JamesCherrill

    Replied To a Post in Palindrome Checker

    The double quote marks in your input string are open/close double curly quotes, not simple straight double quotes, so you do not remove them.
  • Member Avatar for JamesCherrill
    JamesCherrill

    Replied To a Post in Palindrome Checker

    > have resulted in errors. What errors exactly? Help us to help you.
  • Member Avatar for JamesCherrill
    JamesCherrill

    Gave Reputation to Schol-R-LEA in Recursion effects in Python?

    **@JamesCherrill** : The standard Python implementation doesn't do TCO by default - Guido had doctrinal problems with it because he felt it makes stack traces effectively impossible - but there …
  • Member Avatar for JamesCherrill
    JamesCherrill

    Gave Reputation to santhosh_8 in Create a student class

    **Create a student class which has following functionality:** - Initialise a student with mandatory parameters - Create a student with name, email and phone number - Add a list of …
  • Member Avatar for JamesCherrill
    JamesCherrill

    Replied To a Post in Recursion effects in Python?

    Indeed there are cases where a loop can be used instead of recursion, and in those cases the loop will carry less overhead. These are mainly encountered in programming courses …
  • Member Avatar for JamesCherrill
    JamesCherrill

    Gave Reputation to rproffitt in Lines of code identifier and counter

    Sure. No problem. The Java app at https://github.com/MSUSEL/msusel-loc-metrics has full source and does all that. As to your file browser, you could look for that and then integrate the msusel …
  • Member Avatar for JamesCherrill
    JamesCherrill

    Replied To a Post in Question about a platform for IOS in java

    > We also have some code that is data driven so it's almost like a runtime. There's an inevitable grey area between a data-driven app and code-executing app. Data-driven is …
  • Member Avatar for JamesCherrill
    JamesCherrill

    Replied To a Post in Question about a platform for IOS in java

    rproffitt: Apple have Java for MacOS, although its a very old version and not well supported (current Javas for MacOS from Oracle/Apache are fully supported products), but neither Apple nor …
  • Member Avatar for JamesCherrill
    JamesCherrill

    Replied To a Post in Question about a platform for IOS in java

    RoboVM was a nice open source project that ended up being owned, then killed, by Microsoft in 2016. In my opinion you would be mad to start a new development …
  • Member Avatar for JamesCherrill
    JamesCherrill

    Replied To a Post in Inner Class in an Interface?

    Wow. When did we last see such a useless pile of nonsense. Almost every line contains an error. There's no way you could turn that into valid Java code. And …
  • Member Avatar for JamesCherrill
    JamesCherrill

    Replied To a Post in How to add an Object to an ArrayList

    Driver line 2 is the error. It means you have two lists where you should only have one. You have a list in your library class, you don’t need another …
  • Member Avatar for JamesCherrill
    JamesCherrill

    Replied To a Post in Inner Class in an Interface?

    Your title and question are inconsistent! Is it interfaces in inner classes, inner classes in interfaces? Interfaces in inner classes: Yes, sometimes. Because interfaces are by definition static, they can …
  • Member Avatar for JamesCherrill
    JamesCherrill

    Replied To a Post in Safe way to operate on List while using Threads

    Time for a confession: this application is close to my heart because, in years gone by, I worked for IBM as a programmer and spent 2 years on on a …
  • Member Avatar for JamesCherrill
    JamesCherrill

    Replied To a Post in Safe way to operate on List while using Threads

    Not sure why, but something seems uncomfortable about moving Cars around like that. I guess the code gets quite tangled? How about just keeping a list of Cars, and having …
  • Member Avatar for JamesCherrill
    JamesCherrill

    Replied To a Post in Safe way to operate on List while using Threads

    You could synchronise drawing and modifying, but that would prevent them running concurrently and immediately halve the performance of the app and make the UI less responsive (not to mention …
  • Member Avatar for JamesCherrill
    JamesCherrill

    Replied To a Post in Unable to get the Game of Mastermind working

    Line 66: you have confused greater/less than.
  • Member Avatar for JamesCherrill
    JamesCherrill

    Gave Reputation to Reverend Jim in How we can get IP address of computer

    On my system (laptop - wireless) I can get that info under VB.NET 2017 by Imports System.Net.NetworkInformation Public Class Form1 Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click …
  • Member Avatar for JamesCherrill
    JamesCherrill

    Replied To a Post in Hide Private Message in an Image (Python)

    GIF uses lossless compression that does not degrade the quality of the image. As such there no a priori reason why steganography woudn't work.
  • Member Avatar for JamesCherrill
    JamesCherrill

    Replied To a Post in How we can get IP address of computer

    Which address do you want? Could be the public address supplied by your ISP Could be the local address supplied by your router Could be 127.0.0.1 as above if you …
  • Member Avatar for JamesCherrill
    JamesCherrill

    Replied To a Post in Checking duplicates in LinkedLists in simulation using java tests.

    The simplest code to check for duplicates in a List is probably to add its items to a HashSet (HashSet does not allow duplicates) and check if the size is …
  • Member Avatar for JamesCherrill
    JamesCherrill

    Gave Reputation to misstj555 in Help with this Code Block Please

    Thank You. I understand what you are saying now. Sorry that you had to explain again.
  • Member Avatar for JamesCherrill
    JamesCherrill

    Replied To a Post in Help with this Code Block Please

    > the simplest solution is probably to call an extra nextLine() after the nextDouble() Please read what I wrote more carefully. I said to add a `nextLine()`, not a `println`, …
  • Member Avatar for JamesCherrill
    JamesCherrill

    Replied To a Post in Help with this Code Block Please

    Standard answer: It's a real problem with Scanner's design - so many people fall into this trap. You have some input alternating an int followed by some text, eg 101 …
  • Member Avatar for JamesCherrill
    JamesCherrill

    Gave Reputation to Kam_1 in Why I see only frame when I run my program?

    Hi, something weird happened with my program, I mean when I run it I see only grey frame (like I had only JFrame object in my app), then I minimalize …
  • Member Avatar for JamesCherrill
    JamesCherrill

    Replied To a Post in Why I see only frame when I run my program?

    I already told you what causes this probem and how to fix it. You are wasting your time and ours by asking the same question twice.
  • Member Avatar for JamesCherrill
    JamesCherrill

    Replied To a Post in Turning into road - Traffic simulator

    Thiis code is 8 years old, and was pretty obsolete even then. Java has moved on a lot, eg AWT (as used in this code) was superceeded by Swing in …
  • Member Avatar for JamesCherrill
    JamesCherrill

    Replied To a Post in Problem with creating graphic application in Java

    pk11, kam1, same code. Whats going on. No more help until we get some explanation.
  • Member Avatar for JamesCherrill
    JamesCherrill

    Replied To a Post in Problem with graphic interface on my app [Java]

    1 At startup you are updating the content of a visible component on a non-swing thread - use invokeLater etc 2 Don't use fixed sizes. That destroys your portability. 3 …
  • Member Avatar for JamesCherrill
    JamesCherrill

    Replied To a Post in Problem with creating graphic application in Java

    line 77 (etc?) should be paintComponent, not paintComponents
  • Member Avatar for JamesCherrill
    JamesCherrill

    Replied To a Post in Windows installation from Mars

    My machines all have an SSD for the system and applications, and a large HD for data. The large HD is partitioned so it has a bootable clone of the …
  • Member Avatar for JamesCherrill
    JamesCherrill

    Replied To a Post in need clarification on basic array calling

    // simple example... int[] data = {1,2,3}; // create an array doStuff(data); // pass it to the method ... void doStuff(int[] arg) { // declare method with an array parameter …
  • Member Avatar for JamesCherrill
    JamesCherrill

    Replied To a Post in import text file to JTable by using JFilechooser

    Hi ikoren That example you linked to was created by Amruta Sriram (the originator of this thread) and is exactly the same as (s)he posted here. The link you suggested …

The End.