git-fetch和pull的区别

转自 http://blog.csdn.net/hudashi/article/details/7664457 Git中从远程的分支获取最新的版本到本地有这样2个命令: 1.git fetch:相当于是从远程获取最新版本到本地,不会自动merge git fetch origin master git log -p master..origin/master git merge origin/master 以上命令的含义: 首先从远程的origin的master主分支下载最新的版本到origin/master分支上 然后比较本地的master分支和origin/master分支的差别 最后进行合并 上述过程其实可以用以下更清晰的方式来进行: git fetch origin master : tmp git diff tmp git merge tmp 从远程获取最新的版本到本地的test分支上 之后再进行比较合并 2.git pull:相当于是从远程获取最新版本并merge到本地 git pull origin master 述命令其实相当于git fetch 和 git merge 在实际使用中,git fetch更安全一些 因为在merge前,我们可以查看更新情况,然后再决定是否合并

December 11, 2014 · 1 min · Me

linux无界面(headless)使用selenium抓取数据

问题 老高最近遇到一个需求,linux\centos下,使用selenium技术抓取数据。本来很简单的问题,但是由于内存限制,安装X window不现实,所以一个BT的想法诞生了,是否可以在centos命令行界面运行一个虚拟的桌面,然后使用selenium控制Firefox浏览器完成一些操作,Firefox运行在虚拟的桌面中,一切操作都在命令行中完成。 Google之,发现了Xvfb,他可以新建一个虚拟的X窗口,再配合python的pyvirtualdisplay,简直就是神器! 安装 centos下: # 安装Xvfb和pyvirtualdisplay yum install xorg-x11-server-Xvfb pip install pyvirtualdisplay 安装firefox和selenium yum install firefox pip install selenium 代码 from pyvirtualdisplay import Display from selenium import webdriver display = Display(visible=0, size=(800, 600)) display.start() browser = webdriver.Firefox() browser.get('http://www.google.com') print browser.title browser.quit() display.stop() 参考网站: http://selenium-python.readthedocs.org/en/latest/getting-started.html http://nullege.com/codes/search/selenium.webdriver.Remote.find_elements_by_class_name http://www.opsview.com/forum/opsview-core/how-do-i/how-do-i-install-selenium-centos-server https://gist.github.com/textarcana/5855427 http://scraping.pro/use-headless-firefox-scraping-linux/ http://serverfault.com/questions/363827/how-can-i-run-firefox-on-centos-with-no-display https://realpython.com/blog/python/headless-selenium-testing-with-python-and-phantomjs/ https://pypi.python.org/pypi/selenium http://selenium.googlecode.com/git/docs/api/py/selenium/selenium.selenium.html#module-selenium.selenium http://www.ibm.com/developerworks/cn/opensource/os-php-designptrns/ http://www.cnblogs.com/fnng/p/3230768.html http://www.cnblogs.com/fnng/p/3157639.html http://www.cnblogs.com/fnng/p/3157639.html

December 9, 2014 · 1 min · Me

mysql开发常用SQL

主键 -- 为当前表添加主键 ALTER TABLE `tablename` ADD COLUMN id TINYINT UNSIGNED NOT NULL AUTO_INCREMENT, ADD PRIMARY KEY (id); -- 删除主键 ALTER TABLE `tablename` DROP PRIMARY KEY; 创建数据库 # utf8mb4_unicode_ci更准 CREATE DATABASE IF NOT EXISTS typecho DEFAULT CHARSET utf8mb4 COLLATE utf8mb4_unicode_ci; # utf8mb4_general_ci更快 CREATE DATABASE IF NOT EXISTS typecho DEFAULT CHARSET utf8mb4 COLLATE utf8mb4_general_ci; CREATE DATABASE typecho DEFAULT CHARACTER SET gbk COLLATE gbk_chinese_ci; 创建用户并提供相应权限 # 只是创建用户 CREATE USER phpergao@'localhost' IDENTIFIED BY 'yourpasswd'; # 赋予权限 GRANT select,update on phpergao....

December 9, 2014 · 2 min · Me

File-already-exists--filesystem-解决办法

今天用svn命令行提交版本的时候,碰到了这个比较麻烦的问题 svn: File already exists: filesystem 'xxx/svn/xxx/db' 搜了一下解决办法,都是需要两次commit,太麻烦。 直接在提交根目录执行以下命令 svn update path/ --accept=mine-full 一句话解决!

December 3, 2014 · 1 min · Me

SVN预提交(Pre-Commit)钩子的利用

转自:http://java.dzone.com/articles/useful-subversion-pre-commit Checks whether the commit message is not empty Checks whether the commit message consists of at least 5 characters Checks if the committed files are UTF-8 compliant Checks whether the svn:eol-style property is set to LF on newly added files Checks if the committed files have no TAB characters The UTF-8 and TAB checks are performed on the following file suffixes *.java *.js *.xhtml *.css *.xml *....

