range

Scala: strange type mismatch error

Let's say I have a function like this (it's only an example, so do not offer me better ways to create 0,1,2,... style array): def createArray(size: Int): Array[Int] = { for (i <- 0 until size) yield i } But the compiler get upset with some mysterious type mismatch error: (fragment of compare-images.scala):39: error: type mismatch; ...

Get Objects from an ObjectSet by specifying a Range in EF

Hi all, I am trying out EF 4.0.I have an Employee Object and using EF I am getting the Employee ObjectSet by simply calling Context.Employees Now the above call will spit following sql query select * from Employees The above query works fine and I don't have any complains on it however as you know this will not be performant...

scala new Range with step equals zero

Is(and why) this really should be prohibited with exception? scala> val r2 = 15 until (10, 0) java.lang.IllegalArgumentException: requirement failed scala> new Range(10,15,0) java.lang.IllegalArgumentException: requirement failed at scala.Predef$.require(Predef.scala:133) ...

Coloring a range of cells in Excel using VBA

I have a spreadsheet that I use at work to keep track of returned contracts. I've set up a color key so I can quickly glance at the sheet to see which contracts still need to be returned to us and which account manager the account belongs to. The account manager's initials are listed in column A; from there I would like to color the ...

Excel VBA Function to Return True or False based on Cell Background Colors in a Range

I keep a spreadsheet of my timeline at work and when I meet and expect to meet certain milestones. The data (dates) is stored left-to-right and each project has it's own row. The milestones are permantely set and occupy Range(O:AA). My data is color coded as Green (Complete), Orange(Deadline), Blue(Not working on), Red(Not applicable). ...

Is there an elegant way to exclude the first value of a range?

Let's say I have a range from 0 to 10: range = 0...10 Three dots mean, that the last value (10) is excluded: range.include? 10 => false Now, is there a similar and elegant way to exclude the first value? For the above example, this would mean to include all values that are bigger (>, not >=) than 0 and smaller than 10. ...

Regular expression: find range except for one letter or a range

Hello, How can I use the negation within square brackets as an exception, to find e. g. everything between a-z except for the the range from m-o? [a-z^m-o]? Thanks in advance! By the way: it's not for the sake of this example that I ask, but to be able to exclude ranges within ranges, or even single letters within ranges. I am pretty ...

web: extend highlighted text by dragging

I am creating a document tagging application, where the user can select arbitrary (continuous) ranges of text and tag them. After a range has been tagged, it will be highlighted. I want to allow the user to easily extend/shrink a tagged range, without having to remove it and recreate it. Maybe by having a small icon at the beginning an...

How do I search a range for a single integer?

My Python code generates a random number between 0 and 35 and stores that number as 'random'. I am looking to compare 'random' against several ranges of numbers to determine which of three groups it falls into and assign another value to 'winning' based on which group 'random' is in. The groups are: 0-16, 16-34, and 34-36. 'winning' alwa...

Rewrite a IE Code to a FF Code

This is the code (now is full): HTML: <div id="content" contentEditable="true" onkeyup="highlight(this)">This is some area to type.</div> Javascript: function highlight(elem){ // store cursor position var cursorPos=document.selection.createRange().duplicate(); var clickx = cursorPos.getBoundingClientRect().left; ...

Identify whether the selected text in a web page is bold nor not

Hi I am trying to identify whether a selected text (in Firefox) is bold or not? For e.g.: <p>Some <b>text is typed</b> here</p> <p>Some <span style="font-weight: bold">more text is typed</span> here</p> The user can either select a part of bold text, or the full bold text. Here is what I am trying to do: function isSelectedBold(){ ...

How to match the numeric value in a regular expression?

Okay, this is quite an interesting challenge I have got myself into. My RegEx takes as input lines like the following: 147.63.23.156/159 94.182.23.55/56 134.56.33.11/12 I need it to output a regular expression that matches the range represented. Let me explain. For example, if the RegEx receives 147.63.23.156/159, then it needs to ...

How to resize the rangeinput handle after creation?

I am using this http://flowplayer.org/tools/demos/rangeinput/scrollbar.html ( as a horizontal scrollbar ) When resizing using: $('.handle').css('width', 550+"px"); or $(".handle").width(550).click(); after changing the handle width from 800px to 550px ( while using a 1000px width slider ) the handle cant be draged until the end of...

Cross Browser Selection Range Library?

Does any one know of any cross browser user selection range libraries written in javascript? I have a found a few jquery plugins, (which quite frankly are too limiting and very buggy). I have already implemented and am using the following to pull off some of my tricks: http://plugins.jquery.com/project/wrapSelection http://perplexed.co...

SQL Server 2008 - how to get records that have a specific range of IDs

Hi guys In SQL Server 2008 I would like to create a stored procedure to select specific products, passing their IDs as argument. But I intend to bring as result a range of products. This range must have the informed productIds argument value (for example: 1 and 8 and 29 - that means, the range MUST have productId 1 and productId 8 and...

How to loop backwards in python?

I'm talking about doing something like: for(i=n; i>=1; --i) { //do something with i } I can think of some ways to do so in python (creating a list of range(1,n+1) and reverse it, using while and --i, ...) but I wondered if there's a more elegant way to do it. Is there? EDIT: Some suggested I use xrange() instead of range() since r...

Combined total for multiple jQuery-UI Sliders

Hi everyone, I'm trying to implement a page where there are 4 jQuery-UI sliders, and I want to make it so the combined total of all 4 sliders will never go over 400. I don't mind which way this is implemented, it can be from a 0 start, and as soon as you change 1 slider, the remaining available total decreases or setting a slider past ...

what is a range query

What is a range query over a kdtree and how is it done by python? ...

Extending the RangeAttribute in MVC 2 (DataAnnotations namespace) to have a variable date range based on today's date

Has anyone extended the Range attribute to be able to have a variable range? I have a similar need but I can't make this work: public class YearRangeAttribute : RangeAttribute { public YearRangeAttribute() : base(typeof(DateTime), DateTime.Now.AddYears(-100).Year.ToString(), DateTime.Now.AddYears(-14).Year.ToStr...

Javascript Array: get 'range' of items.

Is there an equivalent for ruby's array[n..m] in Javascript ? For example: >> a = ['a','b','c','d','e','f','g'] >> a[0..2] => ['a','b','c'] Thanks ...