问题标签 [take]

For questions regarding programming in ECMAScript (JavaScript/JS) and its various dialects/implementations (excluding ActionScript). Note JavaScript is NOT the same as Java! Please include all relevant tags on your question; e.g., [node.js], [jquery], [json], [reactjs], [angular], [ember.js], [vue.js], [typescript], [svelte], etc.

0 投票
2 回答
3750 浏览

c# - 使用 Take() 从字节数组中抓取字节,在 Take() 之后无法转换回 byte[]

以上失败就result.Take(255);行了。它说我无法转换IEnumerablebyte[],并询问我是否缺少演员表。

我是 C# 新手,不完全确定该怎么做。

0 投票
1 回答
15040 浏览

android - 拍照并使用 android studio 保存

我写了一个可以拍照的程序。问题是当我尝试将其保存在 DIRECTORY_PICTURES 中时,我在图片目录中找不到我拍摄的图片,我的代码有什么问题?我写的程序打开相机没有问题,我可以成功拍照但图片目录中没有图像

0 投票
1 回答
2394 浏览

c# - Linq - Group By Id, Order By 然后选择每个分组的前 5 个

linq group By Id 中是否有某种方式,按降序排序,然后选择每个分组的前 5 个?现在我有一些如下所示的代码,但我使用.Take(5)了它显然选择了前 5 名,而不管分组。

0 投票
3 回答
1892 浏览

function - Ocaml 取函数

我正在尝试创建一个返回列表中前 k 个元素的值的函数。这是行不通的。我不知道为什么。

有人可以帮忙吗?

这是 tl 功能 -

这是真正的拍摄功能-

0 投票
2 回答
101 浏览

.net - .NET 的 LINQ 关键字“TAKE”是否短路?

linq 查询中使用的 TAKE 关键字是否会导致该 linq 查询的执行在评估时短路,或者是否有任何方法导致短路?

0 投票
2 回答
34255 浏览

scala - Spark: Difference between collect(), take() and show() outputs after conversion toDF

I am using Spark 1.5.

I have a column of 30 ids which I am loading as integers from a database:

This is the output of numsRDD:

Right next, I want to produce all combinations of 3 for those ids then save each combination as a tuple of the form: < tripletID: String, triplet: Array(Int)> and convert it into a dataframe, which I do as follows:

As soon as I do that I try to print some of the combinationsDF's contents just to make sure that everything is the way it should be. So I try this:

which returns:

As it is evident, the first element of every tripletID is missing. So, just to be 100% sure I use take(20) as follows:

which returns a more detailed representation as per below:

So now I am sure that the first id from tripletID is somehow for whatever reason deprecated. But still, if I try to use collect instead of take(20):

everything goes back to being fine again (!!!):

1. I have exhaustively queried the steps just before I parallelize the array of combinations into an RDD and everything is ok. 2. I have also printed the output right after parallelize is applied and again everything is ok. 3. The problem appears to be related with the conversion of the numsRDD to a DF and despite my best efforts I cannot deal with it. 4. I was also incapable of reproducing the problem with mock data using the same code snippet.

So first: What's causing this problem? and second: How do I fix it?

0 投票
2 回答
58 浏览

c# - C#在文本框中一次取一段文本

我有一个文本框(textBox2),电子邮件在哪里: thisemail@gmail.com,hello@yahoo.it,YesOrNo@gmail.com,etc..

我有一个发送电子邮件的功能:

我希望您分别向每封电子邮件发送一封电子邮件。也就是说,当我按一次button1给他一封电子邮件并发送电子邮件直到你结束时。我能怎么做?

0 投票
0 回答
207 浏览

android - Android N 拍照

我正在创建一个需要制作照片并将其存储到外部存储的应用程序。现在,每次我单击按钮拍照时,它都会将视图设置回我的主要活动。我的代码有什么问题?

报告.java:

奇怪的是它不会在 android 监视器中返回错误。

清单中相机的权限:

按钮 XML:

有什么建议么?

0 投票
0 回答
1947 浏览

performance - spark警告“块锁未被tid释放”导致性能不佳

我正在学习火花。我正在尝试演示一个简单的聚类算法。假设我在我的 rdd 上找到 k 项代表我的集群。问题是当我尝试将它们带到驱动程序时,我收到一条警告说“块锁未被 tid 释放”。这也会导致性能不佳......下面代码的 20 次迭代需要 11 秒,在 4 核上使用 2mb 数据集。这比我的串行版本差得多。好消息是我仍然得到正确的结果。请看一下:

首先,我拿一个项目。任何物品都可以

然后我创建一个对象,该对象将根据我刚刚找到的所选项目为我的集群查找候选项目。作为记录,它实现了 PairFlatMapFunction

下一步找到一些候选人

但是现在,我需要具有最低 Double 值的 k 个,所以我实现了一个 TupleComparator。然后我调用了 takeOrdered

此时,出现该警告。调用 top() 也是如此。并且作为一种迭代算法,它出现在每次迭代中。我不会向您展示其余的代码。你猜对了..这不仅仅是微不足道的:-)

另外,我确实坚持我的rdds。乔布斯的工作似乎很有魅力。我发现很多人都有这个问题,但没有答案。

我希望我给了你足够的细节,这是我的第一篇文章!

0 投票
3 回答
4318 浏览

pagination - 在 laravel 5.2 中对有限记录使用分页

我正在尝试对 12 条记录使用分页方法。我需要 12 个结果,其中前 6 个结果出现在第一页,其余 6 个结果出现在第二页。我在控制器中使用了以下代码,

我使用 take() 获取 12 条记录并使用 paginate(6) 在一页中显示 6 个结果,如下所示,

在我看来,我给出了这样的链接,

但是 take(12) 不起作用。每页显示 6 个结果,但显示的结果超过 12 个。如何使用有限的记录进行分页。提前致谢。