This week's book giveaway is in the Other Languages forum.
We're giving away four copies of Rust Web Development and have Bastian Gruber on-line!
See this thread for details.
Win a copy of Rust Web Development this week in the Other Languages forum!

Julien Grenier

Ranch Hand
+ Follow
since Sep 01, 2005
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Julien Grenier

Hi All,
I'm quite new to JasperReports and I have a question. Can subreports include subreports? I'm asking because I have this problem :

There is a main report that contain only a Page header and a subreport (don't ask why it was design this way I don't know). This report doesn't generate with iReports and also on our website. The subreport only contain a query and a subreport (still don't ask why it was design with so many layers) . The subreport generate fine. I've investigate the main report and there's nothing beside the page header and the subreports. The result when you try to generate that report is that it will wait forever but neither my computer nor the db server is processing.

any clue ? hope I'm clear.

Julien
Why is it bad style? explain?

The scope of the variable is more appropriate and you avoid the null-checking.
16 years ago
Another way to do it is like that :



that way :
  • You catch only once
  • the scope of connection is more representative
  • you are sure of closing the connection.

  • 16 years ago





    Boolean object are immutable so you can't change the value of it.
    so since you are returning -1 you could consider check if the returned value is -1 and remove the boolean logic.
    16 years ago

    Before you say this is impossible, have a look at the "setAccessible()" method that Constructor, Method, and Field inherit from AccessibleObject.



    I had a look at it. It took me some time to figure how to make it work (my problem was how to get an instance of the cTor (the getConstructors() only returns the public constructors but I found the getDeclaredConstructors() which returns everything). Well I guess I'll go to bed less stupid tonight.
    16 years ago


    (2)Will applet downloaded every time or only for the first time?



    The applet is usually cached by the JRE. so the short answer is only the first time.
    so be aware. let's say you are developing/testing the applet remember to close IE between test since it won't download the new one.
    16 years ago
    JSP


    You could create more than one instance of a singleton using Reflection I think. But then a developer would have to purposefully ignore the fact this class is a singleton and presumably is documented as such. Used normally though you can guarentee there will only be one instance of this class per JVM.



    Actually the only way to achieve that is to use Reflection within the Singleton Class, if not that's not possible since the Constructor is private (by Singleton definition).

    like in this example :

    But then you are purposly being dumb if you code something like that.

    Trying to pull something like that outside the Singleton class result to the following Runtime-error :

    java.lang.IllegalAccessException: Class Main can not access a member of class Singleton with modifiers "private"
    16 years ago
    here's some ideas :

    -You can use a Set (see Set documentation)
    -You can iterate through the ArrayList and compare them against each other and count them.
    -You can create a new ArrayList and fill it with only unique values.

    stuff like that. use your imagination.
    16 years ago


    o be honest I don�t know how to avoid the exception by using Scanner.hasNextInt() since its returns a boolean.



    something like that


    There's probaby better ways but that's one of them
    16 years ago


    But I really don't understand how it could produce a leak. so if you could provide an example or ever just an hint to what I should look for.

    as for the excessive scope... given the fact that well written code should produce concise methods. It's likely that the method will end with the try statement ending so who cares the method look like this



    instead of this :



    The scope of the variable is quite the same.
    [ September 30, 2005: Message edited by: Julien Grenier ]
    16 years ago
    After that you add your label to the Frame, you need to refresh(repaint) it(the frame).


    now you need to find how.
    16 years ago
    maybe you forgot to import your class Person into
    the other class.

    also maybe posting some parts of the code would help

    Julien
    16 years ago


    Actually the question was like this ... 1st they asked me how to make a class readonly .. I said by making all the variables private and providing getters for them ... then they said what if one of the field is an ArrayList ... I said make it final .. they replied ArrayList should be able to change within the class ... but some who access arraylist from outside should only be able to see its contents.



    the answer is in the API



    see the Javadoc for more information

    Julien.
    16 years ago
    If you are using JDK 5.0.

    You can override the return type with a subclass and do the following
    Vector v = x.transpose();

    if not you are forced to return the parent class and downcast it (i.e : Vector v = (Vector)x.transpose() .

    Julien
    16 years ago