在Linode的VPS上配置了VPN服务器(pptpd),连接正常。在我自己的Mac电脑上连接以后无法访问Google或其他国外网站,可正常访问百度和微博等国内网站,QQ也同样可以登录。
通过ip138查询当前访问ip来自VPN服务器所在地,证明我本地是通过VPN服务器访问的其他网站或服务。
同时,我在手机上也使用相同的账户连接同一个VPN服务器,手机可以正常访问Google和其他国外网站,比如twitter。
检查Mac路由表(连接VPN后):

连接VPN后,ping google.com 正常,nslookup 也正常,不知道改怎么调试了,求解.

 

MTU,英文全称为Maximum Transmission Unit,中文即最大传输单元的意思,是一种通信协议层上所能通过的最大数据包值。如果MTU设置得当,可以优化网络性能。反之设置不当,则可能影响网络速度、甚至影响部分软件和网络使用。比如连接上VPN不能访问网站,或不能连接等问题。

由于VPN连接需要对原有的IP或者是TCP/UDP数据进行封装,因此增加了数据的长度。如果VPN连接上不能上网,可以将MTU设置小一些,比如1450,具体设置方法可以参考下文介绍。

除了MTU的设置可能影响VPN连接使用外,如果设置不合理,也可能影响网络连接质量。现在常用的以太网网络下,MTU值默认是1500,超过此大小的话,数据包将被分段传输。如果MTU过小的话,会增加数据包拆分传输次数,而且拆包组包的过程也浪费了时间。

那么按上所说,是不是设置最大值最好呢?答案是否定的,因为在不同使用网络环境,网络MTU最大值也可能不一样。比如ADSL网络MTU值是1492字节,如果强行设置为1500,因为网络本身最大只能1492,超过的话,传输前就需要拆包分段传输,在这过程中也浪费了时间,并且产生额外的数据包。

所以MTU设置需要恰当,不能过大也不能过小,根据网络本身最大MTU传输字节设置即可。那么如何查看使用网络的最大MTU值呢,下面将介绍一下检查方法(Windows下手动查询,如果觉得麻烦,也可以使用Simple MTU Test这个软件查询)。

一、网络最大MTU值检测方法

1、首先同时按下键盘上的Win+R键,弹出“运行”窗口,输入”cmd.exe”,点击确定。

2、在命令行窗口中输入”ping -l 1472 -f www.baidu.com”然后按下回车键。解释一下这段命令的作用:

ping:发送一个数据包检测;
-l(L的小写):指定数据包大小;
1472:数据包大小为1472字节;
-f:禁止路由器拆分数据包;
www.baidu.com:使用百度为检测目标;

3、执行以上命令后,如果成功响应了(如下图),则说明你的网络MTU最大为1500字节,这时设置MTU为1500即可。(这里我修改了检测数据包为1450,方便截图)

4、如果返回显示需要拆分数据包但是设置 DF。或是Packer needs to be fragmented but DF set.的提示,则说明数据包大小超过了本身网络最大MTU值。

5、这时可以减小发送数据包大小再尝试,依次减少5字节,直到能正确返回响应。返回后逐渐加1字节再次检测,以查询网络最大MTU值。比如查询网络最大MTU值为1452,那么这个并不是完整的MTU值,还需要加上28字节的数据包报文(包含IP头部,但不包含协议栈更下层的头部),完整的MTU应该是1480字节。

6、查询到网络最大MTU值后,设置即可。路由器设置的话,不同路由器,设置方法也可能不一样,建议查看使用说明设置。TP-LINK路由器的话,一般是在管理页面——网络参数——WAN口设置——编辑正在使用的网络连接——WAN口高级设置里。

7、当然除了直接在路由器设置外,还可以在操作系统里修改,下面将介绍一下各系统设置方法。

二、Windows系统设置MTU方法

除了下面介绍的手动设置方法外,一些软件也有辅助修改功能,比如魔方优化大师等。

