后来
后来我发现,不是我身边的人变了,而是我变了。变得忍耐力强,变得对待事情不那么较真,变得害怕吵架,变得害怕哭泣,害怕那种由于情感的波动而导致身体的不适的可怕的感觉。
发现很多事情都是累积和惯性的结果,如果你认为他有某种恶习,那么除非他痛改前非的非常明显,才会在内心里消除掉不好的印象,否则,但凡有类似的恶习出现,则开始认为这人死不悔改。
心里难过,偷偷哭,委屈到极点的纵容自己的眼泪,不再想像年轻的时候,希望有人来安慰,因为,哭泣的目的很单纯,那就是告诉自己,我委屈了,需要哭泣,不想理智的告诉自己不要生气,也没法为了心疼眼睛而控制,所以,那就哭吧。很清楚自己在干什么,想干什么,那就这么做吧。
如果两个人亲近到说话可以肆无忌惮,那就危险了。
在安装了Android的SDK(1.0版)和为Eclipse安装完毕ADT插件之后,DDMS控制台没有打印出什么信息,在0.9版本的时候,没有遇到这个问题,不知道该怎么办。
临时的办法是:继续使用Eclipse来启动模拟器,直接使用sdk中提供的ddms来连接这个模拟器。也没有麻烦太多。但是发现ddms也启动不了:
12:43 E/ddms: shutting down due to uncaught exception
12:43 E/ddms: java.lang.UnsatisfiedLinkError:
/data/programs/android/android-sdk-linux_x86-1.0_r1/tools/lib/libswt-pi-gtk-3232.so:
/data/programs/android/android-sdk-linux_x86-1.0_r1/tools/lib/libswt-pi-gtk-3232.so:
wrong ELF class: ELFCLASS32 (Possible cause: architecture word width
mismatch)
at java.lang.ClassLoader$NativeLibrary.load(Native Method)
at java.lang.ClassLoader.loadLibrary0(ClassLoader.java:1751)
at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1660)
at java.lang.Runtime.loadLibrary0(Runtime.java:822)
at java.lang.System.loadLibrary(System.java:993)
at org.eclipse.swt.internal.Library.loadLibrary(Library.java:123)
at org.eclipse.swt.internal.gtk.OS.<clinit>(OS.java:22)
at org.eclipse.swt.internal.Converter.wcsToMbcs(Converter.java:63)
at org.eclipse.swt.internal.Converter.wcsToMbcs(Converter.java:54)
at org.eclipse.swt.widgets.Display.<clinit>(Display.java:126)
at com.android.ddms.UIThread.runUI(UIThread.java:329)
at com.android.ddms.Main.main(Main.java:97)
原因大概是android sdk不是for x86_64版本的,所以从Eclipse那里下载swt-3.2-gtk-linux-x86_64.zip,解压缩后覆盖tools/lib下的那几个文件,就可以启动了。
好多天了,什么都写不出来,脑子空空,想好好珍惜这几天,难得的。到底在追求改变还是不变,不清楚,奇怪的人,奇怪的思想,奇怪的想念,奇怪的理论,奇怪的时间,奇怪的愤怒,奇怪的奇怪的。
关于Ajax的框架,以前用的是Buffalo,但是DWR比较热,于是配置一下DWR玩一玩。现在的形势是:无论弄个什么框架,如果不和Spring集成一下,都不好意思跟别人打招呼。
在这里使用的Spring和DWR都是最新的版本:
Spring版本: 2.5.5
DWR版本:2.0.5
首先来一个测试页面,这是一个静态页面,在这个页面中调用java.util.Date的toString()方法。使用java.util.Date比较简单,这样除了用到了Spring和DWR的类库外,不用写任何Java代码既可以达到演示的目的。
<body>
<input type=’button’ on-click=’javaDate.toString(reply);’ value=’show time’/>
<script type=’text/javascript’>
var reply = function(data)
{
if (data != null && typeof data == ’object’)
alert(dwr.util.toDescriptiveString(data, 2));
else
dwr.util.setValue(’d0′, dwr.util.toDescriptiveString(data, 1));
}
</script>
<br>
<span id=’d0′></span>
</body>
</html>
接下来有两种配置Spring与DWR集成的方式:
第一种配置方式
在这种方式中,不需要dwr.xml文件,将这部分配置与Spring的配置写在同一个文件中。DWR使用的servlet为:org.directwebremoting.spring.DwrSpringServlet,这样,只需要两个配置文件就可以了,分别是:
web.xml:
<web-app id="simplelife.cn">
<context-param>
<param-name>contextConfigLocation</param-name>
<param-value>/WEB-INF/applicationContext.xml</param-value>
</context-param>
<listener>
<listener-class>
org.springframework.web.context.ContextLoaderListener
</listener-class>
</listener>
<servlet>
<servlet-name>dwr-invoker</servlet-name>
<display-name>DWR Servlet</display-name>
<description>Direct Web Remoter Servlet</description>
<servlet-class>org.directwebremoting.spring.DwrSpringServlet</servlet-class>
<!– This should NEVER be present in live –>
<init-param>
<param-name>debug</param-name>
<param-value>true</param-value>
</init-param>
<!– Remove this unless you want to use active function reverse() {
[native code]
} ajax –>
<init-param>
<param-name>activeReverseAjaxEnabled</param-name>
<param-value>true</param-value>
</init-param>
<!– By default DWR creates application scope objects when they are first
used. This creates them when the app-server is started –>
<init-param>
<param-name>initApplicationScopeCreatorsAtStartup</param-name>
<param-value>true</param-value>
</init-param>
<!– This enables full streaming mode. It’s probably better to leave this
out if you are running across the internet –>
<init-param>
<param-name>maxWaitAfterWrite</param-name>
<param-value>-1</param-value>
</init-param>
<!–
For more information on these parameters, see:
- http://getahead.org/dwr/server/servlet
- http://getahead.org/dwr/function reverse() {
[native code]
}-ajax/configuration
–>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>dwr-invoker</servlet-name>
<url-pattern>/dwr/*</url-pattern>
</servlet-mapping>
</web-app>
另外一个文件是applicationContext.xml文件:
<bean id="dwrJavaDate" class="java.util.Date">
<dwr:remote javascript="javaDate">
</dwr:remote>
</bean>
<dwr:configuration></dwr:configuration>
<dwr:controller id="dwrController" debug="true" />
</beans>
注意配置文件中的黑体部分。
第二种配置方式
使用第一种方式的Spring配置文件看起来比较乱,不那么干净,在这种方式中,将Spring的配置与DWR的配置完全分开,看起来干净利落。DWR使用的servlet为:org.directwebremoting.servlet.DwrServlet ,这样就需要三个配置文件了:
web.xml文件:
<web-app id="simplelife.cn">
<context-param>
<param-name>contextConfigLocation</param-name>
<param-value>/WEB-INF/applicationContext.xml</param-value>
</context-param>
<listener>
<listener-class>
org.springframework.web.context.ContextLoaderListener
</listener-class>
</listener>
<servlet>
<servlet-name>dwr-invoker</servlet-name>
<display-name>DWR Servlet</display-name>
<description>Direct Web Remoter Servlet</description>
<servlet-class>org.directwebremoting.servlet.DwrServlet</servlet-class>
<!– This should NEVER be present in live –>
<init-param>
<param-name>debug</param-name>
<param-value>true</param-value>
</init-param>
<!– Remove this unless you want to use active function reverse() {
[native code]
} ajax –>
<init-param>
<param-name>activeReverseAjaxEnabled</param-name>
<param-value>true</param-value>
</init-param>
<!– By default DWR creates application scope objects when they are first
used. This creates them when the app-server is started –>
<init-param>
<param-name>initApplicationScopeCreatorsAtStartup</param-name>
<param-value>true</param-value>
</init-param>
<!– This enables full streaming mode. It’s probably better to leave this
out if you are running across the internet –>
<init-param>
<param-name>maxWaitAfterWrite</param-name>
<param-value>-1</param-value>
</init-param>
<!–
For more information on these parameters, see:
- http://getahead.org/dwr/server/servlet
- http://getahead.org/dwr/function reverse() {
[native code]
}-ajax/configuration
–>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>dwr-invoker</servlet-name>
<url-pattern>/dwr/*</url-pattern>
</servlet-mapping>
</web-app>
applicationContext.xml文件,这是一个纯粹的Spring配置文件:
最后一个文件是dwr.xml,在这个文件中,使用spring容器中的对象:
以上两种方式都可以完成Spring与DWR的集成,我比较喜欢第二种,“上帝的归上帝,恺撒的归恺撒”。
如果再需要配置MVC等其他功能,直接在web.xml中声明另外的Servlet即可,就合DWR没什么关系了。
附录:目录结构
[END]
周末看了几集电视剧,主演是王志文和左小青,剧名叫《天道》,最大的特点是台词深奥和感动。记得几句:
1.如果你知道你是谁,你就不是你了;如果你不知道你是谁,你才是你。
2.就希望躺在你的怀里,悄悄的死去,然后你把我撒向大海。
3.我的坟头会开着很多小小的勿忘我,然后你拿着一只花走向坟头,两行泪水从你的眼中流下。
为了试验Mysql的分区功能,所以下载了mysql-5.1.28-rc-linux-x86_64-glibc23.tar.gz,Mysql自5.1起才开始提供partition的功能,只不过现在还是rc版,并且这个特性一直都是试验性质的,not production-ready。最喜欢的就是tar.gz这种形式的二进制软件包了,不需要安装,解开压缩就可以用,data目录等都在当前目录下,很方便。
可是用这个5.1的时候,就出了一些小麻烦:
FATAL ERROR: Could not find /fill_help_tables.sql
If you compiled from source, you need to run ’make install’ to
copy the software into the correct location ready for operation.
If you are using a binary release, you must either be at the top
level of the extracted archive, or pass the –basedir option
pointing to that location.
javor@desktop:/data/programs/mysql$
还可能出现一些其他的错误:
解决办法:
同样,在启动Mysql服务的时候:
在进入mysql client的时候使用同样的方式。
近期发生了两件大事: