Questions tagged [take]

Take is a common keyword or function name used to return a given number of elements, usually contiguously and from the beginning of a collection. Only use this tag for the take keyword or function name; usage such as "take a picture/screenshot" is out of scope.

Take functions usually only require two pieces of information: the number of elements to be returned from the sequence, and the sequence itself.

If take is a method in a particular library or language, it is called on the object and would only require the number parameter.

This concept is found in many languages and libraries, some of which are listed below.

Reference

142 questions
0
votes
1 answer

Is there any way with Apache Spark to reduce number of elements in rdd [take as transformation]

I am working with Apache Spark for a query processing engine. The problem I recently faced is that I want to limit the number of elements in the rdd. I know there is take function in rdd which can be used to retrieve only the given number of…
0
votes
1 answer

Does anyone know why Take() isn't working here

i have the following code using Nhibernate.Linq var apps = Session.Linq().OrderByDescending(r => r.LastUpdated).Take(50); Console.Write(apps.Count()); the count returns 1000 (NOT 50 which is what i would have expected) any ideas why…
leora
  • 188,729
  • 360
  • 878
  • 1,366
0
votes
1 answer

Linq Paging using Skip and Take returning wrong result after first page

We have a jquery.jtable page that implements paging. We noticed that the paging is not quite working. For example, if there are 17 total items, the first page correctly shows 10 and the second shows 7. However, if there is a total of 20 items, the…
Joel WZ
  • 100
  • 8
0
votes
1 answer

Skip() function not working [Laravel 5]

I am trying to use skip and take function in Laravel 5... When I just use take() it will work find but if I add skip() it will not... Here is my code: public function orderWhat($what){ $this->what = $what; //QUERY FOR GROUPS…
Vladimir Djukic
  • 2,042
  • 7
  • 29
  • 60
0
votes
1 answer

Using Take() with bindingsource

How to use Take() with the following code? var context = new Entities(); BindingSource bi = new BindingSource(); var TableName = cboSelectTable.Text.ToString(); bi.DataSource = context.GetType().GetProperty(TableName).GetValue(context,…
feather
  • 85
  • 1
  • 2
  • 13
0
votes
1 answer

Capture image from video file URL

-(void)captureImageFromUrlPath : (NSString *)urlStr { // Import this from for these classes #import AVURLAsset* asset = [AVURLAsset URLAssetWithURL:[NSURL fileURLWithPath:urlStr] options:nil]; AVAssetImageGenerator*…
Ashi
  • 139
  • 1
  • 10
0
votes
1 answer

Clojure lazy-eval inside apply

I'm trying to read in a file line by line and concatenate a new string to the end of each line. For testing I've done this: (defn read-file [filename] (with-open [rdr (clojure.java.io/reader filename)] (doall (line-seq rdr)))) (apply str…
Nick
  • 375
  • 1
  • 3
  • 14
0
votes
1 answer

Error while implementing take for a Stream

I was trying to solve Exercise 2 from Functional Programming in Scala. The question is as follows: EXERCISE 2: Write a function take for returning the first n elements of a Stream. def take(n: Int): Stream[A] My solution is as follows: …
sc_ray
  • 7,803
  • 11
  • 63
  • 100
0
votes
2 answers

Nhibernate Linq - fetchmany where many count == 0

I have this query: var query = session.Query() .FetchMany(x => x.Tracks) .ThenFetchMany(x => x.Indices) .Where(t => t.Tracks.Any(v => v.Indices.Count == 0)) …
SexyMF
  • 10,657
  • 33
  • 102
  • 206
0
votes
1 answer

LINQ, Skip and Take against Azure SQL Databse Not Working

I'm pulling a paged dataset on an ASP.NET MVC3 application which uses JQuery to get data for endlesss scroll paging via $ajax call. The backend is a Azure SQL database. Here is the code: [Authorize] [OutputCache(Duration=0,NoStore=true)] public…
0
votes
2 answers

Vb.net PRTSC (Screen capture) - Error

Hi again my question this time its related with this piece of code, im using the visual studio beta 2012, i cant seem to find the issue, if you guys could help me out ill appreciate it Public Class Form1 Private Sub fullScreen_Click(ByVal…
Wesker Power
  • 9
  • 1
  • 5
0
votes
1 answer

LinkedBlockingDeque.take() - separate instance in multipe thread

In our multithreaded java app, we are using LinkedBlockingDeque separate instance for each thread, assume threads (c1, c2, .... c200) Threads T1 & T2 receive data from socket & add the object to the specific consumer's Q between c1 to…
-1
votes
1 answer

Excel, using the Take Formula and ignore blank rows

So I have an excel spreadsheet where I will copy data into. Then on that sheet I will have several other formulas combining text and so on. On a second sheet I want to take all the rows and certain columns and display those items. I have used the…
Micheal
  • 309
  • 4
  • 16
-1
votes
1 answer

angular resolver with ngrx effect and take operator

i have a route in my app that uses a resolver to fetch data (array of objects) from the db. the resolve function check if the data exist in the store state (if the array has length), and if not it dispatches an effect to fetch the data from the db…
guy
  • 111
  • 3
  • 9
-1
votes
3 answers

Ocaml take function

i am trying to make a function that returns the value of first k elements in a list. This is not working. I do not know why. Can someone help? This is the tl function - let tl j = match j with | [] -> [] | x :: xs -> xs;; This is the real take…
1XCoderX1
  • 27
  • 1
  • 5
1 2 3
9
10