A、Vista、Win7、Win8系统设置方法

1、打开系统盘\Windows\System32\文件夹下找到cmd.exe,右键“以管理员身份运行”;

2、在“命令提示符”窗口中输入“netsh interface ipv4 show subinterfaces”并回车查看当前的MTU值;

3、接下来输入“netsh interface ipv4 set subinterface “修改的网络连接名” mtu=查询的网络最大MTU值 store=persistent”并回车即可;

例如:“netsh interface ipv4 set subinterface “本地连接” mtu=1492 store=persistent”。

B、Windows XP系统设置方法

1、 按下Win+R组合键,弹出“运行”窗口,输入regedit,点击确定;

2、依次找到以下注册表项:“HKEY_Local_Machine——SYSTEM——CurrentControlSet——Services——Tcpip——Parameters——interface”;

3、在interface中下可能有很多项,需要逐个观察键值,会有一个项与你的网卡IP一致,选中该项;

4、然后在该项上点击右键,选择“编辑——新建——DWORD值”,然后在右侧将其命名为“MTU”;

5、右键点击MTU,选择“修改”,在弹出的窗口中选择“十进制”,设置你查询网络MTU值即可。

6、设置后,需要重启电脑应用生效。

三、Mac OS X设置MTU方法

依次打开:系统偏好设置——网络——以太网(如果使用的是无线网络就修改无线网络)——高级设置,在“硬件”选项卡下“配置”选择手动,然后就可以设置MTU了,如下图:

I’m trying to compile PHP 5.6.10 from the source, and I encountered the following problem:

Undefined symbols for architecture x86_64:
  "_PKCS5_PBKDF2_HMAC", referenced from:
      _zif_openssl_pbkdf2 in openssl.o
  "_TLSv1_1_client_method", referenced from:
      _php_openssl_setup_crypto in xp_ssl.o
  "_TLSv1_1_server_method", referenced from:
      _php_openssl_setup_crypto in xp_ssl.o
  "_TLSv1_2_client_method", referenced from:
      _php_openssl_setup_crypto in xp_ssl.o
  "_TLSv1_2_server_method", referenced from:
      _php_openssl_setup_crypto in xp_ssl.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make: *** [libs/libphp5.bundle] Error 1

OpenSSL is installed via Brew. In PHP included like --with-openssl=/usr/local/Cellar/openssl/1.0.2c

P.S. Before tried to use just /usr for OpenSSL but got the same error.

 

The Makefile has a line with EXTRA_LIBS, something like:

EXTRA_LIBS = -lresolv -lmcrypt -lltdl -liconv-lm -lxml2 -lcurl -lssl -lcrypto

Remove all occurrences of -lssl and -lcrypto and add the full path to libssl.dylib and libcrypto.dylib (brew links openssl to /usr/local/opt/openssl/lib/)

EXTRA_LIBS = -lresolv -lexslt -ltidy -lmysqlclient -lmcrypt -lltdl /usr/local/lib/libiconv.dylib /usr/local/Cellar/openssl/1.0.2d_1/lib/libssl.dylib /usr/local/Cellar/openssl/1.0.2d_1/lib/libcrypto.dylib -lpng -lz -ljpeg -lcurl -lbz2 -lz  -lm -lxml2 -lz -licucore -lm -lcurl -lldap -lz -lxml2 -lz -licucore -lm -lfreetype -lmysqlclient -lxml2 -lz -licucore -lm -lxml2 -lz -licucore -lm -lxml2 -lz -licucore -lm -lxml2 -lz -licucore -lm -lxml2 -lz -licucore -lm -lxslt -lxml2 -lz -licucore -lm

首先让我们踏着欢快的脚步去Github创建一个新库,这里取名 composer-car,又欢快的将它克隆到本地:

git clone https://github.com/GeHou/composer-car.git

cd composer-car

