range

Use jQuery select() to select contents of a div

折月煮酒 提交于 2019-11-27 03:36:32
问题 Is it possible to use or adapt jQuery's .select() to set a selection range on the entire contents of a div? I have a div which has a series of labels, inputs, select objects and a couple of other UI elements. I have found code on a separate StackOverflow post with some code hosted on jsFiddle: http://jsfiddle.net/KcX6A/570/ Can this be adapted to select the value of inputs also? Or how would you suggest I go about this? Thanks, Conor Edit: More info I know how to get the value of inputs using

range over character in python

喜夏-厌秋 提交于 2019-11-27 03:35:42
Is there an way to range over characters? something like this. for c in xrange( 'a', 'z' ): print c I hope you guys can help. Ned Batchelder This is a great use for a custom generator: Python 2: def char_range(c1, c2): """Generates the characters from `c1` to `c2`, inclusive.""" for c in xrange(ord(c1), ord(c2)+1): yield chr(c) then: for c in char_range('a', 'z'): print c Python 3: def char_range(c1, c2): """Generates the characters from `c1` to `c2`, inclusive.""" for c in range(ord(c1), ord(c2)+1): yield chr(c) then: for c in char_range('a', 'z'): print(c) import string for char in string

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

浪子不回头ぞ 提交于 2019-11-27 03:12:26
问题 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

VBA paste range

♀尐吖头ヾ 提交于 2019-11-27 02:55:01
问题 I have simple goal of copying range and pasting it into another spreadsheet . The following code below gives copies, but does not paste. Sub Normalize() Dim Ticker As Range Sheets("Sheet1").Activate Set Ticker = Range(Cells(2, 1), Cells(65, 1)) Ticker.Copy Sheets("Sheet2").Select Cells(1, 1).Activate Ticker.PasteSpecial xlPasteAll End Sub Any suggestions? 回答1: To literally fix your example you would use this: Sub Normalize() Dim Ticker As Range Sheets("Sheet1").Activate Set Ticker = Range

Copy a selected range to another worksheet

被刻印的时光 ゝ 提交于 2019-11-27 02:24:07
I am using code below which I am trying to change so as not to use .select Selection.Select ' from active worksheet Selection.Copy Sheets("Purch Req").Select Range("A1").Select ActiveSheet.Paste I have tried using this but there is no output to the other worksheet. Dim src2Range As Range, dest2Range As Range Set src2Range = Selection 'source from selected range Set dest2Range = Sheets("Purch Req").Range("A1").Resize(src2Range.Rows.Count, src2Range.Columns.Count) ' destination range _ 'in Purch req worksheet There is mane ways to do that, but here goes two. 1) Sub pasteExcel() Dim src2Range As

Array of indexes to array of ranges

跟風遠走 提交于 2019-11-27 02:19:31
问题 Ranges in ruby are pretty cool. I end up with arrays such as this: geneRanges = [(234..25), (500..510), (1640..1653)] And subsequently have to remove bits of them. For that I: genePositions = geneRanges.collect {|range| range.entries }.flatten => [500, 501, 502, 503, 504, 505, 506, 507, 508, 509, 510, 1640, 1641, 1642, 1643, 1644, 1645, 1646, 1647, 1648, 1649, 1650, 1651, 1652, 1653] They get manipulated, so some numbers get excluded, and others may be added. I may end up with this: [505, 506

Why is Enumerable.Range faster than a direct yield loop?

一世执手 提交于 2019-11-27 02:19:05
问题 The code below is checking performance of three different ways to do same solution. public static void Main(string[] args) { // for loop { Stopwatch sw = Stopwatch.StartNew(); int accumulator = 0; for (int i = 1; i <= 100000000; ++i) { accumulator += i; } sw.Stop(); Console.WriteLine("time = {0}; result = {1}", sw.ElapsedMilliseconds, accumulator); } //Enumerable.Range { Stopwatch sw = Stopwatch.StartNew(); var ret = Enumerable.Range(1, 100000000).Aggregate(0, (accumulator, n) => accumulator

SQLite loop statements?

南楼画角 提交于 2019-11-27 02:11:36
问题 Is there any loop statements in SQLite like FOR .. in .. LOOP or something like that? I have two columns StartRange, EndRange and I need to insert whole sequence in other table. So if StartRange is 1 and EndRange is 3 it's necessary to make three inserts with value, contains 1, 2, 3 . 回答1: You can do this sort of thing in straight SQL if you have an extra table that holds all the integers that you need. Suppose your StartRange and EndRange range between one and ten and you have a table like

Only index needed: enumerate or (x)range?

穿精又带淫゛_ 提交于 2019-11-27 02:07:42
If I want to use only the index within a loop, should I better use the range/xrange function in combination with len() a = [1,2,3] for i in xrange(len(a)): print i or enumerate ? Even if I won't use p at all? for i,p in enumerate(a): print i I would use enumerate as it's more generic - eg it will work on iterables and sequences, and the overhead for just returning a reference to an object isn't that big a deal - while xrange(len(something)) although (to me) more easily readable as your intent - will break on objects with no support for len ... That's a rare requirement – the only information

Range as dictionary key in Python

大城市里の小女人 提交于 2019-11-27 01:32:43
问题 So, I had an idea that I could use a range of numbers as a key for a single value in a dictionary. I wrote the code bellow, but I cannot get it to work. Is it even possible? stealth_roll = randint(1, 20) # select from a dictionary of 4 responses using one of four ranges. ## not working. stealth_check = { range(1, 6) : 'You are about as stealthy as thunderstorm.', range(6, 11) : 'You tip-toe through the crowd of walkers, while loudly calling them names.', range(11, 16) : 'You are quiet, and