• Member Avatar for JamesCherrill
    JamesCherrill

    Replied To a Post in JAVA Checking 10th place in a 2d Arraylist

    Hint (also applies to your other thread): You can get the nth element in a List as follows: `list.get(n)`
  • Member Avatar for JamesCherrill
    JamesCherrill

    Replied To a Post in Calculating distance with arraylist

    take a moment to think through the value(s) of j on lines 6 and 7. on each pass of the loop you do the whole calculation for just one value …
  • Member Avatar for JamesCherrill
    JamesCherrill

    Replied To a Post in adobe phtostoshop

    Go to adobe.com and purchase the kind of licence that suits you best.
  • Member Avatar for JamesCherrill
    JamesCherrill

    Gave Reputation to hemoram631 in General Information

    Check these things on the PC where you want to install Windows 10: 64-bit or 32-bit processor (CPU). You'll create either the 64-bit or 32-bit version of Windows 10 that's …
  • Member Avatar for JamesCherrill
    JamesCherrill

    Replied To a Post in General Information

    What exactly is the point of this? How many people are going to do a clean install of WIndows 10 on a 32 bit machine in 2021? To quote Microsoft: …
  • Member Avatar for JamesCherrill
    JamesCherrill

    Replied To a Post in How to use my undo/redo bottom from my other view?

    Which line and variable does the NPE refer to?
  • Member Avatar for JamesCherrill
    JamesCherrill

    Replied To a Post in can anyone help me to translate this c++ into pseudocode?

    looks like a simple array sort to me. If so the pseudo code is already well known and you just have to match it to the details of this implementation
  • Member Avatar for JamesCherrill
    JamesCherrill

    Replied To a Post in i'm having trouble with this question if anyone can help me to solve

    The instructions are almost pseudo-code for the actual solution. Each sentence represents a few lines of code, all in the right order. So start with "Read from the user the …
  • Member Avatar for JamesCherrill
    JamesCherrill

    Replied To a Post in javac: file not found: C:\Program Files\Java\Main.java

    It seems like it's looking for your java file in the wrong place. It's looking in c:\Program Files\java, presumably because that's your working directory (?). That's a really bad place …
  • Member Avatar for JamesCherrill
    JamesCherrill

    Replied To a Post in A simple encryption scheme

    Now that the algorithm is sealed, I’ve indulged my love of structuring code for maximum clarity and maintainability, and made a Java version accordingly. The structure follows the short spec: …
  • Member Avatar for JamesCherrill
    JamesCherrill

    Replied To a Post in help my code is wrong

    Its a very bad idea to have multiple Scanners usig the same input stream (System.in). You never know which Scanner will read the next character from the stream, or which …
  • Member Avatar for JamesCherrill
    JamesCherrill

    Replied To a Post in A simple encryption scheme

    That looks good to me.
  • Member Avatar for JamesCherrill
    JamesCherrill

    Replied To a Post in A simple encryption scheme

    It's necessary that the receiver can generate the same sequesnce of keys as the sender, otherwize he can't decode the message. If you use a random salt and don't share …
  • Member Avatar for JamesCherrill
    JamesCherrill

    Replied To a Post in A simple encryption scheme

    I read about code re-use with an XORed stream, and that left me worried. Given 2 Messages M1 and M2 and a stream of bytes S such as we get …
  • Member Avatar for JamesCherrill
    JamesCherrill

    Replied To a Post in A simple encryption scheme

    Hello again - I thought his topic had faded out, but obviously I was wrong!. Excellent! > I obscure the hash byte by XOR'ing with the key, wouldn't it make …
  • Member Avatar for JamesCherrill
    JamesCherrill

    Replied To a Post in How to become a Java master or advanced?

    I've been programming in Java since the mid-90s (working for HP Consulting), and programming since 1969, but I'm not prepared to call myself a "master". The more I learn, the …
  • Member Avatar for JamesCherrill
    JamesCherrill

    Replied To a Post in A simple encryption scheme

    yes, that makes sense to me. it looks like creating the digests dominates the execution speed, so using 32 bytes instead of just 1 will run about 30x faster, and …
  • Member Avatar for JamesCherrill
    JamesCherrill

    Replied To a Post in A simple encryption scheme

    That'll teach me not to speed read. OK, let's start again. Here's an encrypted string using my Java implementation of your algorithm with SHA3-512 digest and unsigned bytes for the …
  • Member Avatar for JamesCherrill
    JamesCherrill

    Replied To a Post in A simple encryption scheme

    Yes, I had SHA=256. My mistake. Herewith the data using SHA-512... 71, 210, 218, 188, 244, 138, 119, 150, 216 any better?
  • Member Avatar for JamesCherrill
    JamesCherrill

    Replied To a Post in A simple encryption scheme

    I don't see the problem with bytes. Both languages generate valid SHA512 bytes, and this program just uses XOR; no artithmetic operations, so the signed/unsigned difference never comes into play. …
  • Member Avatar for JamesCherrill
    JamesCherrill

    Replied To a Post in A simple encryption scheme

    ps why not use all the bytes in the hash before taking the hit on computing a new hash? Could make a difference if you are encoding a lot of …
  • Member Avatar for JamesCherrill
    JamesCherrill

    Replied To a Post in more about java programming

    What are you trying to say???
  • Member Avatar for JamesCherrill
    JamesCherrill

    Replied To a Post in A simple encryption scheme

    That looks like fun! To see if I understood it correctly I tried a Java version. Before I publish it maybe you could validate it by decoding the following: key …
  • Member Avatar for JamesCherrill
    JamesCherrill

    Replied To a Post in Java heap size issue

    > Thanks it works. So what did you do- edit the .bat or upgrade to 64 bit? ps: As a wise man once said as part of his DaniWeb signature: …
  • Member Avatar for JamesCherrill
    JamesCherrill

    Replied To a Post in Java heap size issue

    Are you running a 64 bit JRE? 32 bit JREs won't support 4g of anything "JADX" - is that the android de-compiler? I'm looking at jadx.bat where I see: set …
  • Member Avatar for JamesCherrill
    JamesCherrill

    Replied To a Post in Java heap size issue

    Is it in the .bat file?
  • Member Avatar for JamesCherrill
    JamesCherrill

    Gave Reputation to toto_4 in convert python to java

    defFlip(b): return [[b[(N-1)-i][j]for j in range(N)]for i in range(N)] defRot90(b): return[[b[N-1)-j][i]for j in range(N)]for i in range(N)] defRot180(b): return Rot90(Rot90(b)) defRot270(b): return Rot180(Rot90(b)) defFlipRot90(b): return Flip(Rot90(b)) defFlipRot180(b): return Flip(Rot180(b)) defFlipRot270(b): …
  • Member Avatar for JamesCherrill
    JamesCherrill

    Replied To a Post in convert python to java

    There's nothing quite like repeating the same mistake... You hijack a 15 year old thread to post uncommented UNINDENTED Python? And you expect us to do what?
  • Member Avatar for JamesCherrill
    JamesCherrill

    Replied To a Post in convert python to java

    You hijack a 15 year old thread to post uncommented UNINDENTED Python? And you expect us to do what?
  • Member Avatar for JamesCherrill
    JamesCherrill

    Replied To a Post in getting the last modified date of file in java

    Sorry - I don't have an Adroid SDK to test on. The Date class was superceeded by the NIO Path/Files classes years ago. Maybe try the NIO equivalent? ... System.out.println(Files.getLastModifiedTime(f.toPath()));
  • Member Avatar for JamesCherrill
    JamesCherrill

    Replied To a Post in getting the last modified date of file in java

    I can't see anything wrong with that code. I pasted it into a little stand-alone test and it works perfectly... JFileChooser fileChooser = new JFileChooser(); int result = fileChooser.showOpenDialog(null); File …
  • Member Avatar for JamesCherrill
    JamesCherrill

    Replied To a Post in How to convert this piece of java code to equivalent php code?

    > Java/ Javascript is usually client side There's no such thing as "Java/ Javascript" javascript is client side. Java (not the same thing) is used for both, but the majority …
  • Member Avatar for JamesCherrill
    JamesCherrill

    Replied To a Post in Error when running program

    > 9999999999 That's 10 digits, not 7 and as such can hold values > 2^31 which cannot be stored in an int. (Although I have no idea if that is …
  • Member Avatar for JamesCherrill
    JamesCherrill

    Replied To a Post in Grading system

    Do you have a question relating to that code?
  • Member Avatar for JamesCherrill
    JamesCherrill

    Replied To a Post in Exception handling in java (Looping in menu)

    Maybe the problem is that `choice` is still zero after a failed `nextInt()`, thus exiting the loop. Try setting `choice` to some other vaue (eg -99) in the `catch`.
  • Member Avatar for JamesCherrill
    JamesCherrill

    Replied To a Post in What is the counterpart of this C pointer programme in C#?

    This is presumably all about passing params as references rather than values (the default in C#) To pass a parameter as a reference use the `ref` keyword. See https://docs.microsoft.com/en-us/dotnet/csharp/programming-guide/classes-and-structs/passing-parameters
  • Member Avatar for JamesCherrill
    JamesCherrill

    Replied To a Post in Casting an ArrayList?

    I think that sos's point was that you shouldn't have to perform that kind of cast. It probably results from a bad design decision. The "correct" solution is to declare …
  • Member Avatar for JamesCherrill
    JamesCherrill

    Replied To a Post in Removing Duplicates - Java

    `HashSet<Object>` or. `HashSet<>`. or just `HashSet` will allow any kind of object. Primitives will be automatically wrapped with the appropriate class.
  • Member Avatar for JamesCherrill
    JamesCherrill

    Replied To a Post in Removing Duplicates - Java

    Yes, one of the easiest ways to detect duplicates is to use a Collection that does not allow duplicates, eg HashSet. Its `add` method returns false if the set already …
  • Member Avatar for JamesCherrill
    JamesCherrill

    Replied To a Post in convert to java

    ... and your question is?
  • Member Avatar for JamesCherrill
    JamesCherrill

    Replied To a Post in java indexOf question

    > Hint: Count the steps while traversing the list until encountering position p > isnt it put the method Iterable positions();? Yes. Simply use positions() to loop through the elements …
  • Member Avatar for JamesCherrill
    JamesCherrill

    Replied To a Post in Buttons don't work or even appear in my Java GUI in JGRASP

    Where do you add the JPanels to the JFrame????
  • Member Avatar for JamesCherrill
    JamesCherrill

    Replied To a Post in Apache Derby Database Cloud

    JavaDB is just Derby, which moved from Oracle to Apache where it is still very much alive. The most recent release was March 1st 2021 (!) https://db.apache.org/derby/
  • Member Avatar for JamesCherrill
    JamesCherrill

    Gave Reputation to Reverend Jim in #1 What Is The Best Way To Learn Java?

    If you already know how to program well in another language then learning to program in java should be "easier". However, learning any new skill takes time and effort in …
  • Member Avatar for JamesCherrill
    JamesCherrill

    Replied To a Post in #1 What Is The Best Way To Learn Java?

    Recognise that best AND easy doesn't exist. Oracle's own tutorials are (IMHO) the best - start [here](https://docs.oracle.com/javase/tutorial/getStarted/index.html) As for easy - there are loads of beginner tutorials on the web …
  • Member Avatar for JamesCherrill
    JamesCherrill

    Replied To a Post in I am having trouble understanding why my program is giving me an error?

    Your while test is wrong... while grades<= zero AND >= zero. Grades can't be both those at the same time (unless it is == 0), so the test is false …
  • Member Avatar for JamesCherrill
    JamesCherrill

    Replied To a Post in New to Java and would appreciate the help.

    You should explain EXACTLY what "does not work properly" means... eg what error message do you get, or how does the output differ from what you expected. Anyway - for …
  • Member Avatar for JamesCherrill
    JamesCherrill

    Replied To a Post in can anyone help with this code

    ... and what is your question?
  • Member Avatar for JamesCherrill
    JamesCherrill

    Replied To a Post in Desktop_Application

    All you NEED is the Java Development Kit (JDK) and a text editor (any text editor). IDEs like Eclipse and NetBeans are used by real programmers because they provide all …
  • Member Avatar for JamesCherrill
    JamesCherrill

    Replied To a Post in can anyone help with this code

    Hint: `for (Account acc : gBank) {...` this loops through all the accounts, setting `acc` to refer to each account in turn so in the loop you can use `acc` …

The End.