line

Get text of view (button)

南笙酒味 提交于 2019-12-05 18:33:41
I have two column in relative layout. both column have few button with text. I want to draw a line using finger which join the button. Take the example of "match the following" like A ------------------- A. Above things are done. Now i want to get the text of button from where user start drawing the line and end the line. In above case is "A". Could any one please help me out. I want to get the text with Orange circle when user start drawing the line from finger and then text of the green circle when user stop the line draw from finger. Text showing inside the circle are button only. I am

Python读取中文txt乱码问题

夙愿已清 提交于 2019-12-05 18:19:37
txt文件中是什么编码的,要转换一下,例如f.read().decode("utf-8") #coding=gbk #coding=utf-8 f = open ( r'e:/bigdata/weibo/weibo_train_data/weibo_train_data.txt' , 'r' ) line = f.readline().decode( 'utf-8' ) // 读取一行数据,转化为中文 print line 来源: CSDN 作者: 南山牧笛 链接: https://blog.csdn.net/u012556077/article/details/48383153

printf定义宏方便调试

旧街凉风 提交于 2019-12-05 16:41:34
/************************************************************************************** * Define debug message **************************************************************************************/ //#define DEBUG_PRINTF #ifndef DEBUG_PRINTF #define debug_printf(format,...) printf("FILE: "__FILE__", LINE: %d: "format"/n", __LINE__, ##__VA_ARGS__) #else #define debug_printf(format,...) #endif 以下便是打印调试信息: 来源: https://www.cnblogs.com/ownDefine/p/11933857.html

使用python删除txt文件中两行之间的内容

爱⌒轻易说出口 提交于 2019-12-05 16:40:35
txt=open(r'test.txt') lines=[] flag=False # 立flag for line in txt: if line.strip()=="start line": flag=True # 起始行开始不再添加 if not flag: lines.append(line) # 需求之外的行添加到列表 if line.strip()=="end line": flag=False # 结束行开始恢复添加 txt.close() open(r'test.txt','w').writelines(lines) 来源: https://www.cnblogs.com/wangzhilong/p/11933808.html

Apply lines() to columns of a data frame/matrix; each line with a different color

孤人 提交于 2019-12-05 15:54:05
I am trying to come up with a solution that doesn't involve using other packages such as ggplot. While plotting multiple lines is pretty straightforward, I haven't figured out a way to apply different values of an argument - e.g., different colors - to different lines. The code below (with the resulting plot) was my attempt, which obviously didn't do what I would like it to do. I also don't want to use a loop because I am trying to make my script as simple as possible. df = cbind(sort(rnorm(10)), sort(rnorm(10,-2)), sort(rlnorm(10))) plot(0, xlim = c(1,10), ylim=range(df), type="n") apply(df,

不知道怎么向女神表白?Python三大神技分分钟带你成功逆袭!

落花浮王杯 提交于 2019-12-05 15:21:31
一行python的表白 首先祭出绝招,用1行python表白: print(' '.join([''.join([('I LOVE U'[(x-y) % 8] if ( (x*0.05)**2 + (y*0.1)**2 -1)**3 - (x*0.05)**2 * (y*0.1)**3 <=0 else ' ') for x in range(-30,30)]) for y in range(15, -15, -1)])) 效果如下: UI LOVE LOVE UI L OVE UI LOVE UI LO UI LOVE UI LOVE U LOVE UI LOVE UI LOVE UI LOVE UI LOVE UI L LOVE UI LOVE UI LOVE UI LOVE UI LOVE UI LOV LOVE UI LOVE UI LOVE UI LOVE UI LOVE UI LOVE OVE UI LOVE UI LOVE UI LOVE UI LOVE UI LOVE U VE UI LOVE UI LOVE UI LOVE UI LOVE UI LOVE UI E UI LOVE UI LOVE UI LOVE UI LOVE UI LOVE UI UI LOVE UI LOVE UI LOVE UI LOVE UI LOVE UI L UI LOVE UI

nodejs笔试编程(单行多行输入)

北慕城南 提交于 2019-12-05 14:40:43
单行输入 const readline = require('readline'); const rl = readline.createInterface({ input: process.stdin, output: process.stdout }); //单行输入 rl.on('line',function(line){ var tokens = line.split(' '); //获取第一行的内容,存为数组 console.log(result); }); 多行输入,固定行数的输入(两种方法) //方法1: var readline = require('readline'); const rl = readline.createInterface({ input: process.stdin, output: process.stdout }); const lines = []; rl.on("line", function(line) { lines.push(line); //将输入放到新建的空数组中 if (lines.length === 2){ //判断,如果输入的行数等于固定值时开始处理 //通过数组索引分别得到数组中每一行的数据,并做相应操作 var arr1= lines[0]; console.log(result); } }); //方法2:

Read a line of text from an input stream in Java keeping the line-termination character(s)

試著忘記壹切 提交于 2019-12-05 14:31:28
问题 I have this code in Java: InputStreamReader isr = new InputStreamReader(getInputStream()); BufferedReader ir = new BufferedReader(isr); String line; while ((line = ir.readLine()) != null) { //do stuff with "line" } If the input stream contains the following: "hello\nhey\ryo\r\ngood-day", then line variable would be following on each iteration: hello hey yo good-day I want to read one line at a time, but I want to keep the line-termination character(s): hello\n hey\r yo\r\n good-day How can I

OpenGL: draw line between two elements

我与影子孤独终老i 提交于 2019-12-05 14:11:00
I need to draw a line between two meshes I've created. Each mesh is associated with a different model matrix. I've been thinking on how to do this and I thought of this: glMatrixMode(GL_MODELVIEW); glLoadMatrixf(first_object_model_matrix); glBegin(GL_LINES); glVertex3f(0, 0, 0); // object coord glMatrixMode(GL_MODELVIEW); glLoadMatrixf(first_object_model_matrix); glVertex3f(0, 0, 0); // ending point of the line glEnd( ); But the problem is that I can't call glMatrixMode and glLoadMatrixf between glBegin and glEnd . I'm also using shaders and the programmable pipeline, so the idea of turning

Add multiple horizontal lines in a boxplot

╄→尐↘猪︶ㄣ 提交于 2019-12-05 14:05:48
I know that I can add a horizontal line to a boxplot using a command like abline(h=3) When there are multiple boxplots in a single panel, can I add different horizontal lines for each single boxplot? In the above plot, I would like to add lines 'y=1.2' for 1, 'y=1.5' for 2, and 'y=2.1' for 3. I am not sure that I understand exactly, what you want, but it might be this: add a line for each boxplot that covers the same x-axis range as the boxplot. The width of the boxes is controlled by pars$boxwex which is set to 0.8 by default. This can be seen from the argument list of boxplot.default :