Ashley Bye

Ranch Hand
+ Follow
since Jan 30, 2013
Ashley likes ...
Java Mac
Cows and Likes
Cows
Total received
2
In last 30 days
0
Total given
0
Likes
Total received
18
Received in last 30 days
0
Total given
7
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Ashley Bye

Thanks Tim. I'm curious as to the rationale behind that decision. Is there any particular reason post editing is not a general feature? The only reason I can think of is users editing their post to remove or significantly change it after one or more replies, thus losing discussion context. Makes sense to limit editing in that case.
11 months ago
It's been a while since I contributed to this site, but having just done so, I noticed a mistake in my post:

Ah, I'll quickly change this. But wait, there is no edit button. Oh!

Where has the 'Edit' button gone? Was there ever an edit button? Or do I need to go and purchase a set of spectacles?
11 months ago

Aaron McCarthy wrote:Here is the actual assignment as well for additional context.
- Location (this represents a class called Location which has 2 points: longitude & latitude)



I'd suggest that you ought not to be passing the latitude and longitude as arguments, but should instead be passing a Location object.



In your move methods, you can create a new Location object, e.g:



Etc.
11 months ago
I'd be interested in working on a game project. Perhaps it could be educational too? I've been thinking for a while that making a game of Decisions & Disruptions could be a fun idea.
11 months ago
Okay, thanks. I'll take a look and see what I come up with.
2 years ago
I have put together a relatively small app which calculates some properties of a graph to help me learn JavaFX. The GUI opens a new tab for each graph created. Since some of the calculations can be quite long running (e.g. with a large number of nodes specified), I want to show the new tab and have the properties display "Calculating..." until they have been computed, at which point they should then show the result. However, what actually happens is that the app hangs until all the calculations have been completed.

Each of the calculations is computed using a Task:



When creating the view, the individual tasks are specified, e.g.:



With the result of the Task as a Worker bound to the textProperty() of the relevant TextField:



Once the View has been added to a new Tab and shown, I execute the tasks:





For what it's worth, full source code is available on GitHub.

What am I doing incorrectly that causes the app to hang until the tab has finished calculating all the values?
2 years ago
Ah, so I still need to include it on the classpath even if deployed to an App Server?
2 years ago
Although in the configuration posted I've used a database named Employee rather than SimpleWebProject, which would lead to a revised connection URL from that given in the first post.
2 years ago
In standalone.xml:

2 years ago
The following is based on Wildfly 10.1 Standalone and Derby Remote client. I assume the same will be true for other environments.

I have deployed derbyclient.jar to the deployments folder and registered a DataSource in Wildfly named 'SimpleWebProjectDS', a JNDI-Name of 'java:jboss/SimpleWebProjectDS' and associated this with the deployed Derby driver. The server URL is set to 'jdbc:derby://localhost:1527/SimpleWebProjectDB;create=true'.

With Derby running on port 1527, the following causes a ClassNotFoundException:



The following executes without throwing an exception and produces the expected functionality:



Why does the first solution cause a ClassNotFoundError?
2 years ago
According to this presentation the correct way to load resources is using Class.getResource(). As it transpires, it's right. I'm not sure what I did yesterday that caused this not to work, probably not sleeping! However, the following fixes the problem I was having:

2 years ago
I'm trying to load a stylesheet that is saved as a resource in my module, but receive the following warning when running the application under JDK9 using the module system:

When running under JDK 8, this was loaded fine with the following directory structure:



It is my understanding that for named modules in Java 9, I should be able to use either the Class or ClassLoader to load a resource and that doing so looks for the resource in module/package.name, e.g. chapter8-styling-nodes/com/jdojo/resources/css/buttonstyles.css, and I've updated the module structure to reflect this. However, if I attempt to load the stylesheet this way, I get various exceptions related to reflection. I can load the resource and read it from an InputStream:



I obviously can't add this to the scene's stylesheets as it's not a URL. If I try to load the stylesheet as a URL and convert it to a string, the below excerpt yields the following result:



Using the same method as for JDK8 results in the resource not being found. Adjusting the path for JDK9 seems to have similar effects. How should I go about adding a stylesheet to a scene in a named module in Java9?
2 years ago
The exam questions at the end of Ch5 in the OCA8 book asks what is and isn't true about interfaces.



One of the possible answers is "A class that implements HasVocalChords must override the method makeSound()". This option is considered incorrect, with the explanation that an abstract class doesn't need to implement the method.

My question, therefore, is: in the exam, should I assume that in any circumstance, unless specifically stated otherwise, the word "class" refers to both concrete and abstract classes?


This is with import javax.faces.bean.ViewScoped;
4 years ago
JSF
Ha, I hadn't thought about a vanilla constructor. Doh! I also remember you mentioning about request scope being next to useless in another post, although I tried ViewScope which didn't have any better result. What's JSF rule #1? We don't talk about JSF?
4 years ago
JSF