快乐的天空

时间来得快,去得也快

 

2017年6月24日

MySQL 分支选择

转自:http://dbaplus.cn/news-11-414-1.html
选择Percona Server、MariaDB还是MYSQL
 

 

1、Mysql三种存储引擎

 

MySQL提供了两种存储引擎:MyISAM和 InnoDB,MySQL4和5使用默认的MyISAM存储引擎。从MYSQL5.5开始,MySQL已将默认存储引擎从MyISAM更改为InnoDB。

 

MyISAM没有提供事务支持,而InnoDB提供了事务支持。

 

XtraDB是InnoDB存储引擎的增强版本,被设计用来更好的使用更新计算机硬件系统的性能,同时还包含有一些在高性能环境下的新特性。

 

2、Percona  Server分支

 

Percona Server由领先的MySQL咨询公司Percona发布。

 

Percona Server是一款独立的数据库产品,其可以完全与MySQL兼容,可以在不更改代码的情况了下将存储引擎更换成XtraDB。是最接近官方MySQL Enterprise发行版的版本。

 

Percona提供了高性能XtraDB引擎,还提供PXC高可用解决方案,并且附带了percona-toolkit等DBA管理工具箱。

 

3、MariaDB

 

MariaDB由MySQL的创始人开发,MariaDB的目的是完全兼容MySQL,包括API和命令行,使之能轻松成为MySQL的代替品。

 

MariaDB提供了MySQL提供的标准存储引擎,即MyISAM和InnoDB,10.0.9版起使用XtraDB(名称代号为Aria)来代替MySQL的InnoDB。

 

4、如何选择

 

综合多年使用经验和性能对比,首选Percona分支,其次是MariaDB,如果你不想冒一点风险,那就选择MYSQL官方版本。

 

常用的MYSQL调优策略
 

 

1、硬件层相关优化

 

修改服务器BIOS设置

 

选择Performance Per Watt Optimized(DAPC)模式,发挥CPU最大性能。

 

Memory Frequency(内存频率)选择Maximum Performance(最佳性能)

 

内存设置菜单中,启用Node Interleaving,避免NUMA问题。

 

2、磁盘I/O相关

 

使用SSD硬盘

 

如果是磁盘阵列存储,建议阵列卡同时配备CACHE及BBU模块,可明显提升IOPS。

 

raid级别尽量选择raid10,而不是raid5。

 

3、文件系统层优化

 

使用deadline/noop这两种I/O调度器,千万别用cfq

使用xfs文件系统,千万别用ext3;ext4勉强可用,但业务量很大的话,则一定要用xfs;

 

文件系统mount参数中增加:noatime, nodiratime, nobarrier几个选项(nobarrier是xfs文件系统特有的)。

 

4、内核参数优化

 

修改vm.swappiness参数,降低swap使用率。RHEL7/centos7以上则慎重设置为0,可能发生OOM。

 

调整vm.dirty_background_ratio、vm.dirty_ratio内核参数,以确保能持续将脏数据刷新到磁盘,避免瞬间I/O写。产生等待。

 

调整net.ipv4.tcp_tw_recycle、net.ipv4.tcp_tw_reuse都设置为1,减少TIME_WAIT,提高TCP效率。

 

5、Mysql参数优化建议

 

建议设置default-storage-engine=InnoDB,强烈建议不要再使用MyISAM引擎。

 

调整innodb_buffer_pool_size的大小,如果是单实例且绝大多数是InnoDB引擎表的话,可考虑设置为物理内存的50% -70%左右。

 

设置innodb_file_per_table = 1,使用独立表空间。

 

调整innodb_data_file_path = ibdata1:1G:autoextend,不要用默认的10M,在高并发场景下,性能会有很大提升。

 

设置innodb_log_file_size=256M,设置innodb_log_files_in_group=2,基本可以满足大多数应用场景。

 

调整max_connection(最大连接数)、max_connection_error(最大错误数)设置,根据业务量大小进行设置。

 

