append

强大的vim配置文件,让编程更随意

只愿长相守 提交于 2019-12-22 20:03:22
花了很长时间整理的,感觉用起来很方便,共享一下。 我的vim配置主要有以下优点: 1.按F5可以直接编译并执行C、C++、java代码以及执行shell脚本,按“F8”可进行C、C++代码的调试 2.自动插入文件头 ,新建C、C++源文件时自动插入表头:包括文件名、作者、联系方式、建立时间等,读者可根据需求自行更改 3.映射“Ctrl + A”为全选并复制快捷键,方便复制代码 4.按“F2”可以直接消除代码中的空行 5.“F3”可列出当前目录文件,打开树状文件目录 6. 支持鼠标选择、方向键移动 7. 代码高亮,自动缩进,显示行号,显示状态行 8.按“Ctrl + P”可自动补全 9.[]、{}、()、""、' '等都自动补全 10.其他功能读者可以研究以下文件 vim本来就是很强大,很方便的编辑器,加上我的代码后肯定会如虎添翼,或许读者使用其他编程语言,可以根据自己的需要进行修改,配置文件里面已经加上注释。 读者感兴趣的话直接复制下面的代码到文本文件,然后把文件改名为“ .vimrc” (不要忘记前面的“.”),然后把文件放到用户文件夹的根目录下面即可。重新打开vim即可看到效果。 为方便管理,源码托管到了github,后期增加了好多新功能, 具体详见: https://github.com/ma6174/vim 这是在github上的vim配置的截图: 下面是精简的

切片面试题:学习切片长度、容量,切片增长的过程

假如想象 提交于 2019-12-22 16:15:44
关于切片的面试题:摘自 https://goquiz.github.io/#subslice-grow func Subslice() { s := []int{1, 2, 3,4,5,6,7,8,9} ss := s[3:6] fmt.Printf("len ss : %d\n", len(ss)) fmt.Printf("Cap ss : %d\n", cap(ss)) ss = append(ss, 4) fmt.Printf("len ss : %d\n", len(ss)) fmt.Printf("Cap ss : %d\n", cap(ss)) for _, v := range ss { v += 10 } for i := range ss { ss[i] += 10 } fmt.Println(s) } 大家可以看一下结果是什么,结果是: len ss : 3 Cap ss : 6 len ss : 4 Cap ss : 6 [1 2 3 14 15 16 14 8 9 0 1 3] 下面是解析过程: 首先ss := s[3:6],结果就是截取索引在[3, 6)上的数据,所以len(ss)是3,那ss的cap容量为啥是9呢? 一个切片的容量就是该切面在底层数组山的开始位置向右扩展至数组的结束位置,在这边就是索引位置3到索引位置8 ,一共六个元素,append(

How To Append an Integer (with an Integer) in C++

让人想犯罪 __ 提交于 2019-12-22 10:57:30
问题 I was wondering if anyone could tell me how to append an integer (with another integer) in C++. Basically, if I have an int with this the value 67, how would I append it with the number 4 so the integer is now 674? Thanks in advance! 回答1: Multiply first by ten to the power of digit number of second and add the other . Example: 63 and 5 63*10=630 630+5 =635 Example: 75 and 34 75*100=7500 7500+34=7534 int i1=75; int i2=34; int dn=ceil(log10(i2+0.001)); //0.001 is for exact 10, exact 100, ...

Dynamic Array-Like Structure In R?

落花浮王杯 提交于 2019-12-22 10:56:08
问题 In the R programming language, how do I get a dynamic array (as described on Wikipedia) or equivalent data structure? I want something with the following attributes: O(1) indexing. Amortized O(1) appending. O(N) or less wasted space. Type parametric, i.e. can hold lists, user-defined objects, functions, matrices, etc., not just numbers. Appending without naming should be supported. Therefore, using an environment won't cut it. From what I can tell, using a list doesn't work because appending

Angular2 - http://localhost:4200/ being appended with api call why?

