通过ctrl+~
或者View->Show Console
调出控制台,然后输入一下内容回车,在线安装。
import urllib2,os,hashlib; h = 'df21e130d211cfc94d9b0905775a7c0f' + '1e3d39e33b79698005270310898eea76'; pf = 'Package Control.sublime-package'; ipp = sublime.installed_packages_path(); os.makedirs( ipp ) if not os.path.exists(ipp) else None; urllib2.install_opener( urllib2.build_opener( urllib2.ProxyHandler()) ); by = urllib2.urlopen( 'http://packagecontrol.io/' + pf.replace(' ', '%20')).read(); dh = hashlib.sha256(by).hexdigest(); open( os.path.join( ipp, pf), 'wb' ).write(by) if dh == h else None; print('Error validating download (got %s instead of %s), please try manual install' % (dh, h) if dh != h else 'Please restart Sublime Text to finish installation')
也可以通过下面方式离线安装package control
Preferences > Browse Packages…
menuInstalled Packages/
folderControl.sublime-package
and copy it into the Installed Packages/ directory* shift + ctrl + p
* 输入install package
* 输入插件名回车就可以了自动安装
* shift + ctrl + p
* 输入remove package
* 选择要删除的插件回车
通过ctrl+~
或者View->Show Console
调出控制台,然后输入一下内容回车。
import urllib.request,os,hashlib; h = 'df21e130d211cfc94d9b0905775a7c0f' + '1e3d39e33b79698005270310898eea76'; pf = 'Package Control.sublime-package'; ipp = sublime.installed_packages_path(); urllib.request.install_opener( urllib.request.build_opener( urllib.request.ProxyHandler()) ); by = urllib.request.urlopen( 'http://packagecontrol.io/' + pf.replace(' ', '%20')).read(); dh = hashlib.sha256(by).hexdigest(); print('Error validating download (got %s instead of %s), please try manual install' % (dh, h)) if dh != h else open(os.path.join( ipp, pf), 'wb' ).write(by)
在Preference中设置参数即可。
// The number of spaces a tab is considered equal to
“tab_size”: 4,
// Set to true to insert spaces when tab is pressed
“translate_tabs_to_spaces”: true,
我们知道PHP是一种弱类型语言,相对于C、Java等语言来说,弱类型语言的变量能够接收各种类型的值,例如:
$var = 10;
$var = 'this is a string';
$var = array('score' => 100);
$var = new MyClass();
从上面可以看出变量$var
能接整型、字符串、数组、对象等多种类型的值,非常灵活。
但是PHP是用C来实现的,C语言是强类型的语言,PHP底层是如何实现的呢?
在Zend/zend.h
文件中,实际定义一个变量的时候,PHP用的是zval
来表示变量的,而zval
又被定义为_zval_struct
typedef struct _zval_struct zval;
下面我们看_zval_struct
的结构。
struct _zval_struct {
/* Variable information */
zvalue_value value; /* value */
zend_uint refcount__gc;
zend_uchar type; /* active type */
zend_uchar is_ref__gc;
};
在_zval_struct
中,PHP除了定义存储变量的value
,还存在引用计数refcount__gc
、变量类型type
、是否是引用is_ref__gc
。
PHP定义的type
有以下几种,我们很容易从宏定义的名字看出来每种类型对应的值:
/* data types */
/* All data types <= IS_BOOL have their constructor/destructors skipped */
#define IS_NULL 0
#define IS_LONG 1
#define IS_DOUBLE 2
#define IS_BOOL 3
#define IS_ARRAY 4
#define IS_OBJECT 5
#define IS_STRING 6
#define IS_RESOURCE 7
#define IS_CONSTANT 8
#define IS_CONSTANT_ARRAY 9
#define IS_CALLABLE 10
zval
中value
字段实际保存变量的值,而value
的类型是zvalue_value
,结构如下:
typedef union _zvalue_value {
long lval; /* long value */
double dval; /* double value */
struct {
char *val;
int len;
} str;
HashTable *ht; /* hash table value */
zend_object_value obj;
} zvalue_value;
zvalue_value
是一个union的结构,相对于struct,union能够节省更多的内存空间,降低PHP的内存占用。另外,从结构中可以看到:lval
用来保存整数值;dval
用来保存浮点数值;str
用来指向字符串的位置并记录长度;ht
用来存放一个hash表,例如数组等;obj
则用来存放对象。每个变量的值都存储在这个数据结构中。
变量类型 | zval.type | zval.value |
---|---|---|
boolean | IS_BOOL | lval |
integer | IS_LONG | lval |
float | IS_DOUBLE | dval |
null | IS_NULL | - |
resource | IS_RESOURCE | lval |
string | IS_STRING | str |
array | IS_ARRAY | ht |
object | IS_OBJECT | obj |
每种变量的存储,以及相应存储字段如上表所示。下一节我们着重展开HashTable的分析。
chrome有很多好用的插件,善于利用这些插件能够极大地提高我们的工作效率。下面我们介绍几个常用的扩展。
vimium提供了类似vim操作的chrome插件,浏览页面时能够极大程度对鼠标的需求。
常用快捷键:
1. 页面内移动操作
下(j) 上(k) 左(h) 右(l)
上半屏(u) 下半屏(d)
页首(gg) 页尾(G)
2. 页面操作
前进(H) 后退(L)
重载(r)
当前tab打开页面链接(f)
薪tab打开页面链接(F)
关闭当前页面(x)
恢复已关闭页面(X)
3. tab间跳转
跳转到左边tab(J)
跳转到右边tab(K)
WEB前端助手(FeHelper)提供包括字符串编解码、代码压缩、美化、JSON格式化、正则表达式、时间转换工具、二维码生成器、编码规范检测、页面性能检测、页面取色、Ajax接口调试等功能。
Postman>是一款功能强大的网页调试与发送网页HTTP请求的Chrome插件。能够模拟几乎所有类型http请求来调试接口。
Samba是种用来让UNIX系列的操作系统与微软Windows操作系统的SMB/CIFS(Server Message Block/Common Internet File System)网络协议做链接的自由软件。在UNIX系统上配置并开启samba服务后,在windows下映射相应的UNIX目录。这样,在windows下,就像想浏览普通windows路径一样访问UNIX资源。
本文以centos为例,配置samba服务。
[gongmh@localhost ~]$ sudo yum install samba
[gongmh@localhost ~]$ sudo smbpasswd -a gongmh
[gongmh@localhost ~]$ echo -e "\n[mydisk]\n\tcomment = Home Directories\n\tbrowseable = no\n\twritable = yes\n\tpath=/home/gongmh\n\tvalid users =gongmh\n" >> /etc/samba/smb.conf
[gongmh@localhost ~]$ sudo service smb start
[gongmh@localhost ~]$ service smb status
service iptables stop
setenforce 0
创建【映射网络驱动器】
配置 \\ip\samba_name
输入账号、密码连接服务
(done)
(add 2017-06-24)
smbclient -L host //Get a list of shares available on a host
testparm smb_conf_path -s
标题
# 一级标题
## 二级标题
###### 六级标题
学而不思则罔思而不学则殆。
链接
百度是一个搜索公司。
图片
int main()
{
printf("Hello World.\n");
}
$sKey = 'my_redis_key';
表格
|—
| Default aligned | Left aligned | Center aligned | Right aligned
|-|:-|:-:|-:
| First body part | Second cell | Third cell | fourth cell
| Second line |foo | strong | baz
| Third line |quux | baz | bar
|—
| Second body
| 2 line
|===
| Footer row
删除线和下划线
删除hello world
删除del content
下划线下划内容
加粗和斜体
斜体文字
斜体文字
加粗文字
加粗文字
链接和邮箱
链接http://www.baidu.com链接
邮箱git@github.com邮箱
转义
*不是斜体*
上下标
E = mc2
Water: H2O
\ * TOC
\ {:toc}
\ # Contents
\ {:.no_toc}
\ * Will be replaced with the ToC, excluding the "Contents" header
\ {:toc}
\ # H1 header
\ ## H2 header
<font color=#0099ff size=12 face=”黑体”>黑体</font>
kramdown语法规则。