range

is there no way to create a reversed (i.e. right-to-left) selection from JavaScript?

六眼飞鱼酱① 提交于 2019-11-29 11:25:49
I'm trying to create a selection that goes from right to left in the text, but it seems the DOM Range API doesn't let me do that. (I don't see anything about this in the spec - not that I read it closely - but all implementations seem to agree on not supporting it.) For example, given a very minimal document: data:text/html,<div> this is a test </div> I can use this script to enable editing and create a normal selection (for example from a bookmarklet, but line wrapping added for clarity): javascript:document.designMode='on'; var r=document.createRange(),d=document.getElementsByTagName('div')

Does CouchDB support multiple range queries?

爱⌒轻易说出口 提交于 2019-11-29 10:56:19
How are multiple range queries implemented in CouchDB? For a single range condition, startkey and endkey combination works fine, but the same thing is not working with a multiple range condition. My View function is like this: "function(doc){ if ((doc['couchrest-type'] == 'Item') && doc['loan_name']&& doc['loan_period']&& doc['loan_amount']) { emit([doc['template_id'], doc['loan_name'],doc['loan_period'], doc['loan_amount']],null);}}" I need to get the whole docs with loan_period > 5 and loan_amount > 30000. My startkey and endkey parameters are like this: params = {:startkey =>[

Data structure to build and lookup set of integer ranges

白昼怎懂夜的黑 提交于 2019-11-29 10:49:35
I have a set of uint32 integers, there may be millions of items in the set. 50-70% of them are consecutive, but in input stream they appear in unpredictable order. I need to: Compress this set into ranges to achieve space efficient representation. Already implemented this using trivial algorithm, since ranges computed only once speed is not important here. After this transformation number of resulting ranges is typically within 5 000-10 000, many of them are single-item, of course. Test membership of some integer, information about specific range in the set is not required. This one must be

R: need finite 'ylim' values in function

十年热恋 提交于 2019-11-29 10:30:27
I'd like to plot the data in data.frame xy for each group (defined by ID ). When a year before 1946 is in a group, plot 2 should be executed. When the years are between 1946 and 2014, plot1 should be executed. My problem: This works fine without NA values, but as I have data gaps I rely on NAs to define these data gaps. This is why I get an error: error in plot.window(need finite 'ylim' values) . I tried to put finite=T in plot1 at the y-axis but this gives a subscript out of bounds error. Is there a way I could solve this and that the graphics are correctly plotted? In the following is my

How to select a range of values in a pandas dataframe column?

会有一股神秘感。 提交于 2019-11-29 09:23:42
import pandas as pd import numpy as np data = 'filename.csv' df = pd.DataFrame(data) df one two three four five a 0.469112 -0.282863 -1.509059 bar True b 0.932424 1.224234 7.823421 bar False c -1.135632 1.212112 -0.173215 bar False d 0.232424 2.342112 0.982342 unbar True e 0.119209 -1.044236 -0.861849 bar True f -2.104569 -0.494929 1.071804 bar False I would like to select a range for a certain column, let's say column two . I would like to select all values between -0.5 and +0.5. How does one do this? I expected to use -0.5 < df["two"] < 0.5 But this (naturally) gives a ValueError: ValueError

How do I make html5 slider (input type='range') work in Firefox

∥☆過路亽.° 提交于 2019-11-29 09:17:36
I try to use html5 element, which is <input type='range' step='1' min='-300' max='-1' /> It is supposed to be a slider. It works in Chrome. But it does not work in Firefox8. I checked that in "html5test.com", it says firefox 8 partially supports the "range" type. It supports "min" and "max" attribute, but not "step" attribute. Then I erase the "step" attribute, like <input type='range' min='-300' max='-1' /> Why it still does not work? Is any way to let it work? This is not supported in Firefox before version 23. For a Javascript implementation in versions 4 and up, please see http://frankyan

2 Column Mysql Date Range Search in PHP

百般思念 提交于 2019-11-29 08:46:46
MySQL column > sdate, edate ( its 2 column). sdate is start date for project starting and edate is end date for project ending. so i need to make search between them.. <strong>Search</strong><br /> <form method="post" action="search.php"> Start Report Date : <input type="text" name="sdate" /> End Report Date : <input type="text" name="edate" /> <input type="submit" name="Submit" value="Search" /> </form> This is example data in mysql sdate Project Name edate 22 December 2008 project 1 23 December 2008 25 December 2008 project 2 26 December 2008 24 December 2008 project 3 27 December 2008 1

How does Twitter implement its Tweet Box?

一曲冷凌霜 提交于 2019-11-29 08:29:13
问题 I'm trying to implement something like Twitter's tweet box, specifically: Automatically highlights text in a red background when the overall length exceeds 140 characters. Automatically highlights links, mentions, and hashtags in blue. These should happen automatically aka when a user types. By the semantic markup I'm seeing on Twitter, it looks like they're using a contentEditable div. And the DOM inside is modified whenever a mention/hashtag/link is detected, or when the length is exceeded

generate a regexp from a numeric range

风流意气都作罢 提交于 2019-11-29 08:05:21
I'd like to generate a (series of) regexp(s) from a numeric range. Example: 1013 - 4044 => regexp matches --------------------------------------- 101[3-9] 1013 - 1019 10[2-9][0-9] 1020 - 1099 11[0-9][0-9] 1100 - 1199 [23][0-9][0-9][0-9] 2000 - 3999 40[0-3][0-9] 4000 - 4039 404[0-4] 4040 - 4044 what is the simplest algorithm? What is the easiest way to reverse it (i.e. given the regexps, looking for the ranges)? Would be nice to see solutions in java, clojure, perl... Thanks! There is an online tool for generating regex given a range, and provides the explanation. You can find the source code

Limiting user input to a range in Python

倖福魔咒の 提交于 2019-11-29 07:55:01
In the code below you'll see it asking for a 'shift' value. My problem is that I want to limit the input to 1 through 26. For char in sentence: if char in validLetters or char in space: #checks for newString += char #useable characters shift = input("Please enter your shift (1 - 26) : ")#choose a shift resulta = [] for ch in newString: x = ord(ch) #determines placement in ASCII code x = x+shift #applies the shift from the Cipher resulta.append(chr(x if 97 <= x <= 122 else 96+x%122) if ch != \ ' ' else ch) # This line finds the character by its ASCII code How do I do this easily? Use a while