find

Check if page contains specific word

狂风中的少年 提交于 2019-12-13 02:44:54
问题 How can I check if a page contains a specific word. Example: I want to return true or false if the page contains the word "candybar". Notice that the "candybar" could be in between tags (candybar) sometimes and sometimes not. How do I accomplish this? Here is my code for "grabing" the site (just dont now how to check through the site): #!/usr/bin/perl -w use utf8; use RPC::XML; use RPC::XML::Client; use Data::Dumper; use Encode; use Time::HiRes qw(usleep); print "Content-type:text/html\n\n";

pass variable to find via ssh for -newermt option

谁说胖子不能爱 提交于 2019-12-13 02:22:32
问题 I am trying to copy a group of files within a certain time range from a remote server(server B) with a script run on a local server(Server A). I'm using the -newermt option in find to specify my time range. So if I ssh to the remote server(server B) this works: find /appl/backup/monsters/green/y.y.y.y/2016-04-26_08-00-01/jelly/ -newermt "2016-04-26 07:40:00" \! -newermt "2016-04-26 07:50:00" And I get the list of files for the times specified. However, If I try to involke this from the local

Ruby-on-Rails: How to pull out most recent entries from a limited subset of a database table

偶尔善良 提交于 2019-12-13 02:17:38
问题 Imagine something like a model User who has many Friends, each of who has many Comments, where I'm trying to display to the user the latest 100 comments by his friends. Is it possible to draw out the latest 100 in a single SQL query, or am I going to have to use Ruby application logic to parse a bigger list or make multiple queries? I see two ways of going about this: starting at User.find and use some complex combination of :join and :limit. This method seems promising, but unfortunately,

Issue with RegEx Lookaround where new lines are included [duplicate]

大兔子大兔子 提交于 2019-12-13 02:16:02
问题 This question already has an answer here : RegEx in Sublime Text: Match any character, including newlines? (1 answer) Closed 3 years ago . Edit : Clarification, I am using Sublime text. It appears the problem was in fact the multiline issue. Thank you all for your feedback! Okay so I'm trying to analyze text blocks similar to this: Private Sub NAV_VE124_Click() 'Open the picture in its description field Call ShowPic(Me.NAV_VE124.Description) End Sub and the regex pattern (?<=Private Sub )((.*

Python - Returning the value if there is an “exact” match?

陌路散爱 提交于 2019-12-13 01:45:51
问题 lst = ['a', 'b', 'c', 'aa', 'bb', 'cc'] def findexact(lst): i=0 key = ['a','g','t'] while i < len(lst): if any(item in lst[i] for item in key): print lst[i] i+=1 findexact(lst) in the above code, the result comes out to be: 'a' 'aa' I would like the result to be: 'a' What is the right way to use any() to get the right result? 回答1: To match your expected output, you cannot use set.intersection as sets are unordered so if you get a as the first item it is totally by chance , you should make key

Find files with extension with 5 characters or more

生来就可爱ヽ(ⅴ<●) 提交于 2019-12-13 01:43:26
问题 I have a lot of residue files from a failed rsync-command. They all have a file extension of 5 (random)characters. Is there a command that can find all files with an extension of 4 characters and more recursively? Example of a rsync residue filename: foo.jpg.hzmkjt7 I've already found out a way to prevent this with rsync, but all I need to do now is clean those leftovers... 回答1: Using bash, one option would be to use globstar like this: shopt -s globstar # enable the shell option echo **/*.??

QTableWidget find a row through userdata

牧云@^-^@ 提交于 2019-12-13 01:29:53
问题 QTableWidget have a method to search for a row with user data? Something like: //set user data row->setData(0, Qt::UserRole, "ID001"); //find row by user data int rowIndex = table->findByData("ID001"); 回答1: You can use QAbstractItemModel::match() QAbstractItemModel *model = table->model(); QModelIndexList matches = model->match( model->index(0,0), Qt::UserRole, "ID001" ) foreach( const QModelIndex &index, matches ) { QTableWidgetItem *item = table->item( index.row(), index.column() ) // Do

How can I pass multiple sub-commands to xargs when using the parallel option

不问归期 提交于 2019-12-13 01:25:44
问题 I'm trying to write a bash script to process a large directory tree and rsync that in multiple streams. From other research on this site I constructed the following. The assumption is the command is run: program.sh /input/location /output/location $threads The key line in my script is cd $1; find . -depth \( -type d -printf \""%p/\"\n" \) | xargs -n1 -P$3 -I% rsync -lptgoDds --delete --backup --backup-dir=$INCREMENTALS/$DATE/$1 % $2/% The idea of the above is to find all the directories at a

Finding Cell in another sheet

孤街浪徒 提交于 2019-12-13 00:46:42
问题 I created a database for students who have applied for payment plan. I have 3 sheets: "Enquiry" - this is where the data is stored while waiting for the students to sign up. "Confirmed" - this data has 3 row headings: Student ID (B1), Plan ID (B2) and Pay ID (B3).This is where I will input the additional data after the student signs up. "Masterlist" - the final list of students who confirmed the payment plan. The idea is for me to manually input the data in the "Confirmed" sheet then run a

Find escaped characters in a string line

自闭症网瘾萝莉.ら 提交于 2019-12-12 23:34:22
问题 Using the std library, and the function find , how can I know if there are any escaped characters in the given string ? For instance : string line = "bla bla bla \n blabla"; bool hasEscapedSequence = (line.find("\n",0) < line.size()); This obviously won't work since the \n in the find will be escaped. If I try (line.find("\\n",0) < line.size()); , it doesn't seem to change anything How should I do ? 回答1: line.find("\n",0) Will return the position of the cursor where it will find the substring