L Foster

Ranch Hand
+ Follow
since Oct 28, 2003
L likes ...
Android Angular Framework Spring AngularJS Java
Cows and Likes
Cows
Total received
15
In last 30 days
0
Total given
0
Likes
Total received
50
Received in last 30 days
0
Total given
33
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by L Foster

Greetings, All.
I found a nice course on HDPCD certification.  When I say 'nice', I mean informative.  This teacher seems to have all the right information, but is not as slick as some instructors online.

Anyway, although I had never thought of taking HDPCD, I took the course to learn more.  However, the FAQ states that HDPCD is discontinued.


https://www.cloudera.com/about/training/certification/faq.html  this FAQ states:

Will HDP exams continue to be delivered?

The HDPCSD and HDPCD exams were retired on December 6, 2019.



I think the course is still good info (like I said, I did not want to take the test anyway).

The course is "HDPCD:Spark using Scala" on Udemy.

Thanks
6 months ago
Hello, Irvin:

You should take a look at the logic for the third function.  You seem to be expecting it to do a lot, but not giving it any relevant code to do so.  To get you going, you should:
1. Review == and the "equals(Object o)" method in Java.
2. Consider: how could the method ever return anything other than "true"?  You have the default at true, and then you never change the value to anything else.
3. Review some of the methods in java.lang.String.

I hope that helps.
1 year ago
Hello, All.

While I am actually still struggling with a related issue (that is, I am no expert), I can tell you something pivotal to your understanding of this problem.

Java7 and Java8 included JavaFX in their JVM.  As of Java9, that was no longer the case.  Java9 through Java12 (+ assume) requires you to get JavaFX as a module and use that module.  If you are using Maven, you can get past this by including dependencies.  I think these should work.


However, the swing dependency may not be needed, and there are other dependencies to do with JavaFX that you may need, such as javafx-fxml and javafx-media.

Please refer also to https://openjfx.io/openjfx-docs/ for further info.

I hope this helps someone.
1 year ago
This is my question for the author of the new book: "Architecting Modern Java EE Applications".

Looks like hope for the future.  My question to you: what motivated you to take the time to write on this particular topic?  I have seen fewer organizations embrace this technology than in the past.   It is far from moribund in my view.  Are there certain developments in JavaEE 8 that really excite you and convince you this is an excellent approach to modern problem-solving?

Thanks
Hi, nice work going toward graph theory!

So, you've created a 2D space and given it sparse vertexes and edges running through it.  But I cannot tell what you might do with this "model".  Delete-vertex seems to do nothing but report whether the vertex previously existed.  Is that the idea?
2 years ago
Hello, Dana:
I think what you are asking is: 'given this code fails with an exception, how can I assure that the test itself fails?'  That's a great thing to do, IMHO.  I think there are two ways.
1) don't catch the exception; instead declare your AdaugProdusLaCos() method with a "throws Exception" clause.
2) in your catch block, if you want to be explicit about the failure, you can add "Assert.fail(ex.getMessage());", or whatever else you want to say.

This second one will let you be very exact.  But you will have to import the Assert class.  That's under org.testng.Assert.  Here's a page that includes this info.

http://toolsqa.com/selenium-webdriver/testng-reporters-asserts/

Good luck, and thanks for indirectly introducing me to this. In the past I had worked with HtmlTest, HttpTest and even one I wrote myself a long time ago.  This "testng" or "Selenium" looks quite convenient and very similar to Junit.
2 years ago
Hello, AtSvm (Mr. Garg):

I can tell you one thing that I see which is not as intended, and another kind of broader suggestion.  

Note the new setting of thread status?  Well, by default when you declare a boolean field (class data member) in java, it will be set false.  So when your code enters that loop and tests for the first time whether the value matches, it never will for the second thread.  I added the commented line to cause the turn status to be different for the second thread (which is set to the opposite boolean value).  This causes both threads to actually go forward.  And it is because there is no way for that boolean variable to transition (see line 29 in your code) that the second loop goes into an endless loop and never exits.

