search
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
Check if all of multiple strings or regexes exist in a file
Awk is the tool that the guys who invented grep, shell, etc. invented to do general text manipulation jobs like this so not sure why you’d want to try to avoid it. In case brevity is what you’re looking for, here’s the GNU awk one-liner to do just what you asked for: awk ‘NR==FNR{a[$0];next} {for(s … 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
Search by foreign key id in admin
as with the other admin options, you need to use __ for foreign keys e.g. search_fields = [‘id’, ‘transaction__id’]
Can I do a wildcard (*) search on github.com?
The easiest way to find a file in a repository is to use the file finder. You can activate it at any time when you are in repository view by pressing t. See this screenshot from the official annoucement: The file finder will perform some fuzzy matching using the characters you input into the “search … 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