• Member Avatar for JamesCherrill
    JamesCherrill

    Replied To a Post in How to use Text Blocks in Java 15

    ps you may want to add a note about how text blocks can contain single and double quotes with escaping them... it makes a great improvement in readabiltiy for things …
  • Member Avatar for JamesCherrill
    JamesCherrill

    Replied To a Post in How to use Text Blocks in Java 15

    I love the way these posts reveal little goodies hat have slipped into Java over time. I failed to notice `String.indent` (new in Java 12), and that also lead me …
  • Member Avatar for JamesCherrill
    JamesCherrill

    Replied To a Post in Java Functional - Optional Chaining

    > The filter() and map() methods automatically perform the Optional emptiness check for us, and return an empty Optional object downstream Thank you so much for this little gem. I …
  • Member Avatar for JamesCherrill
    JamesCherrill

    Replied To a Post in help my code is wrong

    ankitdixit: In your opinion, why is an online web-basedIDE better than an IDE on your own computer?
  • Member Avatar for JamesCherrill
    JamesCherrill

    Replied To a Post in Java Security - Reduce Attack Surface by Constructing Secure Objects

    Good stuff. In addition to the above, I'm a big fan of the classes in Collections.unmodifiable , eg Collections.unmodifiableList. Collections.unmodifiableMap etc Anytime you need to give limited access to a …
  • Member Avatar for JamesCherrill
    JamesCherrill

    Replied To a Post in Generating Sample Code For HSM

    Googling "pin block encryption java" got me. lot of hits. Is that what you meant?
  • Member Avatar for JamesCherrill
    JamesCherrill

    Replied To a Post in introduction of kasmar45, me

    Welcome - and please accept, with my compliments, the mantle of "Oldest Old Timer". That was me, until you joined, but at only 73 and never having programmed in less …
  • Member Avatar for JamesCherrill
    JamesCherrill

    Replied To a Post in Help writing a java anagram solver

    The brute force search is a good solution for a small dictionary and a small number of searches, but gets very CPU intensive otherwise. I hit this implementing a Scrabble …
  • Member Avatar for JamesCherrill
    JamesCherrill

    Replied To a Post in need help with this driving me crazy

    AFAIK there isn't anything, which is why I hacked this together a while back. Feel free to use it without any warrenty. SImply call `ConsoleWindow.withInput();` and continue to use System.out …
  • Member Avatar for JamesCherrill
    JamesCherrill

    Replied To a Post in Will AGI take jobs or will it evolve jobs and create new industries?

    As was the case with manual labour, smart machines will increasingly offer better price/performance than humans over more and more activities, replace them, thus creating more unemployment. That will be …
  • Member Avatar for JamesCherrill
    JamesCherrill

    Replied To a Post in 21st Century Renaissance Man

    25 years? A mere beginner. <boasting mode>I joined IBM as a trainee programmer in July 1969 and wrote my latest line of code three days ago.Yes, that's more than 50 …
  • Member Avatar for JamesCherrill
    JamesCherrill

    Replied To a Post in 21st Century Renaissance Man

    half your life / 10 years sitting at a terminal hardly qualifies anyone as a "renaissance man"... > the term Renaissance man, often applied to the gifted people of that …
  • Member Avatar for JamesCherrill
    JamesCherrill

    Gave Reputation to dimitrilc in Java Concurrency - use CyclicBarrier to synchronize tasks across threads

    ## Introduction ## This tutorial introduces the `CyclicBarrier` class and teaches you how to use it. ## Goals ## At the end of this tutorial, you would have learned: 1. …
  • Member Avatar for JamesCherrill
    JamesCherrill

    Gave Reputation to dimitrilc in Java Functional - How to use the partitioningBy Collector

    ## Introduction ## `partitioningBy()` collects a `Stream` into a `Map`. In this tutorial, we will compare the two different `partitioningBy` methods and learn how to use them. ## Goals ## …
  • Member Avatar for JamesCherrill
    JamesCherrill

    Replied To a Post in How to Build a HttpClient in Java 11+

    Interesting. I suspect that IDE choice varies a lot by market segment. To be honest I have zero knowledge of the preferences of younger minecraft modders, but in the major …
  • Member Avatar for JamesCherrill
    JamesCherrill

    Replied To a Post in How to Build a HttpClient in Java 11+

    Hi Dimitrilc OK, thanks for the reply. That's what I thought, but I just wanted to check that I hadn't missed something. It is 100% valid Java, even if it's …
  • Member Avatar for JamesCherrill
    JamesCherrill

    Gave Reputation to dimitrilc in How to Build a HttpClient in Java 11+

    ## Introduction ## Based on the 2020 Java Ecosystem survey from Jetbrains, 75% of Java developers are still using JDK 8. JDK 11 introduces `HttpClient`, which replaces the legacy `HttpURLConnection` …
  • Member Avatar for JamesCherrill
    JamesCherrill

    Replied To a Post in KeyListener doesn't work

    Keyboard handling in Swing is always a challenge because the focus is often not where you think. You can often get round that by creating a keyboard handler and adding …
  • Member Avatar for JamesCherrill
    JamesCherrill

    Replied To a Post in Cost for DaniWeb Premium

    I'm sorry, but I don;t have anything positive for yoi here. Back in the day I contributed literally thousands of hours to helping others and thus creating value for DaniWeb. …
  • Member Avatar for JamesCherrill
    JamesCherrill

    Replied To a Post in Cannot invoke "java.net.URL.toExternalForm()" because "location" is null

    Its the other one, line 405, where the problem starts. What's on that?
  • Member Avatar for JamesCherrill
    JamesCherrill

    Replied To a Post in Cannot invoke "java.net.URL.toExternalForm()" because "location" is null

    And what exactly is at com.mycompany.smarttraveller.Form.<init>(Form.java:73) (and the preceeding few lines) ps (may be nothing) > at com.mycompany.smarttraveller.Form.<init>(Form.java:73) at com.mycompany.smarttraveller.Form$8.run(Form.java:625) that seems a bit odd. Form$8 is an anonymous inner …
  • Member Avatar for JamesCherrill
    JamesCherrill

    Replied To a Post in Cannot invoke "java.net.URL.toExternalForm()" because "location" is null

    Yes, this is the right way, and will work just fine when NetBeans puts it all in a Jar. We need to see the full Stack trace from the exception, …
  • Member Avatar for JamesCherrill
    JamesCherrill

    Replied To a Post in Cannot invoke "java.net.URL.toExternalForm()" because "location" is null

    It looks like your files are in the wrong place. As used in your code, getResource will look for the files in same folder (or package if you are runnng …
  • Member Avatar for JamesCherrill
    JamesCherrill

    Replied To a Post in Jpanel do not hide in java

    I don't like posting code for people to copy without understanding, so please do take the time to read and understand this in conjunction with my previous posts before copying …
  • Member Avatar for JamesCherrill
    JamesCherrill

    Replied To a Post in Jpanel do not hide in java

    ps: There's the same problem with calling `get` on an `ApiFuture` - you will block the Swing thread while waitig for the future to complete. In this case you may …
  • Member Avatar for JamesCherrill
    JamesCherrill

    Replied To a Post in Jpanel do not hide in java

    OK, the solution is fairly easy, and absolutely standard, so it's worth learning. What you wanted to do is: a.setVisible(false); b.setVisible(true); Thread.sleep(1000); b.setVisible(false); a.setVisible(true); ... but it doesn't work because …
  • Member Avatar for JamesCherrill
    JamesCherrill

    Replied To a Post in Jpanel do not hide in java

    > techlifelk commented: It is a void function That doesn't matter. Everything to do with Swing runs on the same single thread, including all your Listeners. *That also includes any …
  • Member Avatar for JamesCherrill
    JamesCherrill

    Replied To a Post in Jpanel do not hide in java

    Which thread is that method running on? If it's the Swing thread (eg because it's responding to a button click) then it will hold up all Swing activity until it …
  • Member Avatar for JamesCherrill
    JamesCherrill

    Replied To a Post in Do we really need to use abstract and interface in java project?

    Short answer: small projects (eg < 1 man-month) rarely need interfaces or abstract classes, but large projects use them to define exacty how different parts of the app will communicate …
  • Member Avatar for JamesCherrill
    JamesCherrill

    Replied To a Post in Cost for DaniWeb Premium

    I guess I would count as a "seasoned member". So what would I get that would be worth $60 in a year? I can't see the value proposition.
  • Member Avatar for JamesCherrill
    JamesCherrill

    Replied To a Post in Can anyone help me please! Tomorrow is last date of submitting C++ PROJECT

    IF your plan is to do nothing, wait until the day before the cutoff, then expect someone else to drop everything and do it for you... ... then nobody here …
  • Member Avatar for JamesCherrill
    JamesCherrill

    Replied To a Post in How to program calculator array to not include sentinel?

    i think you'll find that still adds the -1 to the total before exiting the loop. Given the need to exit the loop after validating the input but before processing …
  • Member Avatar for JamesCherrill
    JamesCherrill

    Replied To a Post in Crypto class cipher text varies too often

    plainText gets updated on each pass of the loop. Should be OK, but maybe... ?
  • Member Avatar for JamesCherrill
    JamesCherrill

    Replied To a Post in Crypto class cipher text varies too often

    For what it's worth I tried a little test in Java and the AES encrypted output was always the same for the same input values. I'm no expert, but from …
  • Member Avatar for JamesCherrill
    JamesCherrill

    Replied To a Post in rereun and quit program using 'y' and 'n'

    Two problems with that code: It creates a second Scanner (line 20). Two Scanners on the same input stream is a formula for chaos. Either of them may read ahead …
  • Member Avatar for JamesCherrill
    JamesCherrill

    Gave Reputation to rproffitt in Microscopic multiply

    Hmm, Conway's Game of Life? 110+ solutions at https://rosettacode.org/wiki/Conway%27s_Game_of_Life
  • Member Avatar for JamesCherrill
    JamesCherrill

    Replied To a Post in How would I go about removing an element from an array?

    Your "correct" progam fails to remove the zeros. It just overwrites them and stops printing before it gets to the original values left at the end of the array. As …
  • Member Avatar for JamesCherrill
    JamesCherrill

    Replied To a Post in Best Java Example For Pharmacy Billing System

    "Java 2": Oh yes. That label was created for Java version 1.2 (released December 1998). It was dropped after version 5 (released September 2004). Looks like a teacher somewhere has …
  • Member Avatar for JamesCherrill
    JamesCherrill

    Replied To a Post in Best Java Example For Pharmacy Billing System

    I think they are looking for a simple trainee exercise, not a commercial-grade full system. What's "Java 2"? We're currently on Java 15.
  • Member Avatar for JamesCherrill
    JamesCherrill

    Replied To a Post in Reinstallation/Activation Problems

    You shoild be able to get the key from the BIOS by opening an Admin command prompt and entering wmic path SoftwareLicensingService get OA3xOriginalProductKey (however, you shouldn't need to do …
  • Member Avatar for JamesCherrill
    JamesCherrill

    Replied To a Post in Hash the sentence in java

    In Java hashes are calculated by the `MessageDigest` class. Here's the documentation: https://docs.oracle.com/en/java/javase/15/docs/api/java.base/java/security/MessageDigest.html Come back here if you need help after taking the time to read and understand that
  • Member Avatar for JamesCherrill
    JamesCherrill

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

    The close bracket on line 4 ends the class definition, so whatever follows has to be a new class/interface/enum. Line 7 attempts to define a method inside the method definition …
  • Member Avatar for JamesCherrill
    JamesCherrill

    Replied To a Post in Reinstallation/Activation Problems

    According to Dell's website the Windows licence is specifoc to each particular machine and its details are burned into the BIOS. Is it possible that the original OS was Home …
  • Member Avatar for JamesCherrill
    JamesCherrill

    Replied To a Post in magic the gathering

    Reading existing code can be a good way to learn **IF** that code is of good quaility. Tha;s especially true of O.O. because most code written in OO languages does …
  • Member Avatar for JamesCherrill
    JamesCherrill

    Replied To a Post in magic the gathering

    where to start? Start with design. Classes that represent the nouns of the probem domain with their public interfaces that model the verbs. Don't worry about code yet. Here's a …
  • Member Avatar for JamesCherrill
    JamesCherrill

    Replied To a Post in Can someone help me with this problem?

    I'm frankly baffled by the requirement for a `static void` method to calculate what should be an instance variable, using existing instance variables. It makes absolutely no sense.
  • Member Avatar for JamesCherrill
    JamesCherrill

    Gave Reputation to tinstaafl in Sort an arraylist of an arraylist of doubles

    How would you write a function for Collection.sort to do that? It doesn't normally sort by columns.
  • Member Avatar for JamesCherrill
    JamesCherrill

    Replied To a Post in Sort an arraylist of an arraylist of doubles

    Why write your own bubble sort when `Collections.sort` exists and does it better?
  • Member Avatar for JamesCherrill
    JamesCherrill

    Replied To a Post in Sort an arraylist of an arraylist of doubles

    An ArraylIst of ArrayLists is like a 2d array. Which means that there's no single definition of what it means to sort it. Eg Sort each sub list ? sort …
  • Member Avatar for JamesCherrill
    JamesCherrill

    Replied To a Post in Sum arraylist of and arraylist

    I can assure you that += does work if you use it correctly. Without seeing your code there's nothng mre anyone can do to diagnose your problem. Post the code.

The End.