这个composer-car文件夹就是你的包的root目录了,你只需要记住composer.json在包的哪个目录下面,一般那就是包的root目录了。什么?做包子的工作台?这么理解呢也是可以的,不过同学能先收收你的口水么。

现在我们还没有composer.json文件,你可以根据composer文档生成并编辑它,当然composer贴心的为我们准备了命令行,look:

-> composer init

Welcome to the Composer config generator

This command will guide you through creating your composer.json config.

Package name (<vendor>/<name>) [hou/composer-car]: 这里填写<包提供者>/<包名>的信息
Description []: 包的描述
Author [GeHou <***@gmail.com>]: 作者信息
Minimum Stability []: 最低稳定版本
License []: 授权协议

Define your dependencies.

Would you like to define your dependencies (require) interactively [yes]? no
Would you like to define your dev dependencies (require-dev) interactively [yes]? no

{
    "name": "hou/composer-car",
    "description": "In order to study composer",
    "license": "MIT",
    "authors": [
        {
            "name": "GeHou",
            "email": "***@gmail.com"
        }
    ],
    "minimum-stability": "dev",
    "require": {

    }
}

Do you confirm generation [yes]? yes
Would you like the vendor directory added to your .gitignore [yes]? yes

虽然经过以上的一番挣扎生成了composer.json文件,不过我们还得往里面加点东西。使用你熟悉的编辑器打开composer.json文件修改至如下:

{
    "name": "hou/composer-car",
    "description": "In order to study composer",
    "license": "MIT",
    "authors": [
        {
            "name": "GeHou",
            "email": "***@gmail.com"
        }
    ],
    "minimum-stability": "dev",
    "require": {
        "php": ">=5.3.0"
    },
    "autoload": {
        "psr-4": {
            "Ford\\Escape\\": "src/Ford/Escape",
            "Ford\\Fusion\\": "src/Ford/Fusion",
            "Ford\\Focus\\": "src/Ford/Focus",
            "Ford\\Fiesta\\": "src/Ford/Fiesta"
        }
    }   
}

细心的小伙伴可能已经认出了福特的商标(Ford),这说明我们都是同道中人,你一定也很喜欢汽车,对吧对吧? 🙂

我们登陆一下福特的网站看看都有哪些热销车型,嗯嗯分别有ESCAPE、FUSION、FOCUS、FIESTA,中文名称分别是翼虎、蒙迪欧、福克斯、嘉年华,嘉年华ST我的梦想啊~~~ 好了好了,那位看官放下你手里的板砖,我承认一说到汽车就会滔滔不绝,下面我们把水分挤出去继续讲解。

根据上面的命名空间和目录的映射关系,包的结构现在应该是下面这个样子:

composer-car
- src
- - Ford
- - - Escape
- - - - Escape2013.php
- - - Fiesta
- - - - Fiesta2013.php
- - - Focus
- - - - Focus2013.php
- - - Fusion
- - - - Fusion2013.php
- .gitignore
- composer.json
- README.md

Escape2013.php:

<?php

namespace Ford\Escape;

class Escape2013
{
    public static function info()
    {
        echo "This is Ford Escape2013!<br />";
    }
}

Fiesta2013.php:

<?php

namespace Ford\Fiesta;

class Fiesta2013
{
    public static function info()
    {
        echo "This is Ford Fiesta2013!<br />";
    }
}

Focus2013.php:

<?php

namespace Ford\Focus;

class Focus2013
{
    public static function info()
    {
        echo "This is Ford Focus2013!<br />";
    }
}

Fusion2013.php:

<?php

namespace Ford\Fusion;

class Fusion2013
{
    public static function info()
    {
        echo "This is Ford Fusion2013!<br />";
    }
}

以上都梳理完毕后,需要安装composer来测试我们的包是否可以正常工作,安装它很简单在包的root目录下install即可:

composer install

闪过几行神秘的提示之后即安装完毕,此时会在vendor/composer/autoload_psr4.php中生成命名空间和目录的映射关系,被包在一个数组中:

<?php

