2005年11月16日
#
chrome,firefox下面运行都很正常,唯独在safari下会爆SyntaxError: DOM Exception 12错误:
[Error] Error: SyntaxError: DOM Exception 12
setRequestHeader@[
native code]
http:
//localhost:8989/app/js/base.js:40967:27
http:
//localhost:8989/app/js/base.js:19014:33
forEach@http:
//localhost:8989/app/js/base.js:9537:24
http:
//localhost:8989/app/js/base.js:19012:14
sendReq@http:
//localhost:8989/app/js/base.js:18873:21
serverRequest@http:
//localhost:8989/app/js/base.js:18589:23
processQueue@http:
//localhost:8989/app/js/base.js:22454:29
http:
//localhost:8989/app/js/base.js:22470:39
$eval@http:
//localhost:8989/app/js/base.js:23672:28
$digest@http:
//localhost:8989/app/js/base.js:23488:36
$apply@http:
//localhost:8989/app/js/base.js:23777:31
bootstrapApply@http:
//localhost:8989/app/js/base.js:10661:21
invoke@http:
//localhost:8989/app/js/base.js:13409:22
doBootstrap@http:
//localhost:8989/app/js/base.js:10659:20
bootstrap@http:
//localhost:8989/app/js/base.js:10679:23
angularInit@http:
//localhost:8989/app/js/base.js:10573:14
http:
//localhost:8989/app/js/base.js:35510:16
fire@http:
//localhost:8989/app/js/base.js:3094:35
fireWith@http:
//localhost:8989/app/js/base.js:3206:11
ready@http:
//localhost:8989/app/js/base.js:3412:24
completed@http:
//localhost:8989/app/js/base.js:3428:14
这是个什么error?没见过baidu一下有了:
DOMException是W3C DOM核心对象。
DOMException接口表示一个处理的错误,当一个操作不可能执行的时候,会抛出一个异常。
例如试图创建一个无效的DOM, 或通过一个不存在的节点作为参数节点操作方法。
SYNTAX_ERR code 12 --> 无效或非法的字符串被指定。
具休介绍可以到些链接查看: http:
//www.zhangxinxu.com/wordpress/2012/05/w3c-dom-domexception-object/
先从error stack中找到出错的地方,在angular-file-upload-all.js中的以下位置:
1 var key, i;
2 function patchXHR(fnName, newFn) {
3 window.XMLHttpRequest.prototype[fnName] = newFn(window.XMLHttpRequest.prototype[fnName]);
4 }
5
6
if (window.XMLHttpRequest && !window.XMLHttpRequest.__isFileAPIShim) {
7 patchXHR('setRequestHeader', function (orig) {
8
return function (header, value) {
9
if (header === '__setXHR_') {
10 var val = value(
this);
11
// fix for angular < 1.2.0
12
if (val
instanceof Function) {
13 val(
this);
14 }
15 }
else {
16 orig.apply(
this, arguments);
17 }
18 }
19 });
20 }
出错的位置在第16行,把header打出来看了一下,Authorization的值是这样的'Token '的,后面多了一个空格,果断删除掉空格再试,不爆错了,原来是空格惹的祸,为什么会出错呢,想去看看这个orig的内容是什么,可碰到[
native code],这个估计是c++的code,这个要如何看得到内容呢,问题是解决了,但还未探清问题的源头,又是c代码,请高人指点。
<input name="fieldValue" ng-pattern="{{validateRegexp}}" />
$scope.validateRegexp = "/\\d/";
以上代码,在页面上可以动态改变validateRegexp的值,页面上的ng-pattern的内容也确实变了,但却没有起作用,有没有大侠能解释一下?
1. mysql的数据库文件存放在哪个位置呢,搞了半天可以在workbanch中执行 show variables like '%datadir%' 命令,结果就出来了
经过一年多拶转我又即将回到frontend的开发中来,我比以往有了更多的经验,耐心,专注,比以往更加能规划自已,现在的前端和几年前又不一样了,又多了许多的新东西,我能应付过来么,我相信答案是肯定的,我还能做得更好,加油吧!
想用iframe引用一个网站,但发现该网站做了iframe引用禁止,有没有办法能够让iframe引用它啊?请教各位牛人了.
DateFormat df = DateFormat.getDateTimeInstance(DateFormat.MEDIUM,
DateFormat.SHORT,Locale.CANADA);
TimeZone tz = TimeZone.getTimeZone("America/Los_Angeles");
df.setTimeZone(tz);
String time = df.format(new Date());
System.out.println(time);
如上代码,我构造DateFormat的格式,然后会传入用户所选择的Locale,可能是CANADA,US,CHINA,FRANCH....不同的Locale产生的时间格式不同,比如:
20-Jan-2011 5:35 AM (Locale.CANADA)
Jan 20, 2011 5:38 AM(Locale.US)
Jan 20, 2011 5:39 AM(Locale.ENGLISH)
20 janv. 2011 05:39(Locale.FRANCH)
20.01.2011 05:40(Locale.GERMAN)
2011-1-20 上午5:42(Locale.CHINA)
2011. 1. 20 ?? 5:43(Locale.KOREA)
...等等..
现在这些格式中有的是24小时制显示的,有的是12小时制显示的,我现在想判断每一种Locale是什么时间制,是24还是12小时,然后做相应的处理,怎样判断呢?现在还没有好的办法,请教各位牛人们!
现在
1.在介绍你以前的项目时,请重点跟我介绍你在里面做了什么,怎么做,帮原来公司解决了什么,自己收获了什么,说到底,是你要告诉我你的亮点在哪,别慢舞天际的谈。最郁闷就是碰到有一个在介绍项目时读出一段段的流水账,做了**模块,**模块,**模块...最后我只明白他告诉我他懂得CRUD,神马加浮云。
2.因为我们在行业中算是大型的门户网,对并发要求较高,希望你对性能、并发、分布式等专业领域有一些了解或者研究,哪怕有一些心得也行。
3.在开发方面对struts/spring/hibernate/ibatis等等主流开源框架有一定了解,不要求你一定会哪个,但你选择了哪个框架,就希望你对这个框架的原理,背后的思想有一定的了解,最好还有业界的评测、认识,不要停留在怎么调用api。
4.“我只负责写代码,系统部署运维不关我事”,虽然有些公司是这样的,但这句话我还是不大喜欢,自己写的东西运行的状况如何最起码要有所了解,不要求你掌握着系统的运维,但起码要有所参与,对系统环境和部署要比较熟悉,不要只停留在开发写代码。
5.对主流的服务应用如nginx/apache/resin/tomcat等等,不要求很懂得调优,但起码要会玩。
6.简历不要跟自己的实际情况差太远,如果你写的东西在面试被问到却说不出个所以然,更会减低别人对你的印象。
今天学习了java ResourceBundle类的内容,但一直还有一个问题没有解决,就是它读取资源文件路径的问题.
以下是我的代码:
1package test.resource;
2
3import java.util.Locale;
4import java.util.ResourceBundle;
5
6public class Test {
7 public static void main(String args[]) {
8 Test test = new Test();
9 ResourceBundle messages = test.loadResource();
10 System.out.println(messages.getObject("name"));
11 }
12
13 private ResourceBundle loadResource() {
14 Locale local = Locale.getDefault();
15 ResourceBundle messages = ResourceBundle.getBundle("messages", local,
16 this.getClass().getClassLoader());
17 return messages;
18 }
19}
我的两个资源文件messages_en_US.properties,messages_zh_CN.properties都在当前类路径下面,可是这样的话运行程序它就找不到资源文件,会报错:Can't find bundle for base name messages, locale zh_CN
我必需把两个资源文件copy到classes根目录下才行,我想资源文件是可以放在当前类路径下面的,可是不太清楚如何读取出来,ResourceBundle.getBundle("messages", local,
this.getClass().getClassLoader());方法好像只能读根路径下的资源,请教各位了!
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)
最近接触了jquery,感觉很不错,以后不用写这么繁杂的js代码了,不错,现在手上又接了个新项目,正好在新项目上边学边用了,此文继续更新中...
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!
以上是仅是我个人的看法,有不对之处请大家多指点!
<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"/>
就都能响应事件
请问这是为什么啊,就想知道为什么?
以下是近期项目碰到的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中接受时要进行相应转码.
今天做个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,终于到应该去的地方了.
今天画线,居然笨到用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显示出来不会变形
我用的是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>
- found/coin/garden I found a coin in my garden.
- put/sugar/my tea Please put some sugar in my tea.
- cut/wood/fire Cut some woods for fire.
- bought/newspaper I bought a piece of newspaper this morning.
- made/coffee I made a cup of coffee.
- like/curtains in this room I like the curtains in this room.
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 how 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.
Up to now,my classmate Tao Wei has not found his purse.
There are 30$,a identity card and some credit cards in his purse,Mrs Tao was very unhappy.
He wont to remember what he has done the whole day.
I lost my purse two months ago,there were 200$ , a identity card and 3 credit cards in my purse.
So,I understood Mrs Tao's feeling now.
I returned Chengdu yesterday evening.
I brought some cloth for winter from my home.
My hometown is Eemei, it's to the south of Chengdu,it's a beautiful small city,I was born and studied there,
I got on the bus at Eemei bus station at 6:00 yesterday evening.
I have been sleeping on my way to Chengdu.
I arrived at Chengdu station after tow hours.
I carried a very heavy bag,that's why I went to my department by taxicab istead of by bus.
I have been tired ,up to now,so I wanted to have a rest.
I saw my mother ,my father , my sister-in-law and my nephew.
They looked fine,my nephew was taller than before,He is very lovely.
It was two months since I lost my identity card .
My mother told me my new identity card was completed several days ago.
So,I will go home this afternoon.
I will own my new identity card as soon as I arrive at my home.
I got up and looked out of the window this morning,oh,it rained again.
I had breakfast and then went to work.
A lot of people were waiting for the bus at the bus station this morning.
But the traffic was very havey.
We got on the bus after waiting for a long time .
I disliked this weather, because it was very cold.
昨天在网上不经意的在BT上下了一部俄国战争影片《第九突击队》,没想到俄国影片会有如此高的素质,影片一开始就紧紧的把人吸引住了,真有点美国大片的感觉,影片主要讲俄国在阿富汉的战争,
几个小伙子从新兵训练营到阿富汉的战场,到投入战斗,真的有点写实,不排除对美国战争片的很多引用,特别是到阿富汉飞机舷窗SHENG起来的时候,阿富汉风格的音乐响起,一架武装直升机在半空中盘弦,更让人想了JIE他们将ZAO YU到怎样的阿富汉人,怎么样的战斗,,把战争除开,阿富汉的山地在影片中,我觉得特别的美,,,唉,可惜有基地在那里,现在没人GAN去那里旅游...
不过这真是一部值得一看的影片..
I got up very early this morning.
I jogged along the side of the Sahe river.
I felt much colder than before, winter is coming now! so cold.
It is Wednesday, Nov. 16th