Ben Ooms

Ranch Hand
+ Follow
since May 16, 2011
Ben likes ...
Netbeans IDE Eclipse IDE Debian
Cows and Likes
Total received
In last 30 days
Total given
Total received
Received in last 30 days
Total given
Given in last 30 days
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Ben Ooms

allen robin wrote:Hey,First of all,Java always makes a copy of parameters before sending them to methods means the final doesn't mean any difference for the calling code i.e.,

Not true, check your understanding how objects and primitives are processed awhen used as parameters.

allen robin wrote:
inside the method the variables can not be reassigned.On the other hand, if you reassign any new value within the method the compiler complains immediately.

Also not true,
Is valid code

allen robin wrote:This means that there no complexity in this method.
So,finally its good to use as it makes the code error free and easy.

Code is not as error free as you might think. See this example:
5 years ago
What where the issues you faced?
What are your requirements?

Did you try JSSC? Works for all my Java serial projects.

Why do you think that a licenced product will be better? (just curious ;<)

5 years ago

Ulf Dittmer wrote:

class Baseball ... implements Bounceable

Not much, though

7 years ago
Abstract classes and interfaces are needed to produce maintainable code. If I take your example of the ball and subclasses like soccer ball.

In this example of course you could make a regular Ball class and a sub class called SoccerBall. But what if someone decided to create a Ball instance? This wasn't your intention because your design was expecting specific implementation of a Ball being spherical and having some ability.

So a abstract class Ball would be a good choice to start with so that you enforce that specific implementation are made and generalision is achieved so that you can create methods for processing Ball instances regardless of the Specific implementations.
This can be refined even more because now you have the possibility to define soccer balls and baseballs and so on. But not all ball do bounce (take a bowling ball as example). With only the Abstract class Ball you could create a Bowling ball subclass with a bounce ability of none, fase or 0.
If whe also define a Bounceable interface whe could create methods for Bounceable instances instead of Ball instance with the benefit of knowing beforehand that Bounceable object always bounce.

7 years ago
Hi Ali,

Did you check the wiki at ? This is a good starting point to see the possibilities of junit. I would first start with Junit and be comfortable with the basics and then start with the TDD methodology. At basic level TDD is very easy to start with and get's harder when you deepen your knowledge about it and gain more insight.

If you already have code written and assuming that you don't have unittest for them (otherwise you would know Junit or an other test framework ;<) try to write unittest for this code. This is quite harder then TDD but a good exercise. After this take a small well known piece of code and try to rewrite it using TDD but no copy paste. Base it on the functionality this code is providing and using TDD to develop it. When you do this you will see that the implementation code can be quite different in a positive way.

This reply is not really a pointer to a guide but doing what I suggest will give you a gentle starting point in unittesting and practice at the same time.
7 years ago
If you tried to google for an answer you would have fix this error faster then posting it here and on the netbeans forum. (210 result with query "copylibs doesn't support the "excludeFromCopy" attribute windows 7")

I noticed right away you are using a old version of netbeans. Your problem seems to be related to this old bug

The simplest fix is to delete the build-impl.xml as mentioned in the bugreport as netbeans will recreate one when missing after you reopen the project. Other fix is to install the latest netbeans.
7 years ago
The answer is very simple, it depends on the type of error.

Compile error: read the error thrown by the compiler.
Runtime error: follow the stacktrace
functional error: you have to read and check the code logic against the intended behavior
7 years ago
Hi Peter,

There is a design pattern behind this code called the builder pattern and uses method chaining. The builder pattern is mostly used when you have a object definition with a lot of properties to set at contruction time.
To avoid having a lot of constructor overloading a builder is used.

Another special thing is the usage of a anonymous inner class (see for explanation):

In your code sample:
With new AlertDialog.Builder(this) a new Builder is instantiated with a private AlertDialog instance
every set method set the property on the private AlertDialog instance and returns the builder instance. Returning the builder instance enable the method chaining ( setFoo(prop).setBar(otherprop) )
when all properties are set you call the .show() method on the builder and the AlertDialog instance is returned.

A good explanation for the builder pattern:
7 years ago

E Armitage wrote:There is a difefrence between map["0"] and map[0].
Maps are not indexed so map[0] doesn't really make sense. map["0"] accesses a record in the map whose key is the String "0".

You are absolutly right but i'm not trying to access by index but by key value of type Long.

Sorry for my newbee jsf question but does this mean that given a Map<Long,SomeObject> I never be able to access a value in that map because the key is parsed by the EL as string and therefore cannot find my value?
7 years ago

E Armitage wrote:Try

Well tried this as well without succes. Strange thing is that when I changed the Map to a List does work.
7 years ago

Bear Bibeault wrote:Please be sure to post JSF questions in the JSF forum. I have moved this post there for you.

Sorry, Didn't see that

7 years ago
Hi all,

I'm starting to work with JSF and stumble into an issue with resolving a Map value even my friend Google cannot answer ;<).

This is the context:

Having an object:

In my backing bean:

In my facelet (the map is filled with values) I try to access the property prop from one of the A object and get a null :

So my question is:
Am I not allowed to chain and access the property in this way and is there a way to work around this?

7 years ago
Don't know why youre using those static classes but based on the json example a parsable java representation whould be

With this code and json sample provided you should be able to test with:

Don't forget that Jackson is using the public getters and setters to serialize/deserialize by default (can be overiden)
7 years ago
Hi Ollie,

Don't know exactly what you want to achieve but it looks like you want to process something in the background and update swing components when the background task executes. Did you have a look at Swingworker, might suit your needs. I recently did something with it when updating a view with a connected Arduino on the USB port. . Look at the MainFrame class and it's inner class StatusUpdateTask.

8 years ago