Storing Search Histories - Remove Duplication Without Affecting Performance
Aug 1, 2014
In our product we show search histories on the UI, means what ever user searches we make a history for that search in the database and show it on the UI.
At present we show duplicate histories also. for ex- if a user do a search with some criteria (say, abc), now if the user do search again with same criteria (abc), we show it twice on our history page.
What we need to do -
we need to remove the duplication, and only to show the search histories once if they have same criteria. also we need to save it only once in the database. means we neither display the same search histories nor store them in the database. ofcourse if we store it only once, it will be displayed only once. so we need logic in our storing part here.
Approaches we are trying -
Approach 1 - We thought to remove duplicate search histories by comparing their criteria's, but here the problem is that single search history itself can have so many criteria's and we store around 30 search histories in the database, so if we compare criteria of all of them one by one. we will loose the performance. so we dropped this approach.
Approach 2 - The second approach we are thinking is, at the time of creation of search histories, we will generate checksum based on their criteria, so if the criteria is same for two search histories the checksum generated would be same, and before creating (storing into database) the search history we first check if the checksum is already exist in the search history table for any search history or not, if it is already there, don't create the search history, as it is already there.
The problems with this approach is -
First Problem - we will need to create one more column in the Table which will impact our upgrade process, and we don't want to have an upgrade impact.
Second Problem - if user changed the sequence of criteria of search, for e.g. name criteria first and then number criteria but the values are same. and in the another search number criteria first then name criteria and values are same as first search, here the search results would be same as the criteria are same but only the sequence is different, so in this case two histories will get created (as we generate checksum based on criteria so if sequence gets changed checksum would also be different), however we want only one search history in this situation. we don't want to consider the sequence.
We store the search histories in XML format and we convert this xml to blob to store it into database, i thought to first sort them then generate checksum, but as they are in xml format, so i can't even sort them because the tags are similar to all the criteria's.
View Replies
ADVERTISEMENT
Apr 1, 2015
So in my binary search tree I'm trying to write a method that deletes the idem but for some reason it's not working. I have two things, I have the method and then another piece of code that tests the deletion method. Here's the actual method
public void delete(String word) {
root = deleteItem(root, word);
}
protected TreeNode deleteItem(TreeNode r, String word) {
if (r == null){
return r;
}
if(word.compareTo(r.item.getWord()) < 0){
[Code]...
Here's the test code
message = "Test: deleting 'word' -- ";
t = new BSTRefBased();
try {
t.delete("word");
result = t.getRootItem().getWord().equals(null);
} catch (Exception e) {
result = false;
}
System.out.println(message + (result ? "passed" : "FAILED"));
So for some reason it keeps saying that the test failed. Why does it keep saying that.
View Replies
View Related
Jan 12, 2014
Write a program to copy file from c: drive to another drive and avoid duplication??????????
View Replies
View Related
Jul 28, 2011
I want to monitor performance of web application, running in java JVM(Java version 1.5.0_22) using tomcat web server, for a given functionality want to find, methods and sql queries how much time taking for execution. i am looking for setting and free tools available.
View Replies
View Related
Mar 7, 2014
Have you ever did a design for an application with requirements such as X number of anticipated users of the application in the next 5 years, and should still perform as expected.
How do you usually implement design solution for this? the only solution I am familiar with when faced with this type of requirement is the use of EJBs (is that even a correct design for it?).
View Replies
View Related
Oct 10, 2013
I have an application which has 10 million rows and 1000 columns in Oracle. Each value has a different set of calculations that are stored in User Defined PLSQL functions.
Data is displayed in form of data grid. When a user updates any value, the calculation is performed using plsql function and value is stored in database. Is there an easy way through which calculation is performed on the fly and i get maximum performance ?
View Replies
View Related
Feb 18, 2015
How to improve jsp page load performance and i have use sessions in jsp page.i tried using with include tag rather than using jsp:include. also
View Replies
View Related
Mar 6, 2015
Visual effects such as Transitions perform very poor on linux "wheezy" compared to windows. I noticed this on different PC's, checked for Java7 and Java8. If the UI contains many objects then the transition sometimes does not even appear.
I do not think this is graphic card related since videos play quite ok.
I use the default ATI driver without Xorg.conf file and installed the xcompmgr
and tried several options, such as
Option "Composite" "Enable"
or
Option "backingstore" "true"
Option "AllowGLXWithComposite" "true"
This did not speed up things, are there other things that I could do to improve the performance ?
View Replies
View Related
Dec 23, 2013
As the JRE environments and usage of applets has become more and more secure in through the evolution of enhancements to the JRE we have noticed a performance degradation in usage of these applets and launching of them.
As our customers are in the business to business environment they utilize our applets that are delivered from the server to the client. We are looking at ways to reduce the time to validate that the certificates are still valid. we are looking for ways to provide a means for our customers to validate against a CRL on our server or to cache the the checks against the OCSP so that not each and every client accessing our server needs to go out to the third party sites to get the checks completed.
Is there a means to store this information on our server and have the JRE validate against that system rather than the normal OSCP...
View Replies
View Related
Sep 1, 2014
I'm trying to build a method that can search a binary search tree for a specific target and then return the number of probes it took to get there. It seems to me that the best way to do this would be a recursive search method and a counter that tracks the number of calls. But I'm struggling with how to implement this. Here's the code I have so far. what works/doesn't work with the method.
// Method to search the tree for a specific name and
// return the number of probes
public T search(BTNode<T> btNode) {
[Code]....
View Replies
View Related
Jun 13, 2013
I am using infrared for monitoring performance of j2ee web application(using hibernate and spring),deploying on tomcat 7.0.23 and jdk 1.6.17.here infrared shows only http layer not sql and jsp layer.
View Replies
View Related
Apr 22, 2014
I want to create a search method that returns the frequency of a word in the search method.
public class IndexTree {
private class TreeNode {
TreeNode left;
String word;
int frequency;
TreeNode right;
[Code] .....
View Replies
View Related
Sep 24, 2014
One of the requirements of my programming assignment is that a user enters a command along with two numbers. For example, if I entered the following command:
I 5 6
The program create an image like this (it wouldn't be outputted though):
00000
00000
00000
00000
00000
00000
It creates a 5 x 6 "image". This is where my troubles begin. The program should also accepts other commands, such as:
L 3 2 F
which would produce (also not outputted):
00000
00F00
00000
00000
00000
00000
Here is my method for creating an "image" with an M * N array
for (int i = 0; i < column; i++) {
for (int j = 0; j < row; j++) {
System.out.print("0");
} System.out.println();
}
The code works, but I need to store the image in an array so it can be changed by other methods (I can't create the image manually every time). I tried doing something like this but it doesn't work:
public static String[][] createImage(int row, int column) {
String[][] image = new String[row][column];
for (int i = 0; i < column; i++) {
for (int j = 0; j < row; j++) {
image[j][i] = "0";
} System.out.println();
} return image;
}
This method outputs as many blank lines as the columns I entered and the memory location of image.
So my question is: how would I store "0" in a 2D array so that it can be accessed and changed by other methods?Or, am I using a 2D array incorrectly and will the image have to be created manually every time? If so, how would I output image if it is created in a separate method?
View Replies
View Related
Aug 6, 2014
I am storing out of range values in int and byte type
public class OverflowDemo {
public static void main(String args[]) {
int value = 2147483647 + 10;
System.out.println(value);
byte b=127+10;
System.out.println(b);
}
}
Program will give error for only byte type as OverflowDemo.java:8: error: possible loss of precision
byte b=127+1; ^
required: byte
found: int
So why not for Integer?
View Replies
View Related
Apr 1, 2014
how can i store biginteger in an array?
View Replies
View Related
Oct 9, 2014
I trying to write a piece of code which takes a set of numbers or even data type and stores in an array (or something more suitable).
For example:
Date N1 N2 N3 N4 N5 Day
10/11/2012 10 09 32 100 15 Thursday
11/12/2013 01 0 0 23 50 51 Tuesday
I'd like to be able to sort them so that if I want to search for one of the entries, I can then create a function which allows me to sort them by date or even return all the numbers by a given date or day, etc....
However, I'd like to be able to set it up so that each set is "linked" meaning that again that I can search by date and it returns everything at that date.
I wanted to use an array but I don't know:
-How to do it?
-Whether this is a suitable approach?
View Replies
View Related
Dec 3, 2014
I have the following method that I need to implement:
{
// YOUR CODE HERE
File file = new File(filename);
int counter = 0;
String tempArtist, tempName;
Album tempAlbum;
Track tempTrack;
[code]....
Ok so I updated my code from the initial post since I made some progress on my own. I guess now I'm just stuck on how to scan in the file of strings and stock it into the type Track. (I've tried using both the initial linked list for this and a temporary variable with no luck).
View Replies
View Related
Mar 26, 2014
I've the following requirement. A centralized server needs to be established using java code. The server's responsibility is receiving the status of the each client machine as a XML file and storing it in the server's disk space. The client machine also runs the java code to send the status to the server as an XML file in a daily basis. I've planned to create a SOAP webservice in server machine and client machine will invoke the soap webservice to send the status. Do I have to establish any FTP server for storing the XML files? Is there any other better solution for this requirement?
Do I have to establish any FTP server for storing the XML files?
View Replies
View Related
May 20, 2014
Write a complete Student class that allows you to use the statements such as the following in methods in outside classes, with the obvious meanings. Then write an application program that creates one student object, reads in test grades until a negative "grade" is seen (as a signal that the list of grades has ended), then prints out all available information about the Student:
Student bob = new Student ("Robert", "Newhart");
bob.storeGrade (23); // bob scored 23 on this test
return bob.getTotalGrades();; // total of test scores to date
return bob.getAverageGrade();; // for all test scores to date
return bob.getName();; // returns "Robert Newhart"
What I need is in the Student class... I'm not sure how to go about storing the grades without renewing the value of storeGrade (I'm sure what I have right now is incorrect, but I'm stuck). This is what I have so far, as you can see I left some of the grade-related bits blank for now, but all I want to know is how I can store the grades:
Java Code:
public class Student extends Object
{
private int itsTotalGrades;
private int itsAverageGrades;
private String itsFirstName;
private String itsLastName;
private int storeGrade;
public Student (String first, String last)
[Code] ....
View Replies
View Related
Jun 10, 2014
I am building an app, where I have to store the data eg: "hello ! how are you" in java as a string and then use scanner to get input and check if the entered word is present in the line stored. If it is stored then the entire sentence must be displayed. eg : if the stored string is "hello how are you"
if the entered string is "how", then the entire sentence "hello how are you" should be displayed.
View Replies
View Related
Jul 29, 2014
I need to store the data of a bunch of objects of a particular class in files in a predefined directory. Later, I want to get all the files from the directory and turn them into the objects again. Ideally, I'd like to have one file per object and have the files be human-readable and editable without too much difficulty. The class used by the objects will likely be subject to change in the future, as well. To keep things simple, all the data members are either primitives, Strings, or arrays of them. What is the best library/API to use to deal with this situation? Or should I write my own classes for these operations?
I read into serialization, but I read that it doesn't deal well with classes that are frequently modified. I also found articles on Preferences, but none of the ones I saw seem to explain how to best handle reading and writing to and from multiple objects, especially when I don't know a prior all the objects that were written to disk.
View Replies
View Related
Oct 21, 2014
I'm trying to get data from a GUI input window into an ArrayList and back out via a JTable. I can get the array lists to print to the console within the input class, but I need to wire it to a data container and out through a different class. Here is code from one input class, and its corresponding output class:
Input:
public class AddClassroom extends JFrame implements java.awt.event.ActionListener {
// UI components
// are declared here...
[code]....
View Replies
View Related
Mar 31, 2014
How can I store a value in long type variable whose range is greater than int type variable ....
View Replies
View Related
Jul 22, 2014
I've sample code of jsp and servlets. Below is my code.
Index.html
<!DOCTYPE html>
<html>
<head>
<meta charset="ISO-8859-1">
<title>Insert title here</title>
</head>
<body>
<form action="AnnotationServlet">
[code]....
Now I want to store those username and age(in .html) somewhere and I want those information in welcome.jsp. Now, I'm storing all those in session itself(In doGet method(servlet)).
2 Doubt) Also, when I get the session in servlet HttpSession session = request.getSession(); line No. 27. The session value is org. apache. catalina. session. StandardSessionFacade@69a8bf4f...I'm expecting that session is to be empty. Because, I dint store anything until that line.
View Replies
View Related
Jun 5, 2014
Any article where it mentions about when the class is loaded into memory?Does it happen before the server starts?
Also does the class needed to be loaded into memory? Can the JVM not just execute the code without storing in memory?
I searched in google. Could not get anything concrete.
View Replies
View Related
Mar 1, 2015
Java Code:
package inventory;
import java.util.ArrayList;
import java.util.Scanner;
import java.io.FileReader;
import java.io.FileNotFoundException;
public class Inventory
{
private static Scanner scan = new Scanner(System.in);
public static void main(String[] args) {
ArrayList<Product> InventoryList = new ArrayList<>();
Inventory I = new Inventory();
int option = 0;
View Replies
View Related