range

How can I generate a set of ranges from the first letters of a list of words in Perl?

I'm not sure exactly how to explain this, so I'll just start with an example. Given the following data: Apple Apricot Blackberry Blueberry Cherry Crabapple Cranberry Elderberry Grapefruit Grapes Kiwi Mulberry Nectarine Pawpaw Peach Pear Plum Raspberry Rhubarb Strawberry I want to generate an index based on the first letter of my data...

Ruby Range Unexpected Behavior

Can anyone shed some insight onto why the following happens? irb(main):001:0> r = '1'..'30' => "1".."30" irb(main):002:0> r.each do |i| irb(main):003:1* puts "#{i} : #{r.include?(i)}" irb(main):004:1> end 1 : true 2 : true 3 : true 4 : false 5 : false 6 : false 7 : false 8 : false 9 : false 10 : true ... (snip.. the String-numbers here ...

Detecting if two number ranges clash

This is hopefully a very simple maths question. If I have two number ranges, what is the simplest and most efficient way to check if they clash, eg: 10-20 and 11-14 // clash as B is contained in A 11-15 and 20-22 // don't clash 24-26 and 20-30 // clash as A is contained in B 15-25 and 20-30 // clash as they overlap at each end I curre...

Data Annotation Ranges of Dates

Hi Is it possible to use [Range] annotation for dates? something like [Range(typeof(DateTime), DateTime.MinValue.ToString(), DateTime.Today.ToString())] Thanks Davy ...

Excel Range Format: Number is automatically formatted when Range::Value2 is set

I have an Excel addin written in C# that imports a text file into Excel worksheet. Some of the fields in the file are text and some oare numbers. Problem Steps: Change the System's Regional Settings to Dutch (Belgium) Open Excel and import the file into Excel. Records contain values such as 78,1118 which gets converted to 781.118. Not...

Make programmatic range selection visible to the user?

How can I make a programmatical page selection visible to the user, as if it was selected by the user? var range = document.createRange(); var startPar = [some node]; var endLi = [some other node]; range.setStart(startPar,13); range.setEnd(endLi,17); Thank you. ...

How can I copy and paste a range of tables in Word?

EDIT: If you have an example in VBA, I'll take it. I'm just trying to understand how to use the Range object with the Tables collection to copy and paste multiple tables without looping. Put another way, how can I specify a range of 1..lastTable using the Tables collection? If I can see a working VBA example of this, I'll work on the VBA...

Simpler range finder?

Hay guys I've programmed a very simple range finder. The user can only select numbers 1 - 180 (axis) if the number is 90 or below i have to add 90 on to it if the number is 91 - 180 i have to take off 90 from it. Here's what i have $min_range = range(1,90); $max_range = range(91,180); if(in_array($axis, $min_range)){ $c = $axis...

Mapping integers onto the entire range

I'm using a hash table (DotNET Dictionary object) as part of a sparse two-dimensional data set. Most of the entries in the hash table will be close together. I'll probably end up with 100 ~ 10,000 entries, all of them clustered near zero. I've read that a Hash table performs better when the hashes are spread across the entire integer(32 ...

determine value range of template type in C++

Hi, In a template function, I like to determine the range for the value of its template type. For specific type, like int, INT_MAX and INT_MIN are what I want. But how to do the same for a template type? Thanks and regards! ...

Using VBA for Word, how do I create a range of table cells?

I'm trying to learn how to handle Range objects in Word VBA with regards to MS Word tables. Using the Range object help, it would seem I can create a range of cells as long as the cells are contiguous, however I cannot seem to get the syntax for specifying the Start and End points of the range using cells. For example: Set rngCells = ...

`xrange(2**100)` -> OverflowError: long int too large to convert to int

xrange function doesn't work for large integers: >>> N = 10**100 >>> xrange(N) Traceback (most recent call last): ... OverflowError: long int too large to convert to int >>> xrange(N, N+10) Traceback (most recent call last): ... OverflowError: long int too large to convert to int Python 3.x: >>> N = 10**100 >>> r = range(N) >>> r = r...

select text with range object in iframe, is is possible ?

i have selected text from range object. is it possible to "select" text again, using the range object, if i deselect it (click somewhere) ? text is in iframe. thanks, here is code: var iframe_window = window.frames["iView"]; iframe_content = iframe_window.document.getElementsByTagName("body")[0].innerHTML; iframe_document = iframe_...

How to get Zend Lucene Range Search working properly (or help me debug)

I have an implementation of the Zend Search (Lucene) framework on my website that contains an index of products with prices. I am trying to allow customers to search for something, while contsraining the prices. Eg. Search for "dog food" between $5-$10 dollars. My search index looks like this: Keyword('name') Keyword('price') Lets sa...

Why doesn't the wdBorderVertical exist when using a range of cells instead of a selection?

FYI, I'm using Perl and Win32::OLE, but the error is a Word VBA one. Using Perl's Win32::OLE module, I'm trying to create a table in Word and format certain elements of it. I created the table (15 x 3) and successfully created a range object pointing to the cells from (2, 1) to (14, 3), i.e. all cells except the top and bottom rows. I ...

problem with position jquery slider

Hello, My question is, how I can gain better control over this slider, because if I move over it a couple of times then the slider slide's into a wrong position. Either below minimum value or above maximum value. I use the animate function. The slider has three different positions and it has to do basicly two things. 1.calculate how...

Enumerable.Range implementation

What is the precise implementation of Enumerable.Range in .Net; preferable .Net 4? Is it a yielded for-loop? A custom implementation (IEnumerable, IEnumerator) or? ...

double type digits in C++

The IEE754 (64 bits) floating point is supposed to correctly represent 15 significant digit although the internal representation has 17 ditigs. Is there a way to force the 16th and 17th digits to zero ?? Ref: http://msdn.microsoft.com/en-us/library/system.double%28VS.80%29.aspx : . . Remember that a floating-point number can only appr...

Delphi: How to have non-contiguous subrange enumeration type?

While the following subrange enumeration declaration works: type TReceiptCode = 'A'..'F'; This does not: type TReceiptCode = ' ','A'..'F', 'R'; Nor does type TReceiptCode = ' ','A','B','C','D','E','F','R'; How can i declare a subrange type with non-contiguous values? ...

One-Dimensional Line-Segments/Ranges Intersection Test: Solution Name?

I've worked out a method to test if two one-dimensional line-segments/ranges. So defining a range as: [min, max] Given two instances of range: a = [min, max] b = [min, max] I use the following to test if they intersect: (a.max - b.min) * (b.max - a.min) >= 0. I think this is a one-dimensional cross-product, so my question is:...