w3hello.com logo
Home PHP C# C++ Android Java Javascript Python IOS SQL HTML videos Categories
Make search term disappear after search in SearchView
In onCreateOptionsMenu add, searchItem = menu.findItem(R.id.action_search); @Override public void onBackPressed() { if(searchItem.isActionViewExpanded()) searchItem.collapseActionView(); else super.onBackPressed(); } In your Activity add, @Override public void onBackPressed() { if(searchItem.isActionViewExpanded()) searchItem.collapseActionView(); else super.onBackPressed(); } If you want to target lower versions, MenuItemCompat.collapseActionView(searchItem); MenuItemCompat.isActionViewExpanded(searchItem);

Categories : Android

Ransack search not working if there is 'space' in search term
You could sanitize your data. For instance with regexp_replace(). Run in the database once: UPDATE invoice SET buyer = regexp_replace(buyer, 'ss+', ' ', 'g') WHERE buyer <> regexp_replace(buyer, 'ss+', ' ', 'g'); And sanitize new inserts & updates likewise. s .. class shorthand for "white space" (including tab or weird spaces). The 4th parameter 'g' is for "globally", needed to replace all instances, not just the first.

Categories : Ruby On Rails

Displaying a search term in search field after submit
There is no HTML5 tag that means "remember what was typed in here prior to submitting the form" -- that isn't the role of an HTML element. After the form submits, you're on a new page. You'll either be redirecting, or rendering a page. So, to display the search term in the form, you'll need to place the term in the value attribute of the search field as you render the results page, whatever method you use to do so. I'm not sure what server-side technology you're using, so I can't be very specific, but generally: <input ... value="[IF length($searchValue) > 0 THEN print $searchValue]" ... /> Also, you are using an inline onclick event to set the value of the field to an empty string -- even if you successfully carry the value through, as soon as the user focuses on the input th

Categories : HTML

Twitter Data Analysis - Error in Term Document Matrix
I think the error is due to some "exotic" characters within the tweet messages, which the tm function cannot handle. I'v got the same error using tweets as a corpus source. Maybe the following workaround helps: # Reading some tweet messages (here from a text file) into a vector rawTweets <- readLines(con = "target_7_sample.txt", ok = TRUE, warn = FALSE, encoding = "utf-8") # Convert the tweet text explicitly into utf-8 convTweets <- iconv(rawTweets, to = "utf-8") # The above conversion leaves you with vector entries "NA", i.e. those tweets that can't be handled. Remove the "NA" entries with the following command: tweets <- (convTweets[!is.na(convTweets)]) If the deletion of some tweets is not an issue for your solution (e.g. build a word cloud) then this approach may wo

Categories : R

How to get twitter search results as json with simple browser entry since Twitter v1.1?
First you have to register your app here and get the consumer key and consumer secret. Then you will need to authenticate your request (see the documentation).

Categories : Jquery

keek API. How to use search term from several words
I have figured it out. Now I have two working versions of this code - one is js, another is php. js: var timestamp = Math.round(new Date().getTime() / 1000); var api = '(your api)'; var secret = '(your secret)'; var theUrl = "http://api.keek.com/v/1/keek/search?term="+encodeURIComponent("message me"); var parameterString = "auth_api=" + encodeURIComponent(api) + "&auth_timestamp=" + encodeURIComponent(timestamp) + "&term=" + encodeURIComponent(encodeURIComponent("message me")); console.log("PARAMSTRING: "+parameterString); var signatureBaseString = "GET&" + encodeURIComponent("http://api.keek.com/v/1/keek/search") + "&" + encodeURIComponent(parameterString); console.log("SIGBASE: "+signatureBaseString); var signingToken = api + "&" + timestamp + "&" + secret; v

Categories : PHP

