search

Simple hash search by value

风格不统一 提交于 2019-12-19 05:06:55
问题 I have a simple hash, and would like to return the $key based on $value criteria. That is, for line 14, what code would I need to return the $key where the $value is "yellow"? 1 #!/usr/bin/perl 2 3 # This program creates a hash then 4 # prints out what is in the hash 5 6 %fruit = ( 7 'apple' => ['red','green'], 8 'kiwi' => 'green', 9 'banana' => 'yellow', 10 ); 11 12 print "The apple is @{$fruit{apple}}.\n"; 13 print "The kiwi is $fruit{kiwi}.\n"; 14 print "What is yellow? "; 回答1: grep is the

Find value in spreadsheet using google script

青春壹個敷衍的年華 提交于 2019-12-19 04:55:14
问题 Situation: 1 spreadsheet multiple sheets 1 cell selected (may vary) What I'd like to do is to find and set focus to the next cell in any sheet that matches the selected cell (case insensitive) upon clicking a button-like image in the spreadsheet. Sort of like a custom index MS Word can create for you. My approach is: - set value of the selected cell as the variable (succeeded) - find the first cell that matches that variable (not the selected cell) (no success) - set value of found cell as

How to implement search function to UITextView?

拥有回忆 提交于 2019-12-19 04:45:12
问题 I have more than 40 views with their own respective UITexView . I want to implement a search function that allows the user to search across the UITextViews . Actually, I do not even know how to implement search function for 1 UITextView . Therefore I do not know if it is possible at all. I have searched the web and looked for it here but did not find what I looked for. I appreciate your advice. 回答1: This is a pretty easy (may I say obvious?) task. Just think a bit about it. What does

Searching for a particular element in a stack

邮差的信 提交于 2019-12-19 04:18:11
问题 I am interested in porting this Python code to C++. As part of the port, I am using std::stack from the <stack> header. How can I determine whether some character is contained within a stack<char> ? For example: std::stack<char> myStack if (!('y' is included in myStack)) // I know that this is wrong { } 回答1: The C++ stack does not support random access, so there is no direct way using a stack to check if an element is contained. You can, however, make a copy of the stack and then continuously

Twitter API: search people by email

故事扮演 提交于 2019-12-19 04:08:18
问题 I'm trying to find people via Twitter API. I use urls like this: https://api.twitter.com/1/users/search.json?q=some@email.com But there's a problem. For example, when I search by email "blablabla@gmail.com", twitter responds to me with all account than have "gmail.com" in their email. So I can't find even myself. How can I tell twitter API that I want to find only person with specified email? 回答1: The Twitter API users/search documentation clearly states that the search function is similar to

alternate way to trigger reverse-i-search without pressing ctrl+r in bash

荒凉一梦 提交于 2019-12-19 04:08:12
问题 The reverse-i-search facility in bash is useful, but it is unlike most other bash commands in that it seems to be bound to a keybinding ( Ctrl + R ). How can a user trigger this facility using an alias or typed-in command instead? 回答1: The reverse-i-search function is actually a readline function (reverse-search-history) and not a bash builtin function (man builtin or see builtin commands in the bash reference manual). To my knowledge there is no way to call a readline function outside of

How to quickly search an array of objects in Objective-C

我与影子孤独终老i 提交于 2019-12-18 19:39:46
问题 Is there a way in Objective-C to search an array of objects by the contained object's properties if the properties are of type string? For instance, I have an NSArray of Person objects. Person has two properties, NSString *firstName and NSString *lastName. What's the best way to search through the array to find everyone who matches 'Ken' anywhere in the firstName OR lastName properties? 回答1: Short answer: NSArray:filteredArrayUsingPredicate: Long answer: Predicate Programming Guide 回答2: try

Good algorithm to find similar areas in images?

可紊 提交于 2019-12-18 16:56:58
问题 I want to search for similar areas in two images, but I don't know what works best. The areas are not scaled or transformed in any way, but may appear anywhere in both images (I want to know where). There is other stuff around them. This is an example of what i want: How can I do this? 回答1: segmentate image To obtain bound rectangles/polygon/mask of found areas per each region compute histogram FFT or DCT and filter out unsignificant data (mostly high frequencies ... similar to JPEG

web scraping to fill out (and retrieve) search forms?

点点圈 提交于 2019-12-18 16:55:45
问题 I was wondering if it is possible to "automate" the task of typing in entries to search forms and extracting matches from the results. For instance, I have a list of journal articles for which I would like to get DOI's (digital object identifier); manually for this I would go to the journal articles search page (e.g., http://pubs.acs.org/search/advanced), type in the authors/title/volume (etc.) and then find the article out of its list of returned results, and pick out the DOI and paste that

How to find the smallest and biggest number in an array?

北慕城南 提交于 2019-12-18 16:49:30
问题 Hello how can I find the smallest and biggest number in delphi? Suppose I have 10 different numbers stored in an array: How can I find the biggest number and smallest numbers in my array? 回答1: Simply loop through the array in linear fashion. Keep a variable for the min value and one for the max values. Initialise both to the first value in the array. Then for each element, update the min or max value if that element is less than or greater than the min or max value respectively. minval := a[0