I'm working on a finite deterministic automaton based on this.
From this code:
public void markInitialState (int initialStateId) {
State theInitialState = allStates.get(initialStateId);
theInitialState.isInitial=true;
allStates.add(initialStateId, theInitialState);
...
this is how i normally iterate a collection
for(Iterator iterator = collectionthing.iterator(); iterator.hasNext();){
I believe most of us doing this, I wonder is there any better approach than have to iterate sequentially? is there any java library..can I can make this parallel executed by multi-code cpu? =)
looking forward feedbac...
I'm trying to code an applet and put it in my website. I remember doing this a long time ago using Borland back when 1.4 was the latest version. It of course used the applet tag (which I'm using currently) and it had no issues. But anyways, I put the class files in httpdocs/ under its own directory, and then used this code in the web ...
Considering the basic data types like char, int, float, double etc..in any standard language C/C++, Java etc
Is there anything like.."operating on integers are faster than operating on characters".. by operating I mean assignment, arithmetic op/ comparison etc.
Are data types slower than one another?
...
Most Hibernate tutorials use Maven for handling the build, but I'm looking for a basic configuration using Ant instead. I've reviewed this some:
https://www.hibernate.org/hib_docs/tools/reference/en/html/ant.html
However, it seems like it covers way more in an introductory tutorial than I need. I really want to get started w/ some simp...
Is there a Ruby version of for-loop similar to the one in Java/C(++)?
In Java:
for (int i=0; i<1000; i++) {
// do stuff
}
The reason is because I need to do different operations based on the index of the iteration. Looks like Ruby only has a for-each loop?
Am I correct?
...
I am a Python and Java developer with about 1.5 years of coding experience and I am looking for a fun but challenging project to engage myself in.
What are some fun and interesting project ideas that are challenging enough to be note-worthy and useful enough to put into a portfolio?
Thanks
...
Hi,
Let's say we have an interface 'IA' for which we have an implementation 'A'.
In our application domain, object 'A' never exists without a container object 'X'. So 'A' is never directly operated upon. 'A' aggregates in 'X'.
We don't want to expose 'A' to the outside world. For this we have taken the approach, not to have the public ...
List sychronizedList = Collections.synchronizedList(new ArrayList()); //is this ok?
try {
ExecutorService executor = Executors.newFixedThreadPool(10);
for (final Object item : fromCollection) {
executor.submit(new ARunnableClass(sychronizedList));
}
executor.shutdown(); //do i need this
...
Examining a Java runtime with CMS (Concurrent-Mark-Sweep) GC enabled, what is the definition of the CMS space in the logs below? Shall I assume it is the tenured space? I see the following lines of a minor-major-minor GC event
23.481: [GC 23.481: [DefNew: 1051K->128K(1152K), 0.0029912 secs] 11925K->11027K(13600K), 0.0031697 secs] [Tim...
Can someone please provide some insight into the the following verbosegc lines on a Java runtime with CMS GC enabled? Specifically:
Does the event at 29.490 indicate heap location of the highwater for marking?
What is the preclean phase and what is it doing different than marking?
What is the reset phase? Why would that take time to...
What product / technology can I you use to protect my java code in a commercial application? Is there a obfuscator that does the job? On the other side, it would be great to have anything that combines file-based license management with byte-code encryption.
Any Ideas? Best practices?
...
After adding a RESTFul service using Apache CXF to my Spring (and Wicket) project I get the following exception:
org.apache.cxf.BusException: No binding factory for namespace http://apache.org/cxf/binding/jaxrs registered.
I have included the row below in my Spring configuration and thought this would actually solve my problem. But it ...
Is there an eclipse plugin for jdo which has a designer tab and a source tab like the xml editor?
The designer tab would have a table for me to key in all the fields, each row per field, with columns defining if that field is String, persistent, etc.
Then I flip over to source tab and, voila, is the java class source.
Or something lik...
I recently looked at a Java application which had a very fine-grained package structure. Many packages only contained one or two classes and many sub packages. Also many packages contained more sub packages than actual classes.
Is this a good or a bad thing?
...
Hi, all.
This is my first question on S.O.
I have a very odd problem.
Below is my problem...
I write very simple method that write some text to a file.
Of course it works well my machine(XP, 4CPU, jdk1.5.0_17[SUN])
But it somtimes freezes on operating server
(Linux Accounting240 2.4.20-8smp, 4CPU, jdk1.5.0_22[SUN]).
kill -3 doesn'...
I am parsing binary files and have to implement a CRC algorithm to ensure the file is not corrupted. Problem is that I can't seem to get the binary math working when using larger numbers.
The example I'm trying to get working:
BigInteger G = new BigInteger("11001", 2);
BigInteger M = new BigInteger("1110010000", 2);
BigInteger R = M.r...
Hello can anyone help me integrating OPENMQ (resource adaptor) into JBOSS 4.0.3 .
...
Hello,
I have an table (in ORADB) containing two columns: VARCHAR unique key and NUMBER unique key generated from an sequence.
I need my Java code to constantly (and in parallel) add records to this column whenever a new VARCHAR key it gets, returning the newly generated NUMBER key. Or returns the existing NUMBER key when it gets an ex...
Hi all,
I've noticed recently that there's a few java libs (the JDK, joda time, iText) that compile without some/all of the debugging information. Either the local variable info is missing, or the both the local variable info and line numbers are missing.
Is there any reason for this? I realise it makes compiled code larger but I don...