I'm happy to live!

Develop with pleasure!

  BlogJava :: 首页 :: 新随笔 :: 联系 :: 聚合  :: 管理 ::
  39 随笔 :: 2 文章 :: 31 评论 :: 0 Trackbacks

#

MySQL中的定时执行

 

  查看event是否开启

  show variables like '%sche%';

  将事件计划开户

  set global event_scheduler =1;

 

  创建存储过程test

  CREATE PROCEDURE test ()
  BEGIN
  update examinfo SET endtime = now() WHERE id = 14;
  END;

 

  创建event e_test

  create event if not exists e_test
  on schedule every 30 second
  on completion preserve
  do call test();

 

  每隔30秒将执行存储过程test,将当前时间更新到examinfo表中id=14的记录的endtime字段中去.

 

  关闭事件任务

  alter event e_test ON
  COMPLETION PRESERVE DISABLE;

 

  开户事件任务
  alter event e_test ON
  COMPLETION PRESERVE ENABLE;

 

  以上测试均成功,测试环境为mysql 5.4.2-beta-community mysql community server(GPL)

posted @ 2009-11-20 00:25 Norsor 阅读(1354) | 评论 (2)编辑 收藏

最近接触了jquery,感觉很不错,以后不用写这么繁杂的js代码了,不错,现在手上又接了个新项目,正好在新项目上边学边用了,此文继续更新中...

posted @ 2009-11-09 23:43 Norsor 阅读(194) | 评论 (0)编辑 收藏

    
    Ajax也用了很长时间了,今天只是想整理一下我心中的Ajax.
    简单的说Ajax就是实现了异步向服务器请求数据,让用户有更好的体验.
    XMLHttpRequest其实也就只有两种方式返回请求后的数据:

    1.responseText方式,它是返回文本字串的方式,其实采用这种方式,通常是在服务端在对请求响应处理后,生成好要在浏览器上展示的html代码后,再直接输出到客户端,更新需要更新的客户端页面内容.这种方式的好处是能在服务端生成好客户端代码,可减轻客户端的负担,客户端只需将服务端生成的代码innerHTML到对应的区域就行了... ...  但它的缺点在于,输出到客户端的是文本数据,所以无法对得到的数据在客户端进行处理,所以就难以行成根据取回的数据的差异对页面进行必要的逻辑处理.

    2.responseXML方式,它是返回XML格式的文本,它是在服务端在对请求响应处理后,将数据以XML格式的文本返回到客户浏览器上,然后再由客户端来完成方式1中由服务端来完成的生成页面展示的内容. 客户端将解析返回的XML数据,然后再进行页面的展示,由于是XML数据所以可以进行解析便可以根据解析出的数据对如何展示页面进行逻辑处理,在这一点上是比responseText要灵活的.但付出的是加大了客户端的负担.

    其实现在我正在学习JSON,如果在responseText方式中返回JSON方式的数据的话,是完全可以让responseText和responseXML一样的灵活的,因为JSON也是一种数据结构,可以将要返回的数据组织在其中,到客户端再进行解析,解析也相当简单,只需evel执行即可...  但前提是输出到客户端的JSON数据结构是正确的,不然js就会bomb!

    以上是仅是我个人的看法,有不对之处请大家多指点!
posted @ 2009-07-26 22:49 Norsor 阅读(2155) | 评论 (5)编辑 收藏




<IMG onclick="go()" ID="sphere" SRC="tt.jpg" STYLE="position:absolute;filter:fliph;clip=rect(100 170 140 70)"/>
这样以后,无法响应onclick事件,试了其它事件,好像都不能响应了,
如果改成:
<IMG onclick="go()" ID="sphere" SRC="tt.jpg" STYLE="position:absolute;clip=rect(100 170 140 70)"/>

<IMG onclick="go()" ID="sphere" SRC="tt.jpg" STYLE="position:absolute;filter:fliph"/>
就都能响应事件
请问这是为什么啊,就想知道为什么?
posted @ 2009-07-16 09:40 Norsor 阅读(750) | 评论 (0)编辑 收藏

以下是近期项目碰到的ajax的一些问题列举出来供大家分享,希望有所帮助,还在不断增加中:

1.ajax,action中response返回的xml文档格式错误时,eclipse debug进入不到action中.

2.ajax缓存问题,需要加入xmlHttp.setRequestHeader("If-Modified-Since","0");便可解决.

3.如果不是ajax提交,而设置了PrintWriter out = response.getWriter();则jsp会产生中文乱码.

4.ajax返回xml乱码的原因
response.setContentType("text/xml;charset=GBK");
PrintWriter out = response.getWriter();
这样才起作用,如果这样:
PrintWriter out = response.getWriter();
response.setContentType("text/xml;charset=GBK");
那么response.setContentType("text/xml;charset=GBK");就不起作用了所以返回是乱码,这个问题搞了很久,代码还得仔细看啊.

5.ajax表单提交
xmlHttp.setRequestHeader("Content-Type","application/x-www-form-urlencoded");
由于传过去的是utf-8编码的,所以在action 或servlet中接受时要进行相应转码.

 

posted @ 2009-05-09 15:26 Norsor 阅读(1605) | 评论 (1)编辑 收藏

