typescript - Not able to return an array containing column values from an ag-grid table back to the function

I have written a function which reads a given column in ag-grid and storing it in an array.getSortedText(columnName: string){var testArrayAsc = [];element.all(by.css('div.ag-body-container > [role="row"]')).then(function(count) { console.log("Row Count= ", Object.keys(count).length); for (let rowNo = 0; rowNo < Object.keys(count).length; rowNo++) { element.all(by.css(String.Format("div.ag-body-container div[ row-index='{0}'] > [col-id='{1}']", rowNo, columnName))).map(function (Element) { Element.getText().then(function (resul...Read more

Excel VBA - Assign formula results to array

This works to put the values in the column: Sub JR_ArrayToDebugPint2() ' written by Jack in the UK for [url]www.OzGrid.com[/url] ' our web site [url]www.excel-it.com[/url] ' Excel Xp+ 14th Aug 2004 ' [url]http://www.ozgrid.com/forum/showthread.php?t=38111[/url] Dim JR_Values(500) Dim JR_Count As Integer Dim R As Long R = 2 For JR_Count = 1 To 500 Step 1 JR_Values(JR_Count) = Evaluate("=INDEX('Client'!$O$2:$O$347473,MATCH(1,(('Client_Cost'!$D$2:$D$347473=BC" & CStr(R) & ")*('Clie...Read more

let function and array statement in a macro

I am new to SAS and Macros. I would like some help to understand what the following lines of code are doing:%let numbercccats=201;DATA &OUTDSN(KEEP=HICno CASE &prefix.CC1-&prefix.CC&numbercccats. ID) ERR;SET TEMP1;by ID;length cc $4.;cc=left(addxg);RETAIN &prefix.CC1-&prefix.CC&numbercccats. 0 ; ARRAY C(&numbercccats.) &prefix.CC1-&prefix.CC&numbercccats.;Thank you....Read more

perl extract common elements from 2 arrays (common sequences in fastq file)

I have 2 file (paired_end) with reads in fastq format from the same organism (File_R1.fastq and File_R2.fastq). And I want to determinate the coverage deep using bwa and samtools (bioinformatics), for do it I need both files with the same number of reads, the same name (file_1: @XX00341:4450:6341 1:N:0:AACGTTAA+TTGCAATT and file_2: @XX00341:4450:6341 2:N:0:AACGTTAA+TTGCAATT), in the same order in both files, the problem is that both files have empty reads (The corresponding read for each file, could be empty in one but not in other !!!!), a...Read more

arrays - Using Powershell to select only one file in a folder

I've been trying to figure out a way to use Powershell to select only one file (doesn't matter which one) out of a folder so I can do a rename on it. After that I want it to just exit. Please be patient with me, I'm new to PS, most of my coding experience is in other languages.So I've been doing something like this so it just executes once and exits...$a = 0 DO{ $a $a++} While ($a -le 0)Would I put a Get-ChildItem in there somehow, or how do I reference the file so I can rename it to something like "newfile.txt"? Plus the file location is no...Read more

arrays - Swift String Separation

I am reading a file which contains data in format:1990 3 6.4 1.0 9 1991 1 5.3 12.0 10so the resulting array is["1990"][""][""][""]["3"]....when i only require ["1991"]["3"]["6.4"]....I want to extract this information into an array or struct.But when I try to to: let x = string.components(seperatedBy: .whitespaces)it creates an array with whitespaces which I do not need.The array should only contain the values which are usefull.Thanks...Read more

Check if a Bash array contains a value

In Bash, what is the simplest way to test if an array contains a certain value? Edit: With help from the answers and the comments, after some testing, I came up with this:function contains() { local n=$# local value=${!n} for ((i=1;i < $#;i++)) { if [ "${!i}" == "${value}" ]; then echo "y" return 0 fi } echo "n" return 1}A=("one" "two" "three four")if [ $(contains "${A[@]}" "one") == "y" ]; then echo "contains one"fiif [ $(contains "${A[@]}" "three") == "y" ]; then echo "contains...Read more

Compare Elements in Array for While Loop - Powershell

I am attempting to create a script to read a CSV, then perform some operations on the contents where the first field are similar. Right now I'm stuck on trying to set up the second While loop to compare the current element to the next one.I'm fairly new to this, because I wasn't getting anywhere trying this in Java. I can't seem to find a combination of commands that will let the loop work.Some things I've tried are:While($csv[$count].ip -eq $csv[$count++].ip)While((diff $csv[count].ip $csv[$count++].ip) = true)While($csv[$count].ip = $csv[$cou...Read more

Most performant way of comparing a huge array in vb with records in sql server?

I have a 2D array in vb.net (for test purposes it is only 1000 rows, but the actual will be up to 2.5m).The array can be split into three groups, which is dependent on two fields in SQL server, TD and UID:TDnomatch TDmatchUIDmatchTDmatchUIDnomatchLogic:My original code just looped through each row of the array Pseudo-code to show structurefor row_id = 0 to upper_bound "select ... where TD = " & Pricetable(0, rowid) executereader if sqlreader.Hasrows() ... (getting UID from reader and other validation) closereader ...Read more

arrays - binary (de)serialization of [u8; 128]

I have a struct containing a byte array that I would like to serialize and deserialize to and from binary.But it only works for arrays up to 32 elements.Here is my minimal example codemain.rs:#[macro_use]extern crate serde_derive;extern crate serde;extern crate bincode;use bincode::{serialize, deserialize, Infinite};const BYTECOUNT: usize = 32; // 33 and more does not work, I need 128type DataArr = [u8; BYTECOUNT];#[derive(Serialize, Deserialize, Debug)]struct Entry { number: i64, data: DataArr}fn main() { let mut my_entry = Entry { nu...Read more

How do I create an array of unboxed functions / closures?

Editor's note: This question was asked before Rust 1.0 and some of the syntax has changed since then, but the underlying concepts remain. Some answers have been updated for Rust 1.0 syntax.I'm new to Rust and trying to do something with closures which is trivial in JavaScript, Python, etc. but I am running into lifetime issues in Rust. I understand the error message, but it leads me to believe what I want to do is pretty hard in Rust.I just want to create an array of functions, a, such thata[0] is the function returning 0a[1] is the function r...Read more

scala - Boxing Double during Array.tabulate

I am experiencing a boxing issue which affects negatively performance of my Scala code. I have extracted the relevant code, which still shows the issue, with some added strangeness. I have the following representation of a 2D Double array which allows me to perform transformations on it by providing my functions:case class Container( a: Array[Array[Double]] = Array.tabulate[Double](10000, 10000)((x,y) => x.toDouble * y)) { def transformXY(f: (Double, Double, Double) => Double): Container = { Container(Array.tabulate[Double](a.length,...Read more

types - I don't know why one variable array gets updated in the loop

Look at the code below,program hw1implicit nonereal, parameter :: G =1.4integer :: i, j real :: Miireal, dimension(3) :: cfreal, dimension(96,3):: L_Dreal, dimension(96) :: Mireal :: testcf=(/0.003,0.004,0.005/)Mii=0.5i=0do while (Mii .le. 10.1) Mi(i)=Mii i=i+1 Mii=Mii+0.1end do 10 format(f2.1, 5x, f2.5)open (unit =1,file="L_D_1.txt")do i=0,2 do j=0,size(Mi)-1 print *, Mi(j) L_D(j,i)=((1-Mi(j)**2))!/(G*Mi(j)**2)+(G+1)/(2*G)*log((G+1)*Mi(j)**2/(2+(G-1)*Mi(j)**2)))/(4*cf(i)) end doend doend program hw1if you look at the line ...Read more

initialization - Is there a way to not have to initialize arrays twice?

I need to initialize each element of an array to a non-constant expression. Can I do that without having to first initialize each element of the array to some meaningless expression? Here's an example of what I'd like to be able to do:fn foo(xs: &[i32; 1000]) { let mut ys: [i32; 1000]; for (x, y) in xs.iter().zip(ys.iter_mut()) { *y = *x / 3; } // ...}This code gives the compile-time error: error[E0381]: use of possibly uninitialized variable: `ys` --> src/main.rs:5:37 |5 | for (x, y) in xs.iter().zip(ys.iter...Read more