overlap

identify consecutively overlapping segments in R

大城市里の小女人 提交于 2019-11-28 03:23:32
问题 I need to aggregate overlapping segments into a single segment ranging all connected segments . Note that a simple foverlaps cannot detect connections between non overlapping but connected segments, see the example for clarification. If it would rain on my segments in my plot I am looking for the stretches of dry ground. So far I solve this problem by an iterative algorithm but I'm wondering if there is a more elegant and stright forward way for this problem. I'm sure not the first one to

Merge overlapping time intervals, how?

限于喜欢 提交于 2019-11-28 02:19:27
问题 Anyone could help me in a query that **merge a interval of datas? ex: Common select: SELECT id, date_start, date_end FROM evento ORDER BY date_start I GOT THIS: FROM THIS: but a want a query that return this: 01 - 2013-10-11 08:00:00 2013-10-11 15:00:00 02 - 2013-10-11 16:00:00 2013-10-11 19:00:00 Thanks a lot! 回答1: You may also try this query (once more solutions beside those given by PM 77-1 in the comment above) : WITH RECURSIVE cte( id, date_start, date_end ) AS ( SELECT id, date_start,

Meaning of overlapping when using memcpy

和自甴很熟 提交于 2019-11-28 02:13:16
I am trying to understand the function memcpy() which is defined in the C library <string.h> Syntax: void *memcpy(void*dst,const void*src,size_t n); I know that this function is used to copy the contents of the memory pointed by pointer src to the location pointed by the dst pointer and return a address pointed by dst pointer. I am not able to understand the following important statement regarding memcpy() : When using memcpy() , memory address should not overlap, if it overlaps then the memcpy() is undefined. Another query is: Is the value passed to third argument of the function i.e size_t n

how to overlap intervals efficiently

眉间皱痕 提交于 2019-11-28 01:34:10
I require your help, I have a problem (see picture), I have let say two arrays and each of this array contains intervals with different length and real values and I need to find out how I'm gone overlap this intervals efficiently. I'm open to ideas, or paper theory or concret algorithms which will let me find a way out! I'm guessing about to transform this somehow in waves and overlap them. Its very important, its for my thesis. as an example, here in numbers to explain it better: Array: 1-2, 5-7, 9-12 Array: 3-4, 5-6, 13-17 The result will be then one single array containing the new intervals

How can i check if 2 controls overlap eachother on a canvas in WPF?

ε祈祈猫儿з 提交于 2019-11-27 23:50:32
问题 I am writing a designer that enables the user to drag controls around the screen. What would be the best way of detecting if a control is overlapping another control while i am dragging the one control around? Should i just get the dimensions of the FrameworkElement and keep on checking the dimensions of the other elements? Thanks. Eli 回答1: The dimension (FrameworkElement.ActualWidth FrameworkElement.ActualHeight) and postion (Canvas.Top, Canvas.Bottom,Canvas.Left, Canvas.Right) of your

Finding the overlapping area of two rectangles (in C#)

这一生的挚爱 提交于 2019-11-27 16:10:56
问题 Edit: Simple code I used to solve the problem in case anyone is interested (thanks to Fredrik): int windowOverlap(Rectangle rect1, Rectangle rect2) { if (rect1.IntersectsWith(rect2)) { Rectangle overlap = Rectangle.Intersect(rect1, rect2); if (overlap.IsEmpty) return overlap.Width * overlap.Height; } return 0; } Original Question: I'd like to know a quick and dirty way to check if two rectangles overlap and if they do calculate the area of the overlap. For curiosities sake I'm interested in

Collapse rows with overlapping ranges

只愿长相守 提交于 2019-11-27 14:51:09
I have a data.frame with start and end time: ranges<- data.frame(start = c(65.72000,65.72187, 65.94312,73.75625,89.61625),stop = c(79.72187,79.72375,79.94312,87.75625,104.94062)) > ranges start stop 1 65.72000 79.72187 2 65.72187 79.72375 3 65.94312 79.94312 4 73.75625 87.75625 5 89.61625 104.94062 In this example, the ranges in row 2 and 3 are entirely within the range between 'start' on row 1 and stop on row 4. Thus, the overlapping ranges 1-4 should be collapsed to one range: > ranges start stop 1 65.72000 87.75625 5 89.61625 104.94062 I tried this: mdat <- outer(ranges$start, ranges$stop,

Synchronizing a timer to prevent overlap

一个人想着一个人 提交于 2019-11-27 13:56:05
问题 I'm writing a Windows service that runs a variable length activity at intervals (a database scan and update). I need this task to run frequently, but the code to handle isn't safe to run multiple times concurrently. How can I most simply set up a timer to run the task every 30 seconds while never overlapping executions? (I'm assuming System.Threading.Timer is the correct timer for this job, but could be mistaken). 回答1: You could do it with a Timer, but you would need to have some form of

Collapse intersecting regions

ぐ巨炮叔叔 提交于 2019-11-27 12:55:27
I am trying to find a way to collapse rows with intersecting ranges, denoted by "start" and "stop" columns, and record the collapsed values into new columns. For example I have this data frame: my.df<- data.frame(chrom=c(1,1,1,1,14,16,16), name=c("a","b","c","d","e","f","g"), start=as.numeric(c(0,70001,70203,70060, 40004, 50000872, 50000872)), stop=as.numeric(c(71200,71200,80001,71051, 42004, 50000890, 51000952))) chrom name start stop 1 a 0 71200 1 b 70001 71200 1 c 70203 80001 1 d 70060 71051 14 e 40004 42004 16 f 50000872 50000890 16 g 50000872 51000952 And I am trying to find the

PyQt4: how to make undercorated window with reserved space

半城伤御伤魂 提交于 2019-11-27 07:31:54
问题 I'd like to make a panel-like application using PyQt4 for Linux. for this i need the window i created: to be undecorated to have reserved space to appear on all workspaces From reading the documentation i've got the idea that i should use QtWindowFlags. But i have no clue as to how to do that. Also i believe there should be a Qt.WindowType hint somewhere telling the WM the window's a "dock" application. I have made this with pygtk following this thread, but here with Qt i don't really know