Git SVN获取更新的脚本

上篇Blog里介绍了Git SVN的工作流程,如果在一个分支工作时,想取得SVN上的更新,那么可以使用下面这个脚本,只要一个命令就能搞定了。

br=`git branch|grep \*|cut -c3-`
echo "Branch:$br"
 
echo ""
echo "--- Stashing ---"
git stash
 
if [ $? -ne 0 ]; then
echo "--- Stashing failed. ---"
exit 127
fi
 
echo ""
echo "--- Checking out master ---"
git checkout master
 
echo ""
echo "--- Getting update from SVN ---"
git svn rebase
 
echo ""
echo "--- Checking out $br ---"
git checkout $br
 
echo ""
echo "--- Getting update from master ---"
git rebase master
 
echo ""
echo "--- Restore working space ---"
git stash pop
 
echo ""
echo "--- Done. ---"

快速安装网格引擎 – Sun Grid Engine

注:这个方法不适合要用DRMAA来与网格交互的程序,因为有些需要的.so库没有安装完全。如果要用DRMAA的话,需要用SUN/ORACLE提供的安装包完整安装。

Ubuntu上用apt-get可以很方便地安装Sun Grid Engine(现在已经叫做Oracle Grid Engine)了。我用11.04上的源取得的版本是6.2-4,也就是被Oracle收购前的版本。其官网上的最新版本是6.2-7,但我并不推荐安装这个版本,因为Oracle试图更改其名字因此破坏了一些依赖关系。下面是在一台主机上安装网格引擎的简易过程:

1. 先搜索一下这个包:apt-cache search gridengin[......]

Read more

几个方便Web开发的在线服务

平时Web开发,经常需要找些图标、背景之类的,下载Photoshop之类的又太复杂,杀鸡用牛刀了。下面是我常用的一些在线服务,可以方便地帮助完成这些任务:

选色工具:选择需要的颜色并得到它的RGB代码
http://www.colorpicker.com/

配色工具:自动生成搭配的色盘
http://www.colorschemer.com/online.html

站点图标生成器FavIcon(显示在浏览器标签栏上或标题上的那个)
http://tools.dynamicdrive.com/favicon/

CSS菜单/Tab样式生成
http://www.cssmenumaker.com/

2.0风格的按钮生[......]

Read more

我的Git SVN工作流程

前一篇博文谈到开始使用Git做为SVN的客户端。网上已经有很多文章介绍Git-SVN的用法,这里介绍一下我的工作流程。下面的蓝色文字表示是在主分支(master)下完成的命令,而棕色文字是表示在工作分支完成的命令。

首先,从SVN (Subversion) 签出一个模块并建立工作分支:

$git svn clone -r 20000 -s http://your-svn-repo-url  #签出一个模块(从修订号20000开始取)
$git checkout -b topic #建立一个工作分支叫做topic

… #工作工作工作

提交修改到本地仓库:

$git status #显示当前状态[......]

Read more

Upstart管理Ubuntu自启动服务(10.04以后适用)

从Ubuntu 10.04开始,Upstart就被引入管理系统启动的进程与服务。所以,如果要添加或禁止某些服务进程自动启动,以前的方式(比如用update-rc.d命令)就不管用了。如果你运行这个命令来停止mysql,你会得到如下信息:

$>sudo /etc/init.d/mysql stop
Rather than invoking init scripts through /etc/init.d, use the service(8)
utility, e.g. service mysql restart
 
Since the script you are attempting to invoke has been converted to an
Upstart job, you may also use the restart(8) utility, e.g. restart mysql

那么Upstart又怎么用呢?

首先,我们知道旧的系统管理被称作SysV,它通过在代表各个run level的目录里建立脚本来控制服务的自动启动。比如,/etc/rc0.d目录里以S开头的脚本会被运行在runlevel 0。在这种方式下,如果要屏蔽一个服务,需要把S开头的那个[......]

Read more

开始试用Git作为SVN客户端

由于公司的SVN服务器在国外,由于一些众所周知和众所不知的原因,与这台服务器交互时不时会有些问题,头疼了有一年多了。最近发现Git居然提供了与SVN服务器交互的命令,可以把Git变成一个SVN的客户端,这可把我乐坏了。其实原先是研究过一下它的老对手Mercurial的,不过搜到关于它和SVN的资料比较少,于是决定先用Git试一把。

一开始手很生,很多常用的操作,以前用SVN客户端很容易做的事情,换到Git上会手足无措。但是几天下来,逐渐熟悉以后,感觉到Git的好。总结一下,和SVN对比,主要有这些优点。

  • Git的操作基于本地仓库,这样一来,查看历史、回溯等操作就会非常迅速,特别是[......]

Read more

git-svn rebase的出错信息

用Git从SVN容器取下工程后,做rebase的时候出现下列信息:

$ git svn rebase
W: Refspec glob conflict (ref: refs/remotes/trunk):
expected path: project/branches/trunk
    real path: project/trunk
Continuing ahead with Navigator Product/trunk
Current branch master is up to date.

虽然不影响操作,但有碍观瞻。解决办法是打开项目目录下的.git/config文件,会发现下面几行:

