find

find and set as variable and if

半世苍凉 提交于 2020-01-05 04:34:28
问题 I'm stucked with using Find and set as variable. I cannot get the result I need. In first sheet I have a column Test with values x or (x). If the value is x I need to copy the value from column EN. If the value is (x) do not copy. the code copies values from column "EN" no matter x or (x) I must have probably an error in using Set stfound Dim ENcolumn Dim xcolumn Dim secrow Dim lastrow Dim totrow Worksheets("List1").Activate Worksheets("List1").Range("A1:C1").Find(What:="EN", MatchCase:=True,

retrieving username with find_by_id(comment.user_id).name not working

半腔热情 提交于 2020-01-04 20:38:40
问题 I'm trying to retrieve a user name to insert into a comment on a blog post using rails if I use <%= comment.user_id %>" it will give me an id but if I try and retrieve the user then call the name it return nil class <%= User.find_by_id(comment.user_id).name %>" why is this not working if I leave .name off it returns a space in memory. #<User:000x00000182fe48> 回答1: Most likely, the dynamic finder is getting confused by the id and is returning the (Ruby) object's id (i.e. object_id ) instead of

retrieving username with find_by_id(comment.user_id).name not working

☆樱花仙子☆ 提交于 2020-01-04 20:36:36
问题 I'm trying to retrieve a user name to insert into a comment on a blog post using rails if I use <%= comment.user_id %>" it will give me an id but if I try and retrieve the user then call the name it return nil class <%= User.find_by_id(comment.user_id).name %>" why is this not working if I leave .name off it returns a space in memory. #<User:000x00000182fe48> 回答1: Most likely, the dynamic finder is getting confused by the id and is returning the (Ruby) object's id (i.e. object_id ) instead of

matlab: find the index of common values at the same entry from two arrays

血红的双手。 提交于 2020-01-04 13:44:47
问题 Suppose that I have two arrays of size p ( p is large) that have values from 0,1,2 . I am looking for a way to find the index that both arrays have value 2 at the same entry, the index that one has value 2 and the other one has value 1 , etc (like 2 and 2 , 2 and 1 , `2 and 0 , 1 and 1 , 1 and 0`). Is there a way to achieve this without using the for loop on p ? 回答1: You can use logical arrays, let A and B be your arrays (with consistent sizes): Indices=find((A==2)&(B==2)); Etc. for other

find with spaces in filename

半世苍凉 提交于 2020-01-04 04:40:12
问题 I often use grep twice with find in order to search for two patterns in a file as follows: find . -name \*.xml | xargs grep -l "<beans" | xargs grep singleton Then I ran into files with spaces which of course broke the above command. I modified it as follows to deal with the spaces: find . -name \*.xml -print0 | xargs -0 grep -l "<beans" | xargs grep singleton The option -print0 tells find to use print null as a separator instead of space and -0 tells xargs to expect a null. This works as

Performance problems with list.files

若如初见. 提交于 2020-01-03 19:11:05
问题 I am trying to retrieve files from 3 network drives using list.files and it takes for ever. When I am using find in the shell it returns all results in less then 15 seconds. system.time( jnk <- list.files(c("/Volumes/massspec", "/Volumes/massspec2", "/Volumes/massspec3"), pattern='_MA_.*_HeLa_', recursive=TRUE)) # user system elapsed # 1.567 6.381 309.500 Here is the equivalent shell command. time find /Volumes/masssp* -name *_MA_*_HeLa_* # real 0m13.776s # user 0m0.361s # sys 0m0.620s I need

How can I compare two arrays, removing similar items, without iterating through the whole array?

喜欢而已 提交于 2020-01-03 19:09:30
问题 Is it possible to compare two arrays and remove the values that are equal (if they are at the same index), without iterating through both arrays? Here is an example: $array1 = @(1,2,3,4,5,6,7,23,44) $array2 = @(1,1,3,4,5,7,6,23,45) $array3 = $sudo_compare_function $array1 $array2 where $array3 would now contain an array of indexes where $array2 is different from $array1 array: (1,5,6,8) If there isn't something like this, is there an easy way to do something similar without iterating through

Find and replace a string in multiple files using Batch script

微笑、不失礼 提交于 2020-01-03 12:30:14
问题 I have more 3000 files in a folder. I want to find and replace text with another one. How can I do that? I'm a newbie in batch script. I can replace it in 1 file but I don't know how to replace in multiple files. FOR /F %%L IN (lala.txt) DO ( SET "line=%%L" SETLOCAL ENABLEDELAYEDEXPANSION set "x=!line:E:\Test=E:\Test\Temp!" echo f | xcopy /E !line! !x! ENDLOCAL ) How can I edit my code to replace the string in all files? Waiting for your help. Thanks 回答1: Install the Find And Replace Text

Find value on any sheet in spreadsheets using Google Script

不羁的心 提交于 2020-01-03 04:49:05
问题 Using the code below I'm able to look through multiple sheets in a spreadsheet to find the first value that equals the selected cell. The only problem with this bit is: The cell with the value found is highlighted yellow, but the cell with the value found isn't selected. See code below for hopping through sheets. I can't get my head around this :) Funny thing is that the code for highlighting and selecting a value does work when I'm not hopping through the list of sheets, see the best answer:

Find in subdocuments returning document

有些话、适合烂在心里 提交于 2020-01-03 02:28:10
问题 I have a collection looking somewhat like this: { "colors": ["blue","white"], "items": { "old": { "name": "test" } "current": { "name": "new_test" } } }, { "colors": ["red","green"], "items": { "old": { "name": "test2" } "current": { "name": "new_test2" } } }, Is it possible to use find like this: db.collection.find({"items": { "old": { "name": "test" } } }) So the command would return: { "colors": ["blue","white"], "items": { "old": { "name": "test" } "current": { "name": "new_test" } } } Is