range

Range Multiplication VB.NET (What is wrong with this code?)

有些话、适合烂在心里 提交于 2019-12-12 17:14:47
问题 (VB Express Level: Beginner) I want to do following, A column from Workbook 1 a b c d A column from Workbook2 e f g h Output to a single cell ae+bf+cg+dh (The output is a Sumproduct.) There are 44 rows in workbook 1 and 44 rows in workbook 2. But there are 3 columns in workbook 1 and 104 columns in workbook 2. Each column in workbook 3 must be multiplied with 104 columns from workbook 2. Following is my effort, which writes sames values in all the cells of a column. My understanding is my for

SQL: create sequential list of numbers from various starting points

余生长醉 提交于 2019-12-12 16:39:19
问题 I'm stuck on this SQL problem. I have a column that is a list of starting points ( prevdoc ), and anther column that lists how many sequential numbers I need after the starting point ( exdiff ). For example, here are the first several rows: prevdoc | exdiff ---------------- 1 | 3 21 | 2 126 | 2 So I need an output to look something like: 2 3 4 22 23 127 128 I'm lost as to where even to start. Can anyone advise me on the SQL code for this solution? Thanks! 回答1: ;with a as ( select prevdoc + 1

Groovy: create a two-dimensional array from two ranges

自作多情 提交于 2019-12-12 16:33:08
问题 I want to create this: [ [ 1, 1 ], [ 1, 2 ], [ 1, 3 ], [ 2, 1 ] ... [ 6, 3 ]] Using GroovyConsole I've being trying stuff like this: def blob = (1..6).collect{ i -> (1..3).collect{ j -> [ i, j ] } } println "$blob ${blob.class.simpleName}" ... with various permutations of calls to flatten , as you might surmise. Is there a way to achieve this? 回答1: It's easier to do using the combinations method: l1 = [1,2,3,4,5,6] l2 = [1,2,3] [l, l2].combinations() Which outputs: [[1, 1], [2, 1], [3, 1], [4

How to convert a number to a range of prices

房东的猫 提交于 2019-12-12 15:16:35
问题 I want to calculate the amount to charge my customers, when they buy licenses of my product. I sell it in ranges of licenses: 1-10 : $50/user 11-20 : $40/user 21-30 : $30/user 31-50 : $20/user So when someone purchases 136 licenses, I will charge him: 50 x 2 x $20 = $2000 30 x 1 x $30 = $900 6 x $50 = $300 I'm looking for an algorithm on how to process the given number and break it into number of occurrences in a range.. How can I do this in plain C# or LINQ? ------------ EDIT ---------------

Mathematica's puzzling interpretation of #^2 & /@ Range[n]

冷暖自知 提交于 2019-12-12 14:55:37
问题 I'm puzzled by Mathematica's responses to the following: ClearAll[n] #^2 & /@ Range[n] #^2 & /@ Range[n] // StandardForm It seems that even Mathematica (8.0) doesn't believe what it has just said: #^2 & /@ Range[5] Range[5^2] Any thoughts about what is happening? Edit: The original context for this question was the following. I had written PrimeOmega[Range[n]] - PrimeNu[Range[n]] and since n was going to be very large (2^50), I thought I might save time by rewriting it as: PrimeOmega[#] -

Switching from Range to Array and Back in a VBA Function

这一生的挚爱 提交于 2019-12-12 12:16:16
问题 There are a lot of questions, and a lot of responses dealing with Range/Array conversion in VBA. I haven't been able to find an answer that works, so I would really apreciate some help. Below is what I'm trying to do: Function RangeToArrayToRange(inputRange As Range) As Range Dim inputArray As Variant inputArray = inputRange 'operations on inputArray' '...' Dim outputRange As Range outputRange = inputArray Set RangeToArrayToRange = outputRange End Function Thanks in advance for your help! 回答1

Cycles in c++ like in python (range-based for)

六眼飞鱼酱① 提交于 2019-12-12 11:42:07
问题 What is the easiest way to do cycles in c ++ like in python? for i in range(10): #or range(4, 10, 2) etc foo(i) I mean something simple and one-line like this for(auto i: range(10)) //or range(4, 10, 2) or range(0.5, 1.0, 0.1) etc foo(i); but not like this: std::vector<int> v(10); std::iota(begin(v), end(v), 0); for(auto i: v) { foo(i); } Or this for(auto i: []{vector<size_t> v(10); return iota(begin(v), end(v), 0), v;}() ) { foo(i); } Of course, it is not difficult to use these examples or

Select text just like “Ctrl+A” when clicking the text?

元气小坏坏 提交于 2019-12-12 11:12:30
问题 I want to select the text in a paragraph when I click or double click the <p> tag. Not highlight, just like using mouse to make a select area to choose text to be selected! I have several paragraph and *.rar file link addresses on the page, and I want to select all the text when I click on one of them. I think the textbox could work that way but I like it to be in a paragraph or link tag. Is there a way to select all text in paragraph by clicking another element? 回答1: Here's a function that

Ranges in Kotlin using data type Double

北慕城南 提交于 2019-12-12 10:36:16
问题 fun calcInterest(amount: Double, interest: Double): Double { return(amount *(interest/100.0)) } fun main(args: Array<String>) { for (i in 1.0..2.0 step .5) { println("&10,000 at 5% interest is = ${calcInterest(10000.0,i)}") } } I get the error saying the For-loop range must have an 'Iterator()'Method. It underlines my doubles in the section (i in 1.0..2.0) How can I use doubles in a range?? A website on Ranges Reloaded (https://blog.jetbrains.com/kotlin/2013/02/ranges-reloaded/ ) shows that

mySQL failed attempt at getting posts from last 24hr, and last 60 min

僤鯓⒐⒋嵵緔 提交于 2019-12-12 10:19:26
问题 Ok Editing this... SELECT * FROM votelog WHERE ipaddress = '127.0.0.1' AND datevoted BETWEEN DATE_SUB( CURDATE( ) , INTERVAL 24 HOUR ) AND CURDATE( ) LIMIT 0 , 30 That is an example of the query I am attempting to run to find posts within the past 24 hours. I am also running a separate one for different needs for in the past 60 minutes. Issue is there is at least 4 rows in the table I am testing with 3 of which fall under the 24 hour clause. Edit Ok so I figured out my problem, 1 Im to damn