Menu
  • HOME
  • TAGS

How to do the limited record searching?

php,mysql,range

$query = mysqli_query($link, "SELECT * FROM demo WHERE id_ln = '$prevalue' AND id_ln <= 143"); I think this should answer your question, but as people have already said in the comments, it'd be a better idea to just disallow values higher than 143 before even attempting the query. Unless of...

Javascript range loses whitespace on Firefox?

javascript,jquery,css,range

Firefox is ignoring white spaces in HTML. You have to modify it to replace space characters with   html escape characters. In place of the code inputText.substring(0,maxCharacter) You should do inputText.substring(0,maxCharacter).replace(/ /g, '&nbsp;') Similarly in place of code inputText.substring(maxCharacter) You should do inputText.substring(maxCharacter).replace(/ /g, '&nbsp;') That will fix it. Hopefully...

Change rotateY angle by input range

jquery,css,range

I do not know any Haml, but you should add a data attribute with the starting degrees (data-starting_degrees="") for each circle and then change your javascript to this: $("#focal").on("input", function() { $(".circle").each(function(){ var degrees = parseInt($("#focal").val()) + parseInt($(this).data("start-degrees")); console.log(degrees); $(this).css('transform', 'rotateY(' + degrees + 'deg)'); }); }); Edit: Here's a...

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

You could add something like this: "%02d" % number It will return for example "%02d" % 1 => "01" "%02d" % 51 => "51" For your example it could be: <%= f.select :credit, (0..500).map { |i| "%03d" % i } %> ...

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

javascript,range,selection

