git svn workflow and some tips

May 29, 2011 by · Comments Off on git svn workflow and some tips
Filed under: git 

Git svn simple tutorial

1. get a copy of your project from svn server by git svn clone:

git svn clone –no-metadata /path/to/svn/project

(alt: git-svn init https://svn.kde.org/home/kde/trunk/kdesupport/strigi)

some example:

git svn clone -T http://192.168.1.5/svn/search/dev  search-git

git clone a repository with customized project layout( dev as trunk, release as tags) and only the versions after 9999 (note: 9999 must be an existant version in svn):

git svn clone -r9999:HEAD http://192.168.1.5/svn/search/ search-git  -T dev -b branches -t release
2.  check project status by git status

cd project,  git status

3. Download new revisions from SVN:

git svn fetch

4.Update your working dir:

git svn rebase

and working on your projects, add new code, fix bug…
Then try to see commit to local repository by : git commit -a -m “commit message” –dry-runif all changes are desired to be commited, run commit by : git commit -a -m “commit message”
5.You can commit your changes to the svn server using the command: git svn dcommit
( If failed ,you may need to run firstly to check if conflict: git svn rebase ,  if conflicts occur, solve the conflicts, and then run: git svn dcommit )

Remember the Golden rule: you should always working on a local branch instead of the master, cause in GIT, it is not allowed to push/dcommit project which is not based on the latest version.  That’s to say, if you checkout the project, and working on the master, and modified file A, but someone modified the file A and dcommit before you dcommit your modification, then you will end with failure by push/dcommit your master.  So the recommend way is to work on a local branch:

git checkout -b story1

(it create a local branch story1, and checkout the branch)

then working on the branch, modify your project files, and commit on the branch.
If commit failed, need to merge changes from your topic branch (story1) into the master branch, and commit from the master branch.   Here’s the process to merge and commit:

5.1) Ensure the master branch is up to date

git checkout master

git svn rebase

5.2) Then merge your topic branch(story1) into master :

git merge story1

5.3) then commit the merged version on the master

git svn dcommit

5.4) go back to story1 branch, and working on other new features:

git checkout story1

 

Some tips on using git:
Q: gitk show unicode character correctly. how to solve it ?

A:echo “export LESSCHARSET=utf-8” > $HOME/.profile
git config –global gui.encoding utf-8git config –global i18n.commitencoding utf-8git config –global i18n.logoutputencoding gbkset LESSCHARSET=utf-8( on windows use set instead of export)

Q: how to show svn info for local git repos:

A: git svn info

Q: if git modifies files randomly,
A: caused by end of line. just set the core.autcrlf property to false:for unix:git config –global core.autocrlf inputgit config –global core.safecrlf true
for windowsgit config –global core.autocrlf falsegit config –global core.safecrlf true

Q: How to fix un-committed mistakes

If you’ve messed up the working tree, but haven’t yet committed your mistake, you can return the entire working tree to the
last committed state with
$ git reset –hard HEAD

Q: Fixing a mistake with a new commit.

Creating a new commit that reverts an earlier change is very easy; just pass the git revert command a reference to the bad
commit; for example, to revert the most recent commit:
$ git revert HEAD

This will create a new commit which undoes the change in HEAD. You will be given a chance to edit the commit message for the new commit.
You can also revert an earlier change, for example, the next-to-last:
$ git revert HEAD^git revert -n HEAD

 

Digg This
Reddit This
Stumble Now!
Vote on DZone
Share on Facebook
Bookmark this on Delicious
Share on LinkedIn
Bookmark this on Technorati
Post on Twitter
Google Buzz (aka. Google Reader)

debian squeeze搭建最简xfce4开发环境(二 常用软件及问题解决)

May 27, 2011 by · Comments Off on debian squeeze搭建最简xfce4开发环境(二 常用软件及问题解决)
Filed under: linux 

1.how to install xfce4 and choose x window manager

sudo apt-get install xfce4
sudo update-alternatives –display x-window-manager
sudo update-alternatives –config x-window-manager

中文支持参考:Debian简明中文支持

2.run 32 bit applications:

sudo apt-get install ia32-libs
sudo apt-get install ia32-libs-gtk

then qq, forti ssl vpn client all works.

3. how to change locale & time

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

时间的计算就由UTC改为CST了。

u also may use tzselect to change time zone.

4. how to automatically keep an active network always on desktop, && use wireless network

sudo apt-get install network-manager
sudo apt-get install wicd
sudo apt-get install firmware-iwlwifi

