Help coderanch get a
new server
by contributing to the fundraiser

Ajay Singh

Ranch Hand
+ Follow
since Jan 04, 2008
Merit badge: grant badges
For More
Cows and Likes
Cows
Total received
In last 30 days
0
Forums and Threads

Recent posts by Ajay Singh

Hi,
i am trying to use Lucene for indexing and searching long terms.My terms are of the form A.B.C.D in my documents(Example "Considering.think.Considering.Cognizer.community.Considering.aux.would" is a term which is indexed).I am able to index terms of such patterns.But retrieving does not work for some of these patterns.I am using StandardAnalyzer while indexing the documents and using the same Analyzer for retrieving.While debugging i found that query.toString is blank(empty) for the patterns which are not being searched.Otherwise some values comes in the Sysout in line number 3 below of my term search logic.


QueryParser queryParser = new QueryParser(Version.LUCENE_30,"TM", standardAnalyzer);
Query query= queryParser.parse("\"" + termToBeSearched + "\"");
System.out.println("===================================================Query :: "+query.toString());
System.out.println("=======================Query Class---->"+query.getClass());



Pattern Number 1:-
"Considering.think.Considering.Cognizer.community.Considering.aux.would"

Pattern Number 2:-
"Prohibiting.deny.Prohibiting.StateUNDRofUNDRaffairs.access.Prohibiting.StateUNDRofUNDRaffairs.Descriptor.church.Prohibiting.Explanation.premise.Prohibiting.Explanation.Descriptor.school.Prohibiting.Explanation.view.Prohibiting.Explanation.Characteristic.film.Prohibiting.Explanation.KindUNDRof.public"

The query.toString has some values for Pattern no 1( and is able to search it) but is empty/blank for Pattern number 2 while searching although indexing happens for both. What am i doing wrong? is there any limit in lucene regarding term length.Even some of the bigger length terms compared to the second pattern is being searched successfully,so i dont think that is the case.Please guide me.


Thanks in advance.
Hi
I want to test the timeout functionality of java using futuretask and callable interface. Here is my code. Basically i have three sentences in my array.I want to time out(5 seconds) the second sentence based on the futuretask.get(long,timeunit) method as shown in the code below.for the second sentence i am just calling an infinite loop in the "blockingFunction" function.I am able to catch the timeout exception for the second sentence but i see that the loop continues running evern after the time out exception.Please tell me where i am going wrong.
Hi
i have the following set of statements
1)I am buying a mobile
2)i am buying a tv in usa.
3)i am buying a potato
4)i am buying a tv in dreams.



I have a regex group called electronicItems which has mobile,tv,referigerator etc.Also i have a group for countries which is optional.The word
"buying" is compulsory in my statement and the electronicItem group is also compulsory.so based on these conditions only the first two statements should be matched.
so i have written the following regex

(I)?.*(buying).*(mobile|tv).*(usa|uk)? --->this matches 1st,2nd and 4th statements

Also i am not able to see the country group using matcher.group(4) function.

i want to match only the first two statments along with the captured groups,how do i achieve this?please guide.

thanks in advance,

ajay
13 years ago
Hi all,

I am using mssql authentication(username,password) to connect to the database in a remote location.Now i have a requirement that i need to use Windows impersonation to connect to the same database.In short Username for the Server machine is provided to connect, which can be used by anyone.Is this possible using java?If yes,kindly guide me.

Thanks
Ajay
I have a table(having two columns 'name','company') which is displayed in JSP.Presently i am passing the values row by row to the servlet through the javascript function.Hence the servlet is called as many times as the number of rows in the table.What i am looking for is to put all the name-value pair in a JSONObject in the javascript and then pass this object to the servlet.I tried something like this

// js function
var jsonToBePassed = {};
for (var i = 0; i < NumberOfTableRows; i++)
{
var c= $(this).find('select').attr("company");
var n =$(this).find('select').attr("name");
alert(c);
alert(n); //both the alerts are working
jsonToBePassed .push({name:n, company: c}); // this is not working
}

My aim is to get the following in the javascript
var jsonTobePassed= { "NameCompanyPair" : [ //total size should be equal to number of rows of table
{ "name" : "John",
"company" : "Google"},

{ "name" : "Mark",
"company" : "Yahoo"},

{ "name" : "Sam",
"company" : "Microsoft"},

]

}