冷暖自知 提交于 2019-12-22 09:24:42
问题 just start learning angular2 followed the heroes tutorial. I am making a create request, the URL is perfectly fine, the parameters are fine. But I am still confused why http://localhost:4200/ is being appended with my API call, and because of that the URL gets totally changed, and the calls failed.please shed some light over this issue. I googled a lot but could find the reason. My Create Method create(user: object): Promise<any> { return this.http .post('localhost/usmanProject/api/web/v1

Angular2 - http://localhost:4200/ being appended with api call why?

僤鯓⒐⒋嵵緔 提交于 2019-12-22 09:24:10
问题 just start learning angular2 followed the heroes tutorial. I am making a create request, the URL is perfectly fine, the parameters are fine. But I am still confused why http://localhost:4200/ is being appended with my API call, and because of that the URL gets totally changed, and the calls failed.please shed some light over this issue. I googled a lot but could find the reason. My Create Method create(user: object): Promise<any> { return this.http .post('localhost/usmanProject/api/web/v1

在Qt中使用 Qt Chart 5.7.0

走远了吗. 提交于 2019-12-22 05:37:55
如何安装 Qt Chart 5.7.0 可以参照这篇博文 http://blog.csdn.net/accelerated1987/article/details/50564312 。 安装完毕后,新建一个widget项目,然后按照下面的步骤添加组件。 1、在pro文件中添加 QT += charts 。 1、在界面使用Qt Creator添加一个 QGraphicsView 组件,然后提升为QChartView。提升的时候,这样写提升为的类:QtCharts ::QChartView ,头文件写:qchartview.h。 2、在mainwindow.cpp中添加一段折线图表。方法:首先加入QChart的命名空间 QT_CHARTS_USE_NAMESPACE ,在代码中加上如下语句: #include "mainwindow.h" #include "ui_mainwindow.h" #include <QtCharts/QChartView> #include <QtCharts/QLineSeries> QT_CHARTS_USE_NAMESPACE MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent), ui(new Ui::MainWindow) { ui->setupUi(this);

Appending to slice bad performance.. why?

主宰稳场 提交于 2019-12-22 04:43:14
问题 I'm currently creating a game using GoLang. I'm measuring the FPS. I'm noticing about a 7 fps loss using a for loop to append to a slice like so: vertexInfo := Opengl.OpenGLVertexInfo{} for i := 0; i < 4; i = i + 1 { vertexInfo.Translations = append(vertexInfo.Translations, float32(s.x), float32(s.y), 0) vertexInfo.Rotations = append(vertexInfo.Rotations, 0, 0, 1, s.rot) vertexInfo.Scales = append(vertexInfo.Scales, s.xS, s.yS, 0) vertexInfo.Colors = append(vertexInfo.Colors, s.r, s.g, s.b, s

Appending to slice bad performance.. why?

断了今生、忘了曾经 提交于 2019-12-22 04:43:01
问题 I'm currently creating a game using GoLang. I'm measuring the FPS. I'm noticing about a 7 fps loss using a for loop to append to a slice like so: vertexInfo := Opengl.OpenGLVertexInfo{} for i := 0; i < 4; i = i + 1 { vertexInfo.Translations = append(vertexInfo.Translations, float32(s.x), float32(s.y), 0) vertexInfo.Rotations = append(vertexInfo.Rotations, 0, 0, 1, s.rot) vertexInfo.Scales = append(vertexInfo.Scales, s.xS, s.yS, 0) vertexInfo.Colors = append(vertexInfo.Colors, s.r, s.g, s.b, s

alternately appending elements from two lists

…衆ロ難τιáo~ 提交于 2019-12-22 01:40:09
问题 I have three lists with elements : a = [[0,1],[2,3],...] b = [[5,6],[7,8],...] c = [] I want to append elements from a and b into c to get: c = [ [0,1],[5,6],[2,3],[7,8],.... ] 回答1: Another very simple approach using string slicing (and most performance efficient ) as: >>> a = [[0,1],[2,3]] >>> b = [[5,6],[7,8]] >>> c = a + b # create a list with size = len(a) + len(b) >>> c[::2], c[1::2] = a, b # alternately insert the value >>> c [[0, 1], [5, 6], [2, 3], [7, 8]] Below is the comparison of