find

How does the STL map::find function work without the equality operator?

Under the hood, an STL map is a red-black tree, and it uses the < operator of its keys or a user-provided comparison to figure out the location for element insertion. map::find() returns the element that matches the supplied key (if any matches are present) How can it do this without using an equality operator? Let's say my map has the...

How find values in an array that meet two conditions using Python

I have an array a=[1,2,3,4,5,6,7,8,9] and I want to find the indices of the element s that meet two conditions i.e. a>3 and a<8 ans=[3,4,5,6] a[ans]=[4,5,6,7] I can use numpy.nonzero(a>3) or numpy.nonzero(a<8) but not numpy.nonzero(a>3 and a<8) which gives the error: ValueError: The truth value of an array with more than one eleme...

jquery select element based on background image name

I'm trying to select a div with a certain background image this is what I have so far. Not working. Any ideas of what I'm doing wrong? I'm trying to follow the jQuery documentation. var markerShadow0 = $("div[background-image='url(\"http://www.axtsweapons.com/gmarkers/markershadowA.png\")]"); ...

How do I format the output array in CakePHP

Let's say I have an index action where I want to get a list of projects: $this->Project->find('all', array('order' => 'Project.modified DESC', 'conditions' => array('Project.user_id' => 1))); It works well and returns the following array: Array ( [0] => Array ( [Project] => Array ( [id] => 2 [title] => test project ) ) [1] => Array (...

bash find chained to a grep which then prints

I have a series of index files for some data files which basically take the format index file : asdfg.log.1234.2345.index data file : asdfg.log The idea is to do a search of all the index files. If the value XXXX appears in an index file, go and grep its corresponding data file and print out the line in the data file where the value...

getting all values from h1 tags using php

I want to receive an array that contains all the h1 tag values from a text Example, if this where the given input string: <h1>hello</h1> <p>random text</p> <h1>title number two!</h1> I need to receive an array containing this: titles[0] = 'hello', titles[1] = 'title number two!' I already figured out how to get the first h1 value ...

jQuery find "div" element in returned from ajax call html content

Trying to find div element with "result" id in returned from ajax call html content with no luck. Here is my code: $.ajax({ url: url, cache: false, success: function(response) { result = $(response).find("#result"); alert(response); // works as expected (returns all html) alert(result); // returns [o...

Cron job in cPanel to Delete Emails after 21 days

I'm having some issues with a cron job to delete emails after 21 days. I've read through many examples and have tried many different variations of this command but I can't get it to work: find /home/cont/mail///cur -name "*" -mtime +21 -exec rm {} \; Currently this runs and I get a message back from every mail box that doesn't have any...

Excel: Find value in column(s)

I've got an Excel spreadsheet with multiple columns of different lengths, each filled with unsorted numbers. Each column has a header. Is there a way to determine which column(s) contain that number? For instance, I'd love to be able to do =WHICHCOLS( 123, A, Z ) and have Excel tell me columns [B, C, and K] contain cells with a value ...

VS2005: how to find text in the current function

In the VS2005 code-editor using C#, how do you search for text in the current function only? It allows searching over the Current Document but I cannot see how to limit the search to only the current function. ...

jquery find previous based on class name

Hi all, I'm trying to use jquery to find an item based on it's class name. Basically I have this structure: <ul class="vm_cat"> <li><a class="mainlevel" href="/">MAIN LEVEL 1</a></li> <li><a class="sublevel" href="/">sub 1 a</a></li> <li><a class="sublevel" href="/">sub 1 b</a></li> <li><a class="sublevel" href="/">sub 1...

SQL how to find rows which have highest value of specific column

For example, the table has columns MYINDEX and NAME. MYINDEX | NAME ================= 1 | BOB 2 | BOB 3 | CHARLES Ho do I find row with highest MYINDEX for specific NAME? E.g. I want to find ROW-2 for name "BOB". ...

clearcase: find -name not allow multiple patterns?

I wanna find *.cs and *.cpp files through cleartool find command. But it failed. cleartool find "M:\test_view\code" -name "*.cs *.cpp" -print Nothing can be found based on above even there are matched files in that folder. How to set multiple file-name patterns ? ...

How to delete the directory based on a name of the sub-directory

I have this given directory structure. /tmp/sub_1/sub_2/sub_3//data_1/data_2 where /tmp/sub_1 names will not change and sub_2 and sub_3 directories will be changing. The has only three values (version_a, version_b, version_c). So, what I would want is to check if is either version_a or version_c and remove that directory. For exam...

recongnize and replace links in yahoo pipes with regex

would there be a formula to recognize any link out of rss feeds and replace them with a fix value with regex in yahoo pipes? ...

automated find/replace soltion for scripts (php)

I need a function/class/or some kind of sophisticated find/ replace solution for this problem Have a huge form with lot of: 1: input tags like this one <input id="Id" name="Id" class="element text large" value="" type="text" /> which needs to be "changed/replaced" to this one <div class="element text large" id="username"><?php ec...

Rails -- Find condition with id's all over the place

Hello, I have this find condition pulling from my model that currently looks like this. @major_set = Interest.find(:all, :conditions => {:id => 1..21}) I'd like to add some more individual ids that I've just added which are like 120...130. I tried to do... @major_set = Interest.find(:all, :conditions => {:id => 1..21, 120..130}) ...

jquery how to find if div with specific id exists

I've got a function that appends a div to an element on click. The function gets the text of the clicked element and assigns it to a variable called 'name'. That variable is then used as the div id of the appended element. I need to see if a div id with 'name' already exists before I append the element but I don't know how to find thi...

Rails 3.0, want to match 'UK' == 'United Kingdom' in ActiveRecord model

hey I have a problem, I have a Country model. where the entry in the DB is: {:name => 'United Kingdom'} The data I have is UK instead of United Kingdom. in the other models where i search for it i have done: country_name = "United Kingdom" if country.name == "UK" but i have to do this all over the application and that is just bad. S...

bash: Filtering out directories and extensions from find?

I'm trying to find files modified recently with this find . -mtime 0 Which gives me en/content/file.xml es/file.php en/file.php.swp css/main.css js/main.js But I'd like to filter out the en and es directories but would like to grab anything else. In addition, I'd like to filter out .swp files from the results of those. So I want t...