// autoload_psr4.php @generated by Composer

$vendorDir = dirname(dirname(__FILE__));
$baseDir = dirname($vendorDir);

return array(
    'Ford\\Fusion\\' => array($baseDir . '/src/Ford/Fusion'),
    'Ford\\Focus\\' => array($baseDir . '/src/Ford/Focus'),
    'Ford\\Fiesta\\' => array($baseDir . '/src/Ford/Fiesta'),
    'Ford\\Escape\\' => array($baseDir . '/src/Ford/Escape'),
);

如果发布成packagist包然后进行安装的话,到时候这里就不是$baseDir了而是$vendorDir。

然后我们新建一个测试文件show.php,用以下内容填充它:

<?php

require 'vendor/autoload.php';

use Ford\Escape as Escape;
use Ford\Fiesta as Fiesta;
use Ford\Focus as Focus;
use Ford\Fusion as Fusion;

echo Escape\Escape2013::info();
echo Fiesta\Fiesta2013::info();
echo Focus\Focus2013::info();
echo Fusion\Fusion2013::info();

打开浏览器敲入 http://foo.com/composer-car/show.php (foo.com是我的本地测试域名,请替换成小伙伴自己的)。

浏览器上依次输出了:

This is Ford Escape2013!
This is Ford Fiesta2013!
This is Ford Focus2013!
This is Ford Fusion2013!

是不是有点小激动呢?别急,别一副作鸟兽散的样子,还有发布的流程呢?不过你要是真的急着wc或者觉得教程too simple,侯哥是不会让你捡肥皂的。

首先作为调试代码的部分我们是不需要push到github上的,所以将show.php打入冷宫,编辑.gitignore文件,在末尾加入show.php。这个时候有些小伙伴可能会疑惑了,为什么上面还有个/vendor/,记得我们init包的时候回答过一个问题么?

Would you like the vendor directory added to your .gitignore [yes]? yes

嗯嗯,你懂了吧?

废话少说,经过职业玩家的一番噼里啪啦的敲击之后,代码被push到github上了,噼里啪啦的内容如下:

$ git status
# On branch master
# Untracked files:
#   (use "git add <file>..." to include in what will be committed)
#
#   .gitignore
#   composer.json
#   src/
nothing added to commit but untracked files present (use "git add" to track)

$ git add .
$ git commit -m "gogogo"
$ git push

接下来需要将github上的代码同步到https://packagist.org/上,去[Packagist的网站](https://packagist.org/](https://packagist.org/)注册一个账号(Login with github是个不错的选择)。登录,然后点击的大大的绿色背景按钮 Submit a Package,在 Repository URL (Git/Svn/Hg) 处输入包在github上的地址,这里就是:

https://github.com/GeHou/composer-car 

now,点击 Check,如果一切顺利,会返回项目的名称,确认后点击 Submit 完成抓取操作。

默认情况下Packagist是不会自动更新你在github上commit的代码的,在刚才导入的项目页面中点击 Force Update,Packagist会抓取github上对应库的内容进行更新,但这还不是自动化的,幸运的是我们可以在Github库的设置中进行配置来消除手动更新的麻烦。

进入Github库的 Settings 页面,找到 Webhooks & Services 选项,点击 Configure services 按钮,在出现的列表中找到 Packagist,猛击它!这里需要填写一些信息,在Packagist网站的profile页面可以找到它们:

  • User : Packagist上的用户名
  • Token : Packagist的授权令牌
  • Domain : http://packagist.org

补全后点击 Update settings,如果列表中显示绿剪头就表示OK了。

真的OK了吗?还是有点担心?大不了我们再测试下嘛!

先跳出root目录,在测试环境下新建一个文件夹:

mkdir test-auto-update
cd test-auto-update
vim composer.json

这次我们不使用init命令,只往composer.json里填充一些简单内容:

{
    "require": {
        "php": ">=5.3.0",
        "hou/composer-car": "dev-master"
    },
    "minimum-stability": "dev"
}

