Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Questions asking us to recommend or find a tool, library or favorite off-site resource are off-topic for Stack Overflow as they tend to attract opinionated answers and spam. Instead, describe the problem and what has been done so far to solve it.
Closed 8 years ago.
Improve this question
I have reasearched a couple of options for MySQL & php search on the web and StackOverflow, but have not found something that really fits my scenario. Let me explain.
My scenario:
I have a table (TABLE1) in MySQL that has indexed terms (e.g. McDonalds, Microsoft, etc). This table has over 3000000 records.
I then have generic string that the user can enter - e.g. "There is a company called MCDonalds in my neighbourhood".
What i would like to look for occurances in the user entered string for any terms in my mysql table. I have implemented this currently by traversing each of the 3 million records in TABLE1 to see if it is in the user entered string (entered by user through a PHP page).
3 approach works 'well' - but of course it does not scale and the performance sucks :)
Any suggestion or pointers to algorithms to solve such a problem.. in a scalable and algorithmically sound way?
Thanks,
Joe
You should try MySQL's FULLTEXT search capability. Try something like this:
SELECT whatever, whatever
FROM TABLE1
WHERE MATCH(terms_column) AGAINST('There is a company called McDonalds in my neighbourhood')
You'll probably get lots of false positive matches, but this is an efficient way to at least narrow down the search.
It worked for me on a list of US cities matching against phrases like "Im going back to New Orleans to wear the ball and chain" and "Chicago, New York, Detroit and its all on the same street.".
You will need a FULLTEXT index on the your terms_column. And your table may, depending on the version of MySQL you're using, need to be in the MyISAM storage method.
Related
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Questions asking us to recommend or find a tool, library or favorite off-site resource are off-topic for Stack Overflow as they tend to attract opinionated answers and spam. Instead, describe the problem and what has been done so far to solve it.
Closed 9 years ago.
Improve this question
I have a huge table with a lot of records that I want to split into smaller tables to make it normalized. I already have the model for the normalized table. Now, I want to take all the records from the huge table and split them up into the several tables that'll normalize the data.
Is there a tool to make this process easy? I'm planning to write a script in PHP to loop through the records in the huge table and and split them up into the other tables.
Some ETL tools might be clever enough to allow you to split data into multiple destination tables, but I don't know of one offhand. You can try Kettle.
In my experience, these kinds of tasks are often so custom that it's necessary to write a one-off script.
NORMA for conceptual database design. One side-effect is that it produces the schema for a properly normalized database.
But the best solution is that you should be able to fully understand how to normalize forms, for how long you will be dependent on any tools to do this for you? I would suggest you to study a bit about it so that you could come up with the best solution yourself. As a developer, you will face this every now and then, and what about an interview, let's suppose where you are asked about it? And as Mitch Wheat said, normalization should not require a tool :)
Here are some more resources to get you started:
http://dev.mysql.com/tech-resources/articles/intro-to-normalization.html
Source: MySQL website (Official)
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Questions asking us to recommend or find a tool, library or favorite off-site resource are off-topic for Stack Overflow as they tend to attract opinionated answers and spam. Instead, describe the problem and what has been done so far to solve it.
Closed 9 years ago.
Improve this question
(Please read patiently)
I am developing a application which searches for html documents based on keywords passed like : I want to buy a watch OR A watch for sale or etc. I have large list of html documents which contain these keywords but the problem I am currently facing is that I want to fetch only those docs who match best with the keywords. Suppose I am trying to find a post about selling a watch and tried with keyword : sell a watch this should bring the most relevant post which is actually selling a watch not with just contains selling word and watch word
You could ask what I have done so far : well I have done searching the documents with a simple PHP string search and this is doing just what I don't want to. I like to have natural search, Any third party API or Any idea could help a lot.
Note : I don't have the documents saved in the DB I am just pulling them up from Internet to my code and finding with keyword if they are relevant.
Thanks
Zend_Search_Lucene might help you. http://framework.zend.com/manual/1.12/en/zend.search.lucene.html
If you have the possibility to install a search engine on your server I would recommend Sphinx or ElasticSearch.
You coul also use some 3rd party search SAAS like (in no particular order):
http://www.indexden.com/
http://www.searchify.com/
http://www.found.no/
http://websolr.com/
https://swiftype.com/
https://searchbox.io/
http://www.houndsleuth.com/
http://www.bonsai.io/home
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Questions asking us to recommend or find a tool, library or favorite off-site resource are off-topic for Stack Overflow as they tend to attract opinionated answers and spam. Instead, describe the problem and what has been done so far to solve it.
Closed 9 years ago.
Improve this question
I would like to find a way to be able to split a word into syllables with PHP. For example, the word "nevermore" ran through detect_syllables(), would return "nev-er-more." Are there any good APIs or something out there?
There's a useful PHd thesis paper by Frank Liang that describes an exceptionally accurate algorithm for this: written over 25 years ago, it's still valid. But I'm not aware of any implementation in PHP
EDIT
A quick google has identified this link to a Text Statistics library in PHP, which includes algorithms for syllable counting within words (among other readability measuring algorithms). You should be able to find the code for syllable splitting here.
I'm actually in the finishing stages of making a PHP Hyphenator class based upon Frank Liang's algorithm and the TeX dictionaries, which pretty much seems to be the appoach taken by all office suites. (Actually I found this topic while looking for a good name for it that wasn't already taken). With slowly improving support from browsers for the entity, it's becoming a realistic option to hyphenate content in websites.
Core functionality is working; splitting (and thus counting) and/or hyphenating text and/or HTML, parsing TeX hyphen dictionaries, caching those parsed dictionaries. Some planned features are still missing but nothing that stops you from using it. Also there's no good documentation, samples, formal unittest or vanity site yet.
I've created a github site for it here and will post the current version on it ASAP, so check back in a few days.
I've only tested it with Dutch (my native language) and US English, so it may still have some issues with languages using different character sets.
Note that Frank Liang's paper is on hyphenation, NOT on syllable detection. In addition, his thesis paper itself states that its success rate is around 89% for the dictionary he used, which is not going to be good enough for everyone. There really is no substitute for manually doing it for every single word it seems. It's not that efficient to have to require a complete one-to-one lookup table wordlist in order to do it, but these days storage space is far less expensive than CPU time anyways.
Perhaps someone might consider making a CAPTCHA-like service so that many users could be asked to provide the solution to every known word, with the results checked against each other, so that one person wouldn't have to do it all themselves. I'd hope the results would be released freely once complete.
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Questions asking us to recommend or find a tool, library or favorite off-site resource are off-topic for Stack Overflow as they tend to attract opinionated answers and spam. Instead, describe the problem and what has been done so far to solve it.
Closed 9 years ago.
Improve this question
I am looking to add some dynamics to our corporate website. This is a secondary role so I'd rather not be spending a ton of time on it.
At this point, all I need is a simple PHP script where a non-technical user can pull up and manage the records in a MySQL table. There's only one table of data to be managed; it's just that it will be accessed and updated quite frequently.
I recall that Grails' default scaffolding feature has precisely this: list of entries with the ability to add, edit and delete, with no nonsense.
What would be the best tool to use for this? I would rather not be writing it from scratch, as this will take me quite some time.
It seems like the kind of thing that ought to exist somewhere.
Thanks!
Have a look at Xataface. It's essentially a CRUD interface to your db. It's straightforward to install, open source and can be styled to match your corporate intranet.
for the db script, I recommend phpMyAdmin. It requires sql knowledge to do complex things, but simple operations are made friendly.
If you are looking for similar functionality of Rails, there is CakePHP, which can automatically generate code for scaffolded views to add, edit, view and delete records.
You can also check out https://github.com/laravella/crud
http://laravella.github.io/docs/
It is built on laravel, easy to install, endless possibilities.
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Questions asking us to recommend or find a tool, library or favorite off-site resource are off-topic for Stack Overflow as they tend to attract opinionated answers and spam. Instead, describe the problem and what has been done so far to solve it.
Closed 9 years ago.
Improve this question
Are there any APIs for helping running tournaments that can draw brackets, count scores, etc? Something on PHP/javascript would be nice but I can't find any.
Thanks.
I'm in the process of building one right now.
Mine supports Round-Robin, Single-Elimination, and Boil-Off tournaments! I am working on Double Elimination as we speak. [I actually need to get it done for an event we have this weekend. ;)]
It also supports the folowing scoring modes: Highest Score (Team Sports), Lowest Score (Golf, etc.), Highest Time (King-of-the-Hill), and Lowest Time (Racing, etc.).
http://tournaments.codeplex.com
Here it is in action:
http://lanlordz.net/Events/ViewTournament/4
As you can tell, it was optimized for LAN parties.
It is not in PHP; but, I would encourage a port to PHP.
http://www.tourneylogic.com/products/bracketcontrol/default.aspx
Not free though
There is a pretty useful jquery plugin that draws a binary tree which can be used for building tourney brackets.