java

Methods and garbage collection

I encountered this question in an interview: Is an object created inside of a method eligible for garbage collection after the method is finished? Is yes the correct answer? ...

To implement a remote desktop sharing solution

Hi, I'm on planning/modeling phase to develop a remote desktop sharing solution, which must be web browser based. In other words: an user will be able to see and interact with someone's remote desktop using his web-browser. Everything the user who wants to share his desktop will need, besides his browser, is installing an add-in, which...

WPF client sided and Java server sided?

Hi, I would like to ask for some ideas regarding a scenario like this: 1) we need to build up a real time application that runs on a client. Some sort of stock trading functionality, updates pushed to few clients in different geo locations every 25 secs. 2) the data is collected and pre-processed on the server side (Glassfish/Java) We...

Is there a rich domain model example?

I'm looking for a simple example to illustrate the benefits of using a rich domain model. Ideally, I'd like a before and after code listing (which should be as short as possible). The before code listing should show the problem being solved using an anemic domain model, and a lot of fairly procedural service-layer code, and the after co...

SELinux, Fedora, and Trusted Applet crashing?

For some reason, if I run Firefox 3.5.x under Fedora 11 with SELinux enabled, my browser crashes when I attempt to embed the applet dynamically. Under Windows, Ubuntu, and Mac, the user is prompted to trust the signer and then trust the executing java applet, but under Fedora, I never see this prompt. If I disable SELinux, I get NO promp...

ClassLoader.getResource() doesn't work from .jar file

I have the following code: private final ImageIcon placeHolder = new ImageIcon(this.getClass().getClassLoader().getResource("Cards\\trans.png")); But this does not work once my application exported into a .jar file. ...

Byte Array to String

I'm playing with bencoding and i would like to keep bencoded strings as java strings but they contain binary data blindly converting them to string will corrupt the data. What i am trying to accomplish is have a conversion function that will keep the ascii bytes as ascii end encode non ascii chars in a reversible way. I have found some ...

How to create a linked list of nodes that are contained in the max-Depth of a Binary Tree using Java

I've already created the Binary Tree and Linked list classes, I'm just in need of an algorithm that prints ONLY the nodes of the largest path. The height and size of the Binary Tree are already stored in the root node, but my problem is traversing only the largest path while adding each node to my linked list. ...

Session management using Hibernate in a *multi-threaded* Swing application

Hi, I'm currently working on a (rather large) pet project of mine , a Swing application that by it's very nature needs to be multi-threaded. Almost all user interactions might fetch data from some remote servers over the internet , since I neither control these servers nor the internet itself, long response times are thus inevitable. A ...

jquery not displaying chart in ajax div

Hello. I have a little page I've been working on. It's at: http://nait.jtlnet.com/~fpkj5v0r/programmer.php - and as you can see, a jquery chart shows up, like it's supposed to. Now here's the problem.. which has ended up taking up 6+ hours of my time... when I click a link (which uses ajax to load up a new page in the same div), and the...

Tokenizer, Stop Word Removal, Stemming in Java

Hi there I am looking for a class or method that takes a long string of many 100s of words and tokenizes, removes the stop words and stems for use in an IR system. For example: "The big fat cat, said 'your funniest guy i know' to the kangaroo..." the tokenizer would remove the punctuation and return an arrayList of words the stop wo...

Spring SimpleFormController - Including Search Form In Success View

UPDATE 1/31/10: Since this thread continues to get a lot of views...I am curious if it has been of help to anyone recently? Feel free to leave comments/feedback, thanks. I have a Spring form where I would like to reuse the search page to include the results under the search form. Currently when I do this I get the following error o...

JSObject: Download it or available in JRE 1.6?

Hello all, This is a question from a JAVA noob. I have eclipse open (JRE 1.6), I have copied this code into an eclipse class: http://bit.ly/WLntN The line in question is this: import netscape.javascript.JSObject; Eclipse is complaining that the import can not be resolved. I read that in the docs that the Java Plug-In comes as stand...

hibernate how to create createalias left join?

@Entity @Table(name = "BOOKTEST") @NamedQueries({@NamedQuery(name = "Booktest.findAll", query = "SELECT b FROM Booktest b"), @NamedQuery(name = "Booktest.findById", query = "SELECT b FROM Booktest b WHERE b.id = :id"), @NamedQuery(name = "Booktest.findByBookName", query = "SELECT b FROM Booktest b WHERE b.bookName = :bookName")}) public ...

How to invoke a web service from a stand alone Java client?

I have an echo web service running on lets say http://localhost:8080/axis2/services/Service1. This service just echos back a string that is sent to it through the function echo(). Using the wsdl of the above mentioned service (Service.wsdl), I have generated (in eclipse) the ServiceStub.java and the ServiceCallbackHandler.java. With thes...

why C, C++, Java does not use one complement?

I heard C, C++, Java uses two complements for binary representation. Why not use 1 complement? Is there any advantage to use 2 complement over 1 complement? ...

Customizable Java application Ideas

So I am working on a java application, and the customer has requested the ability to have features that which can be unlocked to make the application customizable based upon what their customer wants to pay for. So I am trying to come with ideas for doing this in a manner that will provide some level of security, but also general maintai...

Detecting API changes/evolution

I want to measure API evolution for a given Java project, in particular new/renamed classes, new methods, newly deprecated methods, etc. Is there a tool that detect such changes? Back in 2007, a Google GSoc project was initiated, however, I cannot find the final work. ...

Selenium: Dynamic buttons and classes?

So, I was trying out a test case on a website and Selenium registers the events perfectly. Now, if I have to search for a particular class and get the innerHTML of that class, how would I do it assuming that I am using Java as the driving language? Just to be more clear. I have a class like this: <h1 class="classname">.....</h1> I...

Changing JList row color at runtime

Hi, I am trying to change JList rows dynamically. I need change nth row colour, highlight it(n is unknown during compilation). I saw a lot of examples with custom ListCellRenderer, but all were "static". In other words I have JList with x rows. During runtime my "business logic" detects nth row is important. So I want make its backgroun...