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 閱讀(1387) | 評論 (2)編輯 收藏

          最近接觸了jquery,感覺很不錯,以后不用寫這么繁雜的js代碼了,不錯,現在手上又接了個新項目,正好在新項目上邊學邊用了,此文繼續更新中...

          posted @ 2009-11-09 23:43 Norsor 閱讀(239) | 評論 (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 閱讀(2185) | 評論 (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 閱讀(760) | 評論 (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 閱讀(1623) | 評論 (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 閱讀(566) | 評論 (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 閱讀(1526) | 評論 (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 閱讀(1076) | 評論 (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 閱讀(443) | 評論 (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 閱讀(332) | 評論 (0)編輯 收藏

          僅列出標題
          共4頁: 上一頁 1 2 3 4 下一頁 
          主站蜘蛛池模板: 项城市| 永昌县| 睢宁县| 南江县| 通海县| 宁化县| 辽阳市| 金华市| 咸宁市| 年辖:市辖区| 溆浦县| 勐海县| 阿图什市| 顺平县| 隆尧县| 高雄市| 思南县| 防城港市| 南岸区| 青铜峡市| 金秀| 奉节县| 平邑县| 霍林郭勒市| 长治县| 田林县| 如皋市| 舟曲县| 邵武市| 措勤县| 遂川县| 墨竹工卡县| 洪泽县| 汶上县| 黑水县| 天水市| 乳源| 富川| 泾川县| 桃园市| 聂拉木县|