然后:

composer install

安装完后扫一眼test-auto-update/src/Ford/Fiesta目录看下是否只有2013款的Fiesta,然后暂时就不需要理会此目录下的内容了,让我们回到composer-car目录。

注:这时test-auto-update/vendor下面的hou/composer-car对应建立项目时的( / ) [hou/composer-car]。

听说2014款的嘉年华出了,赶紧追加新的车款吧:

composer-car/src/Ford/Fiesta 目录下新建文件Fiesta2014.php,填充它:

<?php

namespace Ford\Fiesta;

class Fiesta2014
{
    public static function info()
    {
        echo "This is Ford Fiesta2014!<br />";
    }
}

修改show.php,在最后追加:

echo Fiesta\Fiesta2014::info();

访问测试页,看看是否出现了:

This is Ford Fiesta2014!

ok,再次提交代码:

git add .
git commit -m "test auto update"
git push

接着回到 test-auto-update 目录,这次要换一个命令耍耍,因为install命令之后root目录下会生成一个composer.lock文件,已经安装过的依赖是不能通过install命令进行更新的,所以这次需要使用composer update命令,试试这个命令,看看会发生什么:

$ composer update
Loading composer repositories with package information
Updating dependencies (including require-dev)
       - Updating hou/composer-car dev-master (91bceb0 => 01550b4)
    Checking out 01550b4eeaa85513573ce7406ca7d46ee30c6978

Writing lock file
Generating autoload files

类似这样的神秘信息又在屏幕上一闪而过,实际上因为网络的缘故,有时候得闪好久~

不管怎么闪,更新成功后你就应该在 test-auto-update/vendor/hou/composer-car/src/Ford/Fiesta/ 文件夹下中找到新的 Fiesta2014.php 文件了。不过这里需要注意一点,有时候Packagist与Github之间的同步可能会出现延迟,这时不妨喝杯咖啡、找妹子聊会、扣扣鼻孔之类的噼里啪啦一会再回来试试更新操作。

好吧我们在 test-auto-update 根目录下新建一个 index.php 文件看看是否能跑起来,文件内容其实跟前面的show.php差不了多少:

<?php

require 'vendor/autoload.php';

use Ford\Fiesta as Fiesta;

echo Fiesta\Fiesta2014::info();

不错的话,运行index.php文件后浏览器会输出:

This is Ford Fiesta2014!

至此更新操作也被证实是OK了,同志赶紧自己动手试试吧。

参考资料

中文文档 http://composer.golaravel.com/

PSR-4规范 https://github.com/php-fig/fig-standards/blob/master/proposed/psr-4-autoloader/psr-4-autoloader.md

本文示例

https://github.com/GeHou/composer-car

https://packagist.org/packages/hou/composer-car

link: http://my.oschina.net/houlive/blog/206832

使用aapt    //aapt是sdk自带的一个工具,在sdk\builds-tools\目录下

1.以微信为例,命令行中切换到aapt.exe目录执行:aapt dump badging E:\android\weixin531android460.apk
2.运行后的结果如下(仅截取部分):
package: name=’com.tencent.mm’ versionCode=’542′ versionName=’6.1.0.105_r1085424′
uses-permission:’com.tencent.mm.plugin.permission.READ’
uses-permission:’com.tencent.mm.plugin.permission.WRITE’
uses-permission:’com.tencent.mm.plugin.permission.SEND’
uses-permission:’com.tencent.mm.permission.MM_MESSAGE’
sdkVersion:’10’
targetSdkVersion:’16’

我们可以看到关于微信的很多信息,其中就包括包名,微信的包名为:com.tencent.mm

