each

How to rank a million images with a crowdsourced sort

匿名 (未验证) 提交于 2019-12-03 02:31:01
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I'd like to rank a collection of landscape images by making a game whereby site visitors can rate them, in order to find out which images people find the most appealing. What would be a good method of doing that? Hot-or-Not style ? I.e. show a single image, ask the user to rank it from 1-10. As I see it, this allows me to average the scores, and I would just need to ensure that I get an even distribution of votes across all the images. Fairly simple to implement. Pick A-or-B ? I.e. show two images, ask user to pick the better one. This is

Retrieve last known value for each column of a row

匿名 (未验证) 提交于 2019-12-03 02:31:01
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: Not sure about the correct words to ask this question, so I will break it down. I have a table as follows: date_time | a | b | c Last 4 rows: 15/10/2013 11:45:00 | null | 'timtim' | 'fred' 15/10/2013 13:00:00 | 'tune' | 'reco' | null 16/10/2013 12:00:00 | 'abc' | null | null 16/10/2013 13:00:00 | null | 'died' | null How would I get the last record but with the value ignoring the null and instead get the value from the previous record. In my provided example the row returned would be 16/10/2013 13:00:00 | 'abc' | 'died' | 'fred' As you can

Break D3 Each Loop Without a flag

匿名 (未验证) 提交于 2019-12-03 02:31:01
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: Consider the following code: circle.each(function (d) { //...code }); How can I break the loop? Is there a natural D3 way to break out of an each loop? I mean without a flag as follows: var flag = false; circle.each(function (d) { if (flag) return; if (someCondition) flag = true; //...code }); I've tried returning false inside the if statement but it did not work (thought that maybe this would work the same as jquery.each but I was wrong): circle.each(function (d) { if (someCondition) return false; //Not working //...code }); 回答1: No, there

Sketching objects near each other [closed]

匿名 (未验证) 提交于 2019-12-03 02:31:01
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I want to sketch the below graph on the screen: |----| sphere |----| / / / / / / cylinder / / / / angle = 45 | | | | | | cylinder | | | | | | ----------- cylinder ----------- My output: / / / / / / cylinder / / |-----| sphere / / angle = 45 |-----| I will sketch the top part namely sphere with a cylinder. My code is below, please look and say what is wrong. I have tried to find the error why my primitives do not near to each other. But, I could not find. I have tried to change parameters of translate, but it does not work. Please, help void

web page elements overlapping each other even when using percentage values in css

匿名 (未验证) 提交于 2019-12-03 02:30:02
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I have a page with structure like this. I want to divide the page into 6 sections so I have made 6 outer div s. <body> <div id="header"> <img /> </div> <div id="pageTitle"> title of page </div> <div id="section1" class="section"> <div class="section-title"> section 1 </div> <form> <input /> </form> </div> <div id="section2" class="section"> <div class="section-title"> section 2 </div> <form> <input /> </form> </div> <div id="section3" class="section"> <div class="section-title"> section 3 </div> <form> <input /> </form> </div> <div id="nav">

Applying a function to each row of a data.table

匿名 (未验证) 提交于 2019-12-03 02:30:02
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 由 翻译 强力驱动 问题: I looking for a way to efficiently apply a function to each row of data.table. Let's consider the following data table: library ( data . table ) library ( stringr ) x <- data . table ( a = c ( 1 : 3 , 1 ), b = c ( '12 13' , '14 15' , '16 17' , '18 19' )) > x a b 1 : 1 12 13 2 : 2 14 15 3 : 3 16 17 4 : 1 18 19 Let's say I want to split each element of column b by space (thus yielding two rows for each row in the original data) and join the resulting data tables. For the example above, I need the following result: a V1 1 : 1 12 2 : 1

SQL Group BY, Top N Items for each Group

匿名 (未验证) 提交于 2019-12-03 02:29:01
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I have a SQL Query which gets gets top 5 sold items at a given store. SELECT TOP 5 S.UPCCode, SUM(TotalDollarSales) FROM Sales S WHERE S.StoreId = 1 GROUP BY S.UPCCode ORDER BY SUM(S.TotalDollarSales) desc The Sales table has -> UPCCode, SaleDate, StoreId, TotalDollarSales I am looking for a query which will return me Top 5 items sold for each of the stores in a single query. I can write multiple queries and use a union but it doesn't seem efficient. How can I get the top 5 sold items for each store in a single query. Thanks in advance. 回答1:

dplyr: Find mean for each bin by groups

匿名 (未验证) 提交于 2019-12-03 02:29:01
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I am trying to understand dplyr. I am splitting values in my data frame by group, bins and by sign, and I am trying to get a mean value for each group/bin/sign combination. I would like to output a data frame with these counts per each group/bin/sign combination, and the total numbers per each group. I think I have it but sometimes I get different values in base R compared to the output of ddplyr. Am I doing this correctly? It is also very contorted...is there a more direct way? library(ggplot2) df <- data.frame( id = sample(LETTERS[1:3],

How can I get the minimum and the maximum element of a list in python

匿名 (未验证) 提交于 2019-12-03 02:29:01
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: If a have a list like: l = [1,2,3,4,5] and I want to have at the end min = 1 max = 5 WITHOUT min(l) and max(l) . 回答1: The fastest approach I can think of would be to sort the original list and then pick the first and last elements. This avoids looping multiple times, but it does destroy the original structure of your list. This can be solved by simply copying the list and sorting only the copied list. I was curious if this was slower than just using max() and min() with this quick example script: import time l = [1,2,4,5,3] print "Run 1" t1

Multiple jpa:repositories in xml config, how to configure with @EnableJPARepositories using Spring java config?

匿名 (未验证) 提交于 2019-12-03 02:29:01
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I have researched and found an explaination and sample code as to how to use spring data jpa with multiple datasources which refers to configuring multiple jpa:repositories in the xml configuration as follows: How would you declare both of the above jpa:repositories configurations using java configuration and the @EnableJpaRepositories annotation? The annotation seems to support only one set of attributes (i.e. for one jpa:repository only) and it is not possible to declare the annotation multiple times. 回答1: I created a 'minimal' multiple