方法1:
sudo apt-get install network-manager-gnome

To use network-manager-gnome in Xfce (or Gnome) you need to have the applet running in the sytem tray.
In Gnome this is automatic but in Xfce you need to set it up initially. Fortunately this is very easy:

Alt + F2 to run a command:  nm-applet –sm-disable

network manager is used for keeping an active network always for desktop.
Wireless network is disabled by default, rith click on the desktop network icon, choose “Enable Wireless”, it shall works.
默认无线是关闭的,右键点击桌面工具栏上的网络连接图标,选中”Enable Wireless”,即可使用无线网络.

方法2:

WICD network manager,网络的连接和中断通知默认是关闭的,可以在Preferences里面勾上 Notification.
如果没有在Preferences里面输入wireless interface,WICD默认是找不到无线网络的,通常输入wlan0即可。

Wicd network manager -> Network -> Find a hidden network
即可找到无线网络,点击无线网络的属性,配置好后,点击connect即可。

5. no auto completion in shell ?
default shell is sh, change user’s default shell to bash in /etc/passwd

6. common tools
krusader, firefox, eclipse, gedit, geany
execute query, rdesktop
File manager: gnome-commander, Tux commander, emelFM2  —————–

—- sudo apt-get install tuxcmd tuxcmd-modules
sudo apt-get install gnome-commander

gnome-commander is a two panel file manager with drag & drop support ( tux does not support drag & drop)

xfce4-terminal: a terminal support tab & copy, paste
sudo apt-get install xfce4-terminal

geany is a full functional text editor in xfce.
geany 的快捷键与scim的Ctrl+Space有冲突,切换不了中文输入法,更改快捷键后即可。

sudo apt-get install netwox ssh nmap rdesktop less
sudo apt-get install ftp curl aria2 unrar-free unzip xarchiver
sudo apt-get install subversion git git-svn rapidsvn meld diffuse
sudo apt-get install memcached mongodb redis-server nginx memcachedb mysql-server

sudo apt-get install epdfview evince
sudo apt-get install openoffice.org openoffice.org-l10n-zh-cn openoffice.org-l10n-zh-tw

7.how to install flash player for fixfox?

sudo apt-get install flashplugin-nonfree

or

download flash player from adobe, extract the compressed file, copy libflashplayer.so to /usr/lib/mozilla/plugins
sudo cp libflashplayer.so /usr/lib/mozilla/plugins
then restart firefox

8. change daily updatedb settings in :
vi /etc/cron.daily/locate

9. multiple monitor support
sudo apt-get install grandr

xrandr
grandr

10. how to control services to automatically start
sudo apt-get install rcconf
sudo rcconf

or :

sudo update-rc.d -f {SERVICE-NAME} remove

For example to stop xinetd service at boot time, type the command as follows:
# update-rc.d -f xinetd remove

11. 退出图形界面后,键盘按键没反应,但可以按Alt+Tab切换应用程序,切到其他的应用再切回来就ok了。

这个问题很有历史了。 Debian BTS 见 [1][2] , Ubuntu Launchpad 见 [3] 。                                                        2
这个问题很有历史了。 Debian BTS 见 [1][2] , Ubuntu Launchpad 见 [3] 。
解决办法,一是 patch libX11 ,二是改 scim 配置文件,但后者会影响欧洲字符的输入。

[1] http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=434180
[2] http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=437437
[3] https://bugs.launchpad.net/ubuntu/+source/scim/+bug/66104

更改scim配置文件的解决方法:
关闭scim,
sudo vi /etc/scim/config
vi ~/.scim/config
把两个文件中/FrontEnd/X11/Dynamic的值从false更改为true.

logout, 重新登录

12.debian apt-get下载的包存放在哪里?

/var/cache/apt/archives/

13.如何使得apt-get install下载的更快

从http://www.mattparnell.com/linux/apt-fast/ 下载apt-fast.sh,

拷贝到/usr/local/bin目录:

wget http://www.mattparnell.com/linux/apt-fast/apt-fast.sh

chmod +x apt-fast.sh

sudo cp apt-fast.sh /usr/local/bin
推荐使用 apt fat with aria2c 来从多个源下载来提高速度,

wget http://www.mattparnell.com/linux/apt-fast/apt-fast%20modded/apt-fast_aria2c.sh

chmod +x apt-fast_aria2c.sh

