I am studying More programming pearls (Addison-Wesley, 1988) by Bentley J. and am stumped by the fact that I am unable to find any tool/ profiler for Java that can tell me the number of times each statement in executed in an actual flow (reference: Prime Number Finding algorithm optimization in Chapter 1). I tried using profilers, tried ...
Hi,
I generated a new form using sean-gen (seam new-form) and added another field to it using an @In annotation:
@Stateful
@Name("dummy")
public class DummyBean implements Dummy
{
@Logger private Log log;
@In StatusMessages statusMessages;
@In private String bar;
private String foo;
public void doStuff()
{
...
I'm building an XML document and printing out into an indented format using the JVM build-in libraries. When there is a text node in the document that contains a line break, it wraps the line to the start of the line instead of it's proper indented position
sample code
ByteArrayOutputStream s;
s = new ByteArrayOutputStream();
Documen...
I need to add a button to the title bar of a Wicket modal window. I can't find anything useful in the Wicket API that will help me. Is there any way to customize the title bar in this way?
...
I am making a web application using JBoss Seam 2.2.0, and I want to trim my inputs before receiving them, even before the Hibernate Bean Validation phase. Is this possible?
I saw someone using a PhaseListener to do the same functionality. Is this the best way to do it?
...
I need a mutable boolean field in Java (I will return this field via get* method later and it should be possible to modify this field).
Boolean doesn't work because there are no set* methods in the Boolean class (I would say that Boolean is immutable, you can only change the reference, but you can't change the object itself).
I guess I...
Conside the following for C# and Java,
double d = 3 / 2 * 3.2;
Java
System.out.println(d); // 3.2
C#
Console.WriteLine(d); //3.2
It skip the 3/2,
We know that the correct answer should be 4.8
if i change to
double d = 3.00 / 2 * 3.2;
I can get 4.8,
So i want to ask, if (3 / 2 * 3.2) is illegal , why eclipse and vs2008 hav...
Hello,
my question is about two possible ways to access data:
(My question is about "real life usage" of java statements like below, accessing the data 2-10 times in a function. Not iterating over such statements with thousands of iterations/calls.)
System.out.println(request.getParameter("locale"));
System.out.println(request.getPar...
I'm writing a tool that uses the annotation processor to generate source code depending on the return type of methods of an annotated class. The return type is always some subtype (interface or class) of an interface A that defines a type variable T.
interface A<T>{T m();};
I would like to find the type parameter for the method m() r...
I am trying to call the "dspdf.exe" inside the jar file where this smartpdf class exists. I plan to extract it to a temp location and delete when program ends. However this doesn't seem to work, any help will be appreciated.
import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
import org.omg.CORBA.portable....
Someone helping me with a hung Java server studied the thread dump and does not understand the following state :
INFO | jvm 1 | 2009/08/30 18:11:46 | "103468119@qtp-2047706572-1" prio=10 tid=0x0000000041758000 nid=0x13d7 waiting on condition [0x00007f6dbb75e000]
INFO | jvm 1 | 2009/08/30 18:11:46 | java.lang.Thread.State: ...
Various examples of view frustum calculations are using glGetFloatv() to get the current projection and modelview matrices (GL_PROJECTION_MATRIX, GL_MODELVIEW_MATRIX), and based of that do some view frustum culling.
I have read that glGet* is something you do not want in your main render loop;
"Using "Get" or "Is" functions slows
...
I want to send image object through socket... Don't want to store image in sender or receivers computer...
...
Hi guys,
I'm quite sure this has to be in the docs somewhere, but I've looked for days and haven't spotted it. I'm probably staring myself blind when it's right in front of me, so sorry for asking an abvious question, but....
@RequestMapping(method = RequestMethod.POST)
public ModelAndView post(@ModelAttribute("user") User user) {
Mo...
Hi
I was wondering why do we need separate Remote and Local intefaces for EJB 3.0 Session beans. I guess most of the time they would both be defining the same contract. Why cant I have a common interface and in my Bean I should just be able to say that I want this bean to be accessed remotely and/or locally.
thanks
Vikas
...
How to make a JPanel scrollable? I implemented the scrollable interface yet when adding it to the containing panel with
tabbedPane.add("Editor", new JScrollPane(storeyEditor = new MNScrollablePanel()));
nothing works
Code:
public class MNScrollablePanel extends JPanel implements Scrollable {
public Dimension getPreferredScroll...
Hi
This is a design pattern question. Here is the scenario:
I am using EJB3.0 with JPA. For example lets say I have a user who can belong to groups. So in my User entity I have a method getGroups() which fetches the groups lazily. And I have a UserDao which is a stateless session bean which has a method
User getUser(int uid)
Now in my ...
Is there a way in Java to ask the system get control over the system.
Without doing: Right click on an exe-> run as admin.
What I want is that there comes a frame from uac like in windows vista or windows 7.
Or have I to do some settings while making an exe from the jar?
...
If I have function names stored as strings in a Hashtable.
Is there a way to access the functions via the stored strings?
EDIT
I'm afraid the platform that i'm working on CLDC1.1/MIDP2.0 does not support Reflection.
Any workaround possible?
...
match.matches() returns false. This is odd, because if I take this regex and test String to rubular.com, is shows two matches. What am I doing wrong?
Pattern regex = Pattern.compile("FTW(((?!ODP).)+)ODP");
Matcher match = regex.matcher("ZZZMMMJJJOOFTWZMJZMJODPZZZMMMJJJOOOFTWMZJOMZJOMZJOODPZZZMMMJJJOO");
if (match.matches()) {
Syst...