[svn-remote "svn"]
 
   branches = project/branches/*:refs/remotes/*
   tags = project/tags/*:refs/remotes/tags/*
   branches = project/branches/*:refs/remotes/*
   tags = project/tags/*:refs/remotes/tags/*

其中有两行是重复的。把重复的删除后保存退出。再做rebase的时候,以上错误信息就会消失了。

卸载Xfce/XUbuntu的方法(经验证可靠)

前两天出于好奇,装了Xfce来玩玩,结果发现有些软件兼容性还是有点问题,于是决定把它卸载了。谁知道,请神容易送神难啊,apt-get remove xubuntu-desktop居然没用。想当年我可以是用apt-get install xubuntu-desktop来装的啊。

好吧,经过一番Google,终于还是找到了卸载它的方法。经验证,此法可靠。复制下面这段命令在终端里执行即可(注意这是10.10 Maverick):

sudo apt-get remove a2ps abiword abiword-common abiword-plugin-grammar abiword-plugin-mathview aumix aumix-common browser-plugin-parole catfish elementary-icon-theme exaile exo-utils fortune-mod fortunes-min gdebi gdebi-core gigolo gimp gimp-data gnumeric gnumeric-common gnumeric-doc gtk2-engines-xfce gvfs-bin hal hal-info imagemagick libabiword-2.8 libaiksaurus-1.2-0c2a libaiksaurus-1.2-data libaiksaurusgtk-1.2-0c2a libbabl-0.0-0 libcdt4 libexo-0.3-0 libexo-common libgdome2-0 libgdome2-cpp-smart0c2a libgegl-0.0-0 libgimp2.0 libgoffice-0.8-8 libgoffice-0.8-8-common libgraph4 libgsf-1-114 libgsf-1-common libgtkmathview0c2a libgvc5 libhal-storage1 libhal1 libilmbase6 libjpeg-progs libjpeg8 liblink-grammar4 libloudmouth1-0 libmagickcore3-extra libmng1 libnetpbm10 libopenexr6 libotr2 libots0 libpathplan4 libpsiconv6 librecode0 libsexy2 libtagc0 libthunar-vfs-1-2 libwv-1.2-3 libxcb-keysyms1 libxdot4 libxfce4menu-0.1-0 libxfce4util-bin libxfce4util-common libxfce4util4 libxfcegui4-4 libxfconf-0-2 link-grammar-dictionaries-en mousepad murrine-themes netpbm orage oss-compat parole pidgin pidgin-data pidgin-libnotify pidgin-otr plymouth-theme-xubuntu-logo psutils python-cddb python-mmkeys python-mutagen ristretto smartdimmer tango-icon-theme tango-icon-theme-common thunar thunar-archive-plugin thunar-data thunar-media-tags-plugin thunar-thumbnailers thunar-volman thunderbird ttf-lyx wdiff xchat xchat-common xfburn xfce-keyboard-shortcuts xfce4-appfinder xfce4-clipman xfce4-clipman-plugin xfce4-cpugraph-plugin xfce4-dict xfce4-fsguard-plugin xfce4-mailwatch-plugin xfce4-mixer xfce4-mount-plugin xfce4-netload-plugin xfce4-notes xfce4-notes-plugin xfce4-panel xfce4-places-plugin xfce4-power-manager xfce4-power-manager-data xfce4-quicklauncher-plugin xfce4-screenshooter xfce4-session xfce4-settings xfce4-smartbookmark-plugin xfce4-systemload-plugin xfce4-taskmanager xfce4-terminal xfce4-utils xfce4-verve-plugin xfce4-volumed xfce4-weather-plugin xfce4-xkb-plugin xfconf xfdesktop4 xfdesktop4-data xfprint4 xfswitch-plugin xfwm4 xfwm4-themes xscreensaver xubuntu-artwork xubuntu-default-settings xubuntu-desktop xubuntu-docs xubuntu-gdm-theme xubuntu-icon-theme xubuntu-wallpapers && sudo apt-get install ubuntu-desktop

其他版本的Ubuntu,卸载方法见这里:Getting Back to a Pure Gn[......]

Read more

超强的Linux内存管理机制

Windows下有一个大名鼎鼎的非著名软件SuperCache(那可是要花银子的),可以利用内存作为IO缓存,提升整机的读写性能。而在Linux下,想要找到这样的软件可是难上加难。为什么呢?因为Linux本身已经实现这个功能啦!

要知道,如果你有2G内存,那么你平时使用的时候可能只需几百兆,而剩下的那些可能就要浪费了。但是Linux就很聪明,它会自动把暂没用到的内存当作高速缓存,而不是让他们躺着睡大觉。Windows下还要用SuperCache这样的东东来利用内存,而Linux系统本身就实现了。

想发现这个事实,你只要在命令行输入

661a0cc5c0322999ac59c504a5cb[......]

Read more

从U盘安装Ubuntu Linux

你还在用光盘安装Linux吗?如果回答“是”,那么你已经Out啦。从U盘或硬盘安装一个Linux会比使用光盘更加省时,更加简单。而带给我们福音的就是这个叫做UNetbootin的免费小软件。

UNetbootin可以帮你:

  • 下载所选的Linux发行版,并制作可启动的Linux安装U盘(所需要的一切只是一个U盘和网络)
  • 使用已下载好的ISO映像制作可启动的Linux安装U盘(需要ISO和U盘)
  • 从硬盘安装Linux(只需要网络或ISO文件)
  • 制作可启动的系统工具U盘,包含的免费工具有杀毒、分区、网络检测等

下面详细介绍一下怎样用UNetboot[......]

Read more

« Previous PageNext Page »