另外,open_files_limit、innodb_open_files、table_open_cache、table_definition_cache可以设置大约为max_connection的10倍左右大小。

 

key_buffer_size建议调小,32M左右即可,另外建议关闭query cache。

 

mp_table_size和max_heap_table_size设置不要过大,另外sort_buffer_size、join_buffer_size、read_buffer_size、read_rnd_buffer_size等设置也不要过大。

 

MYSQL常见的应用架构分享
 

 

1、主从复制解决方案

 

这是MySQL自身提供的一种高可用解决方案,数据同步方法采用的是MySQL replication技术。MySQL replication就是从服务器到主服务器拉取二进制日志文件,然后再将日志文件解析成相应的SQL在从服务器上重新执行一遍主服务器的操作,通过这种方式保证数据的一致性。

 

为了达到更高的可用性,在实际的应用环境中,一般都是采用MySQL replication技术配合高可用集群软件keepalived来实现自动failover,这种方式可以实现95.000%的SLA。

 

 

2、MMM/MHA高可用解决方案

 

MMM提供了MySQL主主复制配置的监控、故障转移和管理的一套可伸缩的脚本套件。在MMM高可用方案中,典型的应用是双主多从架构,通过MySQL replication技术可以实现两个服务器互为主从,且在任何时候只有一个节点可以被写入,避免了多点写入的数据冲突。同时,当可写的主节点故障时,MMM套件可以立刻监控到,然后将服务自动切换到另一个主节点,继续提供服务,从而实现MySQL的高可用。

 

 

3、Heartbeat/SAN高可用解决方案

 

在这个方案中,处理failover的方式是高可用集群软件Heartbeat,它监控和管理各个节点间连接的网络,并监控集群服务,当节点出现故障或者服务不可用时,自动在其他节点启动集群服务。在数据共享方面,通过SAN(Storage Area Network)存储来共享数据,这种方案可以实现99.990%的SLA。

 

 

4、Heartbeat/DRBD高可用解决方案

 

此方案处理failover的方式上依旧采用Heartbeat,不同的是,在数据共享方面,采用了基于块级别的数据同步软件DRBD来实现。

DRBD是一个用软件实现的、无共享的、服务器之间镜像块设备内容的存储复制解决方案。和SAN网络不同,它并不共享存储,而是通过服务器之间的网络复制数据。

 

MYSQL经典应用架构
 

 

 

其中:Dbm157是mysql主,dbm158是mysql主的备机,dbs159/160/161是mysql从。

 

MySQL写操作一般采用基于heartbeat+DRBD+MySQL搭建高可用集群的方案。通过heartbeat实现对mysql主进行状态监测,而DRBD实现dbm157数据同步到dbm158。

 

读操作普遍采用基于LVS+Keepalived搭建高可用高扩展集群的方案。前端AS应用通过提高的读VIP连接LVS,LVS有keepliaved做成高可用模式,实现互备。

 

最后,mysql主的从节点dbs159/160/161通过mysql主从复制功能同步mysql主的数据,通过lvs功能提供给前端AS应用进行读操作,并实现负载均衡。

posted @ 2017-06-24 11:23 探路者 阅读(237) | 评论 (0)编辑 收藏

主要坚果和产地

山核桃     浙江临安   天目山区
大核桃    
纸皮核桃  云南无量山区
巴旦木 天山以南喀什绿洲的疏附、英吉沙、莎车、叶城等县
 榛子  东北、山西、内蒙古、山东   
杏仁、腰果、榛子、核桃、松子、板栗、白果(银杏)、开心果、夏威夷果
花生、葵花子、南瓜子、西瓜子

posted @ 2017-06-24 10:20 探路者 阅读(124) | 评论 (0)编辑 收藏

RFID 主要设备生成商

