FAQ Database Discussion Community


Why is `1000000000000000 in range(1000000000000001)` so fast in Python 3?

python,performance,python-3.x,range,python-internals
It is my understanding that the range() function, which is actually an object type in Python 3, generates its contents on the fly, similar to a generator. This being the case, I would have expected the following line to take an inordinate amount of time, because in order to determine...

How to consider the value of a vector is in specific range of values of another matrix in matlab?

matlab,vector,range
I have a vector A with size of 54000 x 2. Each row includes range of accepted min and accepted max of values for that row. For example: A=[0.5 1.5 ; 1 2.5; -0.5 1.5] From the other side, I have vector C with size of 300000 x 1. Now...

Having Range attribute and one extra number

c#,range,data-annotations
I have a property with RangeAttribute.. let's say: [Range(0, 30, ErrorMessageResourceName = "Range", ErrorMessageResourceType = typeof(validationMessages)))] public int? years {get; set;} I want to have the validation range but i also want to let the user enter ONE other number let's say 66 as well. is there anyway to have...

How to select a range of my table

mysql,sql,select,range
I have a table like this: (Pay attention to the sequence numbers for every word) // tablename +---------+----------+ | word | number | ---------------------- | jack | 1 | | jack | 2 | | jack | 3 | | ali | 1 | | ali | 2 | |...

modify range in every loop of the range

python,range
I have a groups.txt file which contains ortholog groups with species and geneID in every groups. it looks like : OG_117996: R_baltica_p|32476565 V_spinosum_v|497645257 OG_117997: R_baltica_p|32476942 S_pleomorpha_s|374317197 OG_117998: R_baltica_p|32477405 V_bacterium_v|198258541 I made a function that created a list of every species in the whole file (66 total) called listOfAllSpecies. I need...

PHP get ranges of same values from array

php,arrays,key,range,value
Is there any way to get the key range of same values and make a new array? Let's say we have an Array Like this in php : $first_array = ['1'=>'a','2'=>'a','3'=>'a','4'=>'b','5'=>'b','6'=>'a','7'=>'a']; How can i get this array? Is there any function for this? $second_array = ['1-3'=>'a','4-5'=>'b','6-7'=>'a']; ...

With sql find next available integer within range that is not present in existing integer subset(s)

sql,math,sql-server-2012,network-programming,range
Problem statement: given a range x -> y of unsigned integers where x and y are both in the range 0 -> 2n and n is 0 -> 32 (or 64 in alternate cases) find the minimum available value not equal to x or y that is not in an...

Return 0 when regex match is found (PHP)

php,regex,range,preg-match,inverse
I am hoping to return 0 when 2011-2016 is found in the string. For the life of me I cannot figure out a regex that will return 0 when a match is found and 1 when there is no match. Yes I could easily negate the entire statement but I...

Swift Range Type endIndex

swift,range
If you create a var Range = 0...0, I would expect the endIndex to be zero. But in reality is 1. var myRange: Range<Int> = 0...0 print("start Index \(myRange.startIndex) End Index \(myRange.endIndex)") output: "start Index 0 End Index 1" How can I question a Range instance if an Index of...

Using ranges as keys in Ruby

ruby,range
I have a hash table that uses ranges as keys. hash = { 1..10 => "Foo", 11..20 => "Bar", 21..30 => "Baz", 31..40 => "Quux", } hash.find {|key, value| key == 5} # => `nil` Why doesn't it return Foo? EDIT: As pointed out below, changed Hash to hash...

how to select monday through sunday in mysql