You can get the node that has the selection, and check if it has the class or is the child of an element that has the class etc function pasteHtmlAtCaret(html, selector) { var sel, range, parent, node = null; if (document.selection) { node = document.selection.createRange().parentElement(); } else { var selection...

Excel/VBA - Loop through range

excel,loops,excel-vba,range

For i = 1 to 4 For t = 1 to 6 TotalCount = Worksheets("Data").Cells(i+10,t+1).Value + TotalCount Next t Worksheets("Data").Cells(i+10,11).Value = TotalCount TotalCount = 0 'reset TotalCount Next i As long as you don't mind the macro going in the opposite direction, that should achieve what you're looking for....

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

jquery,css,html5,internet-explorer,range

Escher, I tested this locally and the doc defaulted to an older IE version. If you move the meta tag before your script include, see below, this shall sort out your IE Version issue. As for your other issue, unfortunately I can't reproduce on my current PC - I have...

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

r,data.frame,range

Set min and max thresholds and then compare each element against them maxind <- max(pos + 1) minind <- min(pos - 1) Then example[sapply(example, function(x) x > minind & x < maxind)] ## [1] 2 3 1 Or, similarly example[example > minind & example < maxind] ## [1] 2 3...

Creating a Range in VBA

vba,range

if you asking about Cells multiple range then you can use this: Sub test1() Dim nStart&, nEnd& Dim Rng As Range nStart = 5: nEnd = 9 Set Rng = Range("A" & nStart) While nStart <> nEnd Set Rng = Union(Rng, Range("A" & nStart + 1)) nStart = nStart +...

Write the result of the function evaluate in excel

excel,function,range,evaluate

I had problems using a function named result. Changing the function name seemed to work. See below: Public Function doo(ran As Range) doo = Evaluate("=" & ran.Value) End Function ...

Finding numbers within a certain range in an arraylist

java,netbeans,methods,arraylist,range

You do not need to sort the array to solve this problem. Here is what you do: Start by writing a loop that prints all elements of the array regardless of the value Modify your loop to skip printing numbers above 50. There are two ways of doing this -...

Simple Python Program - unsure with Range and loop

python,for-loop,while-loop,range

Your line for NoOfGamesPlayed != NoOfGamesInMatch: is not valid Python. If you wanted to use looping here, for is helpful but you need to add a range() function: for NoOfGamesPlayed in range(int(NoOfGamesInMatch)): See the Python tutorial on the for construct. Since the input() function returns a string, you need to...

how to use variable ranges in different sheets

excel,vba,excel-vba,variables,range

Set Chole = Sheet4.Range(Sheet4.Cells(20, 1), _ Sheet4.Cells(19 + col, col)) If you just use Cells then it will refer to the activesheet, not Sheet4. It's good practice to never use either Range or Cells without a specific worksheet qualifier. Your code should not depend on any specific sheet being active....

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

php,date,time,range

EDIT 2: I have updated the function with some date format. Output will be: Event title When: Feb 28, 2010 - Mar 2, 2010 Event title When: Mar 4, 2010 - Mar 5, 2010 Event title When: Dec 31, 2010 - Jan 5, 2011 EDIT: I found this (by searching)...

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

python,for-loop,range,iteration,enumerate

You can make it shorter by defining a function: def r(lst): return range(len(lst)) and then: for i in r(l): ... Which is 9 characters shorter!...

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

excel,vba,indexing,range,variant

Just redim it. With MyWorkSheet MyBuffer = .Range(.Cells(1, NAME_COL), .Cells(10, AGE_COL)).Value ReDim Preserve MyBuffer(LBound(MyBuffer) To UBound(MyBuffer), NAME_COL To AGE_COL) End With ...

Excel - Inserting Cell Values into Ranges

excel,range,cell,excel-indirect

This will do what you want: =M3/SUM(INDIRECT("M" & $A$1 & ":M" & $B$1)) Not sure if you want A1 and B1 absoluted so I did it anyway....

Rapidminer sustituir valores numericos que se encuentran en un rango

range,rapidminer,substitute

I don't speak Spanish but Google translate leads me to think that you need to change the value of an attribute to zero if it is outside a certain range. You can use the Generate Attributes operator for this with if in the parameters section. If your attribute is called...

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

python,range,iteration

That sequence of letters is already in string.ascii_uppercase. And for iterates over the elements of a sequence. import string for letter in string.ascii_uppercase: ... ...

VBA Defining Multiple Named Ranges

excel,vba,range,named

You can do it in VBA. Example to create a new name: ActiveWorkbook.Names.Add Name:="PersonID", _ RefersTo:="=OFFSET(RawData!$A$2,0,0,COUNTA(RawData!$A:$A),1)" To edit an already existing name: ActiveWorkbook.Names("PersonID").RefersTo = _ "=OFFSET(RawData!$A$2,0,1,COUNTA(RawData!$A:$A),1)" You indicate in a comment that you would also like to iterate through all named ranges to facilitate changing their definition. To loop through...

Understanding an RLE coverage value

r,range,bioconductor

Probably it's better to ask about Bioconductor packages on the Bioconductor support site. The interpretation is that there is a run of 25 nucleotides with 0 coverage, then a run of 24 nucleotides with 1 coverage (i.e., a single read) then another run of 249 nucleotides with no coverage, then...

2D array values to sheet at specific location

arrays,excel,vba,excel-vba,range

To move an array into the sheet, place the array formula (UDF) in the cells you want to receive the values. Say the UDF is: Function testArray2Sheet() Dim targetRange As Range Dim arr As Variant Dim rows As Long, cols As Long Dim i As Long, J as Long rows...

Replace values in range Rapidminer

replace,range,rapidminer

(copied from original answer) You can use the Generate Attributes operator for this with if in the parameters section. If your attribute is called a2 and you want to change it to zero if its value is below 3 and above 5, the parameters to the Generate Attributes operator would...

Iterator for a subset of a vector

c++,c++11,vector,range

This is pretty trivial to do (though I'd call the result a range, not an iterator). A simple implementation would look something like this: template <class Iter> class range { Iter b; Iter e; public: range(Iter b, Iter e) : b(b), e(e) {} Iter begin() { return b; } Iter...

Animating a range slider back and forth (loop)

javascript,jquery,jquery-ui,jquery-animate,range

I suggest you just use css3 (and javascript/jQuery) for this. You can set an animation using css3 animations and the rest of the functionality can be added when needed. I created and example here. @keyframes slide { 0% { left: 10px; } 50% { left: 160px; } 100% { left:...

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

sql,oracle,date,range

I would start with this query: update table t set cancelled = true where exists (select 1 from table t2 where t.end_date > t2.start_date and t.uid = t2.uid and t.id < t2.id ) An index on table(uid, start_date, id) might help. As a note: this is probably much easier to...

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

python,performance,python-3.x,range,python-internals

The Python 3 range() object doesn't produce numbers immediately; it is a smart sequence object that produces numbers on demand. All it contains is your start, stop and step values, then as you iterate over the object the next integer is calculated each iteration. The object also implements the object.__contains__...

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

php,arrays,range

Running the range should be very easy, assuming you are using a 64bit capable PHP: $mac_array = range(0x201E503F8A3E, 0x201E503F8A43); foreach ($mac_array as $mac) { echo wordwrap(sprintf("%012X", $mac), 2, ":", true); } Now what is going on here? The range() function creates an array containing integer numbers from the first to...

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

vba,excel-vba,variables,range

You could use: Set MCell = Cells(RC + 1, CCount.Column) Your options do not work, because: CCount.Column returns a column number (not a letter), so the result of CCount.Column & (RC + 1) could be "12" instead of "A2". In Cells() the first argument is Row number and the second...

Angular range input value changing with seconds

angularjs,dynamic,range

When you bind anything using scoped function call angular cannot keep a watch on it so the value will not be updated. You will have to change it to a property and set using ng-model and update the property value using angular's $interval passing the required interval in milliseconds. Html...

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

matlab,vector,range

A bit more intuitive to me would be: c_indx = bsxfun(@le,A(:,1).',C) & bsxfun(@ge,A(:,2).',C); However, by making use of row-operations, it should be computationally faster like this: c_indx = cell2mat(arrayfun(@(x)(A(:,1)<=x & A(:,2)>=x).',C,'UniformOutput',false)) ...

Number of intersections between 2 date ranges

php,codeigniter,date,range

Something like this should work $datetimeStart1 = new DateTime('2015-12-10'); $datetimeEnd1 = new DateTime('2015-12-20'); $datetimeStart2 = new DateTime('2015-12-12'); $datetimeEnd2 = new DateTime('2015-12-28'); // following http://stackoverflow.com/questions/325933/determine-whether-two-date-ranges-overlap if ($datetimeStart1 < $datetimeEnd2 && $datetimeEnd1 > $datetimeStart2) { echo min($datetimeEnd1,$datetimeEnd2)->diff(max($datetimeStart2,$datetimeStart1))->days+1; } else { echo 'no overlap'; } Demo:...

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

numbers,range,livecode

It looks like you're trying to determine whether an object's location (its center point) falls within a rectangular area. Try using the is within operator: if the loc of image "yellowdisk.png" is within the rect of graphic "targetRect" then # do true stuff else # do false stuff end if...

IndexError: list index out of range

python,list,range,indexoutofrangeexception

Atleast one of room.x1 + 1, room.x2, room.y1 + 1 and room.y2 exceeds your map. Either check your map size or limit the access. Option 1: class RoomOutsideError(Exception): pass # ... def create_room(room): global map #set all tiles inside the room to passable # check for limits and raise exception...

How to select a range of my table

mysql,sql,select,range

I have to head out but if your data looks like this with the ID column: +---------+----------+----+ | word | number | ID | --------------------------- | jack | 1 | 1 | | jack | 2 | 2 | | jack | 3 | 3 | | ali | 1...

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

python,range,subset

You can solve this by sorting first: import operator ranges=[[0,1,2,3,4], [1,2], [0,1], [2,3,4], [3,4,5], [3,4,5,6], [4,5], [6,7], [5,6]] sorted_ranges = sorted(ranges,key=operator.itemgetter(-1),reverse=True) sorted_ranges = sorted(sorted_ranges,key=operator.itemgetter(0)) filtered = [] i,j = 0,0 while i < len(sorted_ranges): filtered.append(sorted_ranges[i]) j = i+1 while j < len(sorted_ranges) and sorted_ranges[i][-1] >= sorted_ranges[j][-1]: print "Remove " ,...

comprehension over external range loses output type

range,list-comprehension,julia-lang

Consider the following code it = 1:3 @show typeof([i^2 for i in 1:3]) @show typeof([i^2 for i in it]) function foo() it = 1:3 @show typeof([i^2 for i in 1:3]) @show typeof([i^2 for i in it]) end foo() which produces typeof($(Expr(:comprehension, :(i^2), :(i = 1:3)))) => Array{Int64,1} typeof($(Expr(:comprehension, :(i^2), :(i...

Simple python program - stuck

python,list,integer,range

You started your array index from 1 while in Python, C, C++ and a lot of languages, array indexes (such as lists) start from 0 and ends in ArrayLength - 1. Change your loop to: while (Found == False) and (Current < Max): ↑ ...

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

excel-vba,compare,range,msgbox

It may work as you wish. But if same number occurs more than once in a range it counts it as a seperate match. It counts all the matchs seperately. If one range includes two 4 and the other includes three 4 it counts six matching. Private Sub Compare() Dim...

Sum a value in SSRS Reports based on date range

date,reporting-services,sum,range

The first: you shouldn't use expression like Fields!Calculated_DueDate.Value.value - it is error. The second: There are error in arrangement of brackets. The third: In SSRS 2008R2 call of function today() marks as error. You can use expression DateTime.Today to get current date without errors markup. So, your expression should look...

Excel VBA range after filtering xlCellTypeVisible

excel,vba,excel-vba,filter,range

Something like this should work: Dim newrange As Range, rw as range Set newrange = ActiveSheet.AutoFilter.Range.SpecialCells(xlCellTypeVisible) Dim intValueToFind As Integer intValueToFind = 2 For Each rw in newrange.Rows If rw.cells(3).Value = intValueToFind Then MsgBox ("Found value on row " & rw.cells(1).Row) Exit Sub End If Next rw ...

Swift Range Type endIndex

swift,range

The endIndex is not actually included in the Range. The Range is startIndex ..< endIndex. So, for your example, 0...0 is stored as 0..<1 which means the same thing. For Swift 1.2 you can use the global function contains to check if an Int is contained by a Range: var...

VBA SUM Variable Range

excel,vba,variables,sum,range

Sub Test() Dim y As Variant Dim firstRow As Variant Dim lastRow As Variant lastRow = Range("C" & Rows.Count).End(xlUp).Row firstRow = Cells(lastRow, 3).End(xlUp).Row If IsNumeric(Cells(lastRow + 1, 1)) And IsEmpty(Cells(lastRow + 1, 2)) Then Cells(lastRow + 1, 3).Formula = "=SUM(C" & firstRow & ":C" & lastRow & ")" End If...

Array of integers into array of ranges

ruby,arrays,range

ar.each_slice(2).map { | a, b | a..b } ...

Ionic - Disable Range Selection with Toggle

javascript,angularjs,range,ionic

You can declare $scope.disabled=true; in your controller and use it as ng-model for checkbox. On Discount Amount li tag use ng-if to check if checkbox is disabled or not . Here is a code pen http://codepen.io/anon/pen/YXVMaK .controller('MyCtrl', function($scope, $timeout) { $scope.myTitle = 'Template'; $scope.data = { 'volume' : '5' };...

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

swift,range

In this case the problem was that of operator precedence: (1...12).contains(1) // -> true (the code does look ambiguous otherwise)...

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

python,if-statement,random,while-loop,range

Answering the question in the title, not the real problem (which was answered by Daniel Roseman): How do you create a random range, but exclude a specific number? Using random.choice: import random allowed_values = list(range(-5, 5+1)) allowed_values.remove(0) # can be anything in {-5, ..., 5} \ {0}: random_value = random.choice(allowed_values)...

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

excel-vba,if-statement,range

Dim rng1 As Range Dim rRow as Range Dim matchedRow as Integer Set rng1 = Worksheets("Sheet6").Range("A7:A15") for each rRow in rng1 if Range("A" & rRow.row).Value2 = "Criteria1" and Range("B" & rRow.row).Value2 = "Criteria2" and Range("C" & rRow.row).Value2 = "Criteria3" then rRow.row = matchedRow ''Do stuff with matchedRow end if next...

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

android,button,onclick,range

You have issue on this line int value = Integer.parseInt(num.toString()); change to: int value = Integer.parseInt(num.getText().toString()); Now you call toString() method from Object for EditText object. You have to call getText() method for it as first and after then call toString() method for CharSequence UPDATE: You find two times the...

Using ranges as keys in Ruby

ruby,range

With == you check for a real equality and 5 is no range. But you may use === or include?. You may also try select instead find. Example: hash = { 1..10 => "Foo", 11..20 => "Bar", 21..30 => "Baz", 31..40 => "Quux", } p hash.find {|key, value| key ===...

PHP get ranges of same values from array

php,arrays,key,range,value

Loop through it, extract the keys, generate the ranges and insert to the new array - $first_array = ['1'=>'a','2'=>'a','3'=>'a','4'=>'b','5'=>'b']; $flip = array(); foreach($first_array as $key => $val) { $flip[$val][] = $key; } $second_array = []; foreach($flip as $key => $value) { $newKey = array_shift($value).' - '.end($value); $second_array[$newKey] = $key; }...

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

In this case no recursion is needed, because we have LEAD function. I will think about the problem in terms of "gaps" and "islands". I will focus at first on IPv4, because it is easier to do arithmetic with them, but idea for IPv6 is the same and in the...

Selecting multiple contiguous ranges separately

excel-vba,range

You can cycle through each range separately and explicitly rather than relying on colors to differentiate them. For example: Sub GetRanges() Dim flRange As Range 'Dim v_Ranges As Variant Dim i As Integer 'Tell code to continue if there is an error On Error Resume Next Set flRange = Application.InputBox("Select...

How to check if a number is in a interval

python,coding-style,range,intervals

I use a class with __contains__ to represent the interval: class Interval(object): def __init__(self, middle, deviation): self.lower = middle - abs(deviation) self.upper = middle + abs(deviation) def __contains__(self, item): return self.lower <= item <= self.upper Then I define a function interval to simplify the syntax: def interval(middle, deviation): return Interval(middle,...

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

Either dynamically add a class or data attribute to all your elements on load before you clone so that you have a point of reference then grab the class or data attribute on the common ancestor and remove it from the clone. I can give an example if you like?...

How to find integer array size in java

java,arrays,printing,size,range

The length of an array is available as int l = array.length; The size of a List is availabe as int s = list.size(); ...

IIRF Allow Specific IP's in a blocked range

ip,range,blocked,iirf

I was able to add this code to omit specific IPs in the range above: RewriteCond %{HTTP_true_client_ip} ^(?!54\.243\.53\.243) RewriteCond %{HTTP_true_client_ip} ^(?!54\.243\.53\.248) RewriteCond %{HTTP_true_client_ip} ^(?!54\.198\.174\.172) Tested and it works, no problems. ...

Infinite Scroll: show elements between a range

jquery,range,infinite-scroll

To show the hide items it's better to use this: $('li.item.hide:lt(' + this.ppp + ')').removeClass('hide'); Instead all this: this.count += this.ppp; var eq = $("ul.items li.item").eq(this.count); $('ul.items).nextUntil(' + eq + ')').addClass('show'); Check this minimal example: https://jsfiddle.net/lmgonzalves/q9oh7eb9/...

Errors 91 and 424 when iterating over ranges in Excel VBA

excel,vba,excel-vba,range

I think the error is because, as mentioned in the comments, that your "for each" isn't being used correctly. Try this: Dim cel Set nonZeroes = Range(Cells(1, 1), Cells(10, 1)) ' You need to set the range to search through here. For Each cel In nonZeroes question = isTouching(cel.Value, firstfeat)...

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

c#,range

This program will take into account only the max value, because you are saying that you can accept below 6 price ranges. class Program { static void Main(string[] args) { int maxItems = 6; int minItems = 3; int maxValue = 99232; int minValue = 99000; //the list to store...

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

excel,vba,range,offset

You can use Target.Row to determine the row, so you could just use: Private Sub Worksheet_Change(ByVal Target As Range) If Target.Column < 31 And Target.Column <> 24 Then Cells(Target.Row, 24) = Now() End If End Sub ...

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

c++,range,standards

No, I misunderstood the change; the "change of bounds" did not. In fact, the only change wass that C++14 required bytes to now hold 256 distinct values, which was already within the capabilities of the typical byte data structure before hand. C++ does not restrict its implementations by requiring a...

How to style different input ranges on the same site

html,css,range

I think that you want to style ranges. First of all, input[type="range"] can only written that way and will only work with ranges, nothing more specific. You wanted backgrounds? Here they are: HTML <input type="range" id="green"> <input type="range" id="blue"> CSS(where it get's tough) #green::-webkit-slider-runnable-track { background-color: green; } #green::-moz-range-track {...

input arguments in setRange() in Accumulo

search,range,accumulo

The input to Range would be what you are looking for. Have a look at the docs: http://accumulo.apache.org/1.6/apidocs/org/apache/accumulo/core/data/Range.html#Range(java.lang.CharSequence) An example might be: s.setRange(new Range(new Text("Foo"))); ...

using range in CONCATENATE function

excel,range,concatenation,libreoffice,calc

Unfortunately the Excel CONCATENATE function doesn't work for a range or array (it does in Google Sheets). There is an example here of a simple UDF that does work with arrays in Excel....

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

python,arrays,numpy,range

With range you are using integer array indexing as described here: http://docs.scipy.org/doc/numpy/reference/arrays.indexing.html#integer-array-indexing To get the equivalent of a[0:5,0:5], you have to take advantage of 'broadcasting'. Here the 1st index is a column vector a[np.arange(0,5)[:,None],range(0,5)] In [137]: np.arange(0,5)[:,None] Out[137]: array([[0], [1], [2], [3], [4]]) I could go into more detail, but...

how to select monday through sunday in mysql

mysql,date,range

The difficulty is going to be your last second on Sunday - you often get into rounding errors there. One way to solve this is just to format or cast from DATETIME to DATE... SELECT * FROM logfile WHERE DATE(logdate) BETWEEN DATE_ADD(CURDATE(), -1 INTERVAL day) AND DATE_ADD(CURDATE(), -8 INTERVAL day)...

VBA, moving some range down, if not matching time

excel,vba,range

The following code should do it. Check whether the right ranges and cells are used; I tried to figure it out from your code: Sub timeline() Dim y As Long With ThisWorkbook.Sheets("L5") y = .Range("G" & .Rows.Count).End(xlUp).Row End With x = 2 Do While ThisWorkbook.Sheets("L5").Cells(x, 4) <> "" If ThisWorkbook.Sheets("L5").Cells(x,...

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

python,arrays,sum,logic,range

I first learned about this problem via Jon Bentley's book. To handle list with negative numbers, I added my own modification: def largest(sequence): """ This is based on Bentley's Programming Pearls chapter 8. My modification: if the sequence is all negatives then max is the largest element """ max_so_far =...

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

mysql,range,decimal,case,nested-if

You were close but had some syntax errors. Do this instead: CASE WHEN total_hours >= 1 AND total_hours <= 50 THEN 'Bronze' WHEN total_hours >= 51 AND total_hours <= 125 THEN 'Silver' WHEN total_hours >= 126 AND total_hours <= 249 THEN 'Gold' WHEN total_hours >= 250 THEN 'Platinum' ELSE 'Less...

More elegant way to form n-digit range of numbers

python,python-3.x,numbers,range,dynamically-generated

Try this: if n == 1: interval = range(0, 10**n) else: interval = range(10**(n-1), 10**n) If your range for n=1 is range(1,10), you can use just: range(10**(n-1), 10**n) without the if clause...

modify range in every loop of the range

python,range

Not sure if this is exactly what you want, but it's a start :) from itertools import combinations # Assume input is a list of strings called input_list input_list = ['OG_1: A|1 A|3 B|1 C|2','OG_2: A|4 B|6','OG_3: C|8 B|9 A|10'] # Create a dict to store relationships and a list...

python Win32 Excel is cell a range

python,vba,winapi,range

What you may consider doing is first building a list of all addresses of names in the worksheet, and checking the address of each cell against the list to see if it's named. In VBA, you obtain the names collection (all the names in a workbook) this way: Set ns...

Assign a Range of Numbers to a Single Key with Dictionaries

python,dictionary,range

You have the dictionary backwards. If you want to be able to recall, e.g., 'apple' with any of the numbers 1-5, you'd need the numbers to be the keys, not the values. for i in range(1,6): # range(a,b) gives [a,b) my_dict[i] = 'apple' etc. Then, my_dict[4] == 'apple' and the...

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

matlab,function,if-statement,matrix,range

You need to use the logical AND operator to tie two Boolean expressions together. You are using a comma which is not correct: if (y(i,j) < -0.5 && y(i,j) >= -1) f(i,j) = 0 elseif (y(i,j) < 0 && y(i,j) >= -0.5) f(i,j) = 1 elseif (y(i,j) < 0.75 &&...

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

r,range,infinity

You need to use (as David points out in comments): range.default(f, finite=TRUE) # [1] 1 3 or range(f, finite=1) # [1] 1 3 The function is erroneously requiring finite to be numeric, but then properly uses it in removing infinite values. Notice: f2 <- data.frame(x=1:2, y=3:4) range(f2, finite=TRUE) # Error...

Find and copy/paste last colums

vba,excel-vba,range,paste

Thanks all, I was not aware of this Both the Copy and the PasteSpecial methods must be used on a Range >reference/object. You are trying to use Copy on a Columns reference I have rearranged my code as follows and this works out Sub Macro1() Dim ws As Worksheet Dim...

Haskell, make single string from integer set?

string,haskell,count,int,range

I tried something like this, but it wouldn't work. let intList = map (read::Int->String) [15..22] Well... the purpose of read is to parse strings to read-able values. Hence it has a type signature String -> a, which obviously doesn't unify with Int -> String. What you want here is...

Is inside range

range,contains,nim,nimrod

If you break up the restriction of 1..4 being a type, it's easily possible. 1..4 as a value makes it a Slice instead of a range. I don't know what else you do with Min, but as a slice it supports the in syntax via a contains proc: echo 2...

How do certain variables/equations affect lists?

python,list,range,equation

I am mostly confused by the introduction of [k] in the equation as I don't know how it changes the list. someList[k] is an item accessor for the kth item of the list. So for a list a = [2, 3, 5, 7], a[k] will return the kth number....

AutoFilter in excel VBA

excel,vba,excel-vba,range,autofilter

I would suggest making a variable "rng" that is the entire table you are trying to filter. I will assume for this example that "rng3" is column A and "rng4" is column B. Sub Filter() Dim rng as Range Set rng = Range("A:B") rng.Autofilter 1, Criteria1:=Array( _ "CMS Part D...

Symfony2: How to hide default selected of range

symfony2,range

You have a error in your empty_value parameter. Should be 'year', not 'years' $builder->add('datefinProjet', 'date', array( 'label'=>'Date fin Projet :', 'years' => range(date('Y') - 20, date('Y') - 100), 'empty_value' => array('year' => '', 'month' => '', 'day' => '') )); Source: Docs...

VBA excel: update rowsource for combobox control by resizing range

excel-vba,combobox,resize,range

ComboBox.rowsource expect range.address not range.value or range reference which you have now. So, add .address property at the end of problem line in this way: j.RowSource = ThisWorkbook.Sheets("options").Range(j.Name).Resize(i).address ...

Hide a certain range of children jQuery

jquery,range,hide,children

Try setting className to 1, 2 -> 100 , and utilizing :gt() Selector selector function levels(stepNumber) { $("#meter").addClass(stepNumber) .find("li:gt(" + (stepNumber - 1) + ")") .hide(); } levels(2); <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"> </script> <ol id="meter" class=""> <li>Page 1</li> <li>Page 2</li> <li>Page 3</li> <li>Page 4</li> </ol> Alternatively, to maintain adding className as one,...

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

You can make use of LINQ Skip and Take and your code will be cleaner. for (int i = 0; i < listLength; i=i+100) { var items = bigList.Skip(i).Take(100); // Do something with 100 or remaining items } Note: If the items are less than 100 Take would give you...

Full-range random number in Python

python,numpy,random,range

After the discussion in comments i suggest the following : >>> m=sys.maxint >>> np.random.uniform(-m,m,5) array([ -5.32362215e+18, -2.90131323e+18, 5.14492175e+18, -5.64238742e+18, -3.49640768e+18]) As is said the you can get the max integer with sys.maxint then you can use np.random.randint to get a random number between the maxint and -maxint....

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

excel,vba,function,range

Use this Set starting_cell_string = Range(find_last_column()) instead of starting_cell_string = find_last_column()...

How to select range of records in Oracle

sql,oracle,range

If am not wrong you need to use alias name in outer query. You cannot use company_Id in outer query because you have given a alias name in sub-select you need to use that. SELECT SEQ_NO, URBAN_CODE FROM (SELECT COMPANY_ID as SEQ_NO, NULL as URBAN_CODE, ROWNUM num from COMPANY_TABLE) WHERE...

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

excel,vba,sum,range,target

You can use Intersect and EntireRow to figure out which cells to sum. I would give them to Application.Sum to do the math. Another call to Intersect will let you know if the changed cell is in the "boxed" area. Private Sub Worksheet_Change(ByVal Target As Range) Dim sum As Double...

Python: Converting Miles to Kilometers

python,range

That's because you're stepping by 1501 instead of 100: def mile(x): return 1.609 * x def main(): for n in range(100,1501,100): print(n,mile(n)) ...

Unable to understand the error generated

python,indexing,range

What don't you understand exactly ? The error message is quite clear: you have an IndexError (you're trying to access a non-existant item in a list, tuple or other similar indexed sequence) at line 105, which is student_grade_system = StudentGradeSystem(sys.argv[1]) In this line there's only one indexed access - sys.argv[1]...

Having Range attribute and one extra number

c#,range,data-annotations

You need to define your own validation attribute in that situation. You can directly inherit from ValidationAttribute class or inherit RangeAttribute and override a few methods. class CustomRangeAttribute : RangeAttribute { private double special; public CustomRangeAttribute(double minimum, double maximum, double special) : base(minimum, maximum) { this.special = special; } public...

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

vba,excel-vba,range

Sure you can use this snippet to find the last filled cell in a column and use that row number to set your range.name - just replace the "A" with whatever column you'd like. Sub test() Dim lastrow As Integer lastrow = Cells(Rows.Count, "A").End(xlUp).Row Range("A2:A" & lastrow).Name = "RangeColA" End...

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

postgresql,timestamp,range

Current date, meaning today? SELECT * from call WHERE create_at BETWEEN 'today' AND 'tomorrow' LIMIT 100 As mentioned, you probably also want to sort them, logically sorting them backwards would give the last 100 SELECT * from call WHERE create_at BETWEEN 'today' AND 'tomorrow' ORDER BY create_at desc LIMIT 100...

How to print a greedy range of lines using awk

regex,bash,search,awk,range

$ awk '/startcue/{f=1; buf=""} f{buf = buf $0 RS} /endcue/{printf "%s",buf; f=0}' file startcue This is the text I want to find. endcue ...

how to set a range using columns and rows

excel,vba,range

Point #1 IF "usersFullOutput.csv" is actually your worksheet's name (not a file name), with this name you cannot do this: With work_sheet Set full_range = .Range(...) End With Range is a property of a worksheet object, and not a worksheet name string. Try doing this: With Worksheets(work_sheet) Set full_range =...