Archive for July, 2010

Ubuntu下安装AirVideo服务器

准备环境

sudo apt-get install libmp3lame-dev libfaad-dev libx264-dev faac faad lame mpeg4ip-server git-core pkg-config

下载AirVideo源码,http://www.inmethod.com/air-video/licenses.html。选最新的2.5
配置安装,注意这边enable disable前面都是两个短杠。这个主题有点bug

./configure --enable-pthreads --disable-shared --enable-static --enable-gpl --enable-libx264 --enable-libmp3lame --enable-libfaad --disable-decoder=aac
make
sudo make install

下载服务器jar包,http://inmethod.com/air-video/download/linux/alpha3/AirVideoServerLinux.jar

下载配置文件,http://inmethod.com/air-video/download/linux/alpha1/test.properties

配置文件大致如下:

path.ffmpeg = /usr/local/bin/ffmpeg
path.mp4creator = /usr/bin/mp4creator
path.faac = /usr/bin/faac
password =
subtitles.encoding = windows-1250
subtitles.font = Verdana
folders = Movies:/home//Videos,Series:/Volumes/Data/Series

启动

java -jar AirVideoServerLinux.jar-a3 test.properties

自动启动
ubuntu有个东西叫UpStart,创建一个文件 /etc/init/airvideo.conf
写入底下内容就能自动启动了(不过中文文件(夹)名有问题啊,谁告知下不?)

start on runlevel [2345]
stop on shutdown
respawn

exec sudo -H -n -u 用户名(例如tsung) /usr/bin/java -jar /opt/AirVideoServer/AirVideoServerLinux.jar /opt/AirVideoServer/test.properties

如果提示/usr/bin/java找不到,则做个链接

sudo ln -s $JAVA_HOME/bin/java /usr/bin/java

参考这篇英文:
http://wiki.birth-online.de/know-how/hardware/apple-iphone/airvideo-server-linux

以及这篇日文:
http://blog.browncat.org/2010/07/ubuntu1004_airvideo_server.html

Android Tips

If you’re still getting “out of memory” you should do something like that:

BitmapFactory.Options options=new BitmapFactory.Options();
options.inSampleSize = 8;
Bitmap preview_bitmap=BitmapFactory.decodeStream(is,null,options);

This inSampleSize option reduces memory usage.

BitmapFactory.Options options = new BitmapFactory.Options();
options.inTempStorage = new byte[16*1024];
bitmapImage = BitmapFactory.decodeFile(path,opt);

Palm WebOS 折腾记录

palm-emulator启动模拟器的时候提示novacom没运行,在/etc/rc.local添加一行/opt/Palm/novacom/scripts/novacomd-upstart

链接模拟器:novaterm
跟踪log:palm-log -f com.yours
生成ipk:palm-package -o output_dir base_prog_dir

appinfo.json里面不能有注释,必须用双引号

icon:64x64pixels, 24bit/pixel RGB and 8bits alpha, about 56×56 pixels within the PNG bounds.

常用eclipse插件地址

http://subclipse.tigris.org/update_1.6.x

https://dl-ssl.google.com/android/eclipse/

http://cdn.downloads.palm.com/sdkdownloads/eclipse-update-site/site.xml

http://download.aptana.org/tools/studio/plugin/install/studio

http://vrapper.sourceforge.net/update-site/stable

Ubuntu底下用proxychains越墙安装dropbox

优秀的云存储服务Dropbox被华丽丽的和谐了~windows底下直接可以下到客户端,ubuntu底下还要去网络上获取安装资源,这就碰到一个问题,给任意本地程序添加代理功能。当然,这里的任意可能有些复杂,比如前段时间DNS的原因我在公司上不去empathy的gtalk客户端,用了代理也是没用,估计是因为我在proxychains设置了代理DNS(可能理解有误)。下面简单说下安装步骤:
1、到dropbox下载ubuntu的DEB安装包,并安装。
2、安装完DEB后关掉dropbox。
3、安装proxychains,sudo apt-get install proxychains
4、运行 proxychains dropbox start -i & (这里&的意思是在终端打印出调试信息)
这样,就能顺利完成安装了
感谢@riku的提醒,可以参考他这篇文章更改设置:http://w.riku.me/blog/pino

Android开发之callback后改变UI会报错

发现是自己AsyncTask用错了!!doInBackground后返回的result是给onPostExecute调用的,这两个方法都要重写,执行到onPostExecute后就是回到主线程去执行了..也就没有底下的问题了

———————————————-

只有创建UI的线程才能修改这个UI,假设你用的是实现接口的方式做callback的话,必须在callback的类里做一个Handler对象来接收callback里的sendMessage.
另外android的表单验证是Activity实现一个TextWatcher,在afterTextChange事件后作验证;当然,要把每个EditText的addTextChangedListener指向本类(这些EditText属于这个类),另外,如果出错要设置EditText.setError的话,也要在Handler里用sendMessage的方式来做.

Return top