Let's say you have a text file like this one:
http://www.gutenberg.org/files/17921/17921-8.txt
Does anyone has a good algorithm, or open-source code, to extract words from a text file?
How to get all the words, while avoiding special characters, and keeping things like "it's", etc...
I'm working in Java.
Thanks
...
I'm looking to implement something in Java along the lines of:
class Foo{
private int lorem; //
private int ipsum;
public setAttribute(String attr, int val){
//sets attribute based on name
}
public static void main(String [] args){
Foo f = new Foo();
f.setAttribute("lorem",1);
f.setAttribute("ipsum",2);
}
public ...
I am tracking the Java versions being used by web visitors: http://cowwoc.blogspot.com/2008/12/tracking-java-versions-using-google.html
Unfortunately, the integration level is skin deep. I would like Google Analytics to tell me what percentage of visitors ran what version, and drill down further to find out what sub-attributes each vers...
Hi,
We're creating a web system using Java and Servlet technology (actually Wicket for the presentation layer) and we need our system to be available nearly always as our customers will be quite dependent on it.
This has lead us to look for a good book focusing on the subject or another resource which explains how to set up a more redu...
How can I write a function that takes an array of integers and returns true if their exists a pair of numbers whose product is odd?
What are the properties of odd integers? And of course, how do you write this function in Java? Also, maybe a short explanation of how you went about formulating an algorithm for the actual implementation.
...
Scanner can only get input from system console? not be able to get from any dialog window?
Thanks.
...
I need to load a bunch of words (about 70,000) from a text file, add it to a hashtable (using soundex as a key) and sort the values. While doing all these I want to show a progress bar using JProgressBar. Articles such as this and this, only gives a non-real example (a while loop). Can anyone suggest me how should I proceed. How can I ge...
bCrypt's javadoc has this code for how to encrypt a password:
String pw_hash = BCrypt.hashpw(plain_password, BCrypt.gensalt());
To check whether a plaintext password matches one that has been hashed previously, use the checkpw method:
if (BCrypt.checkpw(candidate_password, stored_hash))
System.out.println("It matches");
else
...
How can I refer a custom function in xml? Suppose that I have a function written in Java and want it to refer by the xml tag, how is this possible?
Current senario: I am using XACML2.0 which contains xml tags and I want to refer some function in Java that will talk to the backend data, I'm unable to refer a function in xacml. Could yo...
We have a java web service application that uses log4j to do logging. An exception gets thrown when log4j tries to delete its rolling log files
Exception:java.security.AccessControlException: access denied
(java.io.FilePermission /var/opt/SUNWappserver/domains/domain1/
applications/j2ee-modules/ourwebservice/WEB-INF/logs/IMWrapper.log....
What is the best way to find the total number of words in a text file in Java? I'm thinking Perl is the best on finding things such as this. If this is true then calling a Perl function from within Java would be the best? What would you have done in condition such as this? Any better ideas?
...
I am writing code for uploading a file from a client to my server and the performance isn't as fast as I think it should be.
I have the current code snippet that is doing the file transfer and I was wondering how I could speed up the transfer.
Sorry about all of the code:
InputStream fileItemInputStream ;
OutputStream saveFileStream;
...
In Eclipse RCP way of doing things, where should I keep my model objects? And when they are loaded or changed, how should they talk to the views?
I am attempting to port my existing application to Eclipse RCP. It could be viewed as an IDE-like application: I open a file, which contains links to source files. The source files are display...
Which libraries for Java are there that have a fast implementation for floating point or fixed point operations with a precision of several thousands of digits? How performant are they?
A requirement for me is that it implements a multiplication algorithm that is better than the naive multiplication algorithm that takes 4 times as much ...
I've been reading through the details of the System libraries set and get methods yet the parameters are usually Strings.
Would you consider the use of String as parameters bad practise since the inclusion of enum?
A better alternative at minimum might be public final String, No?
...
I hate to have to ask, but I'm pretty stuck here.
I need to test a sequence of numbers to find the first which has over 500 factors:
http://projecteuler.net/index.php?section=problems&id=12
-At first I attempted to brute force the answer (finding a number with 480 after a LONG time)
-I am now looking at determining the prime facto...
I have a simple form
form action="email.jsp" method="post"
<label for="firstname">Your Name: </label>
input type="text" id="name"<br/>
<label for="email">Your Email: </label>
input type="text" id="address"<br/>
<label for="message">Message: </label>
textarea size="30" rows=...
I am trying to let a piece of runtime state decide WHICH implementation of an interface to use, preferably solely by autowiring.
I have tried making an object factory for the interface thet uses dynamic proxies, and I used qualifiers to coerce the @Autowired injections to use the factory. The qualifiers are necessary because both the f...
My schema specifies a namespace, but the documents don't. What's the simplest way to ignore namespace during JAXB unmarshalling (XML -> object)?
In other words, I have
<foo><bar></bar></foo>
instead of,
<foo xmlns="http://tempuri.org/"><bar></bar></foo>
...
If you started a new Java EE project today which is to be finished in about a year, which application server would you choose and why?
Part of your answer should include your arguments for your decision. And also how much experience you have with the Java EE server you choose and with the other available servers on the market. These are...