Now the other observation.  This code looks like it is trying to solve one problem two different ways.  On the one hand you have two different threads, and on the other you have this if-check within the while block to switch one thread on or off.  Even after I made this change I don't see the desired behavior. There are outputs from each thread interspersed but they are not in the order you wanted.  Another symptom of this split is that your synchronization variable is separate for each thread.   If you make a "new Turn()" outside of the MyThread class you might also get better results.

I see this as a nice exercise; I would not be trying to force two threads to synchronize in this fashion.  If I were, I might instead establish some kind of "round robin scheduling" approach.  For that, there would be a shared monitor object (like Turn) that would just have each thread waiting for it with a "notify" like you have there.  You could also lookup "Round Robin" and see if it leads you back to the Java concurrency package. I've never bothered to look.

Give that a try.
Hi, Puspender:
I don't know GlassFish very well.  I only used it briefly for learning about 4 years ago.  I used to work with JBoss a lot more. But I think I can contribute something because I do know something about the standards.

GlassFish may have some capabilities of which I know nothing. However, as a JavaEE server it is capable of having either Wars or EJB Ears deployed on it, containing components.  Rather than an executable Jar, if I were you I would deploy the jar as a Singleton Session Bean.  Here is a quote from one of the tutorials:

Singleton Session Beans
A singleton session bean is instantiated once per application and exists for the lifecycle of the
application. Singleton session beans are designed for circumstances in which a single enterprise
bean instance is shared across and concurrently accessed by clients.
Singleton session beans offer similar functionality to stateless session beans but differ from
them in that there is only one singleton session bean per application, as opposed to a pool of
stateless session beans, any of which may respond to a client request. Like stateless session
beans, singleton session beans can implement web service endpoints.
Singleton session beans maintain their state between client invocations but are not required to
maintain their state across server crashes or shutdowns.
Applications that use a singleton session bean may specify that the singleton should be
instantiated upon application startup, which allows the singleton to perform initialization tasks
for the application. The singleton may perform cleanup tasks on application shutdown as well,
because the singleton will operate throughout the lifecycle of the application.



Establishing EJBs like this is pretty easy nowadays.  You don't even need an "ear" file (a "war" or 'web archive' will do, and you won't need Web content if you don't need it).  Since you won't even be contacting this one using a client, you won't need anything except the singleton.  You only need to lookup the annotations required.

Good luck!
2 years ago
Alion:
If you have not understood it all, then I have not answered well enough.  Sorry for that.  I will try one more time.  Maybe I should stick very closely to the words of your question.