Is this the correct way to do?please help
Hi all,
Can someone suggest me on how to pass the object from the server side(servlet) to the jsp.Precisely.i have a form having a textfield for entering a person's name and a 'process' button.I have called a js function (using ajax) on the click of the button,the persons name goes to the server and fetches information like,organization,date of birth and a String array( having the names of the person who work under him).The object information is displayed correctly in the servlet.Now how do i pass the bean object(organization,dob,stringarray) into the js function and display the information in the jsp.i tried request setattribute and getattribute but i am not sure whether it works on onclick of a button.Is JSON something which i should look upon.Someone guide me please.

Thanks in advance
Ajay
Hi all,

i need to display an xml in jsp when i click a button.I am using ajax,writing the xml using the out.write object where out is printwriter object in the servlet.
I am able to retrieve the xml String using alert(XHR.responseText) function in the javascript function, but when i try to put the same String in a placeholder in jsp(using div tag) that is not getting printed.Morever XHR.responseXML gives me an Object not the whole xml.
Is there is something i am missing
Please help.

Server side code
response.setContentType("text/xml");
out.write("<?xml version='1.0' encoding='ISO-8859-1'?>");
out.write("<sets>");
out.write("<set name=''>");
out.write("</set>");
out.write("</sets>");


alert("Response--"+XHR.responseText); //displays correctly the xml

document.getElementById('load').innerHTML=XHR.responseText //does not get printed in the 'load' placeholder

thanks
Ajay
Thanks for the reply,

In the db i have a table which contains say 2 columns i which has some dummy values.i just wanna do some operations like add,delete,modify etc in the client side without using any server side technologies(php,cgi,asp,jsp etc).Something which is runtime,dynamic without the page reloading.Any ideas?
Thanks for the reply
I was looking into this technique so as to speed up the query,reduce overload etc while directly interacting with the database instead of going to a db through a servlet.Is there any
other technology/framework which can help me in this regard?

Ajay
Hi all,

I have one requirement in which i need to enter say name and occupation in a html page and these values should be written into the database through Ajax/JQuery etc
without going to a servlet.ie it should directly write the database without any intermediate layer.Is it possible using the said techniques.Any pointers in this regard would be helpful.

Thanks in advance.
Ajay

Hi all

I am displaying employee object information in a jsp.I am displaying 4 employee information(having elements name,age,designation) in four different inline frames in the jsp.I want to display a relationship between say frame1 and frame2 with arrows having relationship "and",frame2 with frame3 having relationship "or".Is there any jsp specific way to do this.Any third party libraries which can be used for the task?.Please give me some ideas.

Thanks in advance
Hi all

I was searching for a way to display the syntax tree of a sentence in a jsp,just like the way its shown in http://ironcreek.net/phpsyntaxtree/.Precisely i have a string having the same same format as shown in the mentioned site,given this string i should be able to display the syntax tree structure in jsp.Any help would be appreciated.

Thanks in advance
Ajay
14 years ago
JSP
Hi everyone

i am trying to implement a look up algorithm for searching in a dictionary(flat file).Dictionary contains a list of proverbs such as Life after death,
Life begins at forty etc ordered alphabetically starting .Also the first word of the proverb("life" for the above case) is stored in a hashmap.What i am trying to implement is when an input sentence having the proverb (say Life begins at forty) comes it should directly look up the only the proverb starting with Life instead of parsing all the proverb list alphabetically from the dictionary file.I was thinking of using finite state automata for the same,but as the dictionary list increases the system may become too complex.Kindly share any other ideas.

Thanks in advance
Ajay
14 years ago

By modules i mean a separate independent application only.but talking about JMS,isn't it related to server programming stuff,what i am looking is
another application(blackboard,some kind of centralized class) .

Assume that we have three separate modules which work on the same input(say a paragraph of text). These modules perform mutually exclusive functionality, but the output of one module processing the input, may be required to be handled by the other two modules. In this scenario, a blackboard architecture would be appropriate to show to all the modules the subsequent output of a single module, and if one of the other modules deems it relevant to process this particular output, it should retrieve the output from the blackboard. I am clueless as to how to implement this architecture in Java.Ideas welcome

Thanks in advance
Ajay
14 years ago
Thank you for the reply,atleast i have something to start with now
14 years ago