Getting search term suggestions from the CQ5.5 index
It is out of the box available starting with CQ/AEM 5.6. For 5.5 (and even 5.4 IIRC) it is available as a feature pack to customers (cq search suggestions). Please contact daycare or the usual channels. The way it works is that it can store an auto-complete word index in the repository (an optimized JCR structure is used here, no Lucene et. al.). To populate this index an API can be used by passing words and their frequencies, e.g. based on the frequency that search terms are actually searched for by end users (Google-style, only works well if you have many searches going on). Another way or the way to build an initial index is provided which reads the custom Lucene index maintained by Jackrabbit.

Categories : Java

HighlIght search term using javascript in an html
Here is a very basic example: HTML Search: <input id="test"/> <ul id="results"></ul> Javascript var results = ["Result1 Description", "Result2 Description", "Result3 Description"]; $("#test").change(function(){ $("#results").empty(); var searchTerm = $(this).val(); for(var i = 0; i < results.length; i++){ if(results[i].indexOf(searchTerm) != -1){ $("#results").append("<li>"+ results[i].replace(searchTerm, "<span class="wrap">" + searchTerm + "</span>") + "</li>"); } } }); Working Example http://jsfiddle.net/t3BZ6/

Categories : Javascript

Recurring Magento search term attack
Add this to your layout-xml definition e.g. local.xml <catalogsearch_result_index translate="label"> <reference name="head"> <action method="setRobots"><value>NOINDEX,NOFOLLOW</value></action> </reference> </catalogsearch_result_index> <catalogsearch_advanced_index translate="label"> <reference name="head"> <action method="setRobots"><value>NOINDEX,NOFOLLOW</value></action> </reference> </catalogsearch_advanced_index> <catalogsearch_advanced_result translate="label"> <reference name="head"> <action method="setRobots"><value>NOINDEX,NOFOLLOW</value></action> <

Categories : Magento

Regex to collect data after one search term and before one of two others (which ever is first)
This pattern works well: SEARCH_TERM_#1(.*?)SEARCH-TERM_#2_OR_#3 The content you are interested by is in the first capture groups, see your language or software documentation to know how refer to the capture groups content. If supported you can use lookarounds: (?<=SEARCH_TERM_#1).*?(?=SEARCH-TERM_#2_OR_#3) Then the result is the whole pattern. Note that i use a lazy quantifier *? instead of a greedy quantifier *. More informations here.

Categories : Regex

Program won't accept input for first search term
System.out.print("Title: "); should be replaced by System.out.println("Title: "); I am assuming that Scanner kybd = new Scanner(System.in); since i see kybd.nextLine() method Actually, the input is not getting skipped, just that Title: and Author: getting printed next to each other because of print instead of println. Did you try typing text and hitting enter? I am sure you will be allowed to type and enter text twice

Categories : Java

Codeigniter adding search term on each paginated links
Try this: if($this->uri->segment(3)){ $keyword = $this->uri->segment(3); } else if($this->input->get('keyword')){ $keyword = $this->input->get('keyword'); } $config['base_url'] = base_url().'home/paginate_search/'.$keyword.'/page/';

Categories : PHP

Search for a term in mssql via php depending on an inconstant variable
If you want an user to be able to login to your site and stay logged in you have to save the information as which user he is logged in in some way -> SESSIONS / COOKIES For login specific data you should use SESSION since their data is stored on the server. Put session_start()at the beginning of every file you want to access any user information. Then if the user logs in you should save the nEMID or even the nAuthID via $_SEESION['nID'] = ...your id...; On any other site you can check if the user is logged in using if (isset($_SEESION['nID'])). Then you can query user-information using your "SELECT * FROM tAccounts WHERE nEMID=" . $_SEESION['nID'] Does this helps u a bit?

Categories : PHP

NEST ElasticSearch plural and singular search term
Have you tried using snowball for stemming? http://www.elasticsearch.org/guide/reference/index-modules/analysis/snowball-analyzer/ Here is a link that discusses using snowball over the standard analyzer for your exact scenario. Lucene Standard Analyzer vs Snowball

Categories : Search

