continuous

How to constanly monitor LogCat file?

[亡魂溺海] 提交于 2019-11-29 10:47:18
问题 I need to somehow monitor the LogCat log, meaning that while my service is running I need to read the LogCat for new entries. At this moment I know only how to retrieve once the Log: Process mLogcatProc = null; BufferedReader reader = null; try { mLogcatProc = Runtime.getRuntime().exec(new String[] {"logcat", "-d", "ActivityManager:I *:S" }); reader = new BufferedReader(new InputStreamReader (mLogcatProc.getInputStream())); String line; final StringBuilder log = new StringBuilder(); String

python return lists of continuous integers from list

与世无争的帅哥 提交于 2019-11-28 11:35:52
I have a list of integers, and I want to generate a list containing a list of all the continuous integers. #I have: full_list = [0,1,2,3,10,11,12,59] #I want: continuous_integers = [[0,1,2,3], [10,11,12], [59]] I have the following which works, but seems like a poor way to do it: sub_list = [] continuous_list = [] for x in full_list: if sub_list == []: sub_list.append(x) elif x-1 in sub_list: sub_list.append(x) else: continuous_list.append(sub_list) sub_list = [x] continuous_list.append(sub_list) I've seen other questions suggesting that itertools.groupby is an efficient way to do this, but I

ggplot: arranging boxplots of multiple y-variables for each group of a continuous x

我与影子孤独终老i 提交于 2019-11-28 04:35:17
I would like to create boxplots of multiple variables for groups of a continuous x-variable. The boxplots should be arranged next to each other for each group of x. The data looks like this: require (ggplot2) require (plyr) library(reshape2) set.seed(1234) x <- rnorm(100) y.1 <- rnorm(100) y.2 <- rnorm(100) y.3 <- rnorm(100) y.4 <- rnorm(100) df <- as.data.frame(cbind(x,y.1,y.2,y.3,y.4)) which I then melted dfmelt <- melt(df, measure.vars=2:5) The facet_wrap as shown in this solution ( Multiple plots by factor in ggplot (facets) ) gives me out each variable in an individual plot, but I would

Continuous Looping Page (Not Infinite Scroll)

好久不见. 提交于 2019-11-27 07:29:52
I'm looking for resources that create scrolling functions like the ones found on these sites: Outpost Journal Unfold Once the scroll bar hits the bottom of the page, I want it to loop back to the top. I'm familiar with with the infinite scroll, and this is not what I want. I've also found scripts that will write/add the same content to the bottom of the page, but none that loop back to the top of the page. Try this: $('document').ready(function() { $(document).scroll(function(){ if(document.documentElement.clientHeight + $(document).scrollTop() >= document.body.offsetHeight )$(document)

splitting a continuous variable into equal sized groups

孤街醉人 提交于 2019-11-26 19:41:42
I need to split/divide up a continuous variable into 3 equal sized groups. Example data frame das <- data.frame(anim=1:15, wt=c(181,179,180.5,201,201.5,245,246.4, 189.3,301,354,369,205,199,394,231.3)) After being cut up (according to the value of wt ), I would need to have the 3 classes under the new variable wt2 like this: > das anim wt wt2 1 1 181.0 1 2 2 179.0 1 3 3 180.5 1 4 4 201.0 2 5 5 201.5 2 6 6 245.0 2 7 7 246.4 3 8 8 189.3 1 9 9 301.0 3 10 10 354.0 3 11 11 369.0 3 12 12 205.0 2 13 13 199.0 1 14 14 394.0 3 15 15 231.3 2 This would be applied to a large data set try this: split(das,

Continuous Looping Page (Not Infinite Scroll)

不羁岁月 提交于 2019-11-26 13:30:05
问题 I'm looking for resources that create scrolling functions like the ones found on these sites: Outpost Journal Unfold Once the scroll bar hits the bottom of the page, I want it to loop back to the top. I'm familiar with with the infinite scroll, and this is not what I want. I've also found scripts that will write/add the same content to the bottom of the page, but none that loop back to the top of the page. 回答1: Try this: $('document').ready(function() { $(document).scroll(function(){ if

splitting a continuous variable into equal sized groups

五迷三道 提交于 2019-11-26 06:19:41
问题 I need to split/divide up a continuous variable into 3 equal sized groups. Example data frame das <- data.frame(anim=1:15, wt=c(181,179,180.5,201,201.5,245,246.4, 189.3,301,354,369,205,199,394,231.3)) After being cut up (according to the value of wt ), I would need to have the 3 classes under the new variable wt2 like this: > das anim wt wt2 1 1 181.0 1 2 2 179.0 1 3 3 180.5 1 4 4 201.0 2 5 5 201.5 2 6 6 245.0 2 7 7 246.4 3 8 8 189.3 1 9 9 301.0 3 10 10 354.0 3 11 11 369.0 3 12 12 205.0 2 13

Identify groups of continuous numbers in a list

若如初见. 提交于 2019-11-26 05:42:34
问题 I\'d like to identify groups of continuous numbers in a list, so that: myfunc([2, 3, 4, 5, 12, 13, 14, 15, 16, 17, 20]) Returns: [(2,5), (12,17), 20] And was wondering what the best way to do this was (particularly if there\'s something inbuilt into Python). Edit: Note I originally forgot to mention that individual numbers should be returned as individual numbers, not ranges. 回答1: more_itertools.consecutive_groups was added in version 4.0. Demo import more_itertools as mit iterable = [2, 3, 4