setjmp/longjmp回退内存
比如在一段代码中,
setjmp相当于将某一个内存打了一个桩
longjmp可以跳转回来
if (setjmp(ptr)) { //第一次使用返回0
}
...
longjmp(ptr, int); //调用longjmp会goto到setjmp语句,并使setjmp返回非0值。
setjmp/longjmp回退内存
比如在一段代码中,
setjmp相当于将某一个内存打了一个桩
longjmp可以跳转回来
if (setjmp(ptr)) { //第一次使用返回0
}
...
longjmp(ptr, int); //调用longjmp会goto到setjmp语句,并使setjmp返回非0值。
unsigned long hash(unsigned char *str)
{
unsigned long hash = 5381;
int c;
while (c = *str++)
hash = ((hash << 5) + hash) + c; /* hash * 33 + c */
return hash;
}
用这个函数hash几张图片,得到了同样的值,应该是遇到了0,改进一下
把while循环改成for循环就可以了,不过需要知道字符串的长度
unsigned long hash(unsigned char *str, int size)
{
unsigned long hash = 5381;
int i;
for (i = 0; i < size; i++)
{
int c = (int)str[i];
hash = hash * 33 + c;
}
return hash;
}
从输入url,到打开页面发生了什么?
引用知乎上一个比较好玩的答案:
你发现快要过年了,于是想给你的女朋友买一件毛衣,你打开了www.taobao.com。这时你的浏览器首先查询DNS服务器,将www.taobao.com转换成ip地址。不过首先你会发现,你在不同的地区或者不同的网络(电信、联通、移动)的情况下,转换后的ip地址很可能是不一样的,这首先涉及到负载均衡的第一步,通过DNS解析域名时将你的访问分配到不同的入口,同时尽可能保证你所访问的入口是所有入口中可能较快的一个(这和后文的CDN不一样)。
你通过这个入口成功的访问了www.taobao.com的实际的入口ip地址。这时你产生了一个PV,即Page View,页面访问。每日每个网站的总PV量是形容一个网站规模的重要指标。淘宝网全网在平日(非促销期间)的PV大概是16-25亿之间。同时作为一个独立的用户,你这次访问淘宝网的所有页面,均算作一个UV(Unique Visitor用户访问)。最近臭名昭著的12306.cn的日PV量最高峰在10亿左右,而UV量却远小于淘宝网十余倍,这其中的原因我相信大家都会知道。
因为同一时刻访问www.taobao.com的人数过于巨大,所以即便是生成淘宝首页页面的服务器,也不可能仅有一台。仅用于生成www.taobao.com首页的服务器就可能有成百上千台,那么你的一次访问时生成页面给你看的任务便会被分配给其中一台服务器完成。这个过程要保证公正、公平、平均(暨这成百上千台服务器每台负担的用户数要差不多),这一很复杂的过程是由几个系统配合完成,其中最关键的便是LVS,Linux Virtual Server,世界上最流行的负载均衡系统之一,正是由目前在淘宝网供职的章文嵩博士开发的。
经过一系列复杂的逻辑运算和数据处理,用于这次给你看的淘宝网首页的HTML内容便生成成功了。对web前端稍微有点常识的童鞋都应该知道,下一步浏览器会去加载页面中用到的css、js、图片等样式、脚本和资源文件。但是可能相对较少的同学才会知道,你的浏览器在同一个域名下并发加载的资源数量是有限制的,例如ie6-7是两个,ie8是6个,chrome各版本不大一样,一般是4-6个。我刚刚看了一下,我访问淘宝网首页需要加载126个资源,那么如此小的并发连接数自然会加载很久。所以前端开发人员往往会将上述这些资源文件分布在好多个域名下,变相的绕过浏览器的这个限制,同时也为下文的CDN工作做准备。
据不可靠消息,在双十一当天高峰,淘宝的访问流量最巅峰达到871GB/S。这个数字意味着需要178万个4mb带宽的家庭宽带才能负担的起,也完全有能力拖垮一个中小城市的全部互联网带宽。那么显然,这些访问流量不可能集中在一起。并且大家都知道,不同地区不同网络(电信、联通等)之间互访会非常缓慢,但是你却发现很少发现淘宝网访问缓慢。这便是CDN,Content Delivery Network,即内容分发网络的作用。淘宝在全国各地建立了数十上百个CDN节点,利用一些手段保证你访问的(这里主要指js、css、图片等)地方是离你最近的CDN节点,这样便保证了大流量分散已经在各地访问的加速。
这便出现了一个问题,那就是假若一个卖家发布了一个新的宝贝,上传了几张新的宝贝图片,那么淘宝网如何保证全国各地的CDN节点中都会同步的存在这几张图片供用户使用呢?这里边就涉及到了大量的内容分发与同步的相关技术。淘宝开发了分布式文件系统TFS(taobao file system)来处理这类问题。
好了,这时你终于加载完了淘宝首页,那么你习惯性的在首页搜索框中输入了'毛衣'二字并敲回车,这时你又产生了一个PV,然后,淘宝网的主搜索系统便开始为你服务了。它首先对你输入的内容基于一个分词库进行的分词操作。众所周知,英文是以词为单位的,词和词之间是靠空格隔开,而中文是以字为单位,句子中所有的字连起来才能描述一个意思。例如,英文句子I am a student,用中文则为:“我是一个学生”。计算机可以很简单通过空格知道student是一个单词,但是不能很容易明白“学”、“生”两个字合起来才表示一个词。把中文的汉字序列切分成有意义的词,就是中文分词,有些人也称为切词。我是一个学生,分词的结果是:我 是 一个 学生。
进行分词之后,还需要根据你输入的搜索词进行你的购物意图分析。用户进行搜索时常常有如下几类意图:(1)浏览型:没有明确的购物对象和意图,边看边买,用户比较随意和感性。Query例如:”2010年10大香水排行”,”2010年流行毛衣”, “zippo有多少种类?”;(2)查询型:有一定的购物意图,体现在对属性的要求上。Query例如:”适合老人用的手机”,”500元 手表”;(3)对比型:已经缩小了购物意图,具体到了某几个产品。Query例如:”诺基亚E71 E63″,”akg k450 px200″;(4)确定型:已经做了基本决定,重点考察某个对象。Query例如:”诺基亚N97″,”IBM T60″。通过对你的购物意图的分析,主搜索会呈现出完全不同的结果来。
之后的数个步骤后,主搜索系统便根据上述以及更多复杂的条件列出了搜索结果,这一切是由一千多台搜索服务器完成。然后你开始逐一点击浏览搜索出的宝贝。你开始查看宝贝详情页面。经常网购的亲们会发现,当你买过了一个宝贝之后,即便是商家多次修改了宝贝详情页,你仍然能够通过‘已买到的宝贝’查看当时的快照。这是为了防止商家对在商品详情中承诺过的东西赖账不认。那么显然,对于每年数十上百亿比交易的商品详情快照进行保存和快速调用不是一个简单的事情。这其中又涉及到数套系统的共同协作,其中较为重要的是Tair,淘宝自行研发的分布式KV存储方案。
然后无论你是否真正进行了交易,你的这些访问行为便忠实的被系统记录下来,用于后续的业务逻辑和数据分析。这些记录中访问日志记录便是最重要的记录之一,但是前边我们得知,这些访问是分布在各个地区很多不同的服务器上的,并且由于用户众多,这些日志记录都非常庞大,达到TB级别非常正常。那么为了快速及时传输同步这些日志数据,淘宝研发了TimeTunnel,用于进行实时的数据传输,交给后端系统进行计算报表等操作。
你的浏览数据、交易数据以及其它很多很多的数据记录均会被保留下来。使得淘宝存储的历史数据轻而易举的便达到了十数甚至更多个PB(1PB=1024 TB=1048576GB)。如此巨大的数据量经过淘宝系统1:120的极限压缩存储在淘宝的数据仓库中。并且通过一个叫做云梯的,由2000多台服务器组成的超大规模数据系统不断的进行分析和挖掘。
从这些数据中淘宝能够知道小到你是谁,你喜欢什么,你的孩子几岁了,你是否在谈恋爱,喜欢玩魔兽世界的人喜欢什么样的饮料等,大到各行各业的零售情况、各类商品的兴衰消亡等等海量的信息。
上文中绝大多数是一些WEB后端技术,那么前端能做什么呢?
1.减少HTTP请求数
什么是HTTP请求数,一个css-link标签,一个script标签,一个img-src,都需要一次HTTP请求。当然css-link、script很多时候是同步的,且block页面首次渲染,img是异步的。
页面加载中,大多数时间用在HTTP请求上,如果能减少HTTP请求数,就能大幅提高性能。
1)从设计入手,更少的元素显示更丰富的页面内容。
2)css,js文件合并/压缩,很多优秀的工具如grunt可以很方便的完成这件事。
3)CSS Sprites技术,即把所有背景图放到一张图片内,使用CSS技术:background-image,background-position来显示图片的不同部分。
|
1 2 3 4 5 6 7 |
<div> <span id="image1" class="nav"></span> <span id="image2" class="nav"></span> <span id="image3" class="nav"></span> <span id="image4" class="nav"></span> <span id="image5" class="nav"></span> </div> |
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 |
.nav { width: 50px; height: 50px; display: inline-block; border: 1px solid #000; background-image: url('E:/1.png'); } #image1 { background-position: 0 0; } #image2 { background-position: -95px 0; } #image3 { background-position: -185px 0; } #image4 { background-position: -275px 0; } #image5 { background-position: -366px -3px; } |
但这个只适用于图片元素紧挨在一起,而且定位比较繁琐,很容易出错,且不能指定手工形状。
2.减少DNS查找次数
3.避免跳转
值得一提的一个现象,如真正的url是 http://xxx.xxx.xx/,而我们输入了http://xxx.xxx.xx,这就会造成一次跳转。
4.可缓存的AJAX
5.延迟加载
确定一下页面哪些内容是页面首次渲染时必须加载的,哪些内容稍微延后加载效果会更好?
6.预加载
预加载是浏览器引擎的一种技术,如页面加载,遇到了js脚本,就需要同步的去解析/执行JS。这时候,开一个线程,遍历一下页面中其他需要下载的元素,去下载它们。
业务预加载:业务的预加载是指在空闲的时候(onload之后),可以使用JS脚本去加载那些尚未显示出来的内容,一般是img,也可以是css和js。
7.减少DOM数量
8.根据域名划分页面内容
9.尽量少的iframe
10.使用CDN
11.为文件头指定Expires和Cache-Contorl
对于静态内容:设置文件头过期时间Expires的值为“Never expire”(永不过期)
对于动态内容:使用恰当的Cache-Control文件头来帮助浏览器进行有条件的请求
12.Gzip
13.使用Etag
14.使用flush
15.使用GET来完成AJAX请求
16.css置于顶部
17.不使用css表达式
18.使用外部js和css
19.js置于页面底部
20.减少JS对DOM的访问
21.优化图像
22.不要缩放图像
http://lehsyh.iteye.com/blog/2111265
Windows 7电脑上装了dia 0.97.2,结果画图时不能输入中文,能把输入法调出来,但是输入的字却消失不见。折腾半天,最后发现十分简单。。。
菜单里选择"输入法"->"简单",就可以了,不能用默认的 "系统(Windows IME)"。
在Ubuntu下却要用 "系统(SCIM)",选 "简单" 的话,连输入法都调不出来。
MicroServer Gen8属于HPE(Hewlett Packard Enterprise,惠普企业级产品)而不是HP,MicroServer Gen8的支持页面(如驱动下载)在HPE,官网首页是http://www.hpe.com,不是http://www.hp.com。
HPE大约从2015年起变更了服务支持策略,普通驱动可以无限制下载,但是BIOS、SPP更新等可能需要用主机序列号注册、且在主机质保期内方能下载,超期就只能等待别人搬运分享了。
MicroServer Gen8在AHCI模式时,五个SATA和普通主板的功能一样,唯一不同的是MS G8的BIOS不能选择用哪个硬盘启动。
它会尝试从SATA1引导,如果SATA1没有连接硬盘,则尝试从SATA2引导,以此类推。
可是SATA1~4是硬盘笼子;通常人们都是将4个3.5寸仓库盘放到笼子里面;然后通过SATA5连接一个2.5寸硬盘(放置在9.5mm光驱位置)做系统盘。当五个硬盘都连接时,BIOS仅尝试从SATA1引导,结果出现引导失败。
解决方法就是通过安装一个U盘或MicroSD卡,从而间接引导SATA5接口上的系统盘。
网上给出的方法都是引导Windows系统的,而我们安装的如果是Linux系统的话,则无法简单的使用这些方法来引导系统的。
自己探索了一下,通过使用Rufus来使用并且修改Super GRUB2 Disk的方式来启动Debian的方法。
只插上光驱位置上的硬盘,然后安装Debian Linux系统,只有这样,才能正常安装系统,否则会出现无法安装到正确的磁盘上面。
通过 Intelligent Provisioning安装根本就找不到 tf卡(在 bios中可以把默认的 Dynamic HP Smart Array改成 SATA AHCI模式后就可以顺利安装了,但这样 raid功能也没了)

下载Super GRUB2 Disk最新的镜像文件,官网为http://www.supergrubdisk.org/,一定要下载hybrid版本。
下载Rufus最新的版本,官网地址为https://rufus.akeo.ie/
也可以在本网站下载我使用的版本Super GRUB2 Disk,rufus-3.10
按照下图的步骤处理:
如果使用2.8.x版本,参考下图(注意,如果使用最新的2.0.4版本的Super GRUB2 Disk,只能使用3.11.x版本的Rufus)

只有如下选项才能保证可以在Windows中可以正常访问修改Super GRUB2 Disk已经安装到SD卡上的内容。

如果使用3.10.x版本(已知Rufus 3.11.1678写入的数据无法引导系统,只能使用3.10.x版本),参考下图

只有如下选项才能保证可以在Windows中可以正常访问修改Super GRUB2 Disk已经安装到SD卡上的内容。

在刻录好的SD卡的\boot\grub(Super GRUB2 Disk 2.02)或者\boot\grub\sgd(Super GRUB2 Disk 2.04)目录下创建一个名为Gen8.cfg的配置文件,内容如下:
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 |
# Super Grub Disk - Gen8.cfg set option_title=$"Gen8" function run_option { echo "Starting Gen8 ..." # for uuid #search --set=root --fs-uuid 763A-9CB6 # for file search --set=root --file /boot/grub/grubenv # debian 12.5 for file #search --set=root --file /boot/grub/unicode.pf2 set prefix=(${root})/boot/grub normal } |
一般建议是通过指定磁盘的uuid的方法来启动系统,如果能够确定系统磁盘上存在一个唯一的文件,也可以通过简单的指定文件的方法来让GRUB2来搜索的方式找到启动磁盘。
对于 Super GRUB2 Disk 2.02
修改\boot\grub\main.cfg,在
process_main_option "${prefix}/language_select.cfg"
这行代码下面增加
process_enable "${prefix}/Gen8.cfg" rootmenu
对于 Super GRUB2 Disk 2.04
修改\boot\grub\sgd\main.cfg,在
process_main_option "${sg2d_directory}/language_select.cfg"
这行代码下面增加
process_enable "${sg2d_directory}/Gen8.cfg" rootmenu
并且打开被注释掉的set timeout=10项目,让系统自动启动,否则需要手工点击一下回车。
修改后的内容如下:
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 |
# Super Grub Disk Main Configuration file # Copyright (C) 2009,2010,2011,2012,2013,2014,2015 Adrian Gibanel Lopez. # # Super Grub Disk is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # # Super Grub Disk is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with Super Grub Disk. If not, see <http://www.gnu.org/licenses/>. # Configure gfxterm, but allow it to be disabled by holding shift during boot. # gfxterm is required to display non-ASCII translations. loadfont "$prefix/unifont.pf2" if keystatus --shift; then disable_gfxterm=true # export disable_gfxterm is needed so that the setting will persist even after # a "configfile /boot/grub/main.cfg" (which is what language_select.cfg does after # you select a new language) export disable_gfxterm # The following strings are intentionally not made translateable. echo "It has been detected that the shift key was held down. Because of this SG2D" echo "will use VGA text mode rather than gfxterm. This will cause display problems" echo "when using some non-English translations." echo echo "Press escape to continue to the main menu" sleep --interruptible 9999 fi if [ "$disable_gfxterm" != true ]; then insmod all_video gfxmode=640x480 if terminal_output --append gfxterm then terminal_output --remove console fi fi # Export the variables so that they persist when loading a new menu. export menu_color_normal export menu_color_highlight export menu_color_background export bwcolor function set_sgd_colors { if [ "$bwcolor" = "yes" ]; then menu_color_normal=white/black menu_color_highlight=black/white menu_color_background=black/white else menu_color_normal=white/brown menu_color_highlight=white/blue menu_color_background=yellow/cyan fi } set_sgd_colors # Set secondary_locale_dir to the directory containing SG2D specific mo files. # This makes grub aware of translations for SG2D specific strings. secondary_locale_dir="${prefix}/sgd_locale/" insmod part_acorn insmod part_amiga insmod part_apple insmod part_bsd insmod part_gpt insmod part_msdos insmod part_sun insmod part_sunpc function process_main_option { set option_cfg="$1" source "${option_cfg}" menuentry "${option_title}" "${option_cfg}" { set chosen="" export chosen set sourced_cfgs="${2}" export sourced_cfgs configfile "${prefix}/processoption.cfg" } } function process_option { set option_cfg="$1" source "${option_cfg}" menuentry "${finaloption_tab_str}${option_title}" "${option_cfg}" { set chosen="" export chosen set sourced_cfgs="${2}" export sourced_cfgs configfile "${prefix}/processoption.cfg" } } function process_enable { set option_cfg="$1" set forced_prefix="$2" if [ "$forced_prefix" = "rootmenu" ]; then menu_prefix_str="" else menu_prefix_str="${finaloption_tab_str}" fi source "${option_cfg}" menuentry "${menu_prefix_str}${option_title}" "${option_cfg}" { set chosen="" export chosen set sourced_cfgs="${2}" export sourced_cfgs configfile "${prefix}/processenable.cfg" } } function submenu_title { menuentry "${secondoption_prefixtab_str}${chosen}${secondoption_postfixtab_str}" { sleep 1s } } # Timeout for menu set timeout=10 # Set default boot entry as Entry number 2 (counting from 0) set default=2 # Init Super Grub2 Disk variables insmod regexp regexp -s "sg2d_dev_name" '^\((.*)\).*$' "$prefix" rmmod regexp export sg2d_dev_name # Get the version number for this Super GRUB2 Disk release source "${prefix}/version.cfg" # Get design variables source "${prefix}/design.cfg" menuentry " ====---==- Super Grub2 Disk $sgrub_version -==---==== " { # Set pager=1 so ls output doesn't scroll past the top of the screen # but restore $pager to its previous value when finished set oldpager="${pager}" set pager=1 cat /boot/grub/AUTHORS cat /boot/grub/COPYING set pager="${oldpager}" unset oldpager echo $"Press escape to return to the main menu" sleep --interruptible 9999 } process_main_option "${prefix}/language_select.cfg" process_enable "${prefix}/gen8.cfg" rootmenu # Everything menuentry $"Detect and show boot methods" { configfile "${prefix}/everything.cfg" } process_enable "${prefix}/enableraidlvm.cfg" rootmenu process_enable "${prefix}/enablenative.cfg" rootmenu submenu $"Boot manually""${three_dots_str}" { submenu_title process_option "${prefix}/osdetect.cfg" process_option "${prefix}/cfgextract.cfg" process_option "${prefix}/cfgdetect.cfg" process_option "${prefix}/menulstdetect.cfg" process_option "${prefix}/grubdetect.cfg" process_option "${prefix}/diskpartchainboot.cfg" process_option "${prefix}/autoiso.cfg" source "${prefix}/return.cfg" } submenu $"Extra GRUB2 functionality""${three_dots_str}" { submenu_title process_enable "${prefix}/enablelvm.cfg" process_enable "${prefix}/enableraid.cfg" process_enable "${prefix}/enableencrypted.cfg" process_enable "${prefix}/enablenative.cfg" process_enable "${prefix}/enableserial.cfg" process_enable "${prefix}/searchfloppy.cfg" process_enable "${prefix}/searchcdrom.cfg" process_enable "${prefix}/searchsgd.cfg" source "${prefix}/return.cfg" } menuentry $"Print devices/partitions" { # Set pager=1 so ls output doesn't scroll past the top of the screen # but restore $pager to its previous value when finished set oldpager="${pager}" set pager=1 ls -l set pager="${oldpager}" unset oldpager echo $"Press escape to return to the main menu" sleep --interruptible 9999 } menuentry $"Color ON/OFF" { if [ "$bwcolor" = 'yes' ]; then bwcolor=no else bwcolor=yes fi set_sgd_colors } submenu $"Exit""${three_dots_str}" { submenu_title process_option "${prefix}/halt.cfg" process_option "${prefix}/reboot.cfg" source "${prefix}/return.cfg" } # If it exists, source $prefix/sgd_custom.cfg. This follows the same idea as # grub-mkconfig generated grub.cfg files sourcing $prefix/custom.cfg, though # it's less needed here since one could add custom code to this file directly # whereas their distro might automatically overwrite /boot/grub/grub.cfg on # kernel upgrades. The main motivation for adding this was the vmtest script # which I use heavily during Super GRUB2 Disk development, but this feature # might also be useful to others. if [ -e "$prefix/sgd_custom.cfg" ]; then source "$prefix/sgd_custom.cfg" fi |
注意:如果安装升级的是ubuntu 20.04.1,系统启动的时候,会出现error: symbol 'grub_calloc' not found。
如下图:

但是奇怪的是,如果在系统启动的时候选择Detect and show boot methods,显示出的任何菜单,都可以正常启动系统,如下:


这个问题是因为ubuntu 20.04.1系统使用的是新版本的grub2引导系统,启动配置信息需要进行调整,修改我们创建的\boot\grub\Gen8.cfg(Super GRUB2 Disk 2.02)或者\boot\grub\sgd\Gen8.cfg(Super GRUB2 Disk 2.04),内容调整为如下:
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 |
# Super Grub Disk - Gen8.cfg set option_title=$"Gen8" function run_option { echo "Starting Gen8 ..." #for uuid #search --set=root --fs-uuid 763A-9CB6 #for file insmod xfs search --set=root --file /boot/grub/grubenv # debian 12.5 for file #search --set=root --file /boot/grub/unicode.pf2 configfile /boot/grub/grub.cfg } |
Merge request
什么是Merge request,多人开发项目时,发起将一个远程分支merge到另一个分支(一般为主分支)的请求。
merge request步骤:
1.如果开发完了某个模块的功能,需要提交到线上。
2.首先,git fetch --all,仓库代码图拉下来,把线上的代码更新后合并到自己的本地分支上。
3.解决冲突
4.再次合并代码,没有问题后,git push origin 本地分支名。这样就会在远程仓库创建一个remotes/origin/本地分支名 的分支。
5.gitlab上,,进入mergeRequest页面,选择newMergeRequest(右上角绿色按钮)。
6.选择要merge的source分支,CONTINUE。
7.填写描述,添加reviwer(重要)。
8.等待结果,如果有冲突,需要从头再来。
Reset

git reset 撤销命令
reset有三种模式
git reset --soft HEAD 本地文件不变,撤销掉commit,不撤销index
git reset --hard HEAD 本地文件改为HEAD,所有commit/index都修改掉
git reset HEAD 本地文件不变,撤销掉commit/index
如果只想恢复某一个文件,只需要
git checkout filename
恢复所有文件到当前HEAD
git checkout .
服务器上面安装了WP-Super-Cache后,服务器的响应报文中会自动增加一个WP-Super-Cache字段,这个字段会暴露服务器的一些细节,而WP-Super-Cache的设置中又没有找到去掉这个字段的设置选项。
如下图:

比较简单的解决方法就是,使用Apache2自带的mod_headers模块,通过修改.htacess配置文件的方式来去掉这个响应信息。
1.在网站目录下的.htacess文件中增加如下语句
|
1 2 3 |
<IfModule mod_headers.c> Header always unset WP-Super-Cache </IfModule> |
2.启用mod_headers模块
|
1 |
$ sudo a2enmod headers |
3.重启Apache2服务
|
1 |
$ sudo service apache2 restart |
谷歌优化加速mod_pagespeed作为Apache HTTP Server的module,它能在服务网页请求的即时做出超过15种的优化调整,包括优化缓存,最小化客户端—服务器往返路程,压缩有效传输体积。
经过实验观察,mod_pagespeed最高能使页面加载时间压缩50%。
项目已经被迁移到了GitHub,链接地址为:https://github.com/pagespeed/mod_pagespeed
32位系统
|
1 |
$ wget https://dl-ssl.google.com/dl/linux/direct/mod-pagespeed-stable_current_i386.rpm |
64位系统
|
1 |
$ wget https://dl-ssl.google.com/dl/linux/direct/mod-pagespeed-stable_current_amd64.deb |
鉴于国内被和谐的情况,可以本站下载 64位Ubuntu点击这里 32位Ubuntu点击这里
|
1 |
$ dpkg -i mod-pagespeed-*.deb |
Apache2|
1 |
$ sudo service apache2 restart |
|
1 2 |
$ apachectl -M | grep pagespeed pagespeed_module (shared) |
安装这个插件之后,可能会导致页面在不同操作系统之间的显示错乱问题,目前WordPress上会出现这种问题,应该是缓存导致的问题,因为WordPress会根据系统,浏览器的不同来进行页面兼容处理,如果直接返回缓存数据,反而会出问题。目前暂时只能是禁用这个插件了。
另外,当主机的CPU,内存有限的情况下,这个模块反而增加了系统开销,导致系统响应缓慢。有些Javascript代码被优化后,会工作不正常,目前看来,对小网站来说副作用大于正面作用。
|
1 2 |
$ sudo a2dismod pagespeed $ sudo service apache2 restart |
PHP 5.5以后内建了OpCache,OpCache的加速原理是把编译后的bytecode存储在内存里面, 避免重复编译 PHP 所造成的资源浪费.Ubuntu 14.04默认自带 PHP 5.5.9,已经集成了这个功能。但是默认是不启用的。
修改 php.ini 文件
|
1 2 3 |
$ sudo vim /etc/php5/fpm/php.ini $ sudo vim /etc/php5/cgi/php.ini $ sudo vim /etc/php5/apache2/php.ini |
在文件最后面加入:
|
1 2 3 4 5 6 7 8 |
; 开关打开 opcache.enable=1 ; 可用内存, 酌情而定, 单位 megabytes opcache.memory_consumption=128 ; 对多缓存文件限制, 命中率不到 100% 的话, 可以试着提高这个值 opcache.max_accelerated_files=5000 ; Opcache 会在一定时间内去检查文件的修改时间, 这里设置检查的时间周期, 默认为 2, 单位为秒 opcache.revalidate_freq=240 |
重启服务器
|
1 2 |
$ sudo service php5-fpm restart $ sudo service apache2 restart |
加速效果极端明显,强烈建议启用这个功能。
Ubuntu14.04升级到Ubuntu16.04出现错误,如下图所示:

如果机器上安装了postgresql,则是由于postgresql处于升级黑名单中,因此无法升级。
一般建议手工卸载postgresql。
|
1 2 3 |
$ sudo apt-get remove postgresql* $ sudo apt-get remove pgadmin3 |
卸载完成后继续执行升级命令
|
1 |
$ sudo do-release-upgrade -d |
具体参考这个BUG的链接:
postgresql packages in the removal blacklist making it hard to upgrade