今天做个spring和struts的集成Demo,我用的是myeclipse6.5,导入spring框架和struts框架都相当方便,一切就序后,开tomcat,跑吧,相当的不爽,第一个链接就爆: servlet action is not available,什么意思啊,难道我的配置文件没配对?检查了没天也没发现什么问题.
以下是我的struts  的struts-config.xml:
<struts-config>
    
<data-sources />
    
<form-beans />
    
<global-exceptions />
    
<global-forwards />

    
<action-mappings>
        
<action path="/hello" type="com.laxxx.struts.action.Hello">
            
<forward name="hello" path="/hello.jsp" />
        
</action>
    
</action-mappings>

    
<controller
        
processorClass="org.springframework.web.struts.DelegatingRequestProcessor" />


    
<message-resources
        
parameter="com.laxxx.struts.ApplicationResources" />


    
<plug-in
        
className="org.springframework.web.struts.ContextLoaderPlugIn">

        
    
<set-property property="contextConfigLocation"
            value
="/WEB-INF/applicationContext.xml" />
    
</plug-in>
</struts-config>

以下是spring的applicationContext.xml:
<beans xmlns="http://www.springframework.org/schema/beans"
    xmlns:xsi
="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation
="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd">

    
<bean name="/hello" class="com.laxxx.struts.action.Hello">

    
</bean>
</beans>

看了又看找了又找,还是没看出问题,把struts-config中关于spring两段配置去掉后,单跑struts是没问题的,看来很有可能myeclipse没把包导全啊,可能没找到,发现好多人都中过此招,有些包没找到spring的代理请求处理类或者是没找到初始化spring上下文的插件类,这两个类都在spring.jar中,于是把这个jar包放入lib目录中去,重启tomcat... ... 再点,ok,终于到应该去的地方了.
posted @ 2008-12-04 17:19 Norsor 阅读(546) | 评论 (0)编辑 收藏

今天画线,居然笨到用ps做图来做td的背景在html中当成线条,同事一提醒才知道html中还有个fieldset-->legend标签,就是用来显示线框的,唉,居然从来没用过,不过学到了哈.
<fieldset>
  
<legend>
    Infomation
  
</legend>
  height:180cm
</fieldset>

还有个标记<pre>可以保持文本原本的格式:
<pre>
for(int i = 0;i 
< 10;i ++){
  System.out.println("goal");
}
</pre
>
以上代码在html显示出来不会变形
posted @ 2008-10-30 23:06 Norsor 阅读(1493) | 评论 (5)编辑 收藏

我用的是webwork最新版本2.2,,
在页面上输入姓名后提交到helloWorld.action,到一个新的页面,可interceptor不起作用,所以早前输入的name值也为null.
可不知为什么interceptor不起作用,请大家帮帮忙,这个问题困扰我一个星期了..还是没能解决..

Tomcat不报错,但显示如下信息:
请各位大侠帮帮忙啊,小弟先谢了...

2005-12-5 17:13:32 com.opensymphony.xwork.config.providers.XmlConfigurationProvider verifyInterceptor
严重: Unable to load class com.opensymphony.xwork.spring.interceptor.ActionAutowiringInterceptor for interceptor name au
towiring. This interceptor will not be available.
Cause: Could not load class com.opensymphony.xwork.spring.interceptor.ActionAutowiringInterceptor. Perhaps it exists but
certain dependencies are not available?
2005-12-5 17:13:32 com.opensymphony.xwork.config.providers.InterceptorBuilder constructInterceptorReference
严重: Unable to find interceptor class referenced by ref-name completeStack


我的xwork.xml内容如下:

<xwork>
<include file="webwork-default.xml"/>

<package name=
"default" extends="webwork-default">
<!-- Include webwork defaults (from WebWork JAR). -->
<default-interceptor-ref name=
"completeStack"/>

<action name=
"helloWorld"
class=
"test.HelloWorldAction">
<result name=
"success">hello.jsp</result>
<result name=
"input">name.jsp</result>
</action>
</package>
</xwork>
posted @ 2005-12-05 19:31 Norsor 阅读(1048) | 评论 (1)编辑 收藏

  1. found/coin/garden                      I found a coin in my garden.
  2. put/sugar/my tea                         Please put some sugar in my tea.
  3. cut/wood/fire                              Cut some woods for fire.
  4. bought/newspaper                      I bought a piece of newspaper this morning.
  5. made/coffee                                I made a cup of coffee.
  6. like/curtains in this room         I like the curtains in this room.
posted @ 2005-11-25 10:18 Norsor 阅读(423) | 评论 (1)编辑 收藏

I have been browsing website of the Apache Software Foundation the whole day.
The Apache Software Foundation is an opensource organization of java, and it has many projects and subprojects, such as Tomcat,Struts,Logging,Web Service and Httpclient.
This organization has many volunteers from all over the world, they contribute their achievements to this organization.
The orgznization has developed rapidly.
I thouht h
ow  I can share my achievements with them?
I know  now.
The organization has a community on it's website.
I thought I can learned a lot of knowledge of java  here. 

posted @ 2005-11-23 23:11 Norsor 阅读(306) | 评论 (0)编辑 收藏

仅列出标题
共4页: 上一页 1 2 3 4 下一页