formatting

Remove newlines between two words

|▌冷眼眸甩不掉的悲伤 提交于 2019-12-25 18:56:06
问题 I have a file that looks like: name: charles key1: how are you? name: erika key2: I'm fine, thanks name: ... How could I remove the new lines that between "key\d+" and "name:"? It should look like this: name: charles key1: how are you? name: erika key2: I'm fine, thanks name: ... I'm trying to use sed or awk but without any success. Is there any way to clean that lines? Is there any way to remove the newlines between "key\d+:" and "\w+:"? 回答1: something like this? kent$ awk '/^key.:/{p=1}/

Format of time is incorrect

为君一笑 提交于 2019-12-25 18:54:53
问题 String realTimeStr = "5.2345"; Double realTimeDbl = Double.parseDouble(realTimeStr); long realTimeLng = (long) (realTimeDbl*1000); SimpleDateFormat sdf = new SimpleDateFormat("HH:mm:ss.SSSS", Locale.getDefault()); log("Duration: " + sdf.format(new Date(realTimeLng - TimeZone.getDefault().getRawOffset()))); Current output: Duration: 00:00:05.0234 Desired output: Duration: 00:00:05.2345 I also tried another method, still no good: String realTimeStr = "1.4345"; Double realTimeDbl = Double

Format of time is incorrect

℡╲_俬逩灬. 提交于 2019-12-25 18:54:18
问题 String realTimeStr = "5.2345"; Double realTimeDbl = Double.parseDouble(realTimeStr); long realTimeLng = (long) (realTimeDbl*1000); SimpleDateFormat sdf = new SimpleDateFormat("HH:mm:ss.SSSS", Locale.getDefault()); log("Duration: " + sdf.format(new Date(realTimeLng - TimeZone.getDefault().getRawOffset()))); Current output: Duration: 00:00:05.0234 Desired output: Duration: 00:00:05.2345 I also tried another method, still no good: String realTimeStr = "1.4345"; Double realTimeDbl = Double

How to break x-axis with // marking?

末鹿安然 提交于 2019-12-25 17:39:14
问题 I want to break x-axis with // marking. I have found some similar written scripts for this purpose, for instance: breakxaxis (http://www.mathworks.com/matlabcentral/fileexchange/42905-break-x-axis). However, I am looking for a more professional look with only the // marking in the axis like the following: 来源: https://stackoverflow.com/questions/37378487/how-to-break-x-axis-with-marking

Error when subsetting based on adjusted values of different data frame in R

对着背影说爱祢 提交于 2019-12-25 17:08:32
问题 I am asking a side-question about the method I learned here from @redmode : Subsetting based on values of a different data frame in R When I try to dynamically adjust the level I want to subset by: N <- nrow(A) cond <- sapply(3:N, function(i) sum(A[i,] > 0.95*B[i,])==2) rbind(A[1:2,], subset(A[3:N,], cond)) I get an error Error in FUN(left, right) : non-numeric argument to binary operator. Can you think of a way I can get rows pertaining to values in A that are greater than 95% of the value

Format the summarised variables from proc summary

岁酱吖の 提交于 2019-12-25 16:09:39
问题 I'm using a Proc Summary, as I want to utilise a multilabel format. I've been going round and round trying to apply a format to my summarised outputs, but can't see how to get this without incurring warnings. Proc Summary Data = Source CompleteTypes Missing NoPrint NWay; Class Brand / MLF; Var Id Total; Output Out = Results N(ID) = Volume Sum(Total) = Grand_Total; Run; I want to format my Volume as Comma23. and the Grand_Total as Comma23.2. If I put a format statement after the outputs it

Format the summarised variables from proc summary

天大地大妈咪最大 提交于 2019-12-25 16:09:33
问题 I'm using a Proc Summary, as I want to utilise a multilabel format. I've been going round and round trying to apply a format to my summarised outputs, but can't see how to get this without incurring warnings. Proc Summary Data = Source CompleteTypes Missing NoPrint NWay; Class Brand / MLF; Var Id Total; Output Out = Results N(ID) = Volume Sum(Total) = Grand_Total; Run; I want to format my Volume as Comma23. and the Grand_Total as Comma23.2. If I put a format statement after the outputs it

formatting all the markers for the hovering series in a HighCharts scatterplot

≯℡__Kan透↙ 提交于 2019-12-25 15:52:27
问题 I want to change the appearange of all the markers (not only the one pointed) when hovering the series, but the following code (http://jsfiddle.net/fw852fy9/4/) does not work properly. What's wrong? Highcharts.chart('container', { chart: { type: 'scatter' }, plotOptions: { series: { lineWidth:1, states: { hover: { lineWidthPlus: 2, marker: { enabled: true, radius:3, states: { hover: { fillColor:'#FF0000', lineColor:'#00FF00', lineWidth:3, radius:12 } } } } }, marker: { enabled: true, radius:3

Problems with Decimalformat

随声附和 提交于 2019-12-25 11:35:24
问题 Hey i am using the following code to format my numbers to have two decimal places public String format(double num) { String temp=""; DecimalFormat df=new DecimalFormat("R.##"); temp=temp+df.format(num); return temp; } When I print out the results it gives me the answeres with only one decimal place. Please can someone help me stop that. 回答1: You use # in DecimalFormat which is the character that says "print the digit. if it is 0 leave it out." You need to use 0 where 0 is also printed as 0. E

jQuery.Gantt Date issues

≯℡__Kan透↙ 提交于 2019-12-25 09:34:53
问题 I am trying to implement jQuery.Gantt ( http://taitems.github.io/jQuery.Gantt/ ) into a site I am working on. I'm running into a weird issue with the Date objects. For testing purposes, I created "Milestones" January - December, each one having a start date of THAT month - 16th - 2012. Each one has the same end date of todays date, June 3rd, 2013. Each of the start dates are displaying one day late( MONTH - 17, 2012). The end dates get weird: January, February, November and December all end