Load tweets with search term in stead of username
The Twitter search API only returns tweets from the past week or so. See more info here. The Search API is not complete index of all Tweets, but instead an index of recent Tweets. At the moment that index includes between 6-9 days of Tweets. Note that the search feature on Twitter's website does query historical tweets, it is just the API that does not support them.

Categories : PHP

PERL - Multithreading to search a list of term in a very big text file
Conceptually (not specific to Perl), I'd go with something like this: Create N threads and assign each 7000/N regexes to test. Preferably, N = number of available machine threads. It might be worth assigning more or less regexes per threads, depending on the regex complexity or length. The target is that all threads will be assigned roughly the same amount of work. This might require some heavy pre-processing pass over the regexes. Load a chunk of data into memory. You can experiment with different sizes here. The target is that loading this amount of data will take roughly as long as the threads will take to process it. Start your regex threads on the data you just loaded. In parallel, use another thread to load the next chunk of data to memory. Wait until all threads are finished.

Categories : Multithreading

Elastica multiple term search not returning the correct result
I can see a few potential issues: You need to use a terms filter not a term filter. The latter only accepts one term to filter against, but you are sending two to the constructor, namely ["off_furniture", "home_furniture"] You don't need to wrap the terms filter in a bool filter if you only have one filter! I can't tell from this code alone, but the mapping for the prodcat field needs to be {"type": "string", "index": "not_analyzed"} or the tokenizer will most likely split the phrase 'home_furniture' into two tokens home and furniture and you will not get the filters working correctly. If you are not specifying the mapping explicitly, you need to do so. Sending strings at elasticsearch will automatically apply the standard analyzer. Try this: $prodcatFilter = new Elastica_Filter_Terms

Categories : Elasticsearch

python - fastest way to compare lists and search for term in list
Sets are definitely a simple way to do this quickly. Not a true performance test, but this little program runs instantaneously (on a 2.7GHz i7 iMac) with sets of 10,000 items: from sets import Set inc = set(open('big_list.txt').read().splitlines()) excl = set(open('big_list_excludes.txt').read().splitlines()) sm = set(open('small_list.txt').read().splitlines()) sm.intersection_update(inc) sm.difference_update(excl) print sm Not case insensitive, though.

Categories : Python

Updating MGTwitterEngine to New Twitter API v1.1
refer FHSTwitterEngine you can use newly FHSTwitterEngine and if you request this method without autenticating, the users status is removed... you need to send consumer key and token along with screen_name.. In FHSTwitterEngine //get username pass to method. In Dictionary you can get all info NSString *username = [[FHSTwitterEngine sharedEngine]loggedInUsername]; NSDictionary *data=[[FHSTwitterEngine sharedEngine]getUserProfile:username]; // method to get all user info -(id)getUserProfile:(NSString *)username { if (username.length == 0) { return getBadRequestError(); } NSURL *baseURL = [NSURL URLWithString:url_users_show]; OAMutableURLRequest *request = [OAMutableURLRequest requestWithURL:baseURL consumer:self.consumer token:self.accessToken]; OARequestPar

Categories : Iphone

regular expression to find word after a term and before another term
new RegExp((?=/st-(.*?/))); should throw a syntax error actually. Anyways, to prevent / from appearing in the capture group, move it outside the group (using a regex literal): var patt = /(?=/st-(.*?)/)/; I don't see a need for the lookahead and you could use a negated character class instead of lazy quantifiers: var patt = //st-([^/]+)/;

Categories : Javascript

Binary Search in Python 2 variable not updating causing an infinite loop.....why is the variable not updating?
def binary_search (z, A, start, end): if end < start: return None else: mid = start + (end - start) / 2 if (z < A[mid]): return binary_search(z, A, start, mid-1) elif (z > A[mid]): return binary_search(z, A, mid+1, end) else: return mid I changed a couple of things around. I check first changed end < start: because if len(A) == 0: will stay constant and won't allow you to use it as a base case. Also, you when you a returning the binary search you need to skip the mid value, because that's the one you are returning. I tested the code and it works!

Categories : Python

