java

How can I profile tomcat on mac os X?

Dear All, I am running an independent (I mean not inside any IDE) tomcat instance. I want to profile my application because it seams to respond really slow in a particular use case. So, I tried installing TPTP on my mac os x 10.4 (tiger) but it seams that there is no version available. Then I tried to just set "JAVA_OPTS="-Xmx512m -Xru...

Steps to develop a website

What are the aspects to be considered when I want to develop a website using J2EE application server and a database for back end, I am looking for an answer that can guide me through the steps required to get the site set up- ...

xampp server and java client/server application

hiho, i intend to develop just a litte network application, something like a chat. so i downloaded xampp for windows and installed it (also as service), mysql included. well, i started the apache (and mysql) as service and just wrote the short line in java: try { Socket sock = new Socket("127.0.0.1", 21); System.out.println...

Why does eclipse create a .settings directory

hello, i have noticed that eclipse recently creates a .settings directory with 1 file inside and i am wondering if i should add this to version control? SVN? also, is this new? i have been using eclipse for quite a while, but never noticed it. the contents of the file in the directory is this: #Sun Oct 11 14:57:03 CEST 2009 eclipse.p...

Placing drawing on JPanel

My program have 3 classes. 1) main, 2) frame, 3) drawingBoard. The logic of my program is that, a new drawing will be displayed every times user click on New pattern button (and this working fine). 1st class - main method public class mainPage { public static void main(String[]args){ JFrame appFrame = new Frame(); appFra...

build.xml in Java project

Hi, I am new in Java and I need some information. What is file build.xml? I mean I have a university project which I should extend. It contains also a build.xml. I was wondering if it is a possibility to import this project in eclipse or netbeans using this build.xml. I tried to import the project but I get some errors since one part is ...

onerror parameter in ant <taskdef>/<typedef> in antlib descriptor.

I am creating an antlib with custom tasks to be used in our build system. I have looked at antcontrib antlib declaration and noticed that the typedefs/taskdefs have onerror parameter set to ignore, e.g. <taskdef name="for" classname="net.sf.antcontrib.logic.ForTask" onerror="ignore"/> The default value of the onerror para...

Language Comparison, Java, FoxPro, Visual Basic

Hi, I want to get some Ideas from you about Edge and Overview of languages below. Java = ? FoxPro = ? VisualBasic = ? What projects are best using that languages? Are there approach or tool that unites them? (database? I think) ...

Java Strings: compareTo() vs. equals()

When testing for equality of strings in Java I have always used equals() because to me this seems to be the most natural method for it. After all, its name already says what it is intended to do. However, a colleague of mine recently told me had been taught to use compareTo() == 0 instead of equals(). This feels unnatural (as compareTo()...

Word By Word Comparison

Hi everyone, I want to ask if anyone knows whether Java has built in library for doing something like the following. For instance, I have 2 Strings which are: String a = "Yeahh, I love Java programming."; String b = "love"; I want to check whether the String b which contains "love" is part of the tokens in the String a. Hence, I want...

A beginner's question in Scala

Can a scala program be running on a browser with disabled java plugin (as scala is compiled to a jvm bytecode)? In other words: is the jvm disabled provided the java browser plugin is disabled? Or does Scala run server-side and I am confused? ...

GWT interface to Solr index

I have a solr index on a remote server and need to create a search page interface. I am using GWT to code the pages and XML-HTTP to query the index and receive the response. The problem is the same-site origin security policy. It won't let JavaScript retrieve the remote XML data. Is there a workaround for this, without using JSON prefera...

Equivalent of C# ObservableCollection in Java

Hi, I was wondering if there is a data structure that acts like an OberservableCollection almost like in C# that is able to take a certain type. ex: In C# i am able to say.. ObservableCollection<Beer> Beer = new ObservableCollection<Beer>(); Beer.add("Bud"); <br> Beer.add("Coors"); Assuming that the class Beer is made and we can...

Getting java.lang.ClassNotFoundException: org.apache.commons.logging.LogFactory exception

hi.. i am executing simple Dependency Injection program of spring & getting this exception. I have already included common-logging1.1.1.jar and spring.jar file. Could you please help to out? Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/commons/logging/LogFactory at org.springframework.context.support.Abstra...

What is the equivalent to System.nanoTime() in .NET?

The title is pretty much self-explanatory, I'm killing myself over this simplicity. Looked here, but it isn't much helpful. ...

How can I see the code that HotSpot generates after optimizing?

I'd like to have a better understanding of what optimizations HotSpot might generate for my Java code at run time. Is there a way to see the optimized code that HotSpot is using after it's been running for a while? ...

HW Help: Java programming

Ok. This is my HW and I am kind of lost. I appreciate if you can help me: Credit card companies use built-in "checksums" as added security measures when creating the account numbers on credit cards. This means that there are only certain valid credit card numbers, and validity can instantly be detected by using an algorithm that may inv...

Draw different shape of polygon randomly

My program draw 10 polygon triangles in random sizes (width and height). The coordinate (points) of the polygon were generated using Random generator = new Random(). Since the points of the triangle and the width and height were randomly generated, how can I control the number of sizes drawn? e.g. there are 10 polygon in total, but I wan...

What is the best speech recognition library for Java Micro Edition?

What is the best speech recognition library for jme? ...

How to output JTextPane styled contents to HTML, including custom style?

I currently use a JTextPane to allow users to add/edit text. It allows bold/italic/underline (and I plan to allow links in the future). It also allows users to drop buttons in, which are inserted as custom styles. The panel looks like: I would like to be able to save/load content as HTML - the content will be incorporated in a Flash s...