127.0.0.1 activate.adobe.com
127.0.0.1 practivate.adobe.com
127.0.0.1 ereg.adobe.com
127.0.0.1 activate.wip3.adobe.com
127.0.0.1 wip3.adobe.com
127.0.0.1 3dns-3.adobe.com
127.0.0.1 3dns-2.adobe.com
127.0.0.1 adobe-dns.adobe.com
127.0.0.1 adobe-dns-2.adobe.com
127.0.0.1 adobe-dns-3.adobe.com
127.0.0.1 ereg.wip3.adobe.com
127.0.0.1 activate-sea.adobe.com
127.0.0.1 wwis-dubc1-vip60.adobe.com
127.0.0.1 activate-sjc0.adobe.com
Wednesday, January 25, 2012
hosts
Sunday, October 23, 2011
Android Phone Call Recording - Milestone (Droid) 3
Friday, October 14, 2011
Enable Display Mirroring for iPad 1
This is how to use the plutil utility
#back up K48AP.plist
cp -p /System/Library/CoreServices/SpringBoard.app/K48AP.plist /System/Library/CoreServices/SpringBoard.app/K48AP.plist.bak
#patch
plutil -key capabilities -key display-mirroring -yes /System/Library/CoreServices/SpringBoard.app/K48AP.plist
#check
plutil -key capabilities /System/Library/CoreServices/SpringBoard.app/K48AP.plist
Sunday, August 28, 2011
Sunday, August 14, 2011
How to build Android ndk sample using ant
This is a walkthrough of how to build the hello-jni sample from Android ndk after you have installed sdk and ndk. You want to use ant instead of Eclipse for building sample project.
Suppose your install paths of sdk and ndk are
Setup PATH
Please take note that for Mac OSX Mavericks, ant is no longer in Mac, just download a binary distribution of Ant from http://ant.apache.org/bindownload.cgi . Just download it, unzip/untar it, and add its bin directory to your PATH. say export PATH=${PATH}:~/apache-ant-1.9.4/bin
ndk-build
list target (assume sdk installed)
update project with target 1
list avd (suppose AVD4G created during sdk installation)
start emulator
debug build
install to emulator
use ant uninstall to remove
If you want to code-sign the binary, first create the build.properties and self-signing certificate and compile release
create build.properties
create self-signing certificate and compile release
This is how to compile C++ program with stlport in ndk
modify jni/test-libstl.cpp to
create jni/Application.mk with
modify jni/Android.mk with
run with emulator
For Windows, add this PATH in environment (path should not have spaces)
C:\Android\android-sdk\tools;C:\Android\apache-ant-1.8.2\bin;C:\Android\android-ndk-r6;
JAVA_HOME=C:\Program Files\Java\jdk1.6.0_29
and you need cygwin to start ndk-build
.
.
.
Suppose your install paths of sdk and ndk are
~/android-sdk-mac_x86 and ~/android-ndk-r5cSetup PATH
export PATH=${PATH}:~/android-sdk-mac_x86/tools:~/android-ndk-r5cPlease take note that for Mac OSX Mavericks, ant is no longer in Mac, just download a binary distribution of Ant from http://ant.apache.org/bindownload.cgi . Just download it, unzip/untar it, and add its bin directory to your PATH. say export PATH=${PATH}:~/apache-ant-1.9.4/bin
ndk-build
cd ~/android-ndk-r5c/samples/hello-jni
ndk-buildlist target (assume sdk installed)
android list targetupdate project with target 1
android update project -t 1 -p .list avd (suppose AVD4G created during sdk installation)
android list avdstart emulator
emulator -avd AVD4G -scale 0.5 &
#if you have Samsung Galaxy skin (download here)
emulator -avd AVD4G -skin GALAXY_Tab -scale 0.5 &debug build
ant debuginstall to emulator
ant debug installuse ant uninstall to remove
If you want to code-sign the binary, first create the build.properties and self-signing certificate and compile release
create build.properties
# location of the keystore. This is used by ant release
key.store= /my-path-to-mykey/my.keystore
key.alias=mykeystorecreate self-signing certificate and compile release
keytool -genkey -v -keystore /my-path-to-mykey/my.keystore -alias mykeystore -keyalg RSA -keysize 2048 -validity 10000
ant releaseThis is how to compile C++ program with stlport in ndk
cd ~/android-ndk-r5c/samples/test-libstdc++modify jni/test-libstl.cpp to
- jni/test-libstl.cpp Select all
#include <iostream> using namespace std; int main() { cout << "hello, world\n"; return 0; }
create jni/Application.mk with
APP_STL := stlport_static
modify jni/Android.mk with
- jni/Android.mk Select all
LOCAL_PATH := $(call my-dir) include $(CLEAR_VARS) LOCAL_MODULE := test-libstl LOCAL_SRC_FILES := test-libstl.cpp LOCAL_LDLIBS := -llog include $(BUILD_EXECUTABLE) include $(CLEAR_VARS) LOCAL_EXECUTABLE := test-libstl run: ~/android-sdk-mac_x86/platform-tools/adb push libs/armeabi/$(LOCAL_MODULE) /data/local/bin/$(LOCAL_MODULE) ~/android-sdk-mac_x86/platform-tools/adb shell chmod 755 /data/local/bin/$(LOCAL_MODULE) ~/android-sdk-mac_x86/platform-tools/adb shell /data/local/bin/$(LOCAL_MODULE) # makefile requires the use of tab for the indented spaces above
run with emulator
cd ~/android-ndk-r5c/samples/test-libstdc++
ndk-build clean && ndk-build
ndk-build runFor Windows, add this PATH in environment (path should not have spaces)
C:\Android\android-sdk\tools;C:\Android\apache-ant-1.8.2\bin;C:\Android\android-ndk-r6;
JAVA_HOME=C:\Program Files\Java\jdk1.6.0_29
and you need cygwin to start ndk-build
.
.
.
Friday, July 15, 2011
Binary strstr
strstr is a Standard C function but it cannot handle '\0'. Here is the modified version to handle binary data. The bstrstr confronts to strstr and returns char*
It needs a bstrchr function as well.
here is the testing program
- bstrstr Select all
char *(bstrstr)(const char *s1, size_t l1, const char *s2, size_t l2) {
/* find first occurrence of s2[] in s1[] for length l1*/
const char *ss1 = s1;
const char *ss2 = s2;
/* handle special case */
if (l1 == 0)
return (NULL);
if (l2 == 0)
return ((char *)s1);
/* match prefix */
for (; (s1 = bstrchr(s1, *s2, ss1-s1+l1)) != NULL && ss1-s1+l1!=0; ++s1) {
/* match rest of prefix */
const char *sc1, *sc2;
for (sc1 = s1, sc2 = s2; ;)
if (++sc2 >= ss2+l2)
return ((char *)s1);
else if (*++sc1 != *sc2)
break;
}
return (NULL);
}
It needs a bstrchr function as well.
- bstrchr Select all
char *(bstrchr) (const char *s, int c, size_t l) {
/* find first occurrence of c in char s[] for length l*/
const char ch = c;
/* handle special case */
if (l == 0)
return (NULL);
for (; *s != ch; ++s, --l)
if (l == 0)
return (NULL);
return ((char*)s);
}
here is the testing program
- bstsrstr_test.c Select all
/* bstsrstr test */
#include <stdio.h>
#include <string.h>
#include <ctype.h>
char *(bstrchr) (const char *s, int c, size_t l) {
/* find first occurrence of c in char s[] for length l*/
const char ch = c;
/* handle special case */
if (l == 0)
return (NULL);
for (; *s != ch; ++s, --l)
if (l == 0)
return (NULL);
return ((char*)s);
}
char *(bstrstr)(const char *s1, size_t l1, const char *s2, size_t l2) {
/* find first occurrence of s2[] in s1[] for length l1*/
const char *ss1 = s1;
const char *ss2 = s2;
/* handle special case */
if (l1 == 0)
return (NULL);
if (l2 == 0)
return ((char *)s1);
/* match prefix */
for (; (s1 = bstrchr(s1, *s2, ss1-s1+l1)) != NULL && ss1-s1+l1!=0; ++s1) {
/* match rest of prefix */
const char *sc1, *sc2;
for (sc1 = s1, sc2 = s2; ;)
if (++sc2 >= ss2+l2)
return ((char *)s1);
else if (*++sc1 != *sc2)
break;
}
return (NULL);
}
void printbstr(const char *s, size_t l) {
for (; l!=0 ; --l) {
printf("%c", isprint(*(s))?*(s):'.');
s++;
}
printf("\n");
}
void test(const char *s1, size_t l1, const char *s2, size_t l2) {
printf("\n");
printbstr(s1, l1);
printf("locate ");
printbstr(s2, l2);
const char *r = bstrstr(s1,l1,s2,l2);
if (!r)
printf("not found\n");
else {
printf("result ");
printbstr(r, l1-(size_t)(r-s1));
}
}
int main () {
char *s1 = "I\0am a\0manz";
size_t l1 = 11;
printf("bstrstr test\n------\n");
printbstr(s1, l1);
printf("locate \\%c:%s\n", '0', bstrchr(s1,'\0',l1));
printf("locate %c:%s\n", 'I', bstrchr(s1,'I',l1));
printf("locate %c:%s\n", 'a', bstrchr(s1,'a',l1));
printf("locate %c:%s\n", 'n', bstrchr(s1,'n',l1));
printf("locate %c:%s\n", 'i', bstrchr(s1,'i',l1));
printf("locate %c:%s\n", 'z', bstrchr(s1,'z',l1));
test(s1, l1, "a\0m", 3);
test(s1, l1, "z", 1);
test(s1, l1, "I", 1);
test(s1, l1, "am a", 4);
test(s1, l1, "anz", 3);
test(s1, l1, "ax", 2);
test(s1, l1, "\0x", 2);
test(s1, l1, " x", 2);
test(s1, l1, "\0a", 2);
test(s1, l1, "a\0m", 3);
test(s1, l1, "x", 1);
test(s1, l1, "z", 1);
return 0;
}
Wednesday, June 29, 2011
How to install GIT repo in ZyXEL NSA-320
ZyXEL NSA-320 is 1.2GHz NAS box with maximum of 2 x 2T harddisk (SATA I/II only)
The current firmware is 4.01 and is OK for the fun_plug
This box provides a very cheap alternative for the git repo plus your other storage need such as video, music download and backup as well.
You can gain telnet access following the instruction here : http://zyxel.nas-central.org/wiki/FFP-stick
and if you want to install GIT repo in this box, follow these steps.
(1) Follow the instruction here to gain telnet access, enable ssh server in the box, move the ffproot to harddisk and reboot your NAS box
http://zyxel.nas-central.org/wiki/FFP-stick
If you failed the installation, I suggest you to download this directly http://www.inreto.de/dns323/fun-plug/0.5/fun_plug.tgz and put the fun_plug.tgz in your USB stick rather than let it download during setup.
(2) install all packages (as you need most of them to build the git binary) from here
assume your server ipaddress is 192.168.0.10 and use ssh to access the NAS box
(3) remove dns323 utilities which are not useful for NSA-320
(4) install PERL & python
(5) install the build environment
(6) modify the file chroot.sh to this
(7) chroot to the build environment and get the git source and install it in NAS box
(8) after installation of git, exit the build environment
(9) create git repo in the box (from your desktop)
(10) push your project to the git repo in the NAS box (from your desktop)
(11) If you don't want to build it. Just download this package and install it using funpkg -i git-1.7.6.tgz However, you still need to have some package dependencies like PERL & python in order to run.
.
.
.
The current firmware is 4.01 and is OK for the fun_plug
This box provides a very cheap alternative for the git repo plus your other storage need such as video, music download and backup as well.
You can gain telnet access following the instruction here : http://zyxel.nas-central.org/wiki/FFP-stick
and if you want to install GIT repo in this box, follow these steps.
(1) Follow the instruction here to gain telnet access, enable ssh server in the box, move the ffproot to harddisk and reboot your NAS box
http://zyxel.nas-central.org/wiki/FFP-stick
If you failed the installation, I suggest you to download this directly http://www.inreto.de/dns323/fun-plug/0.5/fun_plug.tgz and put the fun_plug.tgz in your USB stick rather than let it download during setup.
(2) install all packages (as you need most of them to build the git binary) from here
assume your server ipaddress is 192.168.0.10 and use ssh to access the NAS box
ssh root@192.168.0.10
mkdir -p /ffp/pkg
cd /ffp/pkg
rsync -av inreto.de::dns323/fun-plug/0.5/packages .
cd packages
funpkg -i *.tgz
(3) remove dns323 utilities which are not useful for NSA-320
funpkg -r dns323-utils-0.7.176-2.tgz(4) install PERL & python
cd /ffp/pkg
wget http://www.inreto.de/dns323/fun-plug/0.5/extra-packages/perl/perl-5.10-2.tgz
wget http://www.plord.co.uk/funplug/0.5/python-2.6.4-1.tgz
funpkg -i python-2.6.4-1.tgz perl-5.10-2.tgz(5) install the build environment
mkdir -p /i-data/md0/ffpbuildenv
cd /i-data/md0/ffpbuildenv
svn co svn://inreto.de/svn/dns323/funplug/trunk .(6) modify the file chroot.sh to this
- chroot.sh Select all
#!/ffp/bin/sh
set -x
CWD=$(pwd)
ffp=$(readlink -f /ffp)
root=/ffp-chroot
if [ -d "$root" ]; then
echo "$root exists"
exit 1
fi
mkdir -p $root
cd $root
mkdir -p ffp dev etc proc sys mnt i-data/md0
mount -t proc proc proc
mount -t sysfs sysfs sys
mount --bind /dev dev
mount --bind /etc etc
mount --bind $ffp ffp
mount --bind /i-data/md0 i-data/md0
ln -s ffp/bin bin
ln -s ffp/lib lib
ln -s ffp/sbin sbin
ln -s ffp usr
ln -s i-data/md0/ffproot/home home
chroot . $SHELL
umount i-data/md0
umount ffp
umount etc
umount dev
umount sys
umount proc
rm bin lib sbin usr home
rmdir ffp dev etc proc sys i-data/md0 mnt
rmdir i-data
cd ..
rmdir $root
(7) chroot to the build environment and get the git source and install it in NAS box
cd /i-data/md0/ffpbuildenv
sh chroot.sh
cd i-data/md0/ffpbuildenv/source
wget http://kernel.org/pub/software/scm/git/git-1.7.6.tar.bz2
tar xjvf git-1.7.6.tar.bz2
cd git-1.7.6
./configure --prefix=/ffp
NO_NSEC=YesPlease make install
(8) after installation of git, exit the build environment
exit
(9) create git repo in the box (from your desktop)
ssh root@192.168.0.10 "mkdir -p /home/root/git/yourproject.git; cd /home/root/git/yourproject.git; git --bare init; touch git-daemon-export-ok"
(10) push your project to the git repo in the NAS box (from your desktop)
cd ~/yourprojectdir
git init
git add . # include everything below ./ in the first commit;
# if you want to remove use git rm -r --cache xxx
git commit
git remote add origin ssh://root@192.168.0.10/home/root/git/yourproject.git
git push origin master
(11) If you don't want to build it. Just download this package and install it using funpkg -i git-1.7.6.tgz However, you still need to have some package dependencies like PERL & python in order to run.
.
.
.
Subscribe to:
Posts (Atom)



