find

find array elements that are members of set array in python ()

六眼飞鱼酱① 提交于 2019-12-23 20:47:42
问题 I am new to python and my question might seem very badly explained because I have background in MATLAB. usually in MATLAB if we have 1000 arrays of 15*15 we define a cell or a 3D matrix which each element is a matrix with size (15*15). Now in python: (using numpy library) I have a ndarray A with shape (1000,15,15). I have another ndarry B with shape (500,15,15). I am trying to find elements in A that are member in B too. I am specifically looking for a vector to be returned with the indices

[Dart]Find and Replace Strings

强颜欢笑 提交于 2019-12-23 19:37:32
问题 noob here:D I'm using flutter for this app and i'm having trouble with the app's logic. Any help is much appreciated. App goal: Decode(replace) all input abbreviation to words by: -User inputs text via text box -App looks for any abbreviations(several) and replaces the abbreviation only with text. I was able to do it will a few abbreviation but with my case all abbreviation should be in the input text or it wouldn't work or the second index wont work. I tried several ways which didn't work, I

If: XElement Exists, Else Create new one

人盡茶涼 提交于 2019-12-23 18:34:18
问题 My XML File: <?xml version="1.0" encoding="utf-8"?> <SimpleKD> <player name="Tardis"> <kills>0</kills> <deaths>0</deaths> </player> </SimpleKD> First off, I need to check if the username "Tardis" exists in the xml .element("player").attribute("name") . If it doesn't, i need to create it with kills and deaths at zero. If it does, I need to read kills and deaths and set them to variables. I have been using XElement to try and do this.. Thanks! Code used to write the XML: public static string

Leaving out '-print' from 'find' command when '-prune' is used

▼魔方 西西 提交于 2019-12-23 17:27:49
问题 I have never been able to fully understand the -prune action of the find command. But in actuality at least some of my misunderstanding stems from the effect of omitting the '-print' expression. From the 'find' man page.. "If the expression contains no actions other than -prune, -print is performed on all files for which the expression is true." .. which I have always (for many years) taken to mean I can leave out '-print'. However, as the following example illustrates, there is a difference

jQuery pull out text inside div but not in p tag

旧城冷巷雨未停 提交于 2019-12-23 17:25:18
问题 In the below code I would like to put a variable to the text within the div but NOT whats inside the p tag: <div class="review-content merchant-review-content"> I want to grab this text <p class="review-rating"> From a cool person - My Date goes here - A Review </p> <div></div> </div> Additionally I would like to only pull the first 250 characters of it, if thats possible! 回答1: I found this tutorial: http://viralpatel.net/blogs/2011/02/jquery-get-text-element-without-child-element.html Final

How to generate a MySQL IS NOT NULL condition in CakePHP?

女生的网名这么多〃 提交于 2019-12-23 17:15:31
问题 I'm trying to get a subset of results as a virtualField for use in my view. I may even be way off on how I'm approaching this, but here's what I've done so far: I started with this question here: CakePHP virtualField find all not null which lead to this little beauty. Now I have an issue where the find statement passing (Array) into the MySQL. My code looks like: class Transaction extends AppModel { public function __construct($id = false, $table = null, $ds = null) { parent::__construct($id,

Extract specific strings from line in file and output to another file with modifications

笑着哭i 提交于 2019-12-23 16:42:53
问题 New to linux and trying to escape doing this the hard way. I have a file ("output.txt") that contains the results of a 'find' command. Example first three lines from "output.txt": /home/user/temp/LT50150292009260GNC01/L5015029_02920090917_MTL.txt /home/user/temp/LT50150292009276GNC01/L5015029_02920091003_MTL.txt /home/user/temp/LT50150292009292GNC01/L5015029_02920091019_MTL.txt I'd like to use awk or sed (or similar) to extract two parts from the path listed for each line, and output to a new

Use logical indexing instead of FIND

淺唱寂寞╮ 提交于 2019-12-23 16:10:38
问题 Within a loop in my code I use a one-liner to find and plot the minimum of some potential (for clarity: the 7 corresponds to the cells containing the potential values, the 5 to the x-values): plot(PDdata{subject,5}{1,1}(find(PDdata{subject,7}==... min(PDdata{subject,7}))),min(PDdata{subject,7}),'ko') Now Matlab suggests to use logical indexing instead of FIND and although I've looked into it only briefly, it doesn't strike me as something I should do here. Main question here is thus whether I

regex to find an uncommented println

会有一股神秘感。 提交于 2019-12-23 13:56:52
问题 Can someone share a regex that find all not double-slashed commented println in java code? Example: System.out.println("MATCH") /*this line match*/ // System.out.println("DOESN'T MATCH") /*this line doesn't match*/ (I'm using this regex into throw eclipse searching dialog) 回答1: Okay, as I already mentioned, regex is not the right tool, so if you end up using my suggestion, be sure to backup your source! The following regex matches a single line that has System.out.print in it, without // or /

How do I find a specific string in one of many text .log files using VBA?

旧时模样 提交于 2019-12-23 13:11:28
问题 This is the code I have so far to find all the log files in a folder. But I need to be able to find a specific string in each file, if it is found in one file, stop looking and exit the loop and report back what filename it was in. There seems to be so many different ways to open a file and search it that I do not know which is the best and I do not typically use VBA but it is all I have access to at the moment. On a side note, there would be a max of 36 log files and each file max of 5MB