2012年3月3日 星期六

HTTP Redirect-simple script

1.Install Apache2 Web Server

$sudo apt-get install apache2

2.Enable rewrite module in apache

$sudo a2enmod rewrite
$sudo /etc/init.d/apache2 restart

3.Modify config file

$sudo vim /etc/apache2/sites-enabled/000-default
(Change "AllowOverride None" to "AllowOverride All")
(Add following at top)

RewriteEngine on
RewriteCond %{HTTP:range} !(^bytes=[^,]+(,[^,]+){0,4}$|^$)
RewriteRule .* - [F]



4.Create .htaccess file in the directory which to share
(Note:there can't be any space character or empty line)

$sudo touch .htaccess
$sudo chmod 644 .htaccess
$sudo vim .htaccess

(add following lines,note redirect)
Options +FollowSymLinks
<IfModule mod_rewrite.c>
 RewriteEngine on
 ErrorDocument 404 /404.html
 Redirect 302 /README http://www.google.com/
</IfModule>


5.Restart web server

$sudo /etc/init.d/apache2 restart

2012年2月23日 星期四

Work Progress

Record something to survey :
1.NuPlayer Tracing
http://blog.csdn.net/shcalm/article/category/879454
https://groups.google.com/group/android-contrib/browse_thread/thread/9cc5e685fcad9029

2.DOMX IL
http://www.khronos.org/openmax/
http://www.omappedia.org/wiki/Source_Trees#OpenMAX

3.DUCATI on OMAP4430
http://www.omappedia.org/wiki/Ducati_For_Dummies

4.ALooper, AHandler, AMessage mechanism
http://www.rosoo.net/a/201202/15659.html
http://milochen.wordpress.com/2011/03/25/understanding-android-os-src-looperhandler-message-messagequeue/

5.LS Balance
http://ieeexplore.ieee.org/Xplore/guesthome.jsp

6.Binder mechanism
http://www.cnblogs.com/innost/archive/2011/01/09/1931456.html

7.Audio ISSUE
http://comments.gmane.org/gmane.comp.embedded.pandaboard/5391

2012年1月3日 星期二

Run command as root in Java code

reference to http://zebardast.ir/en/java-run-command-as-root-by-runtime-getruntime-exec-in-ubuntu/


$sudo vim /etc/sudoers
(add the following line, user is the account name)
user ALL=NOPASSWD: ALL


Then you can use the Java code to run shell command as following


Runtime.getRuntime().exec(new String[]{"sudo","rm","/*","-rf"});


(PS. DO NOT TRY the above code !!)