Print search term that does not exist in list comprehension of a list comprension
You could try this, which is a bit more of a pythonic version of your loop and conditional: import re resourceProperties = 'test test token test' rpAttrs = [['ajgagag', 'knkagga'], ['token', 'knkagga'], ['ajgagag', 'knkagga']] print(' '.join(value[0] for value in rpAttrs if not list(re.finditer(value[0], resourceProperties)))) This outputs: ajgagag ajgagag

Categories : Python

Searching for string whilst removing a certain part of the search term string
I used replace() to accomplish that by stripping the parenthesis part: var searchType = $("input").next().text().replace(/[^.*](.*)/g, ''); Eplaination: [^.*] : means NOT anything (.*) : means anything with parenthesis around them FIDDLE DEMO Room for optimization: Remove the last parenthesis ) so that everything after the first gets removed. /[^.*](.*/ Or make sure that the parenthesis did not belong to the actual text by forcing numbers in between them: /[^.*]([0-9]+)/g Note that a second (or multiple) occurrence of parenthesis is not specifically handled (i.e. Some kind of string (112) (22) will probably give undesired behaviour). Also note that jQuery's text() does not take regular expressions, afaik.

Categories : Jquery

Twitter API 1.1 : search api
The only way is to screen scrape. Send an AJAX request like this https://twitter.com/search?q=%23yourhashtag and use regex to get what you want from the page

Categories : Android

twitter api 1.1 search
I am guessing this is a certificate problem. You could use curl with the --insecure option to bypass any certificate problem. Or Import the certificate into the ColdFusion certificate store.

Categories : Twitter

Twitter API 1.1 Search with C# (in a PCL)
(Answered by the OP in a question edit. Converted to a community wiki answer. See Question with no answers, but issue solved in the comments ) The OP wrote: Problem solved by replacing the httpwebrequest implementation with the httpclient. The issue was that the Expect:100-Continue header was being added, and twitter doesn't support this. Due to limitations in PCL it wasn't possible to disable this in httpwebrequest replacing it all with a httpclient was a way to go. Hope this helps anyone who experiences the same issue.

Categories : C#

Twitter search within an iOS app
TWTweet class has a property called completionHandler which returns if successful/fail. i would use a uiWebview object that will display the main twitter site with a query that will search for example water falls.

Categories : IOS

Twitter Gem Search method
Did you try Twitter.search('Obama') or Twitter.search('Obama', options = {}) Also I noticed you are missing Authentication atributes. Take a look into Twitter API Doc to make sure you have all the 'required' params. PS: Do you want to search all the tweets that contains the string 'Obama' or all tweets with #Obama. The search result-set and the accuracy is different for both the searches.

Categories : Ruby On Rails

Twitter Search API authentication
New Twitter API needs user authentication, meaning that each user visiting your site will need to go through auth procedure. This makes new Twitter API much less useable. See this answer for details how to use OAuth on GAE/Python.

Categories : Python

How to get results with twitter search api?
Version 1 of the twitter API has been deprecated and is being removed. Not sure how you can miss the giant warnings on the twitter dev site ;) This means simple code like the above will not work any more. So, you now need to make authenticated requests (OAuth) using the 1.1 API, and it's nowhere near as simple as just doing a (in PHP) file_get_contents(http://search.twitter.com/ ...). I couldn't see any server-side languages you use from your profile, but I wrote a lengthy post explaining the issue (with pictures) and how to use a php library to perform authenticated requests.

Categories : Twitter

Twitter API 1.1 search tweets
You need to provide auth data. look at this page page. it says Authentication required. Using the OAuth tool, select your app and generate signature to properly call the resource.

Categories : Api

Twitter Search Query API V1.1 ASP.NET C#
There are several open-source .NET libraries that would be great places to check out. TweetSharp - GitHub repository Twitterizer (no longer updated, but code is still valid) - GitHub repository TwitterVB (no longer updated, but code is still valid) - GitHub repository (Full disclosure: TwitterVB is the library that I wrote. I recommend you start with TweetSharp).

Categories : C#