进口设备商有:Impinj,Alien,讯宝,Thingmagic,CSL,Intermec,SIEMENS
国产的有远望谷,中兴,先施,瑞福,  
标签厂家主要还是"三大家":UPM,Alien,AVERY.国内主要系统商有清华同方,航天金卡,握奇数据等.
http://www.moduletech.com.cn/ 芯联科技
硬件最大的是NXP,芯片王者,从HF、UHF到未来的NFC,布局都很前瞻。
UHF一线厂家:Impinj,Alien,NXP
HF一线厂家:NXP、TI、ST、复旦微、华虹、同方微
RFID没有软件厂商说法,系统集成商就比谁个头大了,IBM、NEC、SAP、ORacle、Micorsoft
读写设备:迅宝(现摩托罗拉),斑马(ZEBRA),Intermec

posted @ 2017-06-24 10:19 探路者 阅读(108) | 评论 (0)编辑 收藏

2017年5月10日

境界的提升

工程师:
不断地思考与锤炼自身对最佳实践方式的理解感悟
设计过的系统架构图、功能结构图、数据库模型,并能基于系统实际使用情况进行基于架构的系统结构优化、性能优化等。

苦行僧:
 追求于设计之道与艺术之道的

布道师:
有着广阔的见识与丰富的实战经验, 经过短暂的观察即可指出对于当前架构的优化意见,可以用最简单的办法解决技术上的难题,可以通过跨领域知识启迪你解决问题.
科学家与哲学家
 paper & spirit

posted @ 2017-05-10 18:15 探路者 阅读(172) | 评论 (0)编辑 收藏

2017年3月23日

shell 脚本

#数字段形式
for i in {1..100}
do
   echo $i
done

#详细列出(字符且项数不多)
for File in 1 2 3 4 5 
do 
    echo $File 
done

#对存在的文件进行循环

for name in 'ls *.log'
do 
          name=`echo "$name" | awk -F. '{print $1}'`           
          echo $name
done

#查找循环(ls数据量太大的时候也可以用这种方法)
for shname in `find . -type f -name "*.sh"`
do 
          name=`echo "$shname" | awk -F/ '{print $2}'`          
          echo $name
done

#((语法循环--有点像C语法,但记得双括号
for((i=1;i<100;i++))
do
    if((i%3==0))
    then
        echo $i
        continue
    fi
done

#seq形式 起始从1开始
for i in `seq 100`
do
    if((i%3==0))
    then
        echo $i
        continue
    fi
done

#while循环注意为方括号[],且注意空格
min=1
max=100
while [ $min -le $max ]
do
    echo $min
    min=`expr $min + 1`
done  

#双括号形式,内部结构有点像C的语法,注意赋值:i=$(($i+1))
i=1
while(($i<100))
do
    if(($i%4==0))
    then
        echo $i
    fi
    i=$(($i+1))
done

#从配置文件读取,并可以控制进程数量
MAX_RUN_NUM=8
cat cfg/res_card_partition.cfg |grep -v '^$'|grep -v "#" | grep -v grep |while read partition 
do        
                nohup sh inv_res_card_process.sh $partition >log/resCard$partition.log 2>&1 &               
                while [ 1 -eq 1 ]
                do
                                psNum=`ps -ef | grep "inv_res_card_process" | grep -v "grep" | wc -l`
                                if [ $psNum -ge $MAX_RUN_NUM ]
                                then
                                              sleep 5
                                else
                                              break
                                 fi                                        
                done                
done


 三.循环控制语句 
    break 命令不执行当前循环体内break下面的语句从当前循环退出. 
    continue 命令是程序在本循体内忽略下面的语句,从循环头开始执行

posted @ 2017-03-23 17:15 探路者 阅读(190) | 评论 (0)编辑 收藏

2017年1月11日

Oracle 学习进阶

学习盖总的文章总结如下

