在运行Android官网上LinearLayout的例子时,发现一个奇怪的现象,和属性layout_weight有关。我用的是Android 2.2平台。LinearLayout例子的布局代码如下:
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent">
<LinearLayout
android:orientation="horizontal"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_weight="1">
<TextView
android:text="red"
android:gravity="center_horizontal"
android:background="#aa0000"
android:layout_width="wrap_content"
android:layout_height="fill_parent"
android:layout_weight="1"/>
<TextView
android:text="green"
android:gravity="center_horizontal"
android:background="#00aa00"
android:layout_width="wrap_content"
android:layout_height="fill_parent"
android:layout_weight="1"/>
<TextView
android:text="blue"
android:gravity="center_horizontal"
android:background="#0000aa"
android:layout_width="wrap_content"
android:layout_height="fill_parent"
android:layout_weight="1"/>
<TextView
android:text="yellow"
android:gravity="center_horizontal"
android:background="#aaaa00"
android:layout_width="wrap_content"
android:layout_height="fill_parent"
android:layout_weight="1"/>
</LinearLayout>
<LinearLayout
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_weight="1">
<TextView
android:text="row one"
android:textSize="15pt"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_weight="1"/>
<TextView
android:text="row two"
android:textSize="15pt"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_weight="1"/>
<TextView
android:text="row three"
android:textSize="15pt"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_weight="1"/>
<TextView
android:text="row four"
android:textSize="15pt"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_weight="1"/>
</LinearLayout>
</LinearLayout>
Read more…
去年某一段时间关注过android,因为在新闻中看到了它,于是就进一步了解了一下,不过没有学android平台上的编程开发。前几天无意间在csdn上发现某人写的博客(Android_Tutor),专门介绍android应用开发的。脑子一热,突然想学一学,于是就到android官网看起了开发文档。趁着现在还有兴趣,趁热打铁吧,学多少算多少,就当增加知识储备了。先从官网文档开始,一步步了解,学到什么程度就看我有多少毅力了。
PS:明天,8月9日,留美两周年纪念日,得写点东西回顾一下。
找了一些有关CPS(Cyber Physical System)的论文和其他文献,感兴趣的可以看看。
- Edward Lee, Cyber Physical Systems – Are Computing Foundations Adequate?, 2006
- Edward Lee, Computing Foundations and Practice for Cyber Physical Systems: A Preliminary Report, 2007
- Edward Lee, Cyber Physical Systems: Design Challenges, 2008
- Helen Gill, From Vision to Reality: Cyber Physical Systems, 2008
- Carolyn Talcott, Cyber Physical Systems and Events, 2008
- Lui Sha et al, Cyber Physical Systems: A New Frontier, 2009
- Timothy Hnat et al, MacroLab: A Vector-based Macropramming Framework for Cyber Physical Systems, 2008
- Yuanfang Zhang et al, Reconfigurable Real-Time Middleware for Distributed Cyber Physical Systems with Aperiodic Events, 2008
- Akshay Dabholkar et al, An Approach to Middleware Specialization for Cyber Physical Systems, 2009
这学期的CIS 825挑了个有关YAWL的project,确切说不是我们挑的,我们是“被挑的”,动手晚了,其他project都被阿三们抢光了。这篇博文就瞎扯一下YAWL,根据我所知道的。
YAWL(Yet Another Workflow Language),从名字就可以看出来YAWL是用于工作流程(Workflow)管理的,或者商业流程管理BPM(Business Process Management)。YAWL通过对商业流程进行建模实现一个完整的BPM系统,管理整个工作流程的运作。YAWL是基于Petri Nets和Workflow Patterns搭建而成的。目前有三类安装版本,YAWL4Study,YAWL4Enterprise和YAWLive。YAWL4Study是单机版的,单用户;YAWL4Enterprise是服务器版的,多用户;YAWLive是LiveCD版本的,在Linux系统上预装了YAWL,可以直接从光盘启动。我用的是YAWL4Study,只是为了写project。YAWL4Study安装后由两部分组成,Editor和Control Centre,另外还有两个快捷方式用于Start和Stop Engine。YAWL Editor用于对workflow system进行建模,然后在YAWL Control Centre上模拟运行。当连接Control Centre进行模拟时时,必须启动Engine。
Read more…
今晚看了《TCP/IP详解 卷1:协议》的第三章内容,IP:网际协议。看到介绍IP首部检验和字段时,有点摸不着头脑,好像自己以前都没仔细去推敲过,只是单纯的看了之后记一下。这种没有理解的记忆一般都持续不了多久,所以每次看,我都觉得很陌生。IP首部(不包括选项和数据)有20字节(160位),16位的IP首部检验和包括在内。根据书上的描述,IP首部检验和的计算步骤如下:
发送方:
Step 1:把检验和字段置为0,即把16位都置为0.
Step 2:对首部中每一组16位进行二进制反码,然后求和,将结果存在检验和字段中。
接收方:
Step 1:对首部的每组16位进行二进制反码(包括16位的检验和字段),然后求和。
Step 2:如果和全为1,那么数据传输过程中没有出现差错;如果不全为1,即检验和错误,丢弃该数据报。
Read more…
February 10th, 2010
nanyo
对Unix (or Linux)一窍不通,在同学的推荐下买了apue 2nd edition,看了几章了。今天想试试书上提供的源代码,首先解压源代码,得到目录apue.2e,打开此目录,按照readme里提供的方法,先将文件Make.defines.linux里的WKDIR改为你的源代码存放路径,默认是WKDIR=/home/var/apue.2e,修改完后,在目录apue.2e下执行make命令,出错。我的系统是Ubuntu 9.10,linux内核好像是2.6.30的。编译出错的原因应该是兼容性的问题,错误显示threadctl/getenv1.c下ARG_MAX未定义。ARG_MAX是在头文件limits.h中定义的,但该文件位于目录/usr/include/linux/下,而getenv1.c的include语句是“#include <limits.h>”,这将在usr/include/下查找文件limits.h,但include目录下的文件limits.h并没有定义ARG_MAX。因此将include语句改为“#include <linux/limits.h>”就行了。除了getenv1.c,还需修改同一目录下的getenv3.c的头文件声明部分,将“#include <limits.h>”改为“#include <linux/limits.h>”。修改保存后,在apue.2e目录下执行make,显示了两个warning,问题出在文件/threads/badexit2.c的两个函数里:printfoo和thr_fn2,我没理会这两个warning,这样源代码算是编译完成了。另外一个问题,网上不少文章说要改apue.2e/std/目录下的linux.mk文件,将nawk改为awk,这只需要在你的linux内核版本较老时才需要,nawk是新的awk,内核版本低的不支持nawk。如果内核版本较高,不需要修改。我在改和不改的情况下都试了一次,结果都一样。
Read more…
之前在台式机上装了双系统,电脑自带的是Vista Home Premium,而我装了Ubuntu 9.10。Ubuntu的Grub自动给电脑做好了引导程序,但默认的启动系统我选的是Ubuntu,不是Vista。后来发现,还是Vista用的多,但启动系统时一不留神就进来Ubuntu,得重启后再进Vista,如此折腾了多次。今天心血来潮,想把默认启动的系统改为Vista。Google了很多修改grub的文章,大多是针对Ubuntu 9.10之前的版本的,这些版本使用的是grub,而Ubuntu 9.10用的是Grub2。Grub2和Grub还是有些不同的,比如/boot/grub/文件夹下就找不到menu.lst。而网上的多数方法都是针对Grub。有关Grub2的修改的文章有一些,但大部分方法不对头,这些方法建议修改/boot/grub/grub.cfg的相关内容,如set default=”0″,来指定默认的启动系统。但这样治标不治本,更新grub之后,所作的修改都会失效。究其原因,可以看grub.cfg文件开头的一段描述:
Read more…
最新评论