0%

基本使用

1
2
3
4
5
i                        # 进入插入模式  
:q # 退出vim  
:w # 保存  
:wq # 保存并退出  
:set syn=c # 设置c风格的语法高亮
阅读全文 »

String Immutability【字符串不变性】

The following diagram shows what happens for the following code:

1
2
String s = "abcd";
s = s.concat("ef");
阅读全文 »

前置安装配置,包括如下:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
info AppiumDoctor  ✔ The Node.js binary was found at: /usr/local/bin/node
info AppiumDoctor ✔ Node version is 6.9.0
info AppiumDoctor ✔ Xcode is installed at: /Applications/Xcode.app/Contents/Developer
info AppiumDoctor ✔ Xcode Command Line Tools are installed.
info AppiumDoctor ✔ DevToolsSecurity is enabled.
info AppiumDoctor ✔ The Authorization DB is set up properly.
info AppiumDoctor ✔ Carthage was found at: /usr/local/bin/carthage
info AppiumDoctor ✔ HOME is set to: /Users/taoyi
info AppiumDoctor ✔ ANDROID_HOME is set to: /opt/android-sdk-macosx
info AppiumDoctor ✔ JAVA_HOME is set to: /Library/Java/JavaVirtualMachines/jdk1.8.0_91.jdk/Contents/Home
info AppiumDoctor ✔ adb exists at: /opt/android-sdk-macosx/platform-tools/adb
info AppiumDoctor ✔ android exists at: /opt/android-sdk-macosx/tools/android
info AppiumDoctor ✔ emulator exists at: /opt/android-sdk-macosx/tools/emulator
info AppiumDoctor ✔ Bin directory of $JAVA_HOME is set
阅读全文 »

安装MongoDB数据库

  1. 下载MongoDB

  2. 安装MongoDB

    1
    2
    tar -zxvf mongodb-osx-x86_64-3.4.1.tgz
    mv mongodb-osx-x86_64-3.4.1 /opt/mongodb-3.4.1/
    阅读全文 »

安装包安装MySQL数据库

本地数据库的安装MySQL

安装完后,会给出一个默认密码:

阅读全文 »

冒泡排序

它重复地走访过要排序的数列,一次比较两个元素,如果他们的顺序错误就把他们交换过来。走访数列的工作是重复地进行直到没有再需要交换,也就是说该数列已经排序完成。

1
2
3
4
5
6
7
8
def bubble_sort(lists):
# 冒泡排序
count = len(lists)
for i in range(0, count):
for j in range(i + 1, count):
if lists[i] > lists[j]:
lists[i], lists[j] = lists[j], lists[i]
return lists
阅读全文 »

冒泡排序

  冒泡排序是一种简单的排序算法。它重复地走访过要排序的数列,一次比较两个元素,如果他们的顺序错误就把他们交换过来。走访数列的工作是重复地进行直到没有再需要交换,也就是说该数列已经排序完成。这个算法的名字由来是因为越小的元素会经由交换慢慢“浮”到数列的顶端。
  冒泡排序的示例

阅读全文 »

安装docker

官网下载 Docker for Mac

无法删除docker镜像时,处理方法

有依赖该image的container,先删除container再删除image

1
2
3
docker ps -a | grep "Exited" | awk '{print $1 }'|xargs docker stop
docker ps -a | grep "Exited" | awk '{print $1 }'|xargs docker rm
docker images|grep none|awk '{print $3 }'|xargs docker rmi

这样清空掉残余的容器后,再删除images就没有异常的提示了。

阅读全文 »

  1. 删除Emacs——可以节省出60MB+的硬盘空间

    1
    sudo rm -rf /usr/share/emacs/
  2. 移除系统嗓音文件——可以节省出500MB-3GB+硬盘空间

    1
    2
    cd /System/Library/Speech/
    sudo rm -rf Voices/*
    阅读全文 »