search

Workaround or alternative to no static methods on an interface

I'm implementing some naive searching in my application, and searches will take place on a couple of different object types (Customer, Appointment, Activity, etc.). I'm trying to create an interface that will have types that are searchable. What I'd like to do is something like this: public interface ISearchable { // Contains the 'a...

How to optimize my current getMax method to retrieve the highest number in an array?

What would be the best way to optimize this code below to make it more efficient while applying the 'best practices'. This is just a simple school project and it works, I've tested it. But I just feel like there's a better and more efficient way to write this method. What do you think? I have an array that is pre-populated with a bunch...

php search string for latin characters

Hi, I am reading a database and i want to find if the field title contains only latin characters, numbers and any special character. I know that regular expression must be used but i am not very good at reg exp. Can anyone help. ...

PHP to search within txt file and echo the whole line

Hi there, Thank you for taking the time to read this and I will appreciate every single response no mater the quality of content. :) Using php, I'm trying to create a script which will search within a text file and grab that entire line and echo it. I have a text file (.txt) titled "numorder.txt" and within that text file, there are s...

How to build an iframe page that searches and displays multiple sites?

I'm trying to build a page similar to www.bing-vs-google.com, but instead of bing and google, I want to populate it with several of my company's internally-used sites. This would function as a "universal search" for our employees to search across a variety of sites (all of which pass search queries via URL). Has anyone seen or done thi...

GrepCode: searching for String constants

I have been using http://www.grepcode.com/ a lot lately to dig into the internals of common libraries to determine what a specific error means. (like what does "Connection reset" mean when using Axis? turns out it means that the socket closed but the buffer doesn't contain an EOF marker in it... though i still can't replicate this except...

Does string exist check 20k times

I have an ITunes library XML file backup file - about 15 MB. I have 20K music files on my C drive and about 25K files on E drive under exactly similar folder structures. I am traversing the first location and going file by file and checking if the file exiss in the second location. That part works for me. Now, for all such duplicate f...

Python binary search always returns target not found value

I've written the following code to do a binary search for a value, target, in a list or tuple, collection. def binary(collection, target): """Binary search Takes a sorted list or tuple, collection, then searches for target Returns -1 if item isn't found. """ length = len(collection) minimum = 0 maximum = length -...

efficient way to find matches against two strings

I need to find all equal substrings against two strings. I've tried to use suffix tree to lookup substrings and it works fast, but too memory consuming (inappropriate for my task). Any other ideas? ...

Get total record count for a query in zend lucene search?

HI I have used "setResultSetLimit(1000)" method to limit results to 1000 records. The good thing is It helps to save server resources, but there is noway to get full record count for a query. Is any one know how to get full hit count? TX ...

Sliding window searching algorithm

Hi I am in need of a data storage type and algorithm for keeping track of the status of the last N items I have seen. Each item has a status of Pass or Fail, but the system I am monitoring will deemed to have failed if M items in a row have failed. Once the system is deemed to have failed I then need to scan back through the history of...

Should I use Google site search or a custom database search for my site?

I'm coding a resource site around a fairly large directory database, and I'd like to make some kind of in-site search available for my visitors. I'm debating between whether to use Google's premade site search (which I can drop right into my template) or coding a custom search that accesses the database directly. Obviously, the custom s...

Search Short Fields Using Solr, Etc. or Use Straight-Forward DB Index

Hello, My website stores several million entities. Visitors search for entities by typing words contained only in the titles. The titles are at most 100 characters long. This is not a case of classic document search, where users search inside large blobs. The fields are very short. Also, the main issue here is performance (and not r...

how to fill JTextFields with the columns of a JTable search?

I have a master/detail form with a JTable on top, and all the JTextFields corresponding below in the JPanel. I'm trying to make a search in the JTable, so that when the correct row gets picked, all the JTextFields can be filled with the column values. I don't know how can I call the rows programmatically to do so. How would it be done...

Ordering results by relevance using Solr search

I'm new to Solr search and trying to get a grasp on how to handle ordering of results. I'm using Ruby on Rails together with the Sunspot gem to interface with Solr. I have an Article model, that has the following fields that are indexed: text Title text AuthorNames integer NumberOfReviews I'd like to be able to perform a search on So...

Ruby/Rails Simple search form and white spaces

Hi, I've implemented a "simple search form" (railscasts #37) in my app, but I wonder how: 1.) I cannot display any results if the keywords field is empty, or if the index page is loaded (I've tried search != "". Maybe there is a better way) 2.) I can add a function which avoid multiple white spaces in the search. (if users wrote someth...

Similar image search software (like TinEye)

Hi guys, In one of our community sites, we allow users to upload images. These images are approved or rejected by our moderators. To limit the work needed by our administrators, we want to 'log' each picture that is rejected to some kind of database, and do a lookup in this database prior to submitting an image for approval. If a simi...

asp.net ajax toolkit list search type of plugin in Jquery

Am looking for asp.net Ajax control toolkit List Search type of plugin in JQuery. Ref. http://www.asp.net/ajax/ajaxcontroltoolkit/Samples/ListSearch/ListSearch.aspx ...

How do I find/search/grep an SVN repository history?

I need to search through all revisions of a Subversion repository to find file names and revision numbers that contain a particular string. I know that this will find occurrences in a dump: svnadmin dump $REPO_PATH | grep -i "Verdana" but the output is too cryptic. The output will include chunks of binary files that match. I have bee...

Ruby/Rails Conditional search method (if ... else "no results found")

Hi, Here is the code of a "simple search form" (thanks to jordinl) which I try to improve. I would like to add the case if there is no match found. So, there is the view (views/users/index.html.erb) <% form_tag users_path, :method => 'get' do %> <%= text_field_tag :search, params[:search] %> <%= submit_tag "Search", :name => nil ...