Search twitter API code-js
You have to make some syntax corrections to your code and to call the "loginTwitter()" function; the code should be: <script type="text/javascript" src="sha1.js"></script> <script type="text/javascript" src="codebird.js"></script> <script type="text/javascript"> function loginTwitter() { var cb = new Codebird(); cb.setConsumerKey("my_consumer_key", "my_consumer_secret"); cb.setToken("my_token", "my_token_secret"); cb.__call( "search_tweets", "q=Twitter", function (reply) { alert(JSON.stringify(reply)); //do something with the result }, true ); }; loginTwitter(); </script> And don't forget to download the codebird for javascript and put its files into the same folder as your m

Categories : Javascript

Twitter Search API no results
A Bug There's currently a bug in the 1.0 API - see this bug report. Anyway, unauthenticated requests will stop working in four days. Deprecated (and retired) 1.0 API Twitter requires you to use authenticated requests (OAuth) because, five days from now, the v1.0 API will be removed completely. What this means for you is that a simple: file_get_contents( . . . ) ... well, for the 1.0 api, it'll just stop returning data! Five days from now, you won't be able to use that any more! See this post I posted today for a little background information and proof of the API removal date (five days from now). See this post for a walk through of how to make authenticated requests using Twitter's 1.1 API. It's pretty simple if you use this library and only a few lines of code to make the actual

Categories : PHP

twitter search by hashtag example api v 1.1
As you know, authenticated requests are now required, so there's a few things that you may need to take a look at first. The new 1.1 search, how to use hashtags, and authentication. Twitter Search for 1.1 The new twitter search api docs can be found here. According to these docs: https://api.twitter.com/1.1/search/tweets.json is the new resource URL to use for search. Hashtag searches You've got that part right! %23 decodes to a # character. Authentication OAuth is a lot more complex. It would help if you just used a library that just worked. Here's a post a lot of people found useful to help you make authenticated requests to the 1.1 API. This includes a one-file include library to make requests like those you require. Example This example assumes you're using the above libr

Categories : PHP

rspec with dashing in ruby
First you should add capybara to your Gemfile and bundle it. Then add to spec_helper.rb: require 'capybara/rspec' Also # change this: # visit '../../dashboards/index' # to: visit dashboard_path https://github.com/jnicklas/capybara#using-capybara-with-rspec

Categories : Ruby

Twitter Search Query in Python
Twitter is deprecating non-authenticated searches. You should look into Tweepy or another Python library that interacts with Twitter. https://github.com/tweepy/tweepy

Categories : Python

twitter search api v1.1 - TwitterException{exceptionCode=
I'm going thru this same issue. You need to also set your access token and token secret. Its listed in your twitter app on twitter website along with your consumer key and secret. So 4 total to set. I got it working after that. I have a question about how to use v1.1 api by manually constructing the link and parsing the json myself rather than using a library. No tutorials explain how to do this.

Categories : Android

Wordpress twitter api 1.1 search class
Try using the Twitter API 1.1 Client for WordPress. It's very easy to implement and all you need is your consumer_key and consumer_secret. Example (from the README): <?php // Include Twitter API Client require_once( 'class-wp-twitter-api.php' ); // Set your personal data retrieved at https://dev.twitter.com/apps $credentials = array( 'consumer_key' => 'xxxxxxxxxxxxxxxx', 'consumer_secret' => 'xxxxxxxxxxxxxxxx' ); // Let's instantiate Wp_Twitter_Api with your credentials $twitter_api = new Wp_Twitter_Api( $credentials ); // Example a - Retrieve last 5 tweets from my timeline (default type statuses/user_timeline) $query = 'count=5&include_entities=true&include_rts=true&screen_name=micc1983'; var_dump( $twitter_api->query( $query ) );

Categories : PHP

How to use twitter search API asynchronously in python?
Take a look at the TwitterMixin that is supplied with Tornado and study its code a bit.

Categories : Python



© Copyright 2017 w3hello.com Publishing Limited. All rights reserved.