We know that only overriden instance methods are dynamically invoked based on the real object's type.
So why getClass() have this behaviour without being overriden?  Because You cannot override getClass (https://docs.oracle.com/javase/tutorial/java/IandI/objectclass.html).



The "getClass()" method is not being overridden.  Instead, it is just returning a different value.  The behavior is not changed--only the value being returned is different.

2 years ago
Hi, An:

What does that starting page look like?  You don't have a File menu to pull down?

When I open my (pretty old) NetBeans IDE and close all projects, I see a kind of T-shaped screen with three boxes and it has the menu bar at the top.  It may be (if memory serves) it had an ad-like screen talking all about how great NetBeans was on one of the large panes.  If you don't have a menu bar, please attach a screen shot.

Regards
2 years ago
Hello, Daniel.

A couple of years back I completed the Oracle Certified Master Java Enterprise Architect certification.  I have done nothing with PHP.  Believe it or not, one of the things one is meant to know for that exam is that Java EE is not necessary for every project under the sun (or every project on the web, of course).

It was clearly stated in course materials that sometimes you just don't need all the extra features of Java EE.  If you were writing a small bulletin-board like system, or a system with lots of read-only users but only one person ever developing it, or perhaps even some more powerful systems without having to use JavaEE.  However, when Java pays off, IMHO are situations like below:
* You have multiple developers writing a lot of code and you want a strongly typed, general-purpose programming language for Object Oriented development.  Java was intended to help avoid certain types of common mistakes, among other things--hopefully alleviating debug.
* You want to use the tooling that is available for java (debuggers, IDEs, performance monitoring, etc.)
* You want to take advantage of a lot of pre-written (usually $ free) code that goes along with it.
* You have or want access to the folks who've learned this already.

...and that's just the Java part.  For the EE (Enterprise Edition) part, here is more.
* If you are doing a lot of transactional processing, Java EE handles that well--even distributed transactions.  You won't have to write the transactional code--just EJBs (which have become far more lightweight these days), unless you are doing some rather unusual transactional processing.
* If you need to have connections and object persistence with databases, Java EE can handle that as a configuration to youre server (combined with annotations to inject things).
* It handles security, propagating roles from the front end (web) to the backend (to the database connection).
* You can have resources injected into your components so that you won't have to wire things up/set things by hand.
* Multithreading is handled by just using the EJB pool.  Each one runs in its own thread.
* You can leverage EJBs (or other beans they have now) for your componentization (breakdown of responsibilities among objects).
* You can leverage their new CDI.  You can leverage Java's JSF (I have not, but I have used Struts as a framework, and JSPs. etc.)
* Your Servlets / Web side technologies--even RESTful--can be done in the same server (or type of server) so nothing else to learn and run.
* You can have a fairly advanced solution for asynchronous processing just built in (MDBs and @Asynchronous EJBs).  These can even be done on a timer.
* If you need it, you can use "stateful ejbs" to deal with user or server state--but they are not required very often.
* All the other JavaEE APIs can be in this one server as well--just reach out and call them.
* You can get servers--even for free--that support all this for you.  There are well established companies for this.  And if you grow and decide you want more support you can purchase that as well.  I have known places that did not bother even with big apps.

The chief drive behind Java EE was: "we know most developers want to write business logic; they don't want to have to reinvent or become experts at things like transactions and multithreading."  If you get around certain developers, these days, they will actually eschew this logic.  I have been running into people especially on my last job who want to build everything themselves because they feel they can do it better than the off-the-shelf system can.  If you are that advanced, perhaps you won't want what comes with JBoss (the free server I mentioned) and you'd rather roll your own.  Further, there is a pretty big community who embraces Spring as an alternative to the whole Sun/Oracle Java EE ecosystem.  However, I have seen the two of them integrated and used together as well.

Another thing I will point out: transactions are going to be more associated with SQL/Relational than the newer NoSQL databases. These newer databases have many advantages, but transactions are one of their drawbacks.  You can integrate JPA (the database solution from Oracle) with several of the NoSQL dbs.  So if you like being able to do it all the same way (or you are mixing SQL and "Not-Only-SQL") this might help.

I Hope that Helps.
2 years ago
Hello, Milan:

Based on just what I see there, the prefs listener is not going to be in synch with the "NULL, NULL, NULL" print out.  To me, it looks like your prefs listener gets established in the same thread as the "println", but it is not going to be called until you later carry out some user action.  This may be a kind of subtle point.  Hopefully, I am not overlooking anything in your code, and I will try and explain it differently.

When you call "connect", one thing that is done is to set a prefs listener (now I will plead some ignorance here, because I am not familiar with PrefsListener.  I will assume it works like other listeners in the Java Swing ecosystem).  After setting that listener (which is just like setting any field or indeed, just like setting the action listener above), the "connect" code proceeds to print the server, username and password immediately.  Then it tries to assemble a JDBC URL, etc.  But you must keep in mind that the "connectionEventOccurred()" method won't be invoked until this "prefs" event is posted.  Nothing has invoked that method (or is extremely unlikely to have--let's hedge bets ;-)  ) by the time you get to the println and the uses of those variables.

I would recommend that you instead move the code following the body of your anonymous inner class inside the PrefsListener inner class implementation.  I think leaving the "forName" outside is not too bad, because you won't need to do that for every connection.  But the rest is in the wrong place.

HTH
2 years ago
Hello, Tom:
This sounds like an awesome little project.  I have done a bit of 3D programming myself, though never with that library.  I've used some OpenGL, Java3D and JavaFX for graphics.

I have not done much with graphics in Eclipse, but how do you know this is specifically about the threads and not about some other problem?

Without access to your source (or minimized version of same displaying the same problem), I would not be able to help.  A suggestion would be to post something like that or move this to a graphics or LWJGL forum.

Good luck.