range

Python: range and xrange for 13-digit numbers?

range() and xrange() work for 10-digit-numbers. But how about 13-digit-numbers? I didn't find anything in the forum. Thanks in advance. ...

Parsing HTTP_RANGE header in PHP

Is there an existing way to parse the HTTP_RANGE header correctly in PHP? Thought I'd ask here before re-inventing the wheel. I am currently using preg_match('/bytes=(\d+)-(\d+)/', $_SERVER['HTTP_RANGE'], $matches); to parse the header but that does not cover all possible values of the header so I am wondering if there is a function ...

Selection ranges in webkit (Safari/Chrome)

Hi, I'm using a content-editable iframe to create a syntax-highlighter in javascript and one of the most important things is to be able to indent code properly. The following code works just as it should in Firefox: // Create one indent character var range = window.getSelection().getRangeAt(0); var newTextNode = document.createTextNod...

Data Structure for Storing Ranges...

I am wondering if anyone knows of a data structure which would efficiently handle the following situation: The data structure should store several, possibly overlapping, variable length ranges on some continuous timescale. For example, you might add the ranges a:[0,3], b:[4,7], c:[0,9]. Insertion time does not need to be particularly ...

Simple custom range in Ruby

I have a Rails named_scope which is using a condition to pull specific days of the week from the table like so: :conditions => [ 'EXTRACT(DOW FROM bookdate) IN (?)', (1..6).to_a ] The 1..6 date range will be a variable depending on the dates the user wants, Which produces this SQL (EXTRACT(DOW FROM bookdate) IN (1,2,3,4,5,6) My pr...

Selection object behaving strange in Chrome contentEditable element

Hi, I'm working on a realtime syntax highlighter in javascript using contenteditable. When parsing content I extract the text of the div and use regex patterns to style it properly. Then I set the innerHtml of the div to the parsed content. However, this makes the cursor disappear from the screen. I have created this function to reset ...

How to get the size of a range in Excel

Hello, Using VBA, is it possible to get the size of a given range in terms of pixels or units? (I don't care which unit as I am only using it to relate to other measurements with the same unit). Thanks. ...

C# and Microsoft Excel 9.0 Object Library (Excel 2000) getting a cell coordinate excel style.

Is there a way with Excel 9.0 Object Library to get a cell coordinate (from a range or cell) "Excel style" for example: A1 or C4 instead of [1,1] and [4,3]? ...

print range of integers in descending or ascending order in java

I have an upper bound and a lower bound and I want to return all number number between the bounds including the bounds. I know python has a range function but I'm sure if java has this method. ...

Start and end date on multiple dates range

Hi my problem is somewhat special or maybe not. However the problem is that I parse range of dates in one array, where I need to find start date and end date where ever it may occur in ranges. I do not know did I explain this well but if you need more info, please let me know. e.g. [2010-7-11,2010-7-12,2010-7-13, 2010-9-01, 2010-9-02,.....

Serialize a DOM range

Hi, is there any standard/easy way to serialize a DOM Range (and the IE equivalent) with java script. The motivation is to store the current selection for a document together with its HTML code. I thought of using XPath for it, but before I start to reinventing the wheel maybe there is something already working available and I just ...

How to convert sequence of numbers in an array to range of numbers

In javascript how to convert sequence of numbers in an array to range of numbers? eg. [2,3,4,5,10,18,19,20] to [2-5,10,18-20] ...

What is the most efficient way to perform a range query over a cluster of nodes?

What is the most efficient way to perform a range query over a cluster of nodes where I want the result sets merged? ...

Fastest way to get maximum value from an exclusive Range in ruby

Ok, so say you have a really big Range in ruby. I want to find a way to get the max value in the Range. The Range is exclusive (defined with three dots) meaning that it does not include the end object in it's results. It could be made up of Integer, String, Time, or really any object that responds to #<=> and #succ. (which are the only ...

Attempting to insert an integer from a list into datetime object...

Hi all, What I am trying to accomplish is very simple: creating a loop from a range (pretty self explanatory below) that will insert the month into the datetime object. I know %d requires an integer, and I know that 'month' type is int...so I'm kind of stuck as to why I can't substitute my month variable. Here is my code: all_months=...

Evenly distributed integers within a range

Lets say I have a range between 0 and 100 and I want an array returned containing 3 integers which are evenly distributed within that range, what would be the best way to do this? For example: Range: 0-100 Wanted: 3 Returned: 25, 50, 75 ...

Objective-C : Insert string into another string at a certain range

hi, i need to insert a string into another string at a certain range. I know there is the appendingString method but i need to insert it at a given range into the string. thank you ...

How To Select A Range in an Iframe With "Start" and "End" in Firefox like "selectionStart" from inputs element

Hi, for Internet Explorer, I have the current code to select a range in an iframe with desingMode setting to on: var Range = window.document.selection.createRange(); var obj = { start: 3, end : 6} Range.collapse( true ); Range.moveStart( 'character', obj.start ); Range.moveEnd( 'character', obj.end - obj.start );...

How to do a range query

I have a bunch of numbers timestamps that I want to check against a range to see if they match a particular range of dates. Basically like a BETWEEN .. AND .. match in SQL. The obvious data structure would be a B-tree, but while there are a number of B-tree implementations on CPAN, they only seem to implement exact matching. Berkeley ...

How to handle resize of range upon insert column/row in Excel via VSTO

Hi all, I'm working on an Excel add-in and have an issue with ranges. Suppose we have a range on a spreadsheet - A1:D1. A user inserts a column at say column C. My VSTO Range object is still A1:D1 but I'd like it to become A1:E1. UPD: I don't expect this to happen automatically, but I wonder is there a way VSTO would help me to impl...