I am testing the performance of a data streaming system that supports continuous queries.
This is how it works:
- There is a polling service which sends data to my system.
- As data passes into the system, each query evaluates based on a window of the stream at the current time.
- The window slides as data passes in.
My problem is this, when I add more queries to the system, I should expect the throughput to decrease because it can't cope the data rate.
However, I actually observe an increase in throughput.
I can't understand why this is the case and I am guessing that it's something to do with the way the JVM allocates CPU, memory etc.
Can anyone shed any light to my problem?
I'm trying to make a method that takes an argument of Country.class, User.class etc, and returns argument.count().
All the possible classes that I would give to this method extend from Model and have the method count().
My code:
private static long <T> countModel(Model<T> clazz)
{
return clazz.count();
}
Called by:
renderArgs.put("countryCount", countModel(Country.class));
However this just doesn't work at all.
How do I do this, please?
I have about 4 threads. One thread keeps checking some data that the other thread is updating. The others are doing some processing in the background. All have been started at this point.
My question is when the checking thread sees that the data has not been updated yet I currently sleep for a little bit but is there any way for me to tell the system to back to executing the thread that does the updating?
That or is there any way I can put something like a listener on the data(a String) and once its updated an event will fire that will do what it needs to do?
I tried using yield() and it seemed to just keep returning to the thread I called yield() from.
Thanks
I have one Map that contains some names and numbers
Map<String,Integer> abc = new TreeMap<String,Integer>();
It works fine. I can put some values in it but when I call it in different class it gives me wrong order. For example:
I putted
abc.put("a",1);
abc.put("b",5);
abc.put("c",3);
some time it returns the order (b,a,c) and some time (a,c,b).
What is wrong with it? Is there any step that I am missing when I call this map?
I need to do a search in a map of maps and return the keys this element belong.
I think this implementation is very slow, can you help me to optimize it?.
I need to use TreeSet and I can't use contains because they use compareTo, and equals/compareTo pair are implemented in an incompatible way and I can't change that.
(sorry my bad english)
Map m = new TreeSet();
public String getKeys(Element element) {
for(Entry e : m.entrySet()) {
mapSubKey = e.getValue();
for(Entry e2 : mapSubKey.entrySet()) {
setElements = e2.getValue();
for(Element elem : setElements)
if(elem.equals(element)) return "Key: " + e.getKey() + " SubKey: " + e2.getKey();
}
}
}
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
Hi Experts,
I want to write "Arabic" in the message resource bundle (properties) file but when I try to save it I get this error:
"Save couldn't be completed
Some characters cannot be mapped using "ISO-85591-1" character encoding. Either change encoding or remove the character ..."
Can anyone guide please?
I want to write:
global.username = ??? ????????
How should I write the Arabic of "username" in properties file? So, that internationalization works..
BR
SC
Why is the following syntax correct:
x = y+++y;
(Where it means y++ + y or y + ++y which both mean y * 2 + 1)
But this is not valid syntax:
x = y+++++y;
(Which should mean y++ + ++y, which must mean y and increase y and then add ++y which increases y thus y * 2 + 2)
Is there a reason for this?
When I pass File file to a method I'm trying to get its full path like file.getAbsolutePath(); I always get the same result no matter which one I use either absolute or canonical path PATH_TO_MY_WORKSPACE/projectName/filename and it is not there, how can I get exact location of the file?
Thank you
If we only need to graphically authorize a user,
view a few tables representation (from database),
ability to change data in the database visually
what tools to use to write such a web application that will run on Tomcat?
What framework allows to do that in the most straightforward, easy-to-manage and elegant way?
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?
Is it a good practice to set stream references to null after closing them? Would this release resources in any way?
Example:
BufferedReader input= new BufferedReader(new FileReader("myfile.txt"));
// code
input.close();
input = null;
// possible more code
I understand from the official documentation on unowned relationships that the app must use sets of Key objects on either side of the relationship. This makes perfect sense.
Coming from many years of RDBM-style programming, though, I'm pretty confused about how I can model properties of that relationship itself. For example, if I have entities Category and Entry in my many-to-many relationship and would like to persist a dateAdded property, or some other data that are only relevant when both sides of the relationship are known.
I suppose it would be possible to create a third class : CategoryEntry that links the two, but this seems like a kludge.
What is the proposed way to model this kind of situation ?
Writing generated PDF (ByteArrayOutputStream) in a Servlet to PrintWriter.
I am desperately looking for a way to write a generated PDF file to the response PrintWriter.
Since a Filter up the hierarchy chain has already called response.getWriter() I can't get response.getOutputStream().
I do have a ByteArrayOutputStream where I generated the PDF into. Now all I need is a way to output the content of this ByteArrayOutputStream to the PrintWriter. If anyone could give me a helping hand would be very much appreciated!
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?
Is a variable inside the main, a public variable?
public static void main(String[] args) {
.........
for(int i=0;i<threads.length;i++)
try {
threads[i].join();
} catch (InterruptedException e) {
e.printStackTrace();
}
long time=0;
....
}
i and time are they both public variables?
Of course if my reasoning is correct, also any variable belonging to a public method should be considered public.. am i right?
Thanks
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!
Hi,
I have two events for two seperate components, but there is a problem. JTabbedPane's stateChanged event is fired before JFormattedField's focusLost event. Is there a way of making stateChange event to be fired after focusLost event.
Thanks,
Tuna
I saw a lot of post on StackOverflow relating to this, but unable to solve my problem.
I want to open a new Panel by clicking a button.
Here is how i try to do it
parameterButton = new JButton("Parametres");
parameterButton.addActionListener(new ActionListener(){
public void actionPerformed(ActionEvent e){
createParameterPanel = new DisplayParameterPanel();
createParameterPanel.setVisible(true);
add(createParameterPanel);
};
});
add(parameterButton);
When I click the parameterButton it doesn't open.
How can I open a new panel.
Thanks,