I´ve been searching for it and I found Encog and Neuroph but I don´t know if any about them... I've to do a final project and I need a litle feedback from humans, sometimes google is not enough XD
My web service was created some time back using IBM JAX-RPC. As a part of enhancement, I need to provide some security to the existing service.
One way is to provide a handler, all the request and response will pass through that handler only. In the request I can implement some authentication rules for each and every application/user accessing it.
Other than this, What are the possible ways for securing it?
I have heard someting called wsse security for web service. Is it possible to implement it for the JAX-RPC? Or it can be implemented only for JAX-WS? Need some helpful inputs on the wsse security so that i can jump learning it.
Other than handler and wsse security, any other possible way to make a service secure?
Please help.
I am trying to proccess a queue of tasks from a database table as fast as possible while also limiting the number of threads to process the tasks.
I am using a fixed sized thread pool with Executors.newFixedThreadPool(N);
I want to know if there is a way of knowing if the thread pool is full, by that I mean are there currently 50 threads running, if so then I'll wait for a thread to be available before starting a new one instead of sleeping the main thread.
Code of what I would like to do:
ExecutorService executor = Executors.newFixedThreadPool(N);
ResultSet results;
while( true ) {
results = getWaitingTasksStmt.executeQuery();
while( results.next() && executor.notFull() ) {
executor.submit( new thread( new runnableInheritedClass(results) ) );
}
}
I got this thing i'm trying to solve:
I got a ListView created using Wicket ( 1.5 ) with a lot of elements and a scroll. When new items are available, the user is asked if he would like to refresh the list via a message backed by an AjaxLink:
public void onClick(AjaxRequestTarget ajaxTarget) {
/* do something ... */
ajaxTarget.addComponent(_list);
}
So on click the list gets reloaded and the scroll position is reset to zero. Is there any way i can call JavaScript before the list reloads the save the scroll position?
(I know how to get/save the scroll position ( .scrollTop() ) , i just don't know how to call a function right before AJAX ).
Hello,
I have a datetime field in mysql table and i am using JPA for persisting data but only date goes in database. Time always shows 00:00:00. What should i do?
I am not doing any manipulation with Date. All i do is to assign new Date() to a variable and store it in database.
What am i doing wrong?
I need to setup LookAndFeel Files in JDK 1.6.
I have two files:
napkinlaf-swingset2.jar
napkinlaf.jar
How can I set this up and use it?
I would like a GTK look and feel OR Qt look and feel, Are they available?
I'm wondering when the GatheringByteChannel's write methods (taking in an array of ByteBuffers) have advantages over the "regular" WritableByteChannel write methods.
I tried a test where I could use the regular vs. the gathering write method on a FileChannel, with approx 400KB/sec total in ByteBuffers of between 23-27 bytes in length in both cases. Gathering writes used an array of 64. The regular method used up approx 12% of my CPU, and the gathering method used up approx 16% of my CPU (worse than the regular method!)
This tells me it's NOT useful to use gathering writes on a FileChannel around this range of operating parameters. Why would this be the case, and when would you ever use GatheringByteChannel? (on network I/O?)
Relevant differences here:
public void log(Queue<Packet> packets) throws IOException
{
if (this.gather)
{
int Nbuf = 64;
ByteBuffer[] bbufs = new ByteBuffer[Nbuf];
int i = 0;
Packet p;
while ((p = packets.poll()) != null)
{
bbufs[i++] = p.getBuffer();
if (i == Nbuf)
{
this.fc.write(bbufs);
i = 0;
}
}
if (i > 0)
{
this.fc.write(bbufs, 0, i);
}
}
else
{
Packet p;
while ((p = packets.poll()) != null)
{
this.fc.write(p.getBuffer());
}
}
}
public class Test {
public static void main(String[] args){
if (5.0 5) // (5.0<5) for both case it is going to else
System.out.println("5.0 is greater than 5");
else
System.out.println("else part always comes here");
/another sample/
if (5.0 == 5)
System.out.println("equals");
else
System.out.println("not equal");
}
}
can any one explain the first "if statement" why it always come to else part
Hi, I'm trying to use the PageFormat information to modify my javax.swing based printout prior to printing it. I am stumped as to how I can get the PageFormat from the PrintJob (which is obtained using getPrinterJob() and printDialog()). I know there is the getPageFormat method, but I can't figure out how to get the PrintRequestAttributeSet (which is not the printJob.getPrintService().getPrintAttributes()). Honestly, all I really want to know is the width and height of the page. Any ideas on how I can do that? Thanks.
Need to write a method describePerson() that takes 3 parameters, a String giving a person’s
name, a boolean indicating their gender (true for female, false for male), and an integer giving their age. The method should return a String formatted as in the following examples:
Lark is female. She is 2 years old.
Or
Jay is male. He is 1 year old.
I am not sure how to write it correctly (my code):
int describePerson(String name, boolean gender, int age) {
String words="";
if(gender==true) return (name + "is "+gender+". "+"She is"+age+ "years old.);
else
return (name + "is "+gender+". "+"She is"+age+ "years old.);
}
The outcome "year" and "years" is also differs, but i don't know how to make it correct..
Hi ive got a log file containing trace routes and pings.
Ive seperated these by using
if(scanner.nextLine().startsWith("64 bytes"){}
so i can work with just the pings for now.
All im interested in from the ping is time=XX
example data line =
64 bytes from ziva.zarnet.ac.zw (209.88.89.132): icmp_seq=119 ttl=46 time=199 ms
I have been reading other peoples similar questions and im not sure how to apply to mine.
I literally need just the number as i will be putting them into a csv file so i can make a graph of the data.
Hi folks,
I have a nested map:
Map<Integer, Map<Integer, Double>> areaPrices = new HashMap<Integer, Map<Integer, Double>>();
and this map is populated using the code:
while(oResult.next())
{
Integer areaCode = new Integer(oResult.getString("AREA_CODE"));
Map<Integer, Double> zonePrices = areaPrices.get(areaCode);
if(zonePrices==null)
{
zonePrices = new HashMap<Integer, Double>();
areaPrices.put(areaCode, zonePrices);
}
Integer zoneCode = new Integer(oResult.getString("ZONE_CODE"));
Double value = new Double(oResult.getString("ZONE_VALUE"));
zonePrices.put(zoneCode, value);
myBean.setZoneValues(areaPrices);
}
I want to use the value of this Map in another method of the same class. For that I have a bean.
How do I populate it on the bean, so that I can get the ZONE_VALUE in this other method
In my bean I added one new field as:
private Map<Integer, Map<Integer, Double>> zoneValues;
with getter and setter as:
public Map<Integer, Map<Integer, Double>> getZoneValues() {
return zoneValues;
}
public void setZoneValues(Map<Integer, Map<Integer, Double>> areaPrices) {
this.zoneValues = areaPrices;
}
What I am looking for to do in the other method is something like this:
Double value = myBean.get(areaCode).get(zoneCode);
How do I make it happen :(
hey guys
i have a column in the database(postgresql)
i want to insert the current time in GMT in this column
when getting the current time and inserting it into the DB
it's inserted in the server timezone GMT-5 although that time was in GMT+0
any ideas how to insert this time in the database in GMT timezone ?
I have few small basic problems :
How to format :
int i = 456;
to give output :
""00000456"
? I've tried %08d but it's not working. Next thing is a problem with conversion and then formatting. I have side and height of triangle, let's say int's 4,7, and 7 is the height. From formula for field we know that F=1/2(a*h). So how to get F as float, with precision up to 10 places ?
float f = a*h;
works fine, but multiplying it by 0.5 gives error and by 1/2 returns 0.
I have an InputStreamReader object. I want to read multiple lines into a buffer/array using one function call (without crating a mass of string objects). Is there a simple way to do so?
Hi
I need to get some information from user by showing a JFrame
I need the first frame pause process until user enter data from the second frame
I thought about using wait() and notify() but I don't know how
How can I do this?
Thanks
I have a generic class Foo<T> and parameterized types Foo<String> and Foo<Integer>. Now I want to put different parameterized types into a single ArrayList. What is the correct way of doing this?
Candidate 1:
public class MMM {
public static void main(String[] args) {
Foo<String> fooString = new Foo<String>();
Foo<Integer> fooInteger = new Foo<Integer>();
ArrayList<Foo<?> > list = new ArrayList<Foo<?> >();
list.add(fooString);
list.add(fooInteger);
for (Foo<?> foo : list) {
// Do something on foo.
}
}
}
class Foo<T> {}
Candidate 2:
public class MMM {
public static void main(String[] args) {
Foo<String> fooString = new Foo<String>();
Foo<Integer> fooInteger = new Foo<Integer>();
ArrayList<Foo> list = new ArrayList<Foo>();
list.add(fooString);
list.add(fooInteger);
for (Foo foo : list) {
// Do something on foo.
}
}
}
class Foo<T> {}
In a word, it is related to the difference between Foo<?> and the raw type Foo.
Update:
Grep What is the difference between the unbounded wildcard parameterized type and the raw type? on this link may be helpful.
I've a typical scenario & need to understand best possible way to handle this, so here it goes -
I'm developing a solution that will retrieve data from a remote SOAP based web service & will then push this data to an Oracle database on network.
Also, this will be a scheduled task that will execute every 15 minutes.
I've event queues on remote service that contains the INSERT/UPDATE/DELETE operations that have been done since last retrieval, & once I retrieve the events for last 15 minutes, it again add events for next retrieval.
Now, its just pushing data to Oracle so all my interactions are INSERT & UPDATE statements.
There are around 60 tables on Oracle with some of them having 100+ columns. Moreover, for every 15 minutes cycle there would be around 60-70 Inserts, 100+ Updates & 10-20 Deletes.
This will be an executable jar file that will terminate after operation & will again start on next 15 minutes cycle.
So, I need to understand how should I handle WRITE operations (best practices) to improve performance for this application as whole ?
Current Test Code (on every cycle) -
Connects to remote service to get events.
Creates a connection with DB (single connection object).
Identifies the type of operation (INSERT/UPDATE/DELETE) & table on which it is done.
After above, calls the respective method based on type of operation & table.
Uses Preparedstatement with positional parameters, & retrieves each column value from remote service & assigns that to statement parameters.
Commits the statement & returns to get event class to process next event.
Above is repeated till all the retrieved events are processed after which program closes & then starts on next cycle & everything repeats again.
Thanks for help !
Basically I have a proof-of-concept application that is a digital recipe book. Each Recipe is an object and each object has, among other fields, a Vector containing arrays. The Vector is the list of all ingredients in the Recipe while each ingredient has an array showing the name of the ingredient, the amount, and the unit for that amount. I want to save each Recipe to XML so that they can be accessed by the user. How can I store a Vector of String arrays in XML or any other sort of file so that it can later be recalled and accessed?
Hi i am trying to match a string against a pattern
this is the possible string
signal CS, NS, dl: stateType := writeOrRead0;
signal CS, pS : stateType := writeOrRead0;
signal dS : stateType := writeOrRead0;
i am only concerned with the pattern as far as the first colon.
but the number of signals define can be more than one it could be three or four even
this is the regular expression i have
^signal\\s*(\\w+),*\\s*(\\w+)\\s*:
it will pick up the second two signal but and for the second one it picks up CS and pS and but the d and S in the next signal when i use
matcher.group()
come up seperately
Can anyone give me an expression that will pick up all signal names whether there is one two three or more?
I have this code to print out all directories and files. I tried to use recursive method call in for loop. With enhanced for loop, the code prints out all the directories and files correctly. But with regular for loop, the code does not work. I am puzzled by the difference between regular and enhanced for loops.
public class FileCopy {
private File[] childFiles = null;
public static void main(String[] args) {
FileCopy fileCopy = new FileCopy();
File srcFile = new File("c:\\temp");
fileCopy.copyTree(srcFile);
}
public void copyTree(File file){
if(file.isDirectory()){
System.out.println(file + " is a directory. ");
childFiles = file.listFiles();
/*for(int j=0; j<childFiles.length; j++){
copyTree(childFiles[j]);
}
This part is not working*/
for(File a: childFiles){
copyTree(a);
}
return;
} else{
System.out.println(file + " is a file. ");
return;
}
}
}
Hello,
I have an object of CalendarEntry
I know that http://www.google.com/calendar/feeds/[email protected]/allcalendars/full is the feed url of all calendars
but how I can get this feed url from CalendarEntry instance?
Because I wanna post a new entry in a specified calendar and I need this url.
Thanks!
Good Morning - it is school assignment, I am not asking for any source code (if you can provide any pesudo code it would be awesome).
Here is the problem :(
I have to create a term frequency table. It is not pure TF, I just need to count the words and write down.
I know basic steps to do it
1 - extract all terms (I can do it with file reader)
2 - remove repeating terms (I can do it with TreeMap)
The output of 2nd step would be
Niga, ponga, dinga, bitlo, etc.
3 - Now I have to see if there is any word in current file from above terms or not, if yes then I will count.
Now this is my problem, I stucked on step 3 :(
I have some idea how to count words with TreeMap (treemap.containskey etc.) but it would be global count not local count for each file :(
Any pseudo code?