range

Same color bar range for different plots - Matplotlib

我与影子孤独终老i 提交于 2019-12-22 09:34:19
问题 I'm struggling to keep the same color bar range through different plots. For example, I have these visualizations: Which are produced with this code: def plot_contour(x_dim, y_dim, x_steps, y_steps, scalar_field, file_path): plt.figure() x, y = numpy.mgrid[-x_dim:x_dim/:x_steps*1j, -y_dim:y_dim:y_steps*1j] cs = plt.contourf(x, y, scalar_field, zorder=1, extent=[-x_dim, x_dim, -y_dim, y_dim]) plt.colorbar(cs) plt.savefig(file_path + '.png', dpi=Vc.dpi) plt.close() I want to be able to compare

Restricting an IP if it is between an IP Range

ⅰ亾dé卋堺 提交于 2019-12-22 09:02:31
问题 Ok, it's friday afternoon, and i've had a long week so would appreciate some help! Currently, i have a list of IP ranges, as follows: List<IPRange> ipRanges = new List<IPRange>(); ipRanges.Add(new IPRange { From = "145.36.0.0", To = "145.36.255.255" }); ipRanges.Add(new IPRange { From = "194.183.227.184", To = "194.183.227.191" }); ipRanges.Add(new IPRange { From = "193.131.192.0", To = "193.131.223.255" }); After getting the IP of the client, if it falls anywhere between these sets of ranges

Select where number range does not overlap

我与影子孤独终老i 提交于 2019-12-22 08:19:08
问题 I have two tables that contain records about road construction activites: table_a is the master list. table_b is a legacy list. For each road, in each year, I want to select the records from table_b that do not already exist in table_a . Also, the records should not overlap spatially along the road. More specifically, the from_m and to_m of the records in table_b should not overlap the from_m and to_m in table_a . How can I do this? I do not have Oracle Spatial. The data in Excel (for easy

Find the maximally intersecting subset of ranges

删除回忆录丶 提交于 2019-12-22 05:18:07
问题 If you have a set of ranges, such as the following simple example... [ [12, 25], #1 [14, 27], #2 [15, 22], #3 [17, 21], #4 [20, 65], #5 [62, 70], #6 [64, 80] #7 ] ... how do you compute the maximally intersecting subset (not sure quite how to phrase it, but I mean "the subset of ranges which intersects and has the highest cardinality") and determine the degree of intersection (cardinality of ranges in that subset)? Logically I can work it out, and might be able to translate that to a naive

How can I add non-sequential numbers to a range?

烈酒焚心 提交于 2019-12-22 04:19:12
问题 I am trying to iterate through the range(750, 765) and add the non-sequential numbers 769, 770, 774. If I try adding the numbers after the range function, it returns the range list, then the individual numbers: >>> for x in range(750, 765), 769, 770, 774: print x ... [750, 751, 752, 753, 754, 755, 756, 757, 758, 759, 760, 761, 762, 763, 764] 769 770 774 How can I get all the numbers in a single list? 回答1: Use the built-in + operator to append your non-sequential numbers to the range. for x in

Explain this code in K&R 2-1

别说谁变了你拦得住时间么 提交于 2019-12-22 02:31:09
问题 I'm trying to determine range of the various floating-point types. When I read this code: #include <stdio.h> main() { float fl, fltest, last; double dbl, dbltest, dblast; fl = 0.0; fltest = 0.0; while (fl == 0.0) { last = fltest; fltest = fltest + 1111e28; fl = (fl + fltest) - fltest; } printf("Maximum range of float variable: %e\n", last); dbl = 0.0; dbltest = 0.0; while (dbl == 0.0) { dblast = dbltest; dbltest = dbltest + 1111e297; dbl = (dbl + dbltest) - dbltest; } printf("Maximum range of

jQuery.val not working on range input?

瘦欲@ 提交于 2019-12-22 01:39:24
问题 <input type="range" value="5,17" /> If I try to change the value with $('input').val('8,20'); it doesn't change... But on hidden inputs works: <input type="hidden" value="s" /> 回答1: The HTML5 <input type="range" /> does only handle one value between min and max attribute - e.g.: <input type="range" min="1" max="10" value="5.3" step="0.1" /> $("input[type=range]").val(); // returns 5.3 $("input[type=range]").val(6); // sets value to 6 $("input[type=range]").val(); // returns 6 If you want to

Adding <h1> around a selection

杀马特。学长 韩版系。学妹 提交于 2019-12-22 01:33:04
问题 I have a jsfiddle here - http://jsfiddle.net/88em6qq9/ - where I'm trying to add <h1> tags around a selection of the entire line: "Here is some content and here too" Selecting the entire line and releasing the mouse button goes into the handler but rounding off the start and end end points with setStartBefore() and setEndAfter() gets me to different start and end containers, so the surround doesn't work. If I put "Here is some content" in its own <span> - see http://jsfiddle.net/88em6qq9/1/ -

How to select a range of rows using two variables in VBA

爱⌒轻易说出口 提交于 2019-12-22 00:28:52
问题 I'm brand new to VBA and am trying to write a macro to pull specific data from all workbooks in the same directory into a master workbook. I'm getting stuck when trying to select a range of data using variables so that I can copy and paste the data into the master workbook. I've been watching videos and reading through forums, but can't seem to get the macro to work. I have an Excel sheet that lists employees in column A, with all the data I want to copy about the employees in columns B, C, D

js contenteditable - prevent from writing into newly inserted element

随声附和 提交于 2019-12-21 23:05:55
问题 I'm working on a simply syntax highlighter that replaces text with dom elements with classes. Say, I have a <div contenteditable="true"> Some text. | And some other text. </div> and the cursor is at the | pipe //if a user types foo <div contenteditable="true"> Some text. foo| And some other text. </div> // and I replace it, then set the selection after the inserted element <div contenteditable="true"> Some text. <span class="highlight-foo">foo</span>| And some other text. </div> but if you