Our project needs libav(ffmpeg) + speex, so it is needed to compile three libraries
libogg, speex 1.2rc1 and libav.
The resource on the internet helped a lot, but there still several things needed to work out :
1. Libraries along can work, but can't generate a "multi-architecture" library with lipo. The error is lack of "architecture" information in armv7 libraries.
Root cause :
The debug information hides the compiled architecture information
Solution :
Add "-O1" or "-O3" in CFLAGS, avoid to use "-O4"
2. can not find assembler , install gas_preprocessor.pl
Root cause :
The environment variable CFLAGS is not applied to "gas_preprocessor.pl"
Solution :
need to put the flags into configure option --extra-cflags "$CFLAGS"
3. After applying "-O3 -pipe -dwarf-2 -no-cpp-precomp -fPIC -marm" option in CFLAGS, compiling h264_cabac, it shows Ran out of registers during register allocation.
Root cause :
Some codes in libav are optimized with assemble code with specified with some architectures. But the instruction implementation is not correct with this version of XCode compiler.
Solution :
1. Use gas_preprocessor.pl
2. If you don't have it, use the command
perl -pi -e "s/HAVE_INLINE_ASM 1/HAVE_INLINE_ASM 0/" config.h
4. In XCode, it errors with "R_ABS reloc but no absolute symbol at target" ... What is this ?
Root cause :
The face reason is symbol table fail. But ... we are using compiler and symbol tables are generated automatically and magically. The reason is the arm thumb2 instruction set was not implemented in this version of compiler.
Solution :
We need to add "--disable-thumb" in configure options
There are many small problems and great solutions, but combining of all together will .... fail. The solutions I verified several times with performance and usability consideration.
2012年12月24日 星期一
2012年12月7日 星期五
cocos2d game development related
1. deprecated interface in cocos2d, can look at
ccDeprecated.h which will hint how to use a replacement.
[CCTouchDispatcher sharedDispatcher] was deprecated, use
[CCDirector sharedDispatcher] instead
ccDeprecated.h which will hint how to use a replacement.
[CCTouchDispatcher sharedDispatcher] was deprecated, use
[CCDirector sharedDispatcher] instead
2012年12月2日 星期日
Add project into another project
Usually we need to add one project to another because the one is a library project.
In this case, we need to
1. Add the project workspace into target project workspace by drag-drop
2. Add item into target -> build phases -> target dependency
3. Add item into target -> build phases -> link binary with libraries
4. Add include path project -> build setting -> search paths -> Header Search Paths
In this case, we need to
1. Add the project workspace into target project workspace by drag-drop
2. Add item into target -> build phases -> target dependency
3. Add item into target -> build phases -> link binary with libraries
4. Add include path project -> build setting -> search paths -> Header Search Paths
2012年11月28日 星期三
install tftpd
apt-get install tftpd tftp xinetd
cd /etc/xinetd.d/
vi tftp
service tftp
{
socket_type = dgram
protocol = udp
wait = yes
user = root
server = /usr/sbin/in.tftpd
server_args = -s /tftpboot
disable = no
per_source = 11
cps = 100 2
flags = IPv4
}
cd /etc/xinetd.d/
vi tftp
service tftp
{
socket_type = dgram
protocol = udp
wait = yes
user = root
server = /usr/sbin/in.tftpd
server_args = -s /tftpboot
disable = no
per_source = 11
cps = 100 2
flags = IPv4
}
Setup up my development environment
# Common development environment
sudo apt-get install cscope vim subversion screen
# Android Developer
#Add eclipse
sudo apt-get install cscope vim subversion screen
# Android Developer
sudo apt-get install git-core gnupg flex bison gperf build-essential \
zip curl libc6-dev libncurses5-dev:i386 x11proto-core-dev \
libx11-dev:i386 libreadline6-dev:i386 libgl1-mesa-glx:i386 \
libgl1-mesa-dev g++-multilib mingw32 openjdk-6-jdk tofrodos \
python-markdown libxml2-utils xsltproc zlib1g-dev:i386
sudo ln -s /usr/lib/i386-linux-gnu/mesa/libGL.so.1 /usr/lib/i386-linux-gnu/libGL.so
#Add jdk and jre#Add eclipse
openwrt build environment
sudo apt-get gawk bison
sudo apt-get install flex autoconf
sudo apt-get install gettext
sudo apt-get install cmake
sudo apt-get install gcc-4.4 g++-4.4 g++-4.4-multilib gcc-4.4-multilib
sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-4.4 50 --slave /usr/bin/g++ g++ /usr/bin/g++-4.4 --slave /usr/bin/gcov gcov /usr/bin/g++-4.4
sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-4.6 40 --slave /usr/bin/g++ g++ /usr/bin/g++-4.6 --slave /usr/bin/gcov gcov /usr/bin/g++-4.6
sudo update-alternatives --config gcc
ssh-keygen -f "/home/myhome/.ssh/known_hosts" -R IP_Address
sudo apt-get install flex autoconf
sudo apt-get install gettext
sudo apt-get install cmake
sudo apt-get install gcc-4.4 g++-4.4 g++-4.4-multilib gcc-4.4-multilib
sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-4.4 50 --slave /usr/bin/g++ g++ /usr/bin/g++-4.4 --slave /usr/bin/gcov gcov /usr/bin/g++-4.4
sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-4.6 40 --slave /usr/bin/g++ g++ /usr/bin/g++-4.6 --slave /usr/bin/gcov gcov /usr/bin/g++-4.6
sudo update-alternatives --config gcc
ssh-keygen -f "/home/myhome/.ssh/known_hosts" -R IP_Address
2012年11月27日 星期二
Build universal architecture library for iPhone -- lipo hints
When developing a ios library for both simulator and iPhone/iPad(s),
the steps are :
1. build each architecture one by one and put into identical path, ie
build.armv6 --- armv6 library
build.armv7 --- armv7 library
build.i386 --- i386 library for simulator
2. use lipo command
lipo -create ./build.armv6/lib1.a ./build.armv7/lib1.a ./build.i386/lib1.a -output ./build.all/lib1.a
lib1.a will contain all three libraries which can be used by iPhone cross ompiler.
3. To see what archs are supported by a library, we can use
lipo -info library_file can get the supported architecture of the library
4. The iPhone/iPad family architectures :
the steps are :
1. build each architecture one by one and put into identical path, ie
build.armv6 --- armv6 library
build.armv7 --- armv7 library
build.i386 --- i386 library for simulator
2. use lipo command
lipo -create ./build.armv6/lib1.a ./build.armv7/lib1.a ./build.i386/lib1.a -output ./build.all/lib1.a
lib1.a will contain all three libraries which can be used by iPhone cross ompiler.
3. To see what archs are supported by a library, we can use
lipo -info library_file can get the supported architecture of the library
4. The iPhone/iPad family architectures :
ARMv7s = iPhone 5, iPad 4 ARMv7 = iPhone 3GS, iPhone 4, iPhone 4S, iPod 3G/4G/5G, iPad, iPad 2, iPad 3, iPad Mini ARMv6 = iPhone 2G/3G, iPod 1G/2G
2012年11月25日 星期日
uninstall xcode
sudo /Developer/Library/uninstall-devtools --mode=all
rm -rf /Developer/Applications/Xcode.app
rm -rf /Developer/Platforms/iPhoneOS.platform
rm -rf /Developer/Applications/Xcode.app
rm -rf /Developer/Platforms/iPhoneOS.platform
2012年11月20日 星期二
openwrt codebase
https://dev.openwrt.org/wiki/GetSource
- Attitude Adjustment 12.09 branch: ChangeLog
svn co svn://svn.openwrt.org/openwrt/branches/attitude_adjustment - Backfire 10.03 branch: ChangeLog
svn co svn://svn.openwrt.org/openwrt/branches/backfire - Kamikaze 8.09 branch: ChangeLog
svn co svn://svn.openwrt.org/openwrt/branches/8.09 - Kamikaze 7.09 (deprecated): ChangeLog
svn co svn://svn.openwrt.org/openwrt/tags/kamikaze_7.09
- Development branch: ChangeLog
svn co svn://svn.openwrt.org/openwrt/trunk/
- Kamikaze packages: ChangeLog
*Note: Kamikaze only contains the essential set of packages, extra packages can be enabled with the command "make package/symlinks" or can be checked out from the following URL:svn co svn://svn.openwrt.org/openwrt/packages/
- Updating to the latest sources:
svn up
- Switching from the prior to 2010 checkout procedure. The move from the past https:// (webdav) URL to the svn:// URL is done with a single command:
svn switch --relocate https://svn.openwrt.org/openwrt svn://svn.openwrt.org/openwrtGIT
For those who prefer using git, there are also git repositories available, which are kept in sync with the main SVN ones:
trunk
- git://nbd.name/openwrt.git (clone of trunk)
- git://nbd.name/packages.git (clone of packages)
- http://git.mirror.nanl.de/openwrt/trunk.git
- http://git.mirror.nanl.de/openwrt/packages.git
Attitude Adjustment
- http://git.mirror.nanl.de/openwrt/branches/attitude_adjustment.git
- http://git.mirror.nanl.de/openwrt/branches/packages_12.09.git
backfire
- http://git.mirror.nanl.de/openwrt/branches/backfire.git
- http://git.mirror.nanl.de/openwrt/branches/packages_10.03.2.git
root
- http://git.mirror.nanl.de/openwrt/root.git (everything - a mirror of svn://svn.openwrt.org/openwrt)
2012年11月19日 星期一
linux domain socket
int create_socket(const char *name, int type, mode_t perm, uid_t uid, gid_t gid)
{
struct sockaddr_un addr;
int fd, ret;
#ifdef HAVE_SELINUX
char *secon;
#endif
fd = socket(PF_UNIX, type, 0);
if (fd < 0) {
ERROR("Failed to open socket '%s': %s\n", name, strerror(errno));
return -1;
}
memset(&addr, 0 , sizeof(addr));
addr.sun_family = AF_UNIX;
snprintf(addr.sun_path, sizeof(addr.sun_path), ANDROID_SOCKET_DIR"/%s",
name);
ret = unlink(addr.sun_path);
if (ret != 0 && errno != ENOENT) {
ERROR("Failed to unlink old socket '%s': %s\n", name, strerror(errno));
goto out_close;
}
#ifdef HAVE_SELINUX
secon = NULL;
if (sehandle) {
ret = selabel_lookup(sehandle, &secon, addr.sun_path, S_IFSOCK);
if (ret == 0)
setfscreatecon(secon);
}
#endif
ret = bind(fd, (struct sockaddr *) &addr, sizeof (addr));
if (ret) {
ERROR("Failed to bind socket '%s': %s\n", name, strerror(errno));
goto out_unlink;
}
#ifdef HAVE_SELINUX
setfscreatecon(NULL);
freecon(secon);
#endif
chown(addr.sun_path, uid, gid);
chmod(addr.sun_path, perm);
INFO("Created socket '%s' with mode '%o', user '%d', group '%d'\n",
addr.sun_path, perm, uid, gid);
return fd;
out_unlink:
unlink(addr.sun_path);
out_close:
close(fd);
return -1;
}
{
struct sockaddr_un addr;
int fd, ret;
#ifdef HAVE_SELINUX
char *secon;
#endif
fd = socket(PF_UNIX, type, 0);
if (fd < 0) {
ERROR("Failed to open socket '%s': %s\n", name, strerror(errno));
return -1;
}
memset(&addr, 0 , sizeof(addr));
addr.sun_family = AF_UNIX;
snprintf(addr.sun_path, sizeof(addr.sun_path), ANDROID_SOCKET_DIR"/%s",
name);
ret = unlink(addr.sun_path);
if (ret != 0 && errno != ENOENT) {
ERROR("Failed to unlink old socket '%s': %s\n", name, strerror(errno));
goto out_close;
}
#ifdef HAVE_SELINUX
secon = NULL;
if (sehandle) {
ret = selabel_lookup(sehandle, &secon, addr.sun_path, S_IFSOCK);
if (ret == 0)
setfscreatecon(secon);
}
#endif
ret = bind(fd, (struct sockaddr *) &addr, sizeof (addr));
if (ret) {
ERROR("Failed to bind socket '%s': %s\n", name, strerror(errno));
goto out_unlink;
}
#ifdef HAVE_SELINUX
setfscreatecon(NULL);
freecon(secon);
#endif
chown(addr.sun_path, uid, gid);
chmod(addr.sun_path, perm);
INFO("Created socket '%s' with mode '%o', user '%d', group '%d'\n",
addr.sun_path, perm, uid, gid);
return fd;
out_unlink:
unlink(addr.sun_path);
out_close:
close(fd);
return -1;
}
2012年11月13日 星期二
Multimedia library source codes
VLC :
1. Download page
http://www.videolan.org/vlc/download-sources.html
2. Repository
1. Download page
http://www.videolan.org/vlc/download-sources.html
2. Repository
git://git.videolan.org/vlc.git3.
# FLV, AAC audio ffmpeg -i in.flv -q 1 -map a out.mp3 # Apply max noclip gain mp3gain -r -k -m 10 out.mp3 # FLV, MP3 audio ffmpeg -i in.flv -c copy -map a out.mp3 # MP3 file ffmpeg -i in.mp3 -c copy -map a out.mp3 # WAV source ffmpeg -i in.wav -b:a 320k out.mp3 # Flac source ffmpeg -i in.flac -b:a 320k out.mp3
2012年11月7日 星期三
MAC OSX 上的開發環境
1. 首先我們需要安裝 MacPort --- mac 上的 package 管理工具庫
安裝的網頁是 www.macports.org/install.php
找到對應的 OSX 版本,我的是 Snow Leopard,下載後安裝
2. 安裝 git,參考網頁 http://alvinalexander.com/mac-os-x/how-install-git-mac-os-x-osx
安裝的網頁是 www.macports.org/install.php
找到對應的 OSX 版本,我的是 Snow Leopard,下載後安裝
2. 安裝 git,參考網頁 http://alvinalexander.com/mac-os-x/how-install-git-mac-os-x-osx
sudo port install git-core +svn +doc +bash_completion +gitweb
3. Install xcode. Under Snow Leopard, we only have xcode v4.2, which can support until iOS 5.0
For 5.1 and above, we have to upgrade :
A. Upgrade xcode with newer iOS SDK
A.1 Download new version xcode, extract it, then go under
/Volumes/Xcode/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/DeviceSupport
Here lists all supported SDKs
4.2 4.3 5.0 5.1 (9B176) Latest
A.2 Create these 2 folders
sudo mkdir /Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS5.1.sdk
sudo mkdir /Developer/Platforms/iPhoneOS.platform/DeviceSupport/5.1\ \(9B176\)/
A.3 Copy the SDK to those 2 new folder
sudo cp -Rf ./5.1\ \(9B176\)/ /Developer/Platforms/iPhoneOS.platform/DeviceSupport/5.1\ \(9B176\)/
sudo cp -Rf ./5.1\ \(9B176\)/ /Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS5.1.sdk/
B. Upgrade to Lion ...
2012年10月9日 星期二
kernel module build
KERNEL_DIR=/home/viulian/android_platform/kernel-2.1.A.0.435/kernel
obj-m := cpufreq_smartass.o
PWD := $(shell pwd)
default:
$(MAKE) ARCH=arm CROSS_COMPILE=/home/viulian/android_platform/prebuilt/linux-x86/toolchain/arm-eabi-4.4.3/bin/arm-eabi- -C $(KERNEL_DIR) SUBDIRS=$(PWD) modules
clean:
$(MAKE) -C $(KERNEL_DIR) SUBDIRS=$(PWD) clean
2012年9月26日 星期三
Install audacity and verify pcm
Install audacity under ubuntu
Import raw data
Select myFile.raw file, then click Open button
Choose these options:
Signed 16-bit PCM
Little-endian
1 Channel (Mono) / 2 Channels (Stereo) based on the selected file
Sample rate same as the selected file
Click Import button
sudo add-apt-repository ppa:audacity-team/dailyVerify PCM raw data
sudo apt-get update
sudo apt-get install audacity
Import raw data
Select myFile.raw file, then click Open button
Choose these options:
Signed 16-bit PCM
Little-endian
1 Channel (Mono) / 2 Channels (Stereo) based on the selected file
Sample rate same as the selected file
Click Import button
2012年9月18日 星期二
some notes
sudo wget --output-document=/etc/apt/sources.list.d/medibuntu.list http://www.medibuntu.org/sources.list.d/$(lsb_release -cs).list
sudo apt-get --quiet update
sudo apt-get --yes --quiet --allow-unauthenticated install medibuntu-keyring
sudo apt-get --quiet update
sudo wget --output-document=/etc/apt/sources.list.d/medibuntu.list http://www.medibuntu.org/sources.list.d/$(lsb_release -cs).list && sudo apt-get --quiet update && sudo apt-get --yes --quiet --allow-unauthenticated install medibuntu-keyring && sudo apt-get --quiet update
sudo apt-get install non-free-codecs
vlc -I dummy ./tender_Mayday.aac ":sout=#transcode{acodec=mp3,ab=128,channels=2,samplerate=44100}:duplicate{dst=std{access=file,mux=raw,dst=./song.mp3}}"
deb http://packages.medibuntu.org/ hardy free non-free
deb-src http://packages.medibuntu.org/ hardy free non-free
sudo apt-get update && sudo apt-get install medibuntu-keyring
sudo apt-get remove ffmpeg
sudo apt-get install ffmpeg
sudo apt-get install libavcodec1d
apt-cache search ...
gpg --keyserver pgpkeys.mit.edu --recv-key 010908312D230C5F
gpg -a --export 010908312D230C5F | sudo apt-key add -
sudo apt-get --quiet update
sudo apt-get --yes --quiet --allow-unauthenticated install medibuntu-keyring
sudo apt-get --quiet update
sudo wget --output-document=/etc/apt/sources.list.d/medibuntu.list http://www.medibuntu.org/sources.list.d/$(lsb_release -cs).list && sudo apt-get --quiet update && sudo apt-get --yes --quiet --allow-unauthenticated install medibuntu-keyring && sudo apt-get --quiet update
sudo apt-get install non-free-codecs
vlc -I dummy ./tender_Mayday.aac ":sout=#transcode{acodec=mp3,ab=128,channels=2,samplerate=44100}:duplicate{dst=std{access=file,mux=raw,dst=./song.mp3}}"
deb http://packages.medibuntu.org/ hardy free non-free
deb-src http://packages.medibuntu.org/ hardy free non-free
sudo apt-get update && sudo apt-get install medibuntu-keyring
sudo apt-get remove ffmpeg
sudo apt-get install ffmpeg
sudo apt-get install libavcodec1d
apt-cache search ...
gpg --keyserver pgpkeys.mit.edu --recv-key 010908312D230C5F
gpg -a --export 010908312D230C5F | sudo apt-key add -
2012年9月17日 星期一
開發 XML 對應的 server
基於 Android / iOS 和 server 溝通的需要,我們需要透過 XML 來
1. 定義通訊協定本體
2. 承載交換訊息
目前 Android 端會用 XMLParser Class,Server 端則選用 libxml2
取得 libxml2 compile including path
xml2-config --cflags
取得 libxml2 library and link path
xml2-config --libs
xmlparser: xmlparser.c
echo $?
echo $@
echo $<
echo $*
echo xmlparser.c
xmlparser.c
echo xmlparser
xmlparser
echo xmlparser.c
xmlparser.c
echo
1. 定義通訊協定本體
2. 承載交換訊息
目前 Android 端會用 XMLParser Class,Server 端則選用 libxml2
取得 libxml2 compile including path
xml2-config --cflags
取得 libxml2 library and link path
xml2-config --libs
xmlparser: xmlparser.c
echo $?
echo $@
echo $<
echo $*
echo xmlparser.c
xmlparser.c
echo xmlparser
xmlparser
echo xmlparser.c
xmlparser.c
echo
2012年7月17日 星期二
Ubuntu 上 initialise stock database
1. 安裝 mysql-server & mysql-client
2. 安裝對應的 mysql perl & php libraries
3. 安裝 mysql server 的時侯, 會要求設定 root password. 如果忘了 root password, 也可以重新安裝 mysql server, 就會重新設定 root password
4. 用 mysql -u root -p 進入, 然後增加需要的 account
mysql> CREATE USER 'somebody'@'localhost' IDENTIFIED BY 'somepassword';
5. 建立 database
mysql> create database;
6. Export database
# Export table structure and data
mysqldump -u username -ppassword database_name > dump.sql
# Export table structure only
mysqldump -u username -ppassword –no-data database_name > dump.sql
# Export data only
mysqldump -u username -ppassword –no-create-info database_name > dump.sql
# Export multiple databases
mysqldump -u username -ppassword –databases db_name1 [db_name2 ...] > dump.sql
# Export all databases
mysqldump -u username -ppassword –all-databases > dump.sql
# Import table
mysql -u username -ppassword database_name < dump.sql
2. 安裝對應的 mysql perl & php libraries
3. 安裝 mysql server 的時侯, 會要求設定 root password. 如果忘了 root password, 也可以重新安裝 mysql server, 就會重新設定 root password
4. 用 mysql -u root -p 進入, 然後增加需要的 account
mysql> CREATE USER 'somebody'@'localhost' IDENTIFIED BY 'somepassword';
5. 建立 database
mysql> create database;
6. Export database
# Export table structure and data
mysqldump -u username -ppassword database_name > dump.sql
# Export table structure only
mysqldump -u username -ppassword –no-data database_name > dump.sql
# Export data only
mysqldump -u username -ppassword –no-create-info database_name > dump.sql
# Export multiple databases
mysqldump -u username -ppassword –databases db_name1 [db_name2 ...] > dump.sql
# Export all databases
mysqldump -u username -ppassword –all-databases > dump.sql
# Import table
mysql -u username -ppassword database_name < dump.sql
Ubuntu 上的 skype 和 MSN
sudo apt-get install emesene
sudo add-apt-repository ppa:telepathy/ppa
sudo apt-get update
sudo apt-get install empathy
sudo apt-get install pidgin
sudo apt-add-repository "deb http://archive.canonical.com/ $(lsb_release -sc) partner"
sudo apt-get update
sudo apt-get install skype
sudo add-apt-repository ppa:telepathy/ppa
sudo apt-get update
sudo apt-get install empathy
sudo apt-get install pidgin
sudo apt-add-repository "deb http://archive.canonical.com/ $(lsb_release -sc) partner"
sudo apt-get update
sudo apt-get install skype
2012年7月11日 星期三
一步步架設 GIT server(2) --- GIT remote with HTTP-dav server
透過 SSH 有先天上的存取權限問題, 解法也很直觀
1. 透過 SSH public key cipher
2. 改用 HTTP/HTTPS server
今天就讓我們試試看 GIT HTTP 的架設
Server : my.web.server
Path : /var/git/project.git
WebPage : /project.git
First, we have to describe some concept :
A GIT HTTP server is a git server, using webdav file system through http protocol.
The result structure looks like
Server Side
1. HTTPD(auth and server control)
2. WebDav(access method and exceptions)
3. File System(www-data read/write permission for contain files)
4. GIT bare server(GIT protocol)
For this 4 rules, we will set them to
1. HTTPD(auth and server control) -- setting up basic authtype and password file
2. WebDav(access method and exceptions) -- setting no access limit to read and directory listing, auth limitation for write and create
3. File System(www-data read/write permission for contain files) -- be sure all file under the repositories with www-data as owner and group
4. GIT bare server(GIT protocol) -- create a bare server by git init -- bare
My first try follows the guide in this page , using the following git_project1.conf :
Second, we tried a git-http-backend suggestion.
Here is the setting of git_project2.conf
This worked for git clone "git clone http://Git@localhost/project2.git" but failed on push and got the following message :
Due to error 22 is confusing, we got block here for a long day. Finally we know that this error means the file accessing in project2 requires authentication but we didn't set. The reason is got no match.
And additionally, if we change the project2 setting to project1, the push could work, where we have to type password twice.
It is time to review the behavior of webdav. The 1 and 2 lead to a simple conclusion : we only have to make read/list require no auth and write/change/create require auth.
Here is the final try
Alias /project3.git /var/www/project3.git
Allow from all
DAV on
AuthType Basic
AuthName "Git"
AuthUserFile /etc/apache2/passwd.git
require valid-user
Finally it works for both clone/fetch and push.
1. 透過 SSH public key cipher
2. 改用 HTTP/HTTPS server
今天就讓我們試試看 GIT HTTP 的架設
Server : my.web.server
Path : /var/git/project.git
WebPage : /project.git
First, we have to describe some concept :
A GIT HTTP server is a git server, using webdav file system through http protocol.
The result structure looks like
Server Side
1. HTTPD(auth and server control)
2. WebDav(access method and exceptions)
3. File System(www-data read/write permission for contain files)
4. GIT bare server(GIT protocol)
For this 4 rules, we will set them to
1. HTTPD(auth and server control) -- setting up basic authtype and password file
2. WebDav(access method and exceptions) -- setting no access limit to read and directory listing, auth limitation for write and create
3. File System(www-data read/write permission for contain files) -- be sure all file under the repositories with www-data as owner and group
4. GIT bare server(GIT protocol) -- create a bare server by git init -- bare
My first try follows the guide in this page , using the following git_project1.conf :
Alias /project1.git /var/www/project1.gitAfter restarting apache2 server, issuing git clone command "git clone http://Git@localhost/project1.git", we got an error
Allow from all
DAV on
AuthType Basic
AuthName "Git"
AuthUserFile /etc/apache2/passwd.git
Require valid-user
Cloning into 'project1'...After searching the solutions, we guess this is a apache-dav-git cowork bug : all file accessing requires authentication but only first file gets a user/password prompt.
Password for 'http://Git@localhost':
error: The requested URL returned error: 401 (curl_result = 22, http_code = 401, sha1 = 515a49392b55fead641c664d771776b0580e2ac2)
error: Unable to find 515a49392b55fead641c664d771776b0580e2ac2 under http://Git@localhost/project1.git
Cannot obtain needed blob 515a49392b55fead641c664d771776b0580e2ac2
while processing commit ecc69bb265fbcb017e472fa0f12d7260ff106f29.
error: Fetch failed.
Second, we tried a git-http-backend suggestion.
Here is the setting of git_project2.conf
Alias /project2.git /var/www/project2.git
Allow from all
DAV on
AuthType Basic
AuthName "Git"
AuthUserFile /etc/apache2/passwd.git
Require valid-user
This worked for git clone "git clone http://Git@localhost/project2.git" but failed on push and got the following message :
#> git push origin master
Password for 'http://Git@localhost':
error: Cannot access URL http://Git@localhost/project2.git/, return code 22
fatal: git-http-push failed
Due to error 22 is confusing, we got block here for a long day. Finally we know that this error means the file accessing in project2 requires authentication but we didn't set. The reason is
And additionally, if we change the project2 setting to project1, the push could work, where we have to type password twice.
It is time to review the behavior of webdav. The 1 and 2 lead to a simple conclusion : we only have to make read/list require no auth and write/change/create require auth.
Here is the final try
Alias /project3.git /var/www/project3.git
Allow from all
DAV on
AuthType Basic
AuthName "Git"
AuthUserFile /etc/apache2/passwd.git
require valid-user
Finally it works for both clone/fetch and push.
一步步架設 GIT server(1) --- GIT remote server through SSL
GIT 對 soho 的人來說非常適合, 因爲
1. 具有 local version control 的能力, 在開發的時候, 可以不必跟 server 作非常平凡的查詢.
2. 可以很輕易的開 branch, 同時有很嚴謹的 merge 管控
可是, 架設 GIT server 很複雜.我決定一步一步學習, 最後的目標
a. 架設 https 支援的 git server, 同時可以用 public-key 取代 password
b. 設定好 GitHub
c. 學習使用 repo
第一步 : 架好使用 SSH + 密碼登入的 git server
Server : my.remote.server
User : myname
Password : mypassword
Path : /home/myname/git-repo/
Source
Server : my.source.archive
Path : /home/myname/source-code/
Test Site
Server : my.test.site
Path : /home/myname/git-test/
Server 端 :
1. Login with myname
2. cd git-repo
3. git init --bare
Source 端 :
1. Login with myname
2. mkdir source-code-git
3. cd source-code-git
4. git init
5. git remote add "git-myrepo" "ssh://myname@my.remote.server/~myname/git-repo"
6. git fetch git-myrepo
type mypassword to pass
7. copy source code from ~/source-code/ to ~/source-code-git/
8. git add . ; git commit -m "Commit Message"
9. git push git-myrepo master
Test 端
1. Login with myname
2. mkdir my-git-test
3. cd my-git-test
4. git init
5. git remote add "git-myrepo" "ssh://myname@my.remote.server/~myname/git-repo"
6. git fetch git-myrepo
7. git checkout master
1. 具有 local version control 的能力, 在開發的時候, 可以不必跟 server 作非常平凡的查詢.
2. 可以很輕易的開 branch, 同時有很嚴謹的 merge 管控
可是, 架設 GIT server 很複雜.我決定一步一步學習, 最後的目標
a. 架設 https 支援的 git server, 同時可以用 public-key 取代 password
b. 設定好 GitHub
c. 學習使用 repo
第一步 : 架好使用 SSH + 密碼登入的 git server
Server : my.remote.server
User : myname
Password : mypassword
Path : /home/myname/git-repo/
Source
Server : my.source.archive
Path : /home/myname/source-code/
Test Site
Server : my.test.site
Path : /home/myname/git-test/
Server 端 :
1. Login with myname
2. cd git-repo
3. git init --bare
Source 端 :
1. Login with myname
2. mkdir source-code-git
3. cd source-code-git
4. git init
5. git remote add "git-myrepo" "ssh://myname@my.remote.server/~myname/git-repo"
6. git fetch git-myrepo
type mypassword to pass
7. copy source code from ~/source-code/ to ~/source-code-git/
8. git add . ; git commit -m "Commit Message"
9. git push git-myrepo master
Test 端
1. Login with myname
2. mkdir my-git-test
3. cd my-git-test
4. git init
5. git remote add "git-myrepo" "ssh://myname@my.remote.server/~myname/git-repo"
6. git fetch git-myrepo
7. git checkout master
2012年7月9日 星期一
2012年4月11日 星期三
GIT Notes
1. When sync with remote repository,
your local branch "refs" may sometimes gets a message
"Your branch is behind ‘remote/xxx’ by 12 commits, and can be fast-forwarded."
This message means a remote branch xxx was newer than our own local xxx. This may be due to other's commit or our developing on other folder.
At this time, you can issue :
git checkout xxx
git merge remote/remote_repository/xxx
It will merge the remote commits to our local xxx branch.
2. When push back "branches", "commits" or "tags", it needs to issue;
git push remote_repository local_branch
3. Usually we have a development procedure like this ----------------------------------------------- Remote repository tree
| | merge/fetch/push
----------------------------------------------- Local tree with local commits and branches.
We develop on local tree, commit then sync with remote repository.
The standard procedure for merge onto remote tree would be
a. issue fetch from remote tree
ie. git fetch git_remote_repository .
b. issue merge from remote tree with local branch
ie. assume we are developing on local branch "Do_Bob_Job" .
git merge git_remote_repository/Do_Bob_Job .
c. if there are conflicts and we fix it, then commit the fixings
ie. git commit -a -m"Add_for_Bob_Job" .
d. doing merge again
e. push on remote repository
ie. git push git_remote_repository.
This procedure should do regularly to reduce conflicts.
4. Generate GIT patch for specified index
git format-patch index^..index -o output_patch_file_path
Description : index^ means previous of the specified index
5. Delete/Revert commits and move HEAD reference
your local branch "refs" may sometimes gets a message
"Your branch is behind ‘remote/xxx’ by 12 commits, and can be fast-forwarded."
This message means a remote branch xxx was newer than our own local xxx. This may be due to other's commit or our developing on other folder.
At this time, you can issue :
git checkout xxx
git merge remote/remote_repository/xxx
It will merge the remote commits to our local xxx branch.
2. When push back "branches", "commits" or "tags", it needs to issue;
git push remote_repository local_branch
3. Usually we have a development procedure like this ----------------------------------------------- Remote repository tree
| | merge/fetch/push
----------------------------------------------- Local tree with local commits and branches.
We develop on local tree, commit then sync with remote repository.
The standard procedure for merge onto remote tree would be
a. issue fetch from remote tree
ie. git fetch git_remote_repository .
b. issue merge from remote tree with local branch
ie. assume we are developing on local branch "Do_Bob_Job" .
git merge git_remote_repository/Do_Bob_Job .
c. if there are conflicts and we fix it, then commit the fixings
ie. git commit -a -m"Add_for_Bob_Job" .
d. doing merge again
e. push on remote repository
ie. git push git_remote_repository.
This procedure should do regularly to reduce conflicts.
4. Generate GIT patch for specified index
git format-patch index^..index -o output_patch_file_path
Description : index^ means previous of the specified index
5. Delete/Revert commits and move HEAD reference
2012年4月9日 星期一
用 Huawei 3G Dongle E220 連遠傳 3G
1. 安裝 wvdial
2. 編輯 /etc/wvdial.conf
[Dialer Defaults]
Init1 = ATZ
Init2 = ATQ0 V1 E1 S0=0 &C1 &D2 +FCLASS=0
Modem Type = Analog Modem
Baud = 460800
New PPPD = yes
Modem = /dev/ttyUSB0
ISDN = 0
Phone = *99#
APN = internet
Password = test
Username = test
Stupid Mode = 1
Dial Command = ATDT
3. 自動連綫 ~~~ 有空再補上
2. 編輯 /etc/wvdial.conf
[Dialer Defaults]
Init1 = ATZ
Init2 = ATQ0 V1 E1 S0=0 &C1 &D2 +FCLASS=0
Modem Type = Analog Modem
Baud = 460800
New PPPD = yes
Modem = /dev/ttyUSB0
ISDN = 0
Phone = *99#
APN = internet
Password = test
Username = test
Stupid Mode = 1
Dial Command = ATDT
3. 自動連綫 ~~~ 有空再補上
2012年3月7日 星期三
Bash string process
${string:position}
Extracts substring from $string at $position.
Example : teststring="MyTestString"; echo ${teststring:1}
Result : yTestString
${string:position:length}
Extracts $length characters of substring from $string at $position.
Example : teststring="MyTestString"; echo ${teststring:0:1}
Result : M
expr index $string $substring
Numerical position in $string of first character in $substring that matches.
Example : expr index $teststring "str"
Result : 5
expr match "$string" '$substring'
expr "$string" : '$substring'
$substring is a regular expression. Find a match at "position"
${#string}
expr length $string
These are the equivalent of strlen() in C.
expr "$string" : '.*'
Length of a string
Extracts substring from $string at $position.
Example : teststring="MyTestString"; echo ${teststring:1}
Result : yTestString
${string:position:length}
Extracts $length characters of substring from $string at $position.
Example : teststring="MyTestString"; echo ${teststring:0:1}
Result : M
expr index $string $substring
Numerical position in $string of first character in $substring that matches.
Example : expr index $teststring "str"
Result : 5
expr match "$string" '$substring'
expr "$string" : '$substring'
$substring is a regular expression. Find a match at "position"
${#string}
expr length $string
These are the equivalent of strlen() in C.
expr "$string" : '.*'
Length of a string
2012年2月29日 星期三
A cscope Android workspace build script
#!/bin/bash -x
TOPDIR=`pwd`
KERNELDIR="kernel"
ARCHDIR="arch"
PLATFORM="arm"
CATEGORY=$1
ACTION=$2
case "$1" in
src|SRC)
[ "$ACTION" = "rebuild" ] && \
find . \
-path "./out*" -prune -o \
-path "./docs*" -prune -o \
-path "./$KERNELDIR/$ARCHDIR/*" ! -path "./$KERNELDIR/$ARCHDIR/$PLATFORM*" -prune -o \
-name "*.c" -print -o -name "*.C" -print -o -name "*.cpp" -print -o -name "*.CPP" -print -o \
-name "*.h" -print -o -name "*.H" -print -o -name "*.hpp" -print -o -name "*.HPP" -print -o \
-name "*.cxx" -print -o -name "*.CXX" -print -o -name "*.java" -print -o -name "*.JAVA" -print -o \
-name "*.s" -print -o -name "*.S" -print -o -name "*.x" -print -o -name "*.X" -print > ./cscope.files.$CATEGORY
;;
mk)
find . \
-path "./out*" -prune -o \
-path "./docs*" -prune -o \
-path "./$KERNELDIR/$ARCHDIR/*" ! -path "./$KERNELDIR/$ARCHDIR/$PLATFORM*" -prune -o \
-name "*Makefile*" -print -o -name "*.mk" -print -o -name "*Kconfig*" -print -o \
-name "*.sh" -print -name "*_defconfig" -print > ./cscope.files.$CATEGORY
;;
conf)
find . \
-path "./docs*" -prune -o \
-path "./$KERNELDIR/$ARCHDIR/*" ! -path "./$KERNELDIR/$ARCHDIR/$PLATFORM*" -prune -o \
-name "*.conf" -print -o -name "*.xml" -print -o -name "*.rc" -print -o \
-name "*.sh" -print -name "*.fstab" -print > ./cscope.files.$CATEGORY
;;
kernel)
find . \
-path "./docs*" -prune -o \
-path "./$KERNELDIR/$ARCHDIR/*" ! -path "./$KERNELDIR/$ARCHDIR/$PLATFORM*" -prune -o \
-path "./*" ! -path "./$KERNELDIR*" -prune -o \
-name "*.c" -print -o -name "*.C" -print -o -name "*.cpp" -print -o -name "*.CPP" -print -o \
-name "*.h" -print -o -name "*.H" -print -o -name "*.hpp" -print -o -name "*.HPP" -print -o \
-name "*.cxx" -print -o -name "*.CXX" -print -o -name "*.java" -print -o -name "*.JAVA" -print -o \
-name "*.s" -print -o -name "*.S" -print -o -name "*.x" -print -o -name "*.X" -print > ./cscope.files.$CATEGORY
;;
esac
cscope -icscope.files.$CATEGORY -q -b -k
TOPDIR=`pwd`
KERNELDIR="kernel"
ARCHDIR="arch"
PLATFORM="arm"
CATEGORY=$1
ACTION=$2
case "$1" in
src|SRC)
[ "$ACTION" = "rebuild" ] && \
find . \
-path "./out*" -prune -o \
-path "./docs*" -prune -o \
-path "./$KERNELDIR/$ARCHDIR/*" ! -path "./$KERNELDIR/$ARCHDIR/$PLATFORM*" -prune -o \
-name "*.c" -print -o -name "*.C" -print -o -name "*.cpp" -print -o -name "*.CPP" -print -o \
-name "*.h" -print -o -name "*.H" -print -o -name "*.hpp" -print -o -name "*.HPP" -print -o \
-name "*.cxx" -print -o -name "*.CXX" -print -o -name "*.java" -print -o -name "*.JAVA" -print -o \
-name "*.s" -print -o -name "*.S" -print -o -name "*.x" -print -o -name "*.X" -print > ./cscope.files.$CATEGORY
;;
mk)
find . \
-path "./out*" -prune -o \
-path "./docs*" -prune -o \
-path "./$KERNELDIR/$ARCHDIR/*" ! -path "./$KERNELDIR/$ARCHDIR/$PLATFORM*" -prune -o \
-name "*Makefile*" -print -o -name "*.mk" -print -o -name "*Kconfig*" -print -o \
-name "*.sh" -print -name "*_defconfig" -print > ./cscope.files.$CATEGORY
;;
conf)
find . \
-path "./docs*" -prune -o \
-path "./$KERNELDIR/$ARCHDIR/*" ! -path "./$KERNELDIR/$ARCHDIR/$PLATFORM*" -prune -o \
-name "*.conf" -print -o -name "*.xml" -print -o -name "*.rc" -print -o \
-name "*.sh" -print -name "*.fstab" -print > ./cscope.files.$CATEGORY
;;
kernel)
find . \
-path "./docs*" -prune -o \
-path "./$KERNELDIR/$ARCHDIR/*" ! -path "./$KERNELDIR/$ARCHDIR/$PLATFORM*" -prune -o \
-path "./*" ! -path "./$KERNELDIR*" -prune -o \
-name "*.c" -print -o -name "*.C" -print -o -name "*.cpp" -print -o -name "*.CPP" -print -o \
-name "*.h" -print -o -name "*.H" -print -o -name "*.hpp" -print -o -name "*.HPP" -print -o \
-name "*.cxx" -print -o -name "*.CXX" -print -o -name "*.java" -print -o -name "*.JAVA" -print -o \
-name "*.s" -print -o -name "*.S" -print -o -name "*.x" -print -o -name "*.X" -print > ./cscope.files.$CATEGORY
;;
esac
cscope -icscope.files.$CATEGORY -q -b -k
iPhone APP view controller and nib coworking
At beginning of program execution, the "applicationDidFinishLaunching" in application delegate,
we create
1. a window by "UIWindow *window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];"
With finally display this window by "[window makeKeyAndVisible];"
2. After a window been created, we than create a view controller -- a simple view controller, a navigation controller, a tab controller or etc …
"viewController = [[MyViewController alloc] init];"
The view controller tiles the screen components like a text area or an image view within "loadView" protocol interface.
At the time view was constructed, the view is assigned to the window by "[window addSubview:nav.view];"
3. Specially for navigation controller, we have a code segment like
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
UINavigationController *nav = [[UINavigationController alloc] initWithRootViewController:[[MyViewController alloc] init]];
[window addSubview:nav.view];
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
This will attach a view controller under a navigation controller.
The three steps are necessary but "can be invisible", by applying complicate interface builder.
1. Simply create a view in "loadView"
"self.view = [[[NSBundle mainBundle] loadNibNamed:@"mainview" owner:self options:nil] lastObject];"
2. Apply to a view controller
"self.viewController = [[ViewTestNoStoryBoard1ViewController alloc] initWithNibName:@"MyViewController" bundle:nil];"
The 1 and 2 works the same, only with some different expression. The nib contains simple structure with a view or an additional view controller
3. Assign to info.plist
"Main nib file base name = MainWindow(.nib)"
With this way, we can add view controllers, navigation controller, application delegate and window into nib file.
*** Important notice *** With this method, the nib file will manage the calling of related view controller code defined in nib file "implicitly".
4. Assign to info.plist with story board
This is a new comer of xcode 4.2 and … I am still studying it.
we create
1. a window by "UIWindow *window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];"
With finally display this window by "[window makeKeyAndVisible];"
2. After a window been created, we than create a view controller -- a simple view controller, a navigation controller, a tab controller or etc …
"viewController = [[MyViewController alloc] init];"
The view controller tiles the screen components like a text area or an image view within "loadView" protocol interface.
At the time view was constructed, the view is assigned to the window by "[window addSubview:nav.view];"
3. Specially for navigation controller, we have a code segment like
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
UINavigationController *nav = [[UINavigationController alloc] initWithRootViewController:[[MyViewController alloc] init]];
[window addSubview:nav.view];
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
This will attach a view controller under a navigation controller.
The three steps are necessary but "can be invisible", by applying complicate interface builder.
1. Simply create a view in "loadView"
"self.view = [[[NSBundle mainBundle] loadNibNamed:@"mainview" owner:self options:nil] lastObject];"
2. Apply to a view controller
"self.viewController = [[ViewTestNoStoryBoard1ViewController alloc] initWithNibName:@"MyViewController" bundle:nil];"
The 1 and 2 works the same, only with some different expression. The nib contains simple structure with a view or an additional view controller
3. Assign to info.plist
"Main nib file base name = MainWindow(.nib)"
With this way, we can add view controllers, navigation controller, application delegate and window into nib file.
*** Important notice *** With this method, the nib file will manage the calling of related view controller code defined in nib file "implicitly".
4. Assign to info.plist with story board
This is a new comer of xcode 4.2 and … I am still studying it.
2012年2月28日 星期二
設定 Ubuntu Oneiric 上的 Android build 環境
0. Firstly, test system architecture by
1. Installing Java JDK and JRE
sudo apt-get install python-software-properties
sudo add-apt-repository ppa:ferramroberto/java
sudo apt-get update
sudo apt-get install sun-java6-bin sun-java6-jdk sun-java6-plugin sun-java6-jre
sudo update-alternatives --config java
--------------------------------------------
Selection Path 優先級 Status
------------------------------------------------------------
* 0 /usr/lib/jvm/java-6-openjdk/jre/bin/java 1061 auto mode
1 /usr/lib/jvm/java-6-openjdk/jre/bin/java 1061 manual mode
2 /usr/lib/jvm/java-6-sun/jre/bin/java 63 manual mode
3 /usr/lib/jvm/java-7-openjdk-amd64/jre/bin/java 1051 manual mode
Press enter to keep the current choice[*], or type selection number: 2
--------------------------------------------
2. Install build tools(Reference to http://source.android.com/source/initializing.html)
sudo apt-get install git-core gnupg flex bison gperf build-essential
sudo apt-get install zip curl zlib1g-dev libc6-dev lib32ncurses5-dev ia32-libs --fix-missing
---- ia32-libs
sudo apt-get install x11proto-core-dev libx11-dev lib32readline5-dev lib32z-dev --fix-missing
---- lib32readline5-dev
sudo apt-get install libgl1-mesa-dev g++-multilib mingw32 tofrodos python-markdown --fix-missing
---- mingw32 python-markdown
sudo apt-get install libxml2-utils xsltproc
sudo apt-get install libx11-dev:i386
** Note 1:
While doing installation packages, the "universe" pool was disappeared while lot of items are required to be there.
The answer is switching to other server, I choose the server in China ubuntu.cn99.com
==> Use the 軟體來源 to do the switching.
==> This can fix the ia32-lins, mingw32, g++-4.4-multilib gcc-4.4-multilib
** Note 2:
Another package lib32readline5-dev was changed to lib32readline-gplv2-dev, use it instead.
3. Switch to gcc 4.4 :
After installing all required packages, we need to note that since some syntax issue in android framework, using gcc/g++ 4.6 will be failed. We need to change back to 4.4
Step 1: Install gcc 4.4 packages
sudo apt-get install gcc-4.4 g++-4.4 g++-4.4-multilib gcc-4.4-multilib
Step 2: Change gcc 4.4 by default
$sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-4.4 50 --slave /usr/bin/g++ g++ /usr/bin/g++-4.4 --slave /usr/bin/gcov gcov /usr/bin/g++-4.4
$sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-4.6 40 --slave /usr/bin/g++ g++ /usr/bin/g++-4.6 --slave /usr/bin/gcov gcov /usr/bin/g++-4.6
$sudo update-alternatives --config gcc
Use gcc 4.4 by default
Step 3: Change g++ 4.4 by default
chenhj@chenhj-MacBookPro:/etc/alternatives$ sudo update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-4.4 50
[sudo] password for chenhj:
update-alternatives: using /usr/bin/g++-4.4 to provide /usr/bin/g++ (g++) in auto mode.
chenhj@chenhj-MacBookPro:/etc/alternatives$ sudo update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-4.6 40
chenhj@chenhj-MacBookPro:/etc/alternatives$ sudo update-alternatives --config g++
There are 2 choices for the alternative g++ (providing /usr/bin/g++).
Selection Path 優先級 Status
------------------------------------------------------------
* 0 /usr/bin/g++-4.4 50 auto mode
1 /usr/bin/g++-4.4 50 manual mode
2 /usr/bin/g++-4.6 40 manual mode
Press enter to keep the current choice[*], or type selection number: 1
update-alternatives: using /usr/bin/g++-4.4 to provide /usr/bin/g++ (g++) in manual mode.
dpkg --print-architectureOn my notebook, it showed "amd64"
1. Installing Java JDK and JRE
sudo apt-get install python-software-properties
sudo add-apt-repository ppa:ferramroberto/java
sudo apt-get update
sudo apt-get install sun-java6-bin sun-java6-jdk sun-java6-plugin sun-java6-jre
sudo update-alternatives --config java
--------------------------------------------
Selection Path 優先級 Status
------------------------------------------------------------
* 0 /usr/lib/jvm/java-6-openjdk/jre/bin/java 1061 auto mode
1 /usr/lib/jvm/java-6-openjdk/jre/bin/java 1061 manual mode
2 /usr/lib/jvm/java-6-sun/jre/bin/java 63 manual mode
3 /usr/lib/jvm/java-7-openjdk-amd64/jre/bin/java 1051 manual mode
Press enter to keep the current choice[*], or type selection number: 2
--------------------------------------------
2. Install build tools(Reference to http://source.android.com/source/initializing.html)
sudo apt-get install git-core gnupg flex bison gperf build-essential
sudo apt-get install zip curl zlib1g-dev libc6-dev lib32ncurses5-dev ia32-libs --fix-missing
---- ia32-libs
sudo apt-get install x11proto-core-dev libx11-dev lib32readline5-dev lib32z-dev --fix-missing
---- lib32readline5-dev
sudo apt-get install libgl1-mesa-dev g++-multilib mingw32 tofrodos python-markdown --fix-missing
---- mingw32 python-markdown
sudo apt-get install libxml2-utils xsltproc
sudo apt-get install libx11-dev:i386
** Note 1:
While doing installation packages, the "universe" pool was disappeared while lot of items are required to be there.
The answer is switching to other server, I choose the server in China ubuntu.cn99.com
==> Use the 軟體來源 to do the switching.
==> This can fix the ia32-lins, mingw32, g++-4.4-multilib gcc-4.4-multilib
** Note 2:
Another package lib32readline5-dev was changed to lib32readline-gplv2-dev, use it instead.
3. Switch to gcc 4.4 :
After installing all required packages, we need to note that since some syntax issue in android framework, using gcc/g++ 4.6 will be failed. We need to change back to 4.4
Step 1: Install gcc 4.4 packages
sudo apt-get install gcc-4.4 g++-4.4 g++-4.4-multilib gcc-4.4-multilib
Step 2: Change gcc 4.4 by default
$sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-4.4 50 --slave /usr/bin/g++ g++ /usr/bin/g++-4.4 --slave /usr/bin/gcov gcov /usr/bin/g++-4.4
$sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-4.6 40 --slave /usr/bin/g++ g++ /usr/bin/g++-4.6 --slave /usr/bin/gcov gcov /usr/bin/g++-4.6
$sudo update-alternatives --config gcc
Use gcc 4.4 by default
Step 3: Change g++ 4.4 by default
chenhj@chenhj-MacBookPro:/etc/alternatives$ sudo update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-4.4 50
[sudo] password for chenhj:
update-alternatives: using /usr/bin/g++-4.4 to provide /usr/bin/g++ (g++) in auto mode.
chenhj@chenhj-MacBookPro:/etc/alternatives$ sudo update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-4.6 40
chenhj@chenhj-MacBookPro:/etc/alternatives$ sudo update-alternatives --config g++
There are 2 choices for the alternative g++ (providing /usr/bin/g++).
Selection Path 優先級 Status
------------------------------------------------------------
* 0 /usr/bin/g++-4.4 50 auto mode
1 /usr/bin/g++-4.4 50 manual mode
2 /usr/bin/g++-4.6 40 manual mode
Press enter to keep the current choice[*], or type selection number: 1
update-alternatives: using /usr/bin/g++-4.4 to provide /usr/bin/g++ (g++) in manual mode.
2012年2月21日 星期二
在 Linux Ubuntu 上使用 webdav client 的測試心得
1. 不論在哪個平臺上, 至少都要有 PC 端 Client, 因爲很多 DAV 的東西 query & response, 都需要作封包的篩選檢測和過濾
2. 在挑選適合的 PC Client 時, 最後選定用 Linux 上的 cadaver
3. 預設的 cadaver 不支援 SSL, 所以需要下載套件重新 compile
3a. 重新編譯 cadaver, 在 configure 的時候, 加上 --with-ssl 會遇到
configure: error: could not find library containing RSA_new
這個錯誤訊息, 需要安裝 libssl-dev 套件
4. 測試 box.com 的時候, 舊的 http://www.box.com 已經不能用了, 要改用
http://www.box.com
我相信 www.box.com 有做自動轉址的動作, 但是在 cadaver 上沒有支援, 要改用
https://www.box.com/dav
2. 在挑選適合的 PC Client 時, 最後選定用 Linux 上的 cadaver
3. 預設的 cadaver 不支援 SSL, 所以需要下載套件重新 compile
3a. 重新編譯 cadaver, 在 configure 的時候, 加上 --with-ssl 會遇到
configure: error: could not find library containing RSA_new
這個錯誤訊息, 需要安裝 libssl-dev 套件
4. 測試 box.com 的時候, 舊的 http://www.box.com 已經不能用了, 要改用
http://www.box.com
我相信 www.box.com 有做自動轉址的動作, 但是在 cadaver 上沒有支援, 要改用
https://www.box.com/dav
2012年1月30日 星期一
Add GIT HUB public key
Generate GIT-HUB ssh key and try to handshaking
1. Log on to GIT HUB with google account
2. Set username and email ( if not default google account )
3. generate a RSA key by
ssh-keygen -t rsa -C "chenhj1234@gmail.com"
then
cat ~/.ssh/id_rsa.pub
===================================================================
ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQC+K1lUFipFIHV/Pi44CzFEDUitb2c3KPm4dyC3wF3qpCNRAMJ18Ay8GrrPye1i4v/9oDIxnARdBKLFLWXO5dMcGU0A0vbo8MGRNEbLJXizD0z7yox/qT5+jVkYqEaBK0Lkt0g6z2Um0tkN1r/sO0vPfj93Pq1D4rdVPJdXA1jUxkJUJtqMbFE5wikym2hgrk9jd4Wm4ffx+tAMCc+hmLhs9/zfIPeYpGmkA7gY70IzJI7bWc3S8qeV0EiyIWU1WfdMk0ArnQzWh8FX4Wc2XMn3WsqK8EiKn76Qq0nuJ6djLPrX+ezXKnGGV64fvwx1cYJ1nl74BTmHm5pis+qqcXON chenhj1234@gmail.com
===================================================================
4. Put the key content onto GIT HUB server
5. Issue "ssh-add" command
6. Test by ssh -p git-server-port username@your-git-server.com
1. Log on to GIT HUB with google account
2. Set username and email ( if not default google account )
3. generate a RSA key by
ssh-keygen -t rsa -C "chenhj1234@gmail.com"
then
cat ~/.ssh/id_rsa.pub
===================================================================
ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQC+K1lUFipFIHV/Pi44CzFEDUitb2c3KPm4dyC3wF3qpCNRAMJ18Ay8GrrPye1i4v/9oDIxnARdBKLFLWXO5dMcGU0A0vbo8MGRNEbLJXizD0z7yox/qT5+jVkYqEaBK0Lkt0g6z2Um0tkN1r/sO0vPfj93Pq1D4rdVPJdXA1jUxkJUJtqMbFE5wikym2hgrk9jd4Wm4ffx+tAMCc+hmLhs9/zfIPeYpGmkA7gY70IzJI7bWc3S8qeV0EiyIWU1WfdMk0ArnQzWh8FX4Wc2XMn3WsqK8EiKn76Qq0nuJ6djLPrX+ezXKnGGV64fvwx1cYJ1nl74BTmHm5pis+qqcXON chenhj1234@gmail.com
===================================================================
4. Put the key content onto GIT HUB server
5. Issue "ssh-add" command
6. Test by ssh -p git-server-port username@your-git-server.com
2012年1月4日 星期三
Some confusing points in GIT
Command to check the local and remote branches
git branch # see local branches
git branch -r # see remote branches
GIT is a multiple tree distributed version control system. All developer working on their local copies of version tree.
---------------------------------------------- remote
-----
/
-------------- local1
\
----------
-----
/
-------------- local2
\
----------
-----
/
-------------- local3
\
----------
To resolve the complex metric, we get 2 sets of commands
1. checkout/add/commit/rebase, working on local tree management
2. clone/fetch/merge/pull/push, working on remote tree conversation
To reserve the complex tree structure, we have folders and files
For local branches :
.git/refs/heads/master
local_branch_1
local_branch_2
local_branch_3
For remote repositories :
.git/refs/remotes/origin/master
local_branch_1
local_branch_2
local_branch_3
When we mention about a "remote repository", it means a "remotes/XXX" folder.
Basically, origin is a must-have repository.
When we mention about a refspec or a remote branch or a named commits, it means a "remotes/XXX/YYY" file.
Basically, origin/master is a must-have repository.
When we mention about a commit, it means ???
Details :
Looking at the manpage of git-fetch
- git fetch [] [ [...]]
Since its parameter is, it uses (with an hidden refs/remotes)
- git fetch origin
Looking at the manpage of git-merge
- git merge [-n] [--stat] [--no-commit] [--squash]
[-s] [-X ]
[--[no-]rerere-autoupdate] [-m] ...
- git merge HEAD ...
Since its parameter is, it uses (with an hidden refs/remotes)
- git merge origin/master
git branch # see local branches
git branch -r # see remote branches
GIT is a multiple tree distributed version control system. All developer working on their local copies of version tree.
---------------------------------------------- remote
-----
/
-------------- local1
\
----------
-----
/
-------------- local2
\
----------
-----
/
-------------- local3
\
----------
To resolve the complex metric, we get 2 sets of commands
1. checkout/add/commit/rebase, working on local tree management
2. clone/fetch/merge/pull/push, working on remote tree conversation
To reserve the complex tree structure, we have folders and files
For local branches :
.git/refs/heads/master
local_branch_1
local_branch_2
local_branch_3
For remote repositories :
.git/refs/remotes/origin/master
local_branch_1
local_branch_2
local_branch_3
When we mention about a "remote repository", it means a "remotes/XXX" folder.
Basically, origin is a must-have repository.
When we mention about a refspec or a remote branch or a named commits, it means a "remotes/XXX/YYY" file.
Basically, origin/master is a must-have repository.
When we mention about a commit, it means ???
Details :
Looking at the manpage of git-fetch
- git fetch [
Since its parameter is
- git fetch origin
Looking at the manpage of git-merge
- git merge [-n] [--stat] [--no-commit] [--squash]
[-s
[--[no-]rerere-autoupdate] [-m
- git merge
Since its parameter is
- git merge origin/master
訂閱:
意見 (Atom)