一、oracle 基础知识
1.Oracle Concept
2.Administrator's Guid
3.Reference 手册
4.Backup and Recovery User's Guid 
5.Data Guard Concepts and Administrator
6.Oracle Clusterware and RAC Administrator 手册
二、百科全书/手册
找 杨长老学习文档。
三、有点及面,深入思考的学习方案
《深入解析Oracle》由点到线再及面的学习, 需要专门的培训和系统的学习。 通过实践的学习和深入的思考 "不患寡,而患不深", 
遇到问题时,不断深入研究,直到问题的核心本质,这样通过一个案例或实际问题的诊断学习和研究,我们可以带动很多连带知识的学习,
这样从一个点深入下去就形成一条线,再横向扩展就可以形成知识网。
四、严谨与独立思考的素质
勤奋、严谨、具有钻研精神及独立思考能力。 
《Oracle 数据库性能优化》  兴趣 + 勤奋 + 坚持 + 方法 -> 成功
五、DBA生存四大守则
《深入浅出Oracle》
1.备份重于一切
2.三思而后行 think thrice before you act 
3.rm 是恶魔
4.制定规范(规范开发和系统人员),不规矩不成方圆。
可以规避有意和无意的错误操作,建设数据库的风险。

posted @ 2017-01-11 09:04 探路者 阅读(198) | 评论 (0)编辑 收藏

2015年8月16日

bjam 编译boost

 

link=static variant=debug,release threading=multi runtime-link=static --layout=versioned --toolset=msvc-9.0  --build-type=complete  stage
--build-dir=<builddir>  编译的临时文件会放在builddir里(这样比较好管理,编译完就可以把它删除了)
--stagedir=<stagedir>  存放编译后库文件的路径,默认是stage
--build-type=complete  编译所有版本,不然只会编译一小部分版本(确切地说是相当于:variant=release, threading=multi;link=shared|static;runtime-link=shared)
variant=debug|release  决定编译什么版本(Debug or Release?)
link=static|shared  决定使用静态库还是动态库。
threading=single|multi  决定使用单线程还是多线程库。
runtime-link=static|shared  决定是静态还是动态链接C/C++标准库。
--with-<library>  只编译指定的库,如输入--with-regex就只编译regex库了。
--show-libraries  显示需要编译的库名称

boost库的命名约定:
[lib]<boost模块名>-<toolset编译器>[-mt][-sgdyp]<-boost版本>.<扩展名>
    [lib]:所有模块均采用lib为前缀,除了windows+msvc环境。在windows+msvc环境下,只有静态库(.lib)才有lib前缀,动态库(.dll)没有lib前缀。windows+mingw环境也使用lib前缀。
    <boost模块名>:所有模块均以boost_开头,比如boost_date_time, boost_python等等
    <toolset编译器>:比如mgw45, vc90
    [-mt]:多线程支持,不指定则默认为仅支持单线程
    [-sgdyp]:ABI的详细情况
        s 静态链接到C++标准库和运行库
        g 使用debug版的标准库和运行库
        d 编译debug版
        y python相关的debug
        p 使用STLPort作为C++标准库而不是编译器默认提供的
    <-boost版本>:比如-1_45
    <扩展名>:
        windows+mingw:dll(动态库),dll.a(动态库的导入库)
        windows+msvc:dll(动态库),lib(无lib前缀的是动态库的导入库),lib(有lib前缀的是静态库)
        unix/linux:a(静态库),so(动态库)
        使用boost
    windows+msvc编译出来的boost库默认会打开auto-link功能,即在包含boost头文件的时候自动寻找并链接依赖库。这实际上是通过msvc特有的预处理指令#pragma comment(lib, "xxx.lib")来实现的,默认的实现为链接静态库。
        如果想要链接动态库,则需要使用预定义宏 -DBOOST_ALL_DYN_LINK
        如果想要完全手动控制链接方式,则需要使用预定义宏 -DBOOST_ALL_NO_LIB。
    windows+mingw编译出来的boost库不支持auto-link,因为gcc没有类似msvc的#pragma comment预处理指令,所以必须手动控制链接方式。
    asio:依赖Boost.system模块,并且如果用到特定功能还可能依赖Boost.regex, Boost.openssl, Boost.thread, Boost.date_time, Boost.serialization等等,可以使用预定义宏 -DBOOST_DATE_TIME_NO_LIB 以及 -DBOOST_REGEX_NO_LIB 关闭相应模块的自动链接。windows下asio最终使用的是windows系统的socket库:ws2_32.lib,Mswsock.lib.同理,msvc可以通过auto-link自动完成链接,mingw需要手动设置。
    使用msvc编译真是有些玄妙:
使用预定义宏BOOST_ALL_DYN_LINK,动态链接:则编译时需要动态链接库导入库system,date_time,regex,执行时需要system,date_time。
使用预定义宏BOOST_ALL_NO_LIB,动态链接:则编译时需要动态链接库导入库system,执行时也只需要system。
使用预定义宏BOOST_ALL_NO_LIB,静态链接:则编译时需要静态库system,执行时不需要system。
 
使用mingw编译,一切正常:
注意上述几个预定义宏只对msvc有用而对mingw是不起作用的
动态链接:则编译时需要动态链接库导入库system,执行时也只需要system
静态链接:则编译时需要静态库system,执行时不需要system
当然ws2_32, Mswsock总是要指定链接的。
Usage:
Bjam  [options]  [properties]  [install|stage]
 
 
install                 Install  headers and compiled library files to the
=======               configured locations (below).
                      在“--prefix=”指定的目录下生成所有头文件
           (boost源代码下boost文件夹下所有文件)和指定库文件
 
--prefix=<PREFIX>       Install architecture independent files here.
                     Default; C:\Boost on Win32
                     Default; /usr/local on Unix. Linux, etc.
 
--exec-prefix=<EPREFIX>  Install architecture dependent files here.
                     Default; <PREFIX>
 
--libdir=<DIR>          Install library files here.
                     Default; <EPREFIX>/lib
 
--includedir=<HDRDIR>   Install header files here.
                      Default; <PREFIX>/include
 
stage                 Build and install only compiled library files
======               to the stage directory.
                          在“--stagedir=”指定的目录下生成指定库文件
 
 
--stagedir=<STAGEDIR>   Install library files here
                      Default; ./stage
 
 
【Other Options】:
--build-type=<type>     Build the specified pre-defined set of variations
                     of the libraries. Note, that which variants get
                     built depends on what each library supports.
 
                     minimal (default) - Builds the single
                     "release" version of the libraries. This
                     release corresponds to specifying:
                     "release  <threading>multi  <link>shared
                     <link>static  <runtime-link>shared" as the
                     Build variant to build.
                     complete - Attempts to build all possible
                     variations.
 
--build-dir=DIR         Build in this location instead of building
                     within the distribution tree. Recommended!
 
--show-libraries        Displays the list of Boost libraries that require
                     build and installation steps, then exit.
 
--layout=<layout>       Determines whether to choose library names
                     and header locations such that multiple
                     versions of Boost or multiple compilers can
                     be used on the same system.
 
                     versioned (default) - Names of boost
                     binaries include the Boost version
                     number and the name and version of the
                     compiler. Boost headers are installed
                     in a subdirectory of <HDRDIR> whose
                     name contains the Boost version number.
 
                     system - Binaries names do not include
                     the Boost version number or the name
                     and version number of the compiler.
                     Boost headers are installed directly
                     into <HDRDIR>. This option is
                     intended for system integrators who
                     are building distribution packages.
 
--buildid=ID                    Adds the specified ID to the name of built
                        libraries. The default is to not add anything.
 
--help                     This message.
 
--with-<library>                Build and install the specified <library>
                            If this option is used, only libraries
                            specified using this option will be built.
 
--without-<library>              Do not build, stage, or install the specified
                             <library>. By default, all libraries are built.
 
 
【Properties】:
toolset=toolset            Indicates the toolset to build with.
                                                        msvc-6.0 :  VC6.0
msvc-7.0:  VS2003
                                                        msvc-8.0:  VS2005
                                                        msvc-9.0:  VS2008
                                                        msvc-10.0:  VS2010
 
variant=debug|release      Select the build variant
 
