Search a whole table in mySQL for a string

Try something like this: SELECT * FROM clients WHERE CONCAT(field1, ”, field2, ”, fieldn) LIKE “%Mary%” You may want to see SQL docs for additional information on string operators and regular expressions. Edit: There may be some issues with NULL fields, so just in case you may want to use IFNULL(field_i, ”) instead of just … Read more

How to search an array in Jquery like SQL LIKE %value% statement

Vanilla JS To search in the array with Vanilla JS I would use the filter() method implemented into the Array prototype. Note: For very large arrays you might want to consider refactoring those to async/await functions else it might slow down the user interface. 1. Using regular expressions (slower) This is the most flexible approach … Read more

Improving search result using Levenshtein distance in Java

Without understanding the meaning of the words like @DrYap suggests, the next logical unit to compare two words (if you are not looking for misspellings) is syllables. It is very easy to modify Levenshtein to compare syllables instead of characters. The hard part is breaking the words into syllables. There is a Java implementation TeXHyphenator-J … Read more

How do I disable Firefox’s “Search for text when I start typing” on pages with keyboard shortcuts?

To disable this in firefox, just go to “Options->General Tab->Browsing and disable “Search for text when I start typing”. More info here . This is very useful in some cases, for example when you try to play WebGL games or when using pages like Gmail or Protonmail that have their own kb shortcuts. UPDATED to … Read more

Find Facebook user (url to profile page) by known email address

The definitive answer to this is from Facebook themselves. In post today at https://developers.facebook.com/bugs/335452696581712 a Facebook dev says The ability to pass in an e-mail address into the “user” search type was removed on July 10, 2013. This search type only returns results that match a user’s name (including alternate name). So, alas, the simple … Read more

Partial match for the key of a std::map

You can’t efficiently search for substring, but you can for prefix: #include <iostream> #include <map> #include <string> #include <algorithm> using namespace std; typedef map<string, string> TStrStrMap; typedef pair<string, string> TStrStrPair; TStrStrMap::const_iterator FindPrefix(const TStrStrMap& map, const string& search_for) { TStrStrMap::const_iterator i = map.lower_bound(search_for); if (i != map.end()) { const string& key = i->first; if (key.compare(0, search_for.size(), … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)