java

How to check for Double.NaN in JSP with JSTL tags?

How to check for Double.NaN in JSP with JSTL tags? ...

Simple, general-interest, code-analyzers based, Java questions

OK, after reviewing some code with PMD and FindBugs code analyzers, i was able to do great changes on the reviewed code. However, there are some things i don't know how to fix. I'll iterate them bellow, and (for better reference) i will give each question a number. Feel free to answer to any/all of them. Thanks for your patience. 1. Ev...

Fetching additional response codes in LDAP (OpenDS) from Java

There is a password policy in place on OpenDS preventing i.e. multiple login failures. If user manages to pass the limit, the logs of LDAP server will show, i.e.: [17/Oct/2009:17:51:11 +0200] BIND RES conn=91 op=0 msgID=1 result=49 authFailureID=197126 authFailureReason="Rejecting a bind request for user uid=XXXXXXXX,ou=users,dc=XXXXXXX...

weird grails error message.

Hi, Using grails 1.1.1 I got this message when I did a modification on a service and then tried to refresh the page. I have a controller name ContributionPlanController. It has a service ContributionPlanservice. inside the ContributionPlanService, it has ProductService and some other Services including JointPIAService. JointPIAServi...

What is the C# equivalent of java.util.regex?

I am converting Java code to C# and need to replace the use of Java's regex. A typical use is import java.util.regex.Matcher; import java.util.regex.Pattern; //... String myString = "B12"; Pattern pattern = Pattern.compile("[A-Za-z](\\d+)"); Matcher matcher = Pattern.matcher(myString); String serial = (matcher.matches()) ? matcher.grou...

Java network code not sending

I'm writing my first non-trivial Java app that uses: networking a GUI threads It's a IM program. When I send a message, the server doesn't output what it should. I'm sorry this description is so bad, but I don't know how to narrow the problem down further. public class MachatServer { //snip public static void sendMessage(i...

Using/Creating Python objects with Jython

HI, lets say I have a Java interface B, something like this. B.java : public interface B { String FooBar(String s); } and I want to use it with a Python class D witch inherits B, like this. D.py : class D(B): def FooBar(s) return s + 'e' So now how do I get an instance of D in java? I'm sorry im asking such a n00b que...

Creating mail application for project

Hi, I'm currently creating mail application for my project, and I'm currently trying to figure out, how mail application like gmail, moves all the messages of particular email address, which I clicked as spam into the spam folder at runtime whenever that marked spam address send messages again. What configuration they do? I want to enab...

Should I be trying to create a reversible enum in Java or is there a better way?

I seem to have faced this problem many times and I wanted to ask the community whether I am just barking up the wrong tree. Basically my question can be distilled down to this: if I have an enum (in Java) for which the values are important, should I be using an enum at all or is there a better way, and if I do use an enum then what is th...

Java: Calculating a metric of String simliarity

This method is a bottleneck in my program. (Or, it is at least where most of the time is being spent.) Its purpose is to calculate the similarity between two strings based on the way characters occur in both, or occur in one or not the other. The code is correct, but I would like to optimize it. Do you see any inefficiencies, bad pract...

Eclipse type proposal change from 3.4 to 3.5 - configurable?

If I already have the types imported, in Eclipse 3.4, I get concrete default classes, but in 3.5 I just get the interface for java.util.Collections. For example, hitting ctrl+space here: Map map = new ctrl+space On 3.4, i get offered HashMap(), on 3.5 Map() (which then gets defaulted to a new impl with methods templated). For List, on...

Java application doesn't know name of file being opened - Mac OS X

I have a Java application in an application bundle that has a file association (using Info.plist) that runs when a document is double-clicked. How do I get the filename of the document that was double-clicked in my Java application? Right now my Java app just runs and displays an empty document. There doesn't seem to be any command line ...

Converting an input word number (like seven) into a character (like @)

so if the user types down seven with Scanner, @@@@@@@ (7) will be the output. I'll have to use a for loop statement but I can at least figure out that much. Just need help with figuring out a way to convert word numbers into a numerical number and finally into a random character. ...

accessing iTunes Lyrics data in Java on Windows

I am writing a short Java program that downloads the lyrics from a website. The only problem is that I don't know how to access the lyrics tab in the mp3 file. Any help would be appreciated ...

J2ME lcdui: Can I manipulate my GUI in a worker thread?

I'm just starting with J2ME and lcdui, and I'm looking at some sample code that calls methods on lcdui objects from a worker thread. In my experience with desktop GUI toolkits, this is usually forbidden - is lcdui different? Is it really OK to do this? (I've Googled for an answer to this question but not found anything - a link to a d...

programming training and consultancy not for a company, but an individual

I'm interested in Ruby, Python, PHP and Java. Does programming training and consultancy the way I described exist for any of those programming languages? Is it good? Why? Is it on the internet? Where? ...

asm / C / Python / Perl / Lisp / Scheme Programmer looking for something new to learn.

I need to have an at-home project now that I'm working on Python/Django at work. I'd like to learn something new, so I was thinking of checking out Java. What's the most well respected web framework for deploying Java web apps? The only reason I'm not checking out ruby on rails is because of how similar the ORM and other parts are to Dj...

Java Question: Is it possible to have a switch statement within another one?

I have a yes or no question & answer. I would like to ask another yes or no question if yes was the answer. My instructor wants us to use charAt(0) as input for the answer. Is it possible to have a switch statement within another one (like a nested if statement)? Thanks in advance. EDIT: Here is a sample of my pseudo code = displa...

Java Chat Server

FYI This is homework. I have to build a Java Chat server. I have been able to build a server which communicates with 1 client. But I need this to communicate with multiple users. A user is supposed to type in the person's name they wish to talk to followed by a dash (-) and then the message to be sent. I am able to get users signed on b...

Eclipse JDT ASTVisitor - how to tell if a field is read or written in a method?

I am writing a Eclipse ASTVisitor. How to tell if a field is read or written in a method? The idea provided was "You need to vist Assignment node. Field on the LHS is written, while fields on the RHS expression is read." After I visit the assignment and get the LHS and RHS which are both of Expression, how do I tell if the Expression c...