I was wondering if there is any library that can be used to represent SQL queries as objects in Java.
In the code I have plenty of static variables of type java.lang.String that are hand written SQL queries. I would be looking for library having a nice fluent API that allows me to represent the queries as objects rather than strings.
E...
I have a Java-webapp. The webapp is packaged as a war-file. These war-file allow static content, that is directly delivered via HTTP. For servlets in this war I can make a HTTP-authentication (implement it with the servlet itself). But I also want HTTP-auth for the static content. How can I realize this?
...
Is there any point in having a com.myco.myproj.MyProjRuntimeException,
which completley extends RuntimeException?
...
I know that Math.sqrt calls StrictMath.sqrt(double a)
I was wanting to look at the actual code used to calculate it.
...
I am taking on a project where all the Exceptions have been placed in a separate package com.myco.myproj.exceptions.
Is this good practice?
...
In our tomcat application, we catch a CommunicationsException. There are various config parameters which can lead to this, including the database config being set wrong, but also the tomcat config have TOMCAT5_SECURITY=yes
When we catch the exception we want to give a helpful error message to the user. So we want to ask tomcat whether T...
I'm experimenting with Netbeans and JBoss and I'd like to print stuff on JBoss console from my code. Can I use log4j for that?
...
Currently I am writing a program for an introductory Java class. I have two pieces to my puzzle. Hopefully this is a relatively simple to answer question.
Firstly, here is what I am trying to use as my main program:
import java.util.Scanner;
public class TheATMGame
{
public static void main(String[] args){
Scanner input = new S...
I am trying to imported a java class from an external lib in jyhon and it does not work. An example
package run;
import import.Imported;
Class Run()
{
public static void main(String[] args){
pi = new PythonInterpreter(null);
pi.execfile('script.py');
}
}
//this is an external...
I'm trying to use a open source java library to visualize nodes and edges in a graph, but I'm completely lost. Up until now I've never needed anything more than the default libraries, and everything online seems to assume I obviously know how to use a new library...
I have a bunch of jar files in a folder. Clicking on SOME of the jar fi...
I am coding several reference algorithms in both Java and C/C++. Some of these algorithms use . I would like for the two implementations of each algorithm to produce identical results, without rounding differently. One way to do this that has worked consistently so far is to use a custom-defined pi constant which is exactly the same in b...
Hello,
We need to add anti-XSS support in our Struts application. Most specifically the architect requires that all user input must be "sanitized" before storing in DB. As I don't want to reinvent the square wheel, which Java library can I use for this ? And where to put it ? Ideally it should be configurable (which input fields to che...
I am trying to determine the class type of a class using reflection and then do something specific. For example, if the class is a double, use a double specific method.
I am attempting to use
if(f.getClass() == Double.class)
However, I am getting a compiler error:
"Incompatible operand types Class <capture#1-of ? extends Field> a...
Hello,
I've already read most of the questions regarding techniques to prevent form spam, but none of them seem to suggest the use of the browser's session.
We have a form that sends an email to given email address and we didn't like the idea of using "captchas" or Javascript, as we wanted to keep the user journey simple and accessible...
I don't necessarily want to use UUIDs since they are fairly long.
The file just needs to be unique within its directory.
One thought which comes to mind is to use File.createTempFile(String prefix, String suffix), but that seems wrong because the file is not temporary.
The case of two files created in the same millisecond needs to be ...
Using Java (1.4) is there a way in which to use Windows UNC file locations (\\servername\filestore\etc) within the classpath?
...
After writing out some processed content to an output stream, I need to revisit the beginning of the stream and write out some content metadata. The data I'm writing is very large, as much as 4Gb, and may be written either directly to a file or to an in-memory buffer, depending on various environmental factors.
How can I implement an O...
I want to learn sql connectivity with swings(java) can any one suggest a good resource available for my purpose.
...
Hi all,
I have to begin a medium-sized project in Java, but I'm not a big fan of ORMs in general so the question is: Should I design the project with an ORM in mind (for later use) or not?
The RDBMS is Oracle 10g and the queries will be very coupled to Oracle syntax/functions (i.e. text, mining, CONNECT BY, etc...).
Thanks a lot.
...
I have a rather annoying issue that I solved using a simple recursive method in Java. However, I'm looking for a better way to do this.
The initial problem involved the presence of whitespace within a Quoted Printable/Base64 encoded Mime header - which as I read the RFC 2047 specification - isn't allowed. This means that decoding fail...