java

JEdit Macro - Open and Save File

I have a JEdit (BeanShell) macro which opens a specific file then immediately saves the file to my c:\temp folder (so that I don't accidentally update the real file). Here is the bean shell code: logFilePath = "c:\\temp\\aj.txt"; jEdit.openFile( view , logFilePath ); _buffer = jEdit.getBuffer(logFilePath); _buffer.save(view,"c:\\tem...

Incompatible Type Error Java

I'm writing code in Java, using the NetBeans IDE. I keep getting a couple of "Incompatible Type" errors. I declare a variable as String and then assign to it the value from a method that returns a String too. The error says that there was expected a type of "String" but instead found "..." where "..." the name of the method I call. For ...

How do RESTful and SOAP Web Services differ in practice?

I am implementing web services for a PHP application and am trying to understand what both standard web services and RESTful web services have to offer. My intent is to write wrapper code to abstract away the web service details so that developers can just "instantiate remote objects" and use them. Here are my thoughts, perhaps some of ...

Genericized commons collection

Hi, I'm astonished that the Apache Commons Collections project still hasn't got around to making their library generics-aware. I really like the features provided by this library, but the lack of support for generics is a big turn-off. There is a Lavalabs fork of Commons Collections which does support generics, which seems to claim back...

JAXM soap message parsing

I am getting the following XML back from a .net service: <?xml version="1.0" encoding="utf-8"?> <soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"&gt; <soap:Body> <validateCred...

spring beans configuration

I'm using Spring's dependency injection but I'm running into difficulty loading a resource in my spring config file. The resource is an XML file and its in a jar file on my classpath. I try to access it as follows; <import resource="classpath:com/config/resources.xml" /> however I keep geting error; Failed to import bean definit...

Is there any other strongly-integrated presentation layer tool other than JSF/JSP for Java EE?

Hello, I'm teaching Java EE at the university, and this was a question a student asked. I said "no", but I wasn't really sure, so I thought I might ask you mighty developers. :) Basically, what I'd like to do is to use entities if they were in my context: cat getters, setters, etc, so like normal POJOs. if I use an EJB using its remote...

Concatenate strings in JSP EL?

I have a List of beans, each of which has a property which itself is a List of email addresses. <c:forEach items="${upcomingSchedule}" var="conf"> <div class='scheduled' title="${conf.subject}" id="scheduled<c:out value="${conf.id}"/>"> ... </div> </c:forEach> This renders one <div> per bean in the List. For the sublist, ...

How to write spam filter

Hi I'm stuck in having to write a simple spam filter I'm not really sure about how I'm going to do it. So far I've come up with wordlist and domain filtering, which will give or remove points up to a certain threshold. For example, if you're writing about "v1agr4" from a blacklisted domain, you'll get like 2 points for spam, but if yo...

Light weight alternative to Hibernate?

I have a single user java program that I would like to have store data in a light weight database such as Derby or Sqlite. I would like to use a data abstraction layer in my program. Hibernate appears to require a lot of configuration and is overkill for what I need. What are light weight alternatives to Hibernate? ...

if-else in FreeMarker template

Hi, FreeMarker templates support an if-statement with the following syntax <#if hot> It's hot. </#if> I've looked in the documentation and can't find any support for an if-else statement. Of course I could achieve the same result with: <#if hot> It's hot. </#if> <#if !hot> It's not hot. </#if> Is support for if-else pro...

Performance comparison of Thrift, Protocol Buffers, JSON, EJB, other?

We're looking into transport/protocol solutions and were about to do various performance tests, so I thought I'd check with the community if they've already done this: Has anyone done server performance tests for simple echo services as well as serialization/deserialization for various messages sizes comparing EJB3, Thrift, and Protocol...

Show me Open Source projects using Facelets!

I want to watch and learn from Open Source projects that are using Facelets, but my Google skills failed me so I went here. The closest thing I found was http://wiki.java.net/bin/view/Projects/FaceletsProjects but -- correct me if I'm wrong -- that tiny link collection only go to demos, 404:s, commercial products or projects that are s...

Good name for an class that holds a object with an onset time

I'm creating a (Java) class to represent an object in a musical score that has a specific onset time, and possibly a duration as well. I need a good name for this class. Is something like "Timed" or "TimedObject" appropriate? I've tried to come up with something that ends in "-able" (like Runnable) but I can't think of anything good; ...

Long Transaction Time Solution for JEE?

A problem I've encountered a few time in my career is in a tiered service architecture a single downstream system can bring down the entire client application if it gets into a state where all its threads are consumed on a deadlock or some sort of infinite loop bug in that system. Under these conditions the server socket on the JEE serve...

Simple Workflow Management with JEE

Hi All, I have an application that allows different users to update some data that is then published to a website. The application uses JPA as a persistence layer. I now want to add a bit of workflow management to this scenario so that when users with junior roles update data, it is not directly published but rather waits for a senior u...

Java Floating License Server API?

Short of rolling your own. There has to be something out there. FlexLM/FlexNet is overpriced, and does not work for a company like ours. The same goes for RLM. There was one product I had hope in called LUM, but IBM no longer licenses the API. So what else is available? Or do you have any known way to get LUM? Please help, I have ...

Which framework is better CXF or Spring-WS?

I am in the process of researching/comparing CXF and Spring-WS for web services? I need to function both as a provider and a consumer of WS. In a nutshell, I have been told that Spring-WS is more configurable, but CXF is easier to get up and running. This question is subjective, but will help direct me in my research. What experience d...

Convert Class[] to generics?

I'm still trying to get my head around using Java's generics. I have no problems at all with using typed collections, but much of the rest of it just seems to escape me. Right now I'm trying to use the JUnit "PrivateAccessor", which requires a Class[] argument with a list of all the argument types for the private method being called. ...

How to generate sound effects in Java?

I'm looking for Java code that can be used to generate sound at runtime - NOT playback of existing sound files. For example, what's the best code for generating a sawtooth waveform at 440 Hz for a duration of 2 milliseconds? Source code appreciated! I remember my Commodore 128 had a simple Sound command that took as parameters voice, f...