Skip to main content

Posts

Showing posts with the label search

Changing the size of the UISearchBar TextField?

I have a UITableView with an Index on the side; I want to add a UISearchBar to it, but the index overlaps with the "x" to clear the search. I've noticed in the Contacts application, the textfield within the UISearchBar is resized to accommodate this, but I can't work out how to do this in my own app. I have tried the following in my viewDidLoad, but it does not seem to work. UITextField * textField = (UITextField *)[[self.search subviews] objectAtIndex:0]; CGRect r = textField.frame; [textField setFrame:CGRectMake(r.origin.x, r.origin.y, r.size.height, r.size.width-30)]; Any ideas? Source: Tips4all

"Did you mean” feature on a dictionary database

I have a ~300.000 row table; which includes technical terms; queried using PHP and MySQL + FULLTEXT indexes. But when I searching a wrong typed term; for example "hyperpext"; naturally giving no results. I need to "compansate" little writing errors and getting nearest record from database. How I can accomplish such feaure? I know (actually, learned today) about Levenshtein distance, Soundex and Metaphone algorithms but currently not having a solid idea to implement this to querying against database. Best regards. (Sorry about my poor English, I'm trying to do my best) Source: Tips4all

Android Market, Search results position Mystery

How is an app's position in the Android Market search results determined? Is it as mysterious and complex as Google Web search results? We obviously don't want to change any words in our app's title or description that would hurt our position. Same question applies for not only search results, but when clicking on a Category in the Android Market. How is the order of the list determined? Hopefully someone here can help. I would think that Google would have published some guidelines at least that could help, but I haven't found anything yet.

Get files from Jar which is on the repository without downloading the whole Jar from Java

I would like to access the jar file on the repository, search inside it for the certain files, retrieve those files and store them on my hard disc. I don't want to download the whole jar and then to search for it. So let's assume I have the address of the Jar. Can someone provide me with the code for the rest of the problem? public void searchInsideJar(final String jarUrl, final String artifactId, final String artifactVersion) { InputStream is = null; OutputStream outStream = null; JarInputStream jis = null; int i = 1; try { String strDirectory = "C:/Users/ilijab/" + artifactId +artifactVersion; // Create one directory boolean success = (new File(strDirectory)).mkdir(); if (success) { System.out.println("Directory: " + strDirectory + " created"); } is = new URL(jarUrl).openStream(); jis = new JarInputStream(is); while (true) { J

Java code to find a particular number from a given list of numbers

How would you solve the following java problem? Write code that finds a particular number from a given list of numbers which are stored as strings? I assume you would have to convert the strings to ints or doubles, using double.parse double or int.parse int and then do some kind of binary search maybe? Here's what I have tried so far import java.io.*; import java.util.Scanner; public class FindNum { static int nElems; static String[] array; public static void main (String[] args) throws IOException { File testFile = new File("X:\\numbers.txt"); Scanner in = new Scanner(System.in); System.out.println("What number would you like to find?"); nElems = in.nextInt(); while(true){ System.out.println("Binary search"); array = new String[nElems]; getContents(testFile);//loads the file That's just basic input to get the access the file witht the list of numbers wondering how would I go about coding a binary se

JqGrid - Simple Searching With Additional Field(s)

i am using jqgrid and have simple searching enabled. i am wondering if there is a way to add an additional item in the select list of fields that does not exist as a column in the grid. i would call it something like 'Any Field' so i could search on any of the fields and then handle that outcome server side. thanks grant.

JqGrid - Simple Searching With Additional Field(s)

i am using jqgrid and have simple searching enabled. i am wondering if there is a way to add an additional item in the select list of fields that does not exist as a column in the grid. i would call it something like 'Any Field' so i could search on any of the fields and then handle that outcome server side. thanks grant.

Replacing special characters like dots in javascript

I have a search query from the user and I want to process it before applying to browser. since I'm using SEO with htaccess and the search url looks like this : /search/[user query] I should do something to prevent user from doing naughty things.. :) Like searching ../include/conf.php which will result in giving away my configuration file. I want to process the query like removing spaces, removing dots(which will cause problems), commas,etc. var q = document.getElementById('q').value; var q = q.replace(/ /gi,"+"); var q = q.replace(/../gi,""); document.location='search/'+q; the first replace works just fine but the second one messes with my query.. any solution to replacing this risky characters safely?