link=static|shared          Whether to build static or shared libraries
 
threading=single|multi      Whether to build single or multithreaded binaries
 
runtime-link=static|shared   Whether to link to static or shared C and C++ runtime.
                         决定是静态还是动态链接C/C++标准库


compile gce dependence lib

b2 --toolset=msvc-14.0  link=static variant=debug,release threading=multi runtime-link=static  asmflags=\safeseh --stagedir=../.. --with-thread --with-atomic  --with-coroutine --with-context --with-system --with-regex --with-date_time --with-chrono
[context] msvc /SAFESEH

http://comments.gmane.org/gmane.comp.lib.boost.devel/244402

posted @ 2015-08-16 23:26 探路者 阅读(1123) | 评论 (2)编辑 收藏

github clone boost 库

 
1.工具gitsys for windows
2.git colne 参考
https://svn.boost.org/trac/boost/wiki/TryModBoost#InstallingModularBoost
http://dev.activebasic.com/egtra/2013/12/03/620/
>git clone https://github.com/boostorg/boost.git 
Cloning into 'modular-boost'...
Receiving objects:   0% (124/197355), 23
remote: Compressing objects: 100% (30/30), done.
error: RPC failed; result=56, HTTP code = 200
fatal: early EOF
fatal: The remote end hung up unexpectedly
fatal: index-pack failed
Git 遇到了 early EOF index-pack failed 问题
# 为 git 添加配置项,通过下面的命令可以简单完成
# 在这之前可以执行 git config -l 命令看看已有配置项有哪些
git config --add core.compression -1
上面是通过命令来完成的,很方便,当然可以直接修改 .gitconfig 文件(在用户目录下),如果你愿意的话。部分内容如下:
[user]
    name = Ggicci
    email = ...
[core]
    compression = -112345
在 [core] 这个 section 里面添加 compression 属性即可。至于它的取值可以参考 Git Config Manpage,
这个页面你可以通过 man git config(linux) 或者 git config --help(windows)来查看本地版本。
compression 是压缩的意思,从 clone 的终端输出就知道,服务器会压缩目标文件,然后传输到客户端,客户端再解压。取值为 [-1, 9],-1 以 zlib 为默认压缩库,0 表示不进行压缩,1..9 是压缩速度与最终获得文件大小的不同程度的权衡,数字越大,压缩越慢,当然得到的文件会越小。
$ cd boost
$ git submodule init
$ git submodule update
> bootstrap.bat
> b2 headers
或者
$ git clone --recursive https://github.com/boostorg/boost.git boost
> cd boost
> bootstrap.bat
> b2 headers
更换发行版本
$ cd boost
$ git checkout release-1.55.0
$ git submodule update

posted @ 2015-08-16 23:23 探路者 阅读(1382) | 评论 (0)编辑 收藏

2014年8月27日

自动更新

auto update 
technology document list 
1. http://www.cnblogs.com/KnightsWarrior/archive/2010/10/20/1856255.html
2.https://ladyuki.wordpress.com/2011/04/04/%E5%AE%A2%E6%88%B7%E7%AB%AF%E8%87%AA%E5%8A%A8%E5%8D%87%E7%BA%A7/
http://pcajax.iteye.com/blog/1069476
issue 
1.http://qt-project.org/forums/viewthread/28600
software & solution 
 ms clickonce     http://msdn.microsoft.com/zh-cn/library/142dbbz4(v=vs.90).aspx
 winsparkle         https://github.com/vslavik/winsparkle 
                                http://winsparkle.org/
                                http://sparkle-project.org/
                                http://netsparkle.codeplex.com/documentation