December 2, 2014 · 3 min · Me

python获取操作系统平台、版本及架构

转自: http://openwares.net/linux/python_os_version_platform.html platform模块提供了底层系统平台的相关信息 系统架构 32位还是64位 >>> import platform >>> platform.architecture() ('64bit', 'ELF') # python 3.3.2+ 64 bits on debian jessie 64 bits ('32bit', 'WindowsPE') # python 3.3.2 32 bits on windows 8.1 64 bits ('64bit', 'WindowsPE') # python 3.3.2 64 bits on wndows 8.1 64 bits ('64bit', '') # python 3.4.1 64 bits on mac os x 10.9.4 ELF和WindowsPE是可执行文件格式 操作系统 linux,mac还是windows >>> platform.system() 'Linux' # python 3.3.2+ 64 bits on debian jessie 64 bits 'Windows' # python 3....

November 19, 2014 · 2 min · Me

python中浅拷贝和深拷贝

python中浅拷贝和深拷贝 今天写python脚本,遇到了一个问题。先贴代码: #coding=utf-8 new_list = [] # 声明一个list tmp = {'a':123,'b':'ccc'} # 新建一个dict new_list.append(tmp) # 追加 print tmp print new_list tmp['a'] = 456 # 修改tmp tmp['b'] = 'ddd' new_list.append(tmp) # 追加 print tmp print new_list # 执行结果: {'a': 123, 'b': 'ccc'} [{'a': 123, 'b': 'ccc'}] # 当改变了tmp,list中的值也会变化 {'a': 456, 'b': 'ddd'} [{'a': 456, 'b': 'ddd'}, {'a': 456, 'b': 'ddd'}] 如果是PHP会发生什么? $b = array(); $a = array('b'=>123); array_push($b , $a); $a = array('b'=>456); array_push($b , $a); var_dump($b); $a = new ArrayObject(array('b'=>123)); $arr = new ArrayObject(); $arr->append($a); $a['b'] = 456; $arr->append($a); var_dump($arr); # 执行结果 array(2) { [0]=> array(1) { ["b"]=> int(123) } [1]=> array(1) { ["b"]=> int(456) } } object(ArrayObject)#2 (1) { ["storage":"ArrayObject":private]=> array(2) { [0]=> object(ArrayObject)#1 (1) { ["storage":"ArrayObject":private]=> array(1) { ["b"]=> int(456) } } [1]=> object(ArrayObject)#1 (1) { ["storage":"ArrayObject":private]=> array(1) { ["b"]=> int(456) } } } } 由结果看,PHP中array_push方法和array_object的结果也不同。...

November 10, 2014 · 1 min · Me

PHPCMS登陆流程

调用phpcms/modules/member/index.php中login。 读取caches/configs/system.php中phpsso的配置。 调用phpcms/modules/member/classes/client.class.php的_ps_post()发送登录信息。 该请求被发送到phpsso_server/phpcms/modules/phpsso/index.php的login方法。 phpsso读取数据库配置phpsso_server/caches/configs/database.php,连接数据库,执行登陆逻辑 返回登录结果

November 5, 2014 · 1 min · Me

git使用笔记

GIT虽然概念比较难理解,但不得不说他是一款开发利器。 老高总结出了一些GIT中很常见的操作命令,分享给大家。但由于GIT命令繁多,所以我将分为基础和进阶两部分。 基础篇: 帮助 git help # 获取帮助,内容如下 usage: git [--version] [--exec-path[=GIT_EXEC_PATH]] [--html-path] [-p|--paginate|--no-pager] [--no-replace-objects] [--bare] [--git-dir=GIT_DIR] [--work-tree=GIT_WORK_TREE] [--help] COMMAND [ARGS] The most commonly used git commands are: add Add file contents to the index bisect Find by binary search the change that introduced a bug branch List, create, or delete branches checkout Checkout a branch or paths to the working tree clone Clone a repository into a new directory commit Record changes to the repository diff Show changes between commits, commit and working tree, etc fetch Download objects and refs from another repository grep Print lines matching a pattern init Create an empty git repository or reinitialize an existing one log Show commit logs merge Join two or more development histories together mv Move or rename a file, a directory, or a symlink pull Fetch from and merge with another repository or a local branch push Update remote refs along with associated objects rebase Forward-port local commits to the updated upstream head reset Reset current HEAD to the specified state rm Remove files from the working tree and from the index show Show various types of objects status Show the working tree status tag Create, list, delete or verify a tag object signed with GPG 配置git # 查看配置 git config -l/--list # 以下是可能出现的配置 core....

November 2, 2014 · 3 min · Me

PHP文档收藏夹

主要记录一些值得研究的PHP文档页面 ...

October 31, 2014 · 1 min · Me