range

Using std.algorithm.map with member functions in D2.

I have: Foo foo = new Foo(); foreach (i; 0..10) { Bar bar = foo.getBar(i); ... } I want to be able to instead say (equivalently): foreach (bar; foo.getAllBars()) { ... } How do I go about implementing getAllBars()? I figured something like this: class Foo { auto getAllBars() { return map!(getBar)(iota(10)); } } ...

Extract a range from NSArray

I need to display 6 views and each view should display 20 items (UIButtons). I have one big NSArray which contains the items for all 6 views. For example, view 1 should be items 0-19, view 2 should be items 20-39. How would i extract the relevant range out of the array? Maybe using NSRange with a length of 20, but the start location w...

integer range in c

why integer has a range between 0 and 32768? ...

Strange behavior of selection

My JS code: function getSelectedText(){ if(window.getSelection){ select = window.getSelection().getRangeAt(0); var st_span = select.startContainer.parentNode.getAttribute("id").split("_")[1]; var end_span = select.endContainer.parentNode.getAttribute("id").split("_")[1]; ...

boundary-points of a range does not meet specific requirements

I am writing a script on which the user needs to be able to select some text which is sent via ajax to the backend script for further process. I can select plain text nodes fine or text nodes that have bold, italic or underlined text inside it. For e.g <p>This is <strong>some</strong> cool <em>italic</em> text, <u>really!</u></p> So...

maven dependency range does not work as expected

Maven 2.2.1 claims to support version ranges (see e.g. http://www.sonatype.com/books/mvnref-book/reference/pom-relationships-sect-project-dependencies.html#pom-relationships-sect-version-ranges) I tried from a brandnew maven installation the following pom: <project> <modelVersion>4.0.0</modelVersion> <artifactId>rangetest</artifac...

YUI range slider separate ticksize for subranges

My requirement is typical. I need a price range dual-handle slider, where based on the current handle value, the tick size (step size) will change, for example if price is less that 1500, the tick size is 50. between 1500 and 15000, the tick size should become 100, between 15000 to 50000 the tick size should become 500, and so on. I have...

Create array of months between two dates.

I have the following snippet that I use to get the individual dates between two dates: DateTime[] output = Enumerable.Range(0, 1 + endDate.Subtract(startDate).Days) .Select(offset => startDate.AddDays(offset)) .ToArray(); However, the following section endDate.Subtract(startDate).Days does not have a .Months to return the ...

Haskell Range Map library

Is there a Haskell library that allows me to have a Map from ranges to values? (Preferable somewhat efficient.) let myRangeMap = RangeMap [(range 1 3, "foo"),(range 2 7, "bar"),(range 9 12, "baz")] in rangeValues 2 ==> ["foo","bar"] ...

Search in MySQL Database based on Date Range provided by the user

I'm a novice in PHP & MySQL coding and still working my way through it.. So, little help on this will be much appreciated: I have a table that keeps record of certain events. Here is how my table looks like: Id - Event_Name - Event_Date - Event_Charges --------------------------------------------- 1 - Event 1 - 10/10/2010 - $100 2 -...

Javascript INDEX_SIZE_ERR: DOM Exception 1 Error for ranges

Using the following code, I get a INDEX_SIZE_ERR: DOM Exception 1 error on the thisRange.setStart line. The code is meant to go through a whole page, find instances of the searchString, and then add a link in front of that search string. For example, if it finds 5 instances of the string, right now it will add the link in front of the fi...

how does ruby handle array range accessing?

ruby-1.8.7-p174 > [0,1][2..3] => [] ruby-1.8.7-p174 > [0,1][3..4] => nil In a 0-index setting where index 2, 3, and 4 are all in fact out of bounds of the 2-item array, why would these return different values? ...

Word VBA Range.Find object works incorrectly

I found an interesting thing: In word 2010, select some text, and run the following VBA code: public Sub Test() With Selection.Range.Find MsgBox .Execute(Selection.Range.text) MsgBox .Found End With End Sub Both the two message box say "False", but both should be "True". Why? Thanks a lot for your suggestion...

jQuery range slider event trigger

Hey Folks, there`s a problem using the jQuery Range Slider plugin. I want to trigger an event every time the slider changed. I don`t know on which elemt i can trigger events. For exmaple i wana have an alert message ro see if it works. Thanks Peter ...

Select text just like "Ctrl+A" when clicking the text?

I just 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! thank you very much!! I am so sorry! It is about a web page function.I have several paragraph and *.rar file link address on the page, and I want to select all...

How to detect "has user selected entire document or not ?" in html javascript

I'm developing a off-line web-page for iphone safari. For highlighting the user's selection in web-page. I've implemented following code. function highlight() { if (window.getSelection) { sel = window.getSelection(); if (sel.getRangeAt) { range = sel.getRangeAt(0); } document.designMode ...

Most effective way to populate a picker view with range of integers?

I have a simple UI picker view in an iOS app (iPhone) and I'm looking to pre-populate it with a range of numbers on launch. What would be the most pragmatic/quickest/optimized way to populate it? I'm new to iOS development, so I'm just starting to test the waters. The documentation is pretty decent but I'd like to get some insight fro...

PHP's range function in Java

PHP's range function work like this in php : $leap_years = range(1900, 2000, 4); creates array like 1900, 1904, 1908, ... Is there something simple like this in Java? ...

jQuery range slider items between min and max

Hey folks, an application uses the jQuery range slider. now i want to select the date items between min and max. how can i select them. for example i wanna change the color of this links. There`s an screenshot of my slider http://picfront.de/d/7UoZ Thanks, Peter ...