google  omaha  http://code.google.com/p/omaha/
wyupdate            http://code.google.com/p/wyupdate/
autoupdate c#  https://autoupdater.codeplex.com/
others 
http://wpkg.org/Automatic_Updates
http://www.codeproject.com/Articles/19623/Adding-automatic-updates-to-your-program-Part
http://www.cnblogs.com/wangiqngpei557/archive/2011/05/13/2045434.html#2096102
Introduction
If you decide to build your enterprise applications through .NET, may be the deployment strategy is one of the most important jobs in your whole project. Failure of the deployment strategy may result in lower customer satisfaction and also increase maintenance costs. Through my experience of building enterprise applications for banks and securities companies, I'll suggest four very clear reasons why you should not use Clickonce as your deployment strategy for your enterprise applications.
Three reasons why you should not choose Clickonce
Reason 1. Clickonce does not support proxy networks
If your customer company uses proxy servers for their network security and if your application is deployed under Clickonce technology, simply, your application doesn't get deployed under the proxy network.
And also I found that almost every bank and securities company uses a proxy network (HSBC, City Bank, Goldman Sachs.. and so on..). So if your clients are companies like that, just don't try to use Clickonce deployment because it does not work at all (there is a way to run Clickonce under a proxy network, if you have the power to order every customer to fix the settings of the machine.config file which is located very deep inside the Windows folder).
Reason 2. Assembly verification time is too long
Even though your application has a moderate number of assemblies, your clients should wait more than minutes to be deployed.
Reason 3. Customization is not allowed.
If you have more than 50 assemblies to be deployed, a financial company's network security device may disconnect your deployment process forcibly with sync flooding failure. Even though you know the cause of that failure, you can not GZip your assemblies into lesser than five physical files because Clickonce does not support doing that.

posted @ 2014-08-27 10:38 探路者| 编辑 收藏

2014年7月12日

Ubuntu安装SublimeText2

一、环境

操作系统:ubuntu 14.04 x64
编辑器:Sublime Text v2.0.1 x64

二、下载并解压

下载SublimeText的地址:http://c758482.r82.cf2.rackcdn.com/Sublime%20Text%202.0.1%20x64.tar.bz2

$ sudo mv Sublime\ Text\ 2.0.1\ x64.tar.bz2 sublime.tar.bz2
$ sudo tar vxjf sublime.tar.bz2
$ sudo mv Sublime\ Text\ 2/ sublime

三、创建快捷方式

我们希望在终端下仅仅只需输入sublime就能打开SublimeText编辑器。那么,可以创建一个符号链接,它相当于Windows的快捷方式。

$ sudo ln -s /tool/sublime/sublime_text /usr/bin/sublime

四、进行统一配置

要让SublimeText每次运行都保持一致,需要为它创建配置文件,位置为"/usr/share/applications"

$ sudo sublime /usr/share/applications/sublime.desktop

并粘贴以下的内容:

  1. [Desktop Entry]  
  2. Version=1.0  
  3. Name=Sublime Text 2  
  4. # Only KDE 4 seems to use GenericName, so we reuse the KDE strings.  
  5. # From Ubuntu's language-pack-kde-XX-base packages, version 13.04-20130413.  
  6. GenericName=Text Editor  
  7.   
  8. Exec=sublime  
  9. Terminal=false  
  10. Icon=/tool/sublime/Icon/48x48/sublime_text.png  
  11. Type=Application  
  12. Categories=TextEditor;IDE;Development  
  13. X-Ayatana-Desktop-Shortcuts=NewWindow  
  14.   
  15. [NewWindow Shortcut Group]  
  16. Name=New Window  
  17. Exec=sublime -n  
  18. TargetEnvironment=Unity  
保存并退出。


五、配置所有的文本文件指定用SublimeText打开


$ sudo sublime /usr/share/applications/defaults.list
把所有的gedit.desktop用sublime.desktop代替。

最后记得把SublimeText锁定到启动器,这样就很完美了。

posted @ 2014-07-12 22:52 探路者 阅读(1005) | 评论 (0)编辑 收藏

仅列出标题  下一页

导航

统计

常用链接

留言簿

随笔分类

随笔档案

文章分类

文章档案

新闻档案

Android

Compiler Course

VIM

编译技术集合

测试

高性能计算

个人博客

框架/组件/库

搜索

最新评论

阅读排行榜

评论排行榜