然后启动代码:

  1. try {
  2.     PackageManager packageManager = getPackageManager();
  3.     Intent intent=new Intent();
  4.     intent = packageManager.getLaunchIntentForPackage(“com.tencent.mm”);
  5.     startActivity(intent);
  6. catch (Exception e) {
  7.     e.printStackTrace();
  8.     Intent viewIntent = new
  9.     Intent(“android.intent.action.VIEW”,Uri.parse(“http://weixin.qq.com/”));
  10.     startActivity(viewIntent);
  11. }

如果手机上安装了微信,就打开微信的主界面,如果没有安装就打开一个浏览器去下载!!!

link: http://blog.csdn.net/lovexieyuan520/article/details/44301753

 

最近因为需要用到Android的自动化测试,于是找到了uiautomator和espresso这两个框架(这里以uiautomator为例).由于在Android Studio(以下简称AS)中使用uiautomator这方面的资料很少,国内这方面的博客基本没有,国外的资料也都很少.可能是因为比较新的原因吧.虽然Android官网有教程,但最终还是折腾了好久才解决.写这篇博客一方面希望大家能够少走一些弯路,另一方面也算是我自己的学习笔记吧.

说明:我的AS版本是1.2.1.1

关于什么是uiautomator和espresso,这里就不做介绍了.

使用之前首先得保证你的Android Support Repository已经成功安装

安装成功后,根据Android官网给出的教程,首先第一步是在build.gradle中添加依赖:

dependencies {
        androidTestCompile 'com.android.support.test:runner:0.2'
        androidTestCompile 'com.android.support.test:rules:0.2'
        androidTestCompile 'com.android.support.test.uiautomator:uiautomator-v18:2.1.0'
}

然后添加

defaultConfig {
        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}

添加完依赖后Sync Project with Gradle Files,但是同步后我发现上面相关的库文件并没有被添加进来.对比很多资料后,我很确信不是我在写法的问题.就是这个问题折腾了我好几天的!

最后的解决办法是先把androidTestCompile换成compile,同步一下,此时会发现库文件已经被添加进来了.

最后再将compile换回androidTestCompile,解决~

突然就觉得自己被坑了,也不知道这算不算是AS的一个BUG…

如果同步之后发现诸如此类的错误:

 Warning:Conflict with dependency 'com.android.support:support-annotations'. Resolved versions for app (22.1.1) and test app (22.0.0) differ.

先在项目的根目录用./gradlew -q app:dependencies查看项目依赖关系(Windows用户请使用gradlew.bat -q app:dependencies), 然后修改build.gradle,否则在后面运行测试时可能会报依赖关系的错误.
可能需要为gradlew加上可执行权限.

说明:我这里会报这个警告是因为新建项目的时候AS帮我自动添加了compile 'com.android.support:appcompat-v7:22.1.1'依赖,将22.1.1改为22.0.0即可.

然后还要在build.gradle中添加:

packagingOptions {
    exclude 'LICENSE.txt'
}

不添加的话运行时候还是会报错的.

最后,确保此时有android设备在运行(虚拟器或手机都可以,要求是系统版本要18或18以上),然后在项目的根目录下输入命令:

./gradlew cC

如无意外的话,应该可以看到BUILD SUCCESS了!

如果不想用命令行的话,也可以Edit Configurations,然后点击+ –> Android Test,然后选择对应的Module,然后在下面的Specific Instrumentation Runner选择

android.support.test.runner.AndroidJUnitRunner

选择OK,然后点击启动按钮.如无意外的话,应该可以看到一条绿色的进度条了!

关于另外一个自动化测试框架Espresso,导入方法和uiautomator一样,不同的只是依赖而已.

dependencies {
    androidTestCompile 'com.android.support.test:runner:0.2'
    androidTestCompile 'com.android.support.test:rules:0.2'
    androidTestCompile 'com.android.support.test.espresso:espresso-core:2.1'
}

关于测试框架的导入就先说这么多了,有关这些框架的使用网上的资料应该也是比较多的了,只不过有一些API已经被弃用了.等我熟悉了这两大框架的使用再来写相关的博客吧.

 

link: http://blog.csdn.net/u011504118/article/details/46318693

文章目录

Git Protocol

A guide for programming within version control.

Maintain a Repo

  • Avoid including files in source control that are specific to your development machine or process.
  • Delete local and remote feature branches after merging.
  • Perform work in a feature branch.
  • Rebase frequently to incorporate upstream changes.
  • Use a pull request for code reviews.

Write a Feature

Create a local feature branch based off master.

git checkout master
git pull
git checkout -b <branch-name>

Rebase frequently to incorporate upstream changes.

git fetch origin
git rebase origin/master

Resolve conflicts. When feature is complete and tests pass, stage the changes.

git add --all

When you’ve staged the changes, commit them.

git status
git commit --verbose

Write a good commit message. Example format:

Present-tense summary under 50 characters

* More information about commit (under 72 characters).
* More information about commit (under 72 characters).

http://project.management-system.com/ticket/123

If you’ve created more than one commit, use a rebase to squash them into cohesive commits with good messages:

git rebase -i origin/master

Share your branch.

git push origin <branch-name>

Submit a GitHub pull request.

Ask for a code review in the project’s chat room.

Review Code

A team member other than the author reviews the pull request. They follow Code Review guidelines to avoid miscommunication.

They make comments and ask questions directly on lines of code in the GitHub web interface or in the project’s chat room.

For changes which they can make themselves, they check out the branch.

git checkout <branch-name>
./bin/setup
git diff staging/master..HEAD

They make small changes right in the branch, test the feature on their machine, run tests, commit, and push.

When satisfied, they comment on the pull request Ready to merge.

Merge

Rebase interactively. Squash commits like “Fix whitespace” into one or a small number of valuable commit(s). Edit commit messages to reveal intent. Run tests.

git fetch origin
git rebase -i origin/master

Force push your branch. This allows GitHub to automatically close your pull request and mark it as merged when your commit(s) are pushed to master. It also makes it possible to find the pull request that brought in your changes.

git push --force origin <branch-name>

View a list of new commits. View changed files. Merge branch into master.

git log origin/master..<branch-name>
git diff --stat origin/master
git checkout master
git merge <branch-name> --ff-only
git push

Delete your remote feature branch.

git push origin --delete <branch-name>

Delete your local feature branch.

git branch --delete <branch-name>

link: https://github.com/thoughtbot/guides/tree/master/protocol/git

对于nginx来说,如果打开了gzip,会对关闭掉etag。

在我们的应用中etag是后端返回的,关闭了就影响到了逻辑。

修改:

在srv/http/modules/ngx_http_gzip_filter_module.c

ngx_http_gzip_header_filter函数中屏蔽//ngx_http_clear_etag(r);

然后重编

 

转自: http://blog.csdn.net/anghlq/article/details/40042057

文章目录

其实制作 OS X Yosemite 正式版 USB 启动盘的方法有很多,譬如使用命令行的,也有使用第三方工具的。这个教程主要介绍前者,因为这是目前我了解到的最稳妥、简单,而且没有兼容性问题的方法了。

01

不过大家可别被「命令行」三个字吓到,其实你只需按步骤来,复制粘贴命令即可快速完成,事实上是很简单的。

一、准备工作:

  1. 准备一个 8GB 或以上容量的 U 盘,确保里面的数据已经妥善备份好(该过程会抹掉 U 盘全部数据)
  2. 从这里下载苹果官方 OS X Yosemite 正式版的安装程序 (可选 AppSotre 或网盘下载)
  3. 如果你是从 Mac AppStore 下载的,下载完成后安装程序可能自动开始,这时先退出安装
  4. 如从网盘下载的,请将解压后获得的 “Install OS X Yosemite.app” (显示为 “安装 OS X Yosemite.app”) 移动到「应用程序」文件夹里面

二、格式化 U 盘:

插入你的 U 盘,然后在「应用程序」->「实用工具」里面找到并打开「磁盘工具」,或者直接用 Spotlight 搜索“磁盘工具” 打开,如下图。

02

  • 1 – 在左方列表中找到 U 盘的名称并点击
  • 右边顶部选择 2 -「分区」,然后在 3 -「分区布局」选择「1个分区」
  • 在分区信息中的 4 -「名称」输入「iPlaySoft」 (由于后面的命令中会用到此名称,如果你要修改成其他(英文),请务必对应修改后面的命令)
  • 在「格式」中选择 5 -「Mac OS 扩展 (日志式)」
  • 这时,先别急着点“应用”,还要先在 6 -「选项」里面,如下图

03

  • 选择「GUID 分区表」,然后点击「好」
  • 最后再点「应用」开始对 U 盘进行格式化。

三、输入终端命令开始制作启动盘:

  • 请再次确保名为 “安装 OS X Yosemite” 的文件是保存在「应用程序」的目录中
  • 在「应用程序」->「实用工具」里面找到「终端」并打开。也可以直接通过 Spotlight 搜索「终端」打开
  • 复制下面的命令,并粘贴到「终端」里,按回车运行:

sudo /Applications/Install\ OS\ X\ Yosemite.app/Contents/Resources/createinstallmedia –volume /Volumes/iPlaySoft –applicationpath /Applications/Install\ OS\ X\ Yosemite.app –nointeraction

回车后,系统会提示你输入管理员密码,接下来就是等待系统开始制作启动盘了。这时,命令执行中你会陆续看到类似以下的信息:

Erasing Disk: 0%… 10%… 20%… 30%…100%…
Copying installer files to disk…
Copy complete.
Making disk bootable…
Copying boot files…
Copy complete.
Done.

当你看到最后有 「Copy complete」和「Done」 字样出现就是表示启动盘已经制作完成了!

四、U 盘启动安装 OS X Yosemite 的方法:

当你插入制作完成的 OS X Yosemite U盘启动盘之后,桌面出现「Install OS X Yosemite」的盘符那么就表示启动盘是正常的了。那么怎样通过 USB 启动进行全新的系统安装呢?

其实很简单,先在目标电脑上插上 U 盘,然后重启你的 Mac,然后一直按住「option」(alt) 按键不放,直到屏幕显示多出一个 USB 启动盘的选项,如下图。

04

这时选择 U 盘的图标回车,即可通过 U 盘来安装 Yosemite 了!这时,你可以直接覆盖安装系统(升级),也可以在磁盘工具里面格式化抹掉整个硬盘,或者重新分区等实现全新的干净的安装。

 

link: http://www.iplaysoft.com/osx-yosemite-usb-install-drive.html

Linux默认情况下使用UTC格式作为标准时间格式,如果在Linux下运行程序,且在程 序中指定了与系统不一样的时区的时候,可能会造成时间错误。如果是Ubuntu的桌面版,则可以直接在图形模式下修改时区信息,但如果是在Server版 呢,则需要通过tzconfig来修改时区信息了。使用方式(如将时区设置成Asia/Chongqing):

 

sudo tzconfig,如果命令不存在请使用 dpkg-reconfigure tzdata

然后按照提示选择 Asia对应的序号,选完后会显示一堆新的提示—输入城市名,如Shanghai或Chongqing,最后再用 sudo date -s “” 来修改本地时间。

按照提示进行选择时区,然后:

sudo cp /usr/share/zoneinfo/Asia/ShangHai /etc/localtime

上面的命令是防止系统重启后时区改变。

 

网上同步时间

1.  安装ntpdate工具

# sudo apt-get install ntpdate

2.  设置系统时间与网络时间同步

# ntpdate cn.pool.ntp.org

3.  将系统时间写入硬件时间

# hwclock –systohc

cn.pool.ntp.org是位于中国的公共NTP服务器,用来同步你的时间(如果你的时间与服务器的时间截不同的话,可能无法同步时间哟,甚至连sudo reboot这样的指令也无法执行)。

 

link: http://www.cnblogs.com/php5/archive/2011/02/15/1955432.html