sudo cp apt-fast_aria2c.sh /usr/local/bin
然后使用 apt-fast_aria2c.sh install xxxx来安装软件包,设置多个mirrors时,速度会快上很多倍。比如安装mplayer, smplayer以及cd播放器:
sudo apt-fast_aria2c.sh install mplayer smplayer cdcd

14. 没有正确的电源状态显示

Problem: acpi could not detect battery status, and shows unkown battery as:

$acpi

Battery 0: Unknown, 0%

首先从主板提供商或者任何渠道获取信息,确保你的bios对linux的acpi驱动是没有问题。

比如Acer的很多笔记本默认BIOS的ACPI支持不好,我的是Aspire 4745G, 需要刷bios。
Aspire 4745G 可以在这里下载,下载之后在windows下运行程序刷新bios。

http://support.acer.com/us/en/product/default.aspx?modelId=2070

然后,确保内核支持acpi, 并在启动参数中增加acpi=on,debian squeeze安装的默认内核是支持acpi的, 增加acpi=on即可:
vi /boot/grub/grub.cfg:

linux   /boot/vmlinuz-2.6.32-5-amd64 root=/dev/hda9 ro acpi=on quiet

然后安装powertop来查看各个程序的能耗,以及几个有用的软件:

sudo apt-get install powertop cpufrequtils laptop-mode-tools
最后重启你的系统。

 

 

Digg This
Reddit This
Stumble Now!
Vote on DZone
Share on Facebook
Bookmark this on Delicious
Share on LinkedIn
Bookmark this on Technorati
Post on Twitter
Google Buzz (aka. Google Reader)

debian squeeze搭建最简xfce4开发环境(一 Debian简明中文支持)

May 27, 2011 by · 2 Comments
Filed under: linux 

1.1 for chinese locale support:
dpkg-reconfigure locales

select all locales like zh_CN.***, zh_TW.***

1.2 how to install chinese fonts

apt-get install ttf-bitstream-vera msttcorefonts  (seems no use)
apt-get install xfonts-wqy ttf-wqy-zenhei

for MS windows fonts, copy Chinese font to /usr/local/share/fonts
sudo cp /data/debian/fonts/* /usr/local/share/fonts
sudo fc-cache

for free fonts:
sudo apt-get install ttf-arphic-*

中文字体美化:

wget http://www.beyondlinux.com/blog/wp-content/uploads/2011/05/fonts.conf_.txt

wget http://www.beyondlinux.com/blog/wp-content/uploads/2011/05/local.conf_.txt

cp fonts.conf_.txt  ~/.fonts.conf
cp local.conf_.txt  /etc/fonts/local.conf

set firefox Chinese minimal font to 14-15, Western font to 18.

1.3 input method:
apt-get install scim scim-pinyin scim-tables-zh

vi /etc/X11/Xsession.d/95xinput
to create a new file 95xinput with the following content:
/usr/bin/scim -d
XMODIFIERS=”@im=SCIM”
export XMODIFIERS
export GTK_IM_MODULE=xim

the last line is meant to be able to use scim input method in firefox

1.4 support chinese in jdk gui.
Here is the way (two steps):
1). make a directory fallback under JavaHome/lib/fonts/
2). add a Chinese TrueType or Type 1 font under fallback

An example:
mkdir /usr/lib/j2sdk1.5-sun/jre/lib/fonts/fallback
ln -s /usr/share/fonts/truetype/arphic/gbsn00lp.ttf .
ln -s /usr/local/share/fonts/simhei.ttf .

 

Digg This
Reddit This
Stumble Now!
Vote on DZone
Share on Facebook
Bookmark this on Delicious
Share on LinkedIn
Bookmark this on Technorati
Post on Twitter
Google Buzz (aka. Google Reader)

install wine 1.3.9 unstable

May 10, 2011 by · Comments Off on install wine 1.3.9 unstable
Filed under: linux 

 

I get the wine unstable package for debian from here:

http://dev.carbon-project.org/debian/wine-unstable/

when I run wine, got the following errors:

$ wine
/usr/bin/wine: line 63: /usr/lib32/wine/wine.bin: No such file or directory
/usr/bin/wine: line 63: exec: /usr/lib32/wine/wine.bin: cannot execute: No such file or directory

after double check, found that libwine-unstable_1.3.19-0.1_amd64.deb was not chosen to be installed during my installation, after reinstall all these debs, wine works.

Digg This
Reddit This
Stumble Now!
Vote on DZone
Share on Facebook
Bookmark this on Delicious
Share on LinkedIn
Bookmark this on Technorati
Post on Twitter
Google Buzz (aka. Google Reader)