mysql,date,range
I have a table that keeps the last few weeks worth of data. The system goes offline around 3am daily for a few min. I would like to run a cron job on Monday around 3am to pull last week's data. How would I select last week's data (Monday 00:00:00...

Understanding an RLE coverage value

r,range,bioconductor
Using R and bioconductor. I'm not sure how to understand an integer rle that you'd get from functions like coverage() such as this integer-Rle of length 3312 with 246 runs Lengths: 25 34 249 16 7 11 16 ... 2 32 2 26 34 49 Values : 0 1 0...

Selecting multiple contiguous ranges separately

excel-vba,range
I'm designing a macro that lets users select certain ranges of a dataset they would like to check for errors (in this case, if respondents to a survey selected the same option for multiple questions). To make it easier for users to see what ranges they are checking (and so...

How do you use a range of numbers in an if statement in livecode?

numbers,range,livecode
How do you do a range of numbers in livecode? I tried using "-" like this if the loc of the image "yellowdisck.png" is 0 50,0-640 then But this doesn't work....

Iterator for a subset of a vector

c++,c++11,vector,range
Is it possible to get a const iterator from a vector that can only iterate a certain range of the vector before being invalidated? For example if I have a vector of 10 elements, I want to return an iterator of elements 4 to 7. pseudo-code: int main() { std::vector<int>...

Insert at caret with javascript, but only within a certain class

javascript,range,selection
I'm using a bit of javascript written by The Great and Powerful Oz Tim Down that inserts things at the caret. It works great, but how can I restrict the function to only operate within a div with a class name of "editor-text"? Edit: It must also work within other...

IndexError: list index out of range

python,list,range,indexoutofrangeexception
While stumbling my way through a tutorial, I've had a recurring issue (I say recurring, because it seemed to spontaneously resolve itself after I'd given up for the day and later on begin appearing again, I don't know what I did to make that happen) with the error: Traceback (most...

Filtering a list of integer in range, to exclude the subsets in python

python,range,subset
I'm trying to find a faster way to filter my list of ranges, so that any range that can be covered completely by a larger range will be excluded. For example, #all ranges have width >1, which means no such case like xx=[1,1] in my list #each range itself is...

Python: Converting Miles to Kilometers

python,range
I am an undergraduate statistics major attempting to learn some programming on the side. I purchased a python book and am stuck on a problem. The chapter introduces For Loops and the preceding introduced functions. Question - Write a program disttable.py that prints a table of mile to kilometer conversions...

How to find integer array size in java

java,arrays,printing,size,range
below is my code which is throwing error: Cannot invoke size() on the array type int[] Code: public class Example{ int[] array={1,99,10000,84849,111,212,314,21,442,455,244,554,22,22,211}; public void Printrange(){ for (int i=0;i<array.size();i++){ if(array[i]>100 && array[i]<500) { System.out.println("numbers with in range ":+array[i]); } } Even i tried with array.length() it also throwing the same error....

Symfony2: How to hide default selected of range

symfony2,range
here's the line ->add('datefinProjet', 'date', array('label'=>'Date fin Projet :', 'years' => range(date('Y') - 20, date('Y') - 100),'empty_value' => array('years'=>'' , 'month' => '', 'day' =>'' ))) i want that the select list start with the empty value '' but its starting with 1995 thanks...

How to print a greedy range of lines using awk

regex,bash,search,awk,range
I've encountered the following problem and haven't found a solution nor why awk behaves in this strange way. So let's say I have the following text in a file: startcue This shouldn't be found. startcue This is the text I want to find. endcue startcue This shouldn't be found either....

Write the result of the function evaluate in excel

excel,function,range,evaluate
i need to make a function : http://i.stack.imgur.com/3JaRw.png Function result(Ran As Range) Application.Volatile Dim columnNum As Integer Dim rowNum As Integer columnNum = ActiveCell.Column rowNum = ActiveCell.Row Ran.value = Evaluate(Cells(RowNum , ColumnNum - 1).Value) End Function it doesn't work How can i write the result of the addition which is...

Excel - Inserting Cell Values into Ranges

excel,range,cell,excel-indirect
I'm having problems inserting the value of a cell into a range. Right now I have: =M3/SUM(M$3:M$13) What I need is to be able to insert the value of another cell into that range, like: =M3/SUM(M$A1:M$B1) I have spent some time with the indirect function but I can't seem to...

How to get rows of a dataframe that contain values between two other values?

r,data.frame,range
So I want to find values in a column of a data.frame, which are in range of defined values: example [1] 6 2 4 3 5 1 pos [1] 1 3 2 I now want to get the values of example for which BOTH of the following statements are TRUE,...

VBA Defining Multiple Named Ranges

excel,vba,range,named
I am working with a sheet with almost 200 named ranges (each column is a NR). I now would like to make them dynamic i.e. instead of defining them like PersonID = =RawData!$A$2:$A$100 I want to do it this way PersonID = OFFSET(RawData!$A$2,0,0,COUNTA(RawData!$A:$A),1) But I do not want to do...

Excel VBA range after filtering xlCellTypeVisible

excel,vba,excel-vba,filter,range
What I want to accomplish: Open a workbook from a specific address, Filter the first column for value equal to 36 or 541 (I got this first part working), then check column 3 to see if a value of 2 exists and if it exists then filter out everything except...

More elegant way to form n-digit range of numbers

python,python-3.x,numbers,range,dynamically-generated
I need to form a range of numbers depending on input param n. If n=1 range is range(0, 10), if n=2 then range(10, 100). I have a code, but it looks ugly, maybe there is better way. start = 0 if n == 1 else int('1' + '0' * (n...

Animating a range slider back and forth (loop)

javascript,jquery,jquery-ui,jquery-animate,range
I am trying to animate a range slider that slides to the max and down to the minimum over a duration of about 2 seconds for each movement and in increments of 1. I do not want to it to be instantaneous; I want the user to see the slider...

Does the change in lower bounds for the char type in C++14 break compatibility with ones' complement systems?

c++,range,standards
Why was char in C++14 ever defined as specifically one less than the amount of values that a char could hold before, and what was their reasoning for changing such things for the C++14 Standard? It appears that from http://en.cppreference.com/w/cpp/language/types that C++14 has changed the lower limit from -127 to...

indexing/slicing a 2d numpy array using the range/arange function as the argument

python,arrays,numpy,range
I have a basic doubt in numpy. I am using Python 2.7, numpy-1.9.2 on Ubuntu 14.04. For example, I initialize a 2d numpy array as a = np.zeros((10,10)). I then try to index a portion of it using the range function as the indices by the following way: a[range(0,5),range(0,5)]. I...

How to select range of records in Oracle

sql,oracle,range
I am trying to select a range of records using a SQL Query: SELECT COMPANY_ID as SEQ_NO, NULL URBAN_CODE FROM (SELECT COMPANY_ID as SEQ_NO, NULL URBAN_CODE, ROWNUM num from COMPANY_TABLE) WHERE num > 1 and num < 9 The error I keep getting is "URBAN_CODE": invalid identifier I saw this...

how can we have double digit range drop downs in rails forms? that gerates drop down with numbers like 00,01, 02 etc, instead 0,1 , 2 etc?

ruby-on-rails,double,range,digit
How Can we have a double digit drop downs for minutes and hours selection, in rails forms? i checked the range drop downs in rails, but it is generating single digit numbers in drop down like 0, 1, 2 etc,but i wanted to generate these numbers like 00, 01,02 etc.,

Creating a Range in VBA

vba,range
I'm working on my first VBA function. The goal is to have a function that accepts two integers as inputs, and outputs an array containing all the integers in between the two inputs (end-points included). Example: If I input 5 and 9, the output should be an array of 5,...

Is inside range

range,contains,nim,nimrod
Say you have the following type: type Min = 1..4 You want to check whether some int falls inside Min as you can with sets: 's' in {'a'..'z'} It is possible to express it more elengantly than: 2 in {low(Min)..high(Min)} #Too many characters 2 in Min #Expecting this conciseness ...

Array of integers into array of ranges

ruby,arrays,range
I'm trying to figure out how I can change array of integers into array of ranges. For example I want to take this array: ar = [0, 49, 14, 30, 40, 23, 59, 101] into ar = [0..49, 14..30, 40..23, 59..101] Given array always will be even. I want to...

IIRF Allow Specific IP's in a blocked range

ip,range,blocked,iirf
I have a range of IP addresses that are blocked. But I have 3 ip addresses within this block that need to be allowed. Can anyone help with this? The Rewrite rule looks like this: RewriteCond %{HTTP_true_client_ip} 54\.(242|243|234|235|236|237|224|225|226|227|208|209|210|211|221|204|205|196|197|198|80|81|82|83|84|85|86|87|88|89|90|91|92)\.\d{1,3}\.\d{1,3} RewriteRule ^(.*)$ $1 [F] I want to allow these three [54.243.53.243, 54.243.53.248,...

2D array values to sheet at specific location

arrays,excel,vba,excel-vba,range
I'm trying to get the values of a 2D array onto a worksheet, starting at a certain cell. For example, in cell A1, I type the formula =testArray2Sheet(D7) The expected outcome would be that the values appear on the sheet, the first value being in cell D7 and spanning 18...

VBA excel: update rowsource for combobox control by resizing range

excel-vba,combobox,resize,range
I am trying to make an VBA update rowsource routine for a series of 3 combobox controls in a userform. The three comboboxes all reside in a frame named "frm1" The rowsource of the comboboxes are three seperate columns in a worksheet. The worksheet are named "options" and the top...

Excel VBA - Using the column of one variable range to set another

vba,excel-vba,variables,range
I have one variable range object that needs to be set using the column of another range variable. The code sample looks like this: For Each CCount In Range("'Req Raw'!$A$2:$AA$2") If CCount.Value <> 0 And CCount.Value <> "" Then Set MCell = Range("'Req Raw'!" & CCount.Column & (RC + 1))...

Process a list with a loop, taking 100 elements each time and automatically less than 100 at the end of the list

c#,list,loops,range
Is there a way to use a loop that takes the first 100 items in a big list, does something with them, then the next 100 etc but when it is nearing the end it automatically shortens the "100" step to the items remaining. Currently I have to use two...

Is There a Standard Algorithm to Iterate Over a Range?

c++,algorithm,for-loop,range,standard-library
I need to call a lambda with every int in a range. Is there a standard algorithm that does this? Ideally something equivalent: for(auto i = 13; i < 42; ++i)[](int i){/*do something*/}(i); ...

how I can extract data between now and the end of the current date? Postgres

postgresql,timestamp,range
I need to extract the last hundred calls from now until the end of the current date ejm: select * from call where create_at between >= yyyy-mm-dd 00:00:00 and <= yyyy-mm-dd 23:59:59 limit 100 how i can to extract the data between this range?...

how to set a range using columns and rows

excel,vba,range
Tried to get a range setup to use the worksheet function COUNTIF. Here's what I've got: Function count_if(work_sheet As String, criteria As String, column_num As Integer) Dim rows As Integer rows = Get_Rows_Generic(work_sheet, 1) ' get the number of rows in another sheet Dim full_range As Range With work_sheet Set...

VBA SUM Variable Range

excel,vba,variables,sum,range
I want a code to sum the Variable rows up if certain condition is met. e.g. If A12 is numeric and B12 is empty then insert a fomula in cell C12 to sum C3:C11. Then perform the same action at C22 and C30. The problem I have is don't...

VBA, moving some range down, if not matching time

excel,vba,range
I have 16k rows of data. There are two columns with time. What i need is to find rows where time doesn't match and move everyhing below in last 3 columns down on one, so at the end I'll have all rows with time match and those that dont would...

Select last cell in a column with blanks

excel,vba,excel-vba,range
I am trying to find the last cell in a column that is populated with data in VBA. The problem is, in the range, there are blank cells. Is there any way to select the last cell with data if there are blanks? Any help would be greatly appreciated! I...

Excel/VBA - Loop through range

excel,loops,excel-vba,range
I have the following code: TotalCount = Application.Sum(Worksheets("Data").Range("B14:G14")) Sheets("Data").Range("H14") = TotalCount TotalCount = Application.Sum(Worksheets("Data").Range("B13:G13")) Sheets("Data").Range("H13") = TotalCount TotalCount = Application.Sum(Worksheets("Data").Range("B12:G12")) Sheets("Data").Range("H12") = TotalCount TotalCount = Application.Sum(Worksheets("Data").Range("B11:G11")) Sheets("Data").Range("H11") = TotalCount As you can see... it's not very efficient. Problem is, i cant find a loop solution to make...

How to check if a number is in a interval

python,coding-style,range,intervals
Suppose I got: first_var = 1 second_var = 5 interval = 2 I want an interval from second_var like second_var ± interval (from 3 to 7). I wank to check if first_var is in that interval. So in this specific case I want False If first_var = 4, I want...

Return a range from a cell's address in an VBA function?

excel,vba,function,range
I have the following function to find a cell's range: Function find_last_column() Dim ws As Worksheet Dim rng1 As Range Set ws = Sheets("Data_History") Set rng1 = ws.rows(1).Find("*", ws.[a1], xlFormulas, , xlByColumns, xlPrevious) find_last_column = rng1.Address End Function I'd like to use rng1.Address as a range in the following sub:...

Internet Explorer won't display range slider or update CSS with jquery

jquery,css,html5,internet-explorer,range
I have a HTML5 range slider, and a div id="text_output" above it. The div starts off with css display: none;, and I update the css to display: block; when the slider is moved. I also update the text in the div to display the slider value. Simple, right? Try as...

R: can range(data.frame) exclude infinite values?

r,range,infinity
I am trying to find the range of a data frame with infinite values: > f <- data.frame(x=c(1,2),y=c(3,Inf)) > range(f) [1] 1 Inf > range(f,finite=TRUE) Error in FUN(X[[2L]], ...) : only defined on a data frame with all numeric variables Calls: Summary.data.frame -> lapply -> FUN > range(f$y) [1] 3...

input arguments in setRange() in Accumulo

search,range,accumulo
I have code like the following: Scanner s = conn.createScanner("userdata", auths); s.setRange(new Range(input)); s.fetchColumnFamily(new Text("age")); My question is, does anyone know that what should be the "input" part in the "new Range(input)"? is the input RowId?...

using range in CONCATENATE function

excel,range,concatenation,libreoffice,calc
I would like to combine the content of many cells in one cell. One possible solution for me is CONCATENATE function. If I use this: =CONCATENATE(B1,C1,D1) it works fine, but for: =CONCATENATE(B1:D1) I am seeing such a value: #VALUE in the cell. How can I define range in a CONCATENATE...

Number of intersections between 2 date ranges

php,codeigniter,date,range
I have 2 date ranges in my Codeigniter App, and i want to calculate the number of days that intersects between those to ranges. any ideas? Date1start = YYYY-MM-DD; Date1end = YYYY-MM-DD; Date2start = YYYY-MM-DD; Date2end = YYYY-MM-DD;...

Number range on an edittext - only want numbers between 1 and 10

android,button,onclick,range
I'm trying to make an app that only allows a user to enter between 1 and 10, I've tried writing my own method where if the number is out of that range, it changes the text views to ERROR and clears what's in the edit text, however it crashes the...

How to specify a range and perform a function accordingly in matlab?

matlab,function,if-statement,matrix,range
I need to perform the following function in matlab. I had tried the following code but somehow my if statement is wrong. I'd like to know how to use the if statement efficiently here. If there is any other method in which i could perform the function please do help....

Can I initialize an array to a range of values?

arrays,coldfusion,range
Using ColdFusion, is there any simple way to initialize an array with a range of numbers? I know that I can loop: testArray = []; for(i=345;i<645;i++){ ArrayAppend(testArray,i); } Is there any implicit way to initialize an array and populate it with a range of numbers?...

Generating a list containing range of numbers from min and max values

c#,range
I'm trying to generate a list containing range of numbers from a given min and max values. If my min value is 14500 and max value is 58000 then I need the method to return; Less than Rs. 20000 Rs. 20,001 - Rs. 30,000 Rs. 30,001 - Rs. 40,000 Rs....

How do you create a random range, but exclude a specific number?

python,if-statement,random,while-loop,range
I have the following code: while True: if var_p1 != "0": break else: import random var_p1 = random.randint(-5,5) I want the loop to repeat until var_p1 equals anything but zero. However, I get zero all the time. What am I doing wrong?...

Assign a Range of Numbers to a Single Key with Dictionaries

python,dictionary,range
I was working on a dictionary, but I came up with an issue. And the issue is, I want to be able to use more than 1 number in order to reference a key in a dictionary. For example, I want the range of numbers between 1 and 5 to...

Angular range input value changing with seconds

angularjs,dynamic,range
I have an input that looks like this and it's hooked up to a controller that's increasing the value every second. If I set value to a number the page will reflect that when it loads but it won't reflect changes that are made dynamically. Do I have to use...

MySQL CASE for value range doesn't work but nested IF's do?

mysql,range,decimal,case,nested-if
I'm probably missing something that is really, really simple, but I can't for the life of me figure out what it is that I'm not doing correctly... I have this query which is used to pull out hours people have completed in volunteering and then assign them an award based...

Infinite Scroll: show elements between a range

jquery,range,infinite-scroll
On my page I have 16 elements. Initially only 4 are showing and the rest 5-16 are hidden on the page. On page load I am using the :gt selector to hide everything beyond my 'post per page' number which is set to 4. this.ppp = 4; this.count = this.ppp...

How do certain variables/equations affect lists?

python,list,range,equation
def list(a, b): for k in range(len(a)): a[k] = a[k] + b[len(b)-1-k] return a When it comes to manipulating lists, how does python execute a function like this one from a line by line basis. Specifically when i'm presented with an len() or [k] in this code how does it...

Find and copy/paste last colums

vba,excel-vba,range,paste
I have a problem inserting new columns and pasting the values of the last columns in these new columns. The code i got so far is this Sub Macro1() Dim ws As Worksheet Dim LC As Long Set ws = ActiveWorkbook.Worksheets("TOT") LC = ws.Cells(3, Columns.Count).End(xlToLeft).Column ws.Columns(LC - 2).Insert ws.Columns(LC -...

Javascript range loses whitespace on Firefox?

javascript,jquery,css,range
My code is here on codepen I am trying to count the characters and wrap those that exceed a certain limit in a <span> which I've styled as red. The code mostly works with the exception of the function that moves the caret to the end, on Firefox the ranges...

Ionic - Disable Range Selection with Toggle

javascript,angularjs,range,ionic
I have a problem when making an ionic app about disable a range selection script below cannot work as I expected below: For controller script: .controller('SetDiscount', function($scope) { if ( $scope.checkbox = { checked: true }) { $scope.disabled = true } else { $scope.disabled = false } }); For Template...

Sum a value in SSRS Reports based on date range

date,reporting-services,sum,range
I'm trying to sum a field value in an SSRS report based on a date range field in the same dataset, but have had no luck. So far this is what I've come up with. I've scoured the forums with no luck. Any help would be greatly appreciated. = sum(...

oracle sql - finding entries with dates (start/end column) overlap

sql,oracle,date,range
So data is something like this: ID | START_DATE | END_DATE | UID | CANCELED ------------------------------------------------- 44 | 2015-10-20 22:30 | 2015-10-20 23:10 | 'one' | 52 | 2015-10-20 23:00 | 2015-10-20 23:30 | 'one' | 66 | 2015-10-21 13:00 | 2015-10-20 13:30 | 'two' | There are more than...

AutoFilter in excel VBA

excel,vba,excel-vba,range,autofilter
I have a large spreadsheet of data that I am trying to filter using autofilter. I have two autofilter statements that, when I run them at the same time, return no data (which I know is a mistake). But, when I run them separately they work fine. I am not...

Rapidminer sustituir valores numericos que se encuentran en un rango

range,rapidminer,substitute
Utilizando Rapidminer Studio 6 tengo que sustituir los valores de un atributo que están fuera de un cierto rango, por 0, y no sé que operador puedo utilizar (o combinación de operadores). Por ejemplo, si tengo para un atributo los valores 1 2 3 4 5 6 7 y aplico...

comprehension over external range loses output type

range,list-comprehension,julia-lang
Another newbie question, I find this difference very confusing: it = 1:3 typeof([i^2 for i in 1:3]) # Array{Int64,1} typeof([i^2 for i in it]) # Array{Any,1} why does it matter where the range is defined? typeof([i^2 for i in it::UnitRange{Int64}]) seems to give a hint, as does this discussion. However,...

Best way to find the most maximum sum of a range in array

python,arrays,sum,logic,range
What is, in Python, the best way to find the maximum sum of elements in a range of an array? e.g. one array [1,-3,2,5,-5] What is the range that the sum of elements is the most positive of any other range in the array? The result has to be the...

Swift Range on the fly 1…12.contains(1) Cannot invoke 'contains' with (Int)

swift,range
Is is not possible to create a range and call its contains method like this: 1...12.contains(1) When I create a var range = 1...12 and print its dynamicType I get a Swift.Range<Swift.Int>, so I'm guessing is not a type mismatch problem, or is it?...

Haskell, make single string from integer set?

string,haskell,count,int,range
I'd greatly appreciate if you could tell me how to make a single string from a range between two ints. Like [5..10] i would need to get a "5678910". And then I'd have to calculate how many (zeroes, ones ... nines) there are in a string. For example: if i...

Errors 91 and 424 when iterating over ranges in Excel VBA

excel,vba,excel-vba,range
I am an absolute VBA beginner. I have been trying to create a function that separates a large range into smaller ranges. However, when I try and iterate over the large range, I get errors 91 and 424 interchangeably. Here is the relevant bit of code: Dim cell As Range...

how to use variable ranges in different sheets

excel,vba,excel-vba,variables,range
I wrote a code for a product between 2 ranges. One of those ranges is in other and when i have tried to make it variable, appear some mistake. This is the code: Sub Correlacionar() Dim col As Integer Dim random As Range Dim SDesv As Range Dim Chole As...

How do I copy an HTML document and edit the copy based upon the selection, without altering the original document?

javascript,html,dom,range,selection
I have an HTML document, and I would like to remove some of the tags from it dynamically using Javascript, based on whether the tags are within the current selection or not. However, I do not want to update the actual document on the page, I want to make a...

Full-range random number in Python

python,numpy,random,range
I'm generating a series of random floats using this line: random.random()*(maxval-minval) + minval I'm using it to add variable noise to a given variable, and the amount of noise added depends on a series of factors. In some cases, the noise should be so high that in practice the original...

Excel VBA - Read range into Variant while maintaining index same as column numbers

excel,vba,indexing,range,variant
I am writing a vba macro in Excel 2013. I have the below code to read a range into a Variant, Dim MyBuffer As Variant With MyWorkSheet MyBuffer = .Range(.Cells(1, NAME_COL), .Cells(10, AGE_COL)).Value End With 'Here NAME_COL = 5, AGE_COL = 9 Now MyBuffer is a 2 dimensional array with...

How to style different input ranges on the same site

html,css,range
I'm trying to style two different ranges on my site. The first one I've already styled. The problem is with the second one. I want the second range to be styled differently than the first one. Here's an example of what I mean: Range 1: blue background Range 2: green...

Build an array with a range of MAC addresses [closed]

php,arrays,range
I want to build an array which contains a full list of MAC addresses based on 3 variables: a prefix, a start, and an end. Let's say I have 20:1E:50:3F:8A as a prefix, 3E as a start, and 43 as an end. This should generate the following array of MAC...

Short for 'for i in range(1,len(a)):' in python

python,for-loop,range,iteration,enumerate
In python, is there a short way of writing for i in range(len(l)):? I know I can use for i,_ in enumerate(l):, but I want to know if there's another way (without the _). Please don't say for v in l because I need the indices (for example to compare...

python Win32 Excel is cell a range

python,vba,winapi,range
I am writing a bit of Python code to automate the manipulation of Excel spreadsheets. The idea is to use spreadsheet templates to create daily reports. Saw this idea working several years ago using Perl. Anyway. Here are the simple rules: Sheets with the Workbook are process in the order...

How to do the limited record searching?

php,mysql,range
Please help me. In this code, the user will type a number. Then after submitting the input, the only records that it should be searching at is from ID numbers 1 to 143 only (excluding numbers 144 and up). How can I do it? Is it like a range? How?...

Hide a certain range of children jQuery

jquery,range,hide,children
I'm building a common header for a bunch of pages and passing in variables to set heading text, etc. I have a breadcrumb menu, and I want to only show the appropriate number of steps for the page. So here's my menu html: <ol id="meter" class=""> <li>Page 1</li> <li>Page 2</li>...

Simple Python Program - unsure with Range and loop

python,for-loop,while-loop,range
Here is the psuedo code I was supposed to create in python: PlayerOneScore ← 0 PlayerTwoScore ← 0 OUTPUT "How many games?" INPUT NoOfGamesInMatch FOR NoOfGamesPlayed ← 1 TO NoOfGamesInMatch Do OUTPUT "Did Player One win the game (enter Y or N)?" INPUT PlayerOneWinsGame IF PlayerOneWinsGame = 'Y' THEN PlayerOneScore...

Excel-VBA: create named Range in row until end of cell content

vba,excel-vba,range
Imagine an Excel sheet with some rows and some content in each row (i.e. different column-length for each row). In Excel-VBA: How can I create a range-X within column-X that goes from row-cell-2 to the end of the content of this X-column ?? i.e. I would like to create a...

Update column “X” if any changes made within A:AE range, but keep the same row

excel,vba,range,offset
I am trying to create a code that would update a date value in column "X" should there be any changes in any cells within A:AE. Update function must only work for the same row. For example, I make a change to A1 and X1 is updated. Many thanks! Private...

How to iterate over a a predictable progression of single characters in Python?

python,range,iteration
I have a series of websites I want to look at. The name of the each page is like this: book_page = ("http://target.com/books/char/X/") where X is a single letter of the alphabet. So the range will be mylist = ['A','B','C'] etc. First, is there an expression to create that list...

Replace values in range Rapidminer

replace,range,rapidminer
I am using Rapidminer Studio 6 and I want to replace values in dataset (or results, or series), lets say we have an attribute with values between 1 and 10, so I want to apply an operator which will replace values 1 to 4 and 8 to 10 by 0...

How can I shrink two dates in to one date range?

php,date,time,range
I need to display date ranges like the following: May 5-7, 2015 April 29-May 5, 2015 December 30 2015-January 1, 2016 I'm provided a start date and an end date as PHP date objects. Is there a way I can parse those with PHP to output as needed? EDIT: I...

Unable to understand the error generated

python,indexing,range
error section--> student_grade_system = StudentGradeSystem(sys.argv1) errored place--> Traceback (most recent call last): File "C:\Users\Daphnie\Desktop\Python_code\12\student_grade\grade_system.py", line 111, in main() File "C:\Users\Daphnie\Desktop\Python_code\12\student_grade\grade_system.py", line 105, in main student_grade_system = StudentGradeSystem(sys.argv1) IndexError: list index out of range Code: import sys from student import Student class StudentGradeSystem(object): def __init__(self, score_file): self._score_file =...

How can I use target address to get sum of a range of cells? [closed]

excel,vba,sum,range,target
I have target.address (or just target) from a worksheet_change sub. I'd like to use the row from target.address and a range of columns (H:W), and get a sum of that range. So, for instance, if I have $100 in H10 and I add $50 in J10, I'd like to get...

Syntax in Excel VBA: how to refer to column of a table as a range in the “=IF” function

excel-vba,if-statement,range
I'm trying to find the row of a cell (in a table) which meets 3 criteria. Thanks to another post I have come up with this working code: x = Filter(Application.Transpose(Application.Evaluate("=IF((Sheet6!A6:A15=""joseph"")*(Sheet6!B6:B15>date(2001,1,1))*Sheet6!C6:C15=""grenade""),ROW(Sheet6!A6:A15),""x"")")), "x", False)* I would now like to use named ranges in this code instead of "Sheet6!A6:A15). When I try...

Finding numbers within a certain range in an arraylist

java,netbeans,methods,arraylist,range
I have an Integer array list that collects numbers that the user inputs. I have to display numbers within the array that <= 50, using a method. How can I do this? public static double levelR(List<Integer> marks){ for (int i= marks.get(0); i<= 50; i++){ System.println(marks.get(i)); } This is all I...

Change rotateY angle by input range

jquery,css,range
I got a problem while messing with Codepen. Here is my pen that I'm working on. Here is the mark-up (in Haml): .planet -(1...100).each do |i| .circle %input{:type => "range" ,:min => "0.1" ,:max => "360" , :step =>'1',:value => '1' ,:id => 'focal'}/ The SCSS : $n:100; //play with...

Simple python program - stuck

python,list,integer,range
I'm writing this code where it says if the person I put has a high score or not. It works fine when I put in a person within the list for example "Thor", however the program is not catching the error and not printing "no they don't have a top...

Compare two sets of Ranges and MsgBox amount and value of common cell values

excel-vba,compare,range,msgbox
I have a problem with this code and I'm not able to resolve it. I have two sets of ranges; Range("C14:C19") and Range("E14:E19") each containing 6 Numbers generated randomly (I already coded the random selection). My goal is to, after generating the Numbers, compare both Ranges. If both Ranges contain...