Sunday, February 17, 2008

The Art and Science of JavaScript

The Art and Science of JavaScript: "By James Edwards

January 16th 2008

Reader Rating: 7.3

In this tutorial, we'll look at a technique for using CSS [1] and JavaScript [2] to build a first-person-perspective maze, in homage to old-school adventure games like Dungeon Master and Doom.

In truth, the scripting involved is fairly complex, and it won't be possible for me to spell out every nuance of the code in this single tutorial. In fact, I won't even list every method used in the script, as some of them are quite long. What I can do, though, is introduce you to the principles of creating shapes and perspective with CSS, and the task of using JavaScript to generate those shapes on de"

Wednesday, February 13, 2008

JABRA BT-5010 蓝牙耳机入手


因为买了车,又习惯把手机放口袋里,加上今年加州 一边开车一边打电话已经算是犯法了,于是入手一个蓝牙耳机..

莫名其妙就买了
丹麦捷波朗Jabra BT5010蓝牙耳机(据说可以同时无线连接两种蓝牙设备,但是我的电脑上没试验成功...以后再试...eee)

总体感觉

优点:
1.小

2.轻

3.通话清楚

4.据说可以同时用两个设备


不足:

1.说明书上说是右耳佩戴的,结果是左耳,害我弄了半天。。。

2.说明书上的键的按法是和真实的不一样的。。。


我觉得不足的地方还是比较害人的,尤其是第一次用bluetooth headset的人。。。

所以写下来希望能对其他人有用

Tuesday, February 12, 2008

http://www.pcpop.com/doc/0/269/269447_7.shtml

美到令人窒息! 10款你绝没见过字体秀

Nothing

美到令人窒息! 10款你绝没见过字体秀


又一款清新自然,适用于多种用途的手写字体

本年度最佳的非正式手写体同时也是本年最佳字体,它就是Nothing.为什么它的设计师 Ryoichi Tsunekawa给这款字体取名叫 Nothing(什么都不是)呢?是日本人的谦恭还是日式的幽默?不管怎么说,Nothing各 项都沾点边。它既是自然型的,同时又属于靠中间的那一类。它看似形式拘谨,但却又带有不确定性。它大方优雅,但在技术上来说,它又是非常简洁的。这款字体 的灵感可能来自于在好莱坞或者麦迪逊大街工作的艺术家们写的手写稿。这款字体里宽宽的,相互连接的字母让它成了一种权威。使用者可以用它创造出高质量的作 品却不失它本身的那种的淡淡的清新典雅。



美到令人窒息! 10款你绝没见过字体秀

Ambassador Script

美到令人窒息! 10款你绝没见过字体秀


手写圆体的完美数字化

Canada Type赢得了本年度最佳正式手写体的桂冠。它是Aldo NovareseJuliet字体的再现。Novaresetipo inglese字体,作为一款英语手写圆体的的再加工,成为了一个新的起点。一个为了爱而付出的起点。设计师Rebecca AlaccariPatrick Griffin花了将近1000个小时来设计这款字体。令人极为惊讶。这款字体有着令人眼花缭乱的各种不同的风格。Ambassador Script确实是正式手写字体的巅峰之作。

Sunday, January 20, 2008

新手入门:Javascript的使用技巧大全_东莞365网 东莞最大的门户网站

1.document.write(""); 输出语句

2.JS中的注释为//

3.传统的HTML文档顺序是:document->html->(head,body)

4.一个浏览器窗口中的DOM顺序是:window->(navigator,screen,history,location,document)

5.得到表单中元素的名称和值:document.getElementById("表单中元素的ID号").name(或value)

6.一个小写转大写的JS: document.getElementById("output").value = document.getElementById("i

nput").value.toUpperCase();

7.JS中的值类型:String,Number,Boolean,Null,Object,Function

8.JS中的字符型转换成数值型:parseInt(),parseFloat()

9.JS中的数字转换成字符型:(""+变量)

10.JS中的取字符串长度是:(length)

11.JS中的字符与字符相连接使用+号.

12.JS中的比较操作符有:==等于,!=不等于,>,>=,<.<=

13.JS中声明变量使用:var来进行声明

14.JS中的判断语句结构:if(condition){}else{}

15.JS中的循环结构:for([initial expression];[condition];[upadte expression]) {inside loop}

16.循环中止的命令是:break

17.JS中的函数定义:function functionName([parameter],...)

18.当文件中出现多个form表单时.可以用document.forms[0],document.forms[1]来代替.

19.窗口:打开窗口window.open(), 关闭一个窗口:window.close(), 窗口本身:self

20.状态栏的设置:window.status="字符";

21.弹出提示信息:window.alert("字符");

22.弹出确认框:window.confirm();

23.弹出输入提示框:window.prompt();

24.指定当前显示链接的位置:window.location.href="URL"

25.取出窗体中的所有表单的数量:document.forms.length

26.关闭文档的输出流:document.close();

27.字符串追加连接符:+=

28.创建一个文档元素:document.createElement(),document.createTextNode()

29.得到元素的方法:document.getElementById()

30.设置表单中所有文本型的成员的值为空:

var form = window.document.forms[0]

for (var i = 0; i if (form.elements.type == "text"){

form.elements.value = "";

}

}

31.复选按钮在JS中判断是否选中:document.forms[0].checkThis.checked (checked属性代表为是否选中

返回TRUE或FALSE)

32.单选按钮组(单选按钮的名称必须相同):取单选按钮组的长度document.forms[0].groupName.length

33.单选按钮组判断是否被选中也是用checked.

34.下拉列表框的值:document.forms[0].selectName.options[n].value (n有时用下拉列表框名称加上.sel

ectedIndex来确定被选中的值)

35.字符串的定义:var myString = new String("This is lightsword");

36.字符串转成大写:string.toUpperCase(); 字符串转成小写:string.toLowerCase();

37.返回字符串2在字符串1中出现的位置:String1.indexOf("String2")!=-1则说明没找到.

38.取字符串中指定位置的一个字符:StringA.charAt(9);

39.取出字符串中指定起点和终点的子字符串:stringA.substring(2,6);

40.数学函数:Math.PI(返回圆周率),Math.SQRT2(返回开方),Math.max(value1,value2)返回两个数中的最

在值,Math.pow(value1,10)返回value1的十次方,Math.round(value1)四舍五入函数,Math.floor(Math.ra

ndom()*(n+1))返回随机数

41.定义日期型变量:var today = new Date();

42.日期函数列表:dateObj.getTime()得到时间,dateObj.getYear()得到年份,dateObj.getFullYear()得到

四位的年份,dateObj.getMonth()得到月份,dateObj.getDate()得到日,dateObj.getDay()得到日期几,dat

eObj.getHours()得到小时,dateObj.getMinutes()得到分,dateObj.getSeconds()得到秒,dateObj.setTi

me(value)设置时间,dateObj.setYear(val)设置年,dateObj.setMonth(val)设置月,dateObj.setDate(va

l)设置日,dateObj.setDay(val)设置星期几,dateObj.setHours设置小时,dateObj.setMinutes(val)设置分,

dateObj.setSeconds(val)设置秒 [注意:此日期时间从0开始计]

43.FRAME的表示方式: [window.]frames[n].ObjFuncVarName,frames["frameName"].ObjFuncVarN

ame,frameName.ObjFuncVarName

44.parent代表父亲对象,top代表最顶端对象

45.打开子窗口的父窗口为:opener

46.表示当前所属的位置:this

47.当在超链接中调用JS函数时用:(javascript :)来开头后面加函数名

48.在老的浏览器中不执行此JS:

49.引用一个文件式的JS:

50.指定在不支持脚本的浏览器显示的HTML:

51.当超链和onCLICK事件都有时,则老版本的浏览器转向a.html,否则转向b.html.例:dfsadf

52.JS的内建对象有:Array,Boolean,Date,Error,EvalError,Function,Math,Number,Object,RangeError,

ReferenceError,RegExp,String,SyntaxError,TypeError,URIError

53.JS中的换行:\n

54.窗口全屏大小:

55.JS中的all代表其下层的全部元素

56.JS中的焦点顺序:document.getElementByid("表单元素").tabIndex = 1

57.innerHTML的值是表单元素的值:如

"how are you"

,则innerHTML的值就是:how are you

58.innerTEXT的值和上面的一样,只不过不会把这种标记显示出来.

59.contentEditable可设置元素是否可被修改,isContentEditable返回是否可修改的状态.

60.isDisabled判断是否为禁止状态.disabled设置禁止状态

61.length取得长度,返回整型数值

62.addBehavior()是一种JS调用的外部函数文件其扩展名为.htc

63.window.focus()使当前的窗口在所有窗口之前.

64.blur()指失去焦点.与FOCUS()相反.

65.select()指元素为选中状态.

66.防止用户对文本框中输入文本:onfocus="this.blur()"

67.取出该元素在页面中出现的数量:document.all.tags("div(或其它HTML标记符)").length

68.JS中分为两种窗体输出:模态和非模态.window.showModaldialog(),window.showModeless()

69.状态栏文字的设置:window.status='文字',默认的状态栏文字设置:window.defaultStatus = '文字.';

70.添加到收藏夹:external.AddFavorite("http://www.dannyg.com"t;,"jaskdlf");

71.JS中遇到脚本错误时不做任何操作:window.onerror = doNothing; 指定错误句柄的语法为:window.on

error = handleError;

72.JS中指定当前打开窗口的父窗口:window.opener,支持opener.opener...的多重继续.

73.JS中的self指的是当前的窗口

74.JS中状态栏显示内容:window.status="内容"

75.JS中的top指的是框架集中最顶层的框架

76.JS中关闭当前的窗口:window.close();

77.JS中提出是否确认的框:if(confirm("Are you sure?"))else{alert("Not Ok");}

78.JS中的窗口重定向:window.navigate("http://www.sina.com.cn"t;);

79.JS中的打印:window.print()

80.JS中的提示输入框:window.prompt("message","defaultReply");

81.JS中的窗口滚动条:window.scroll(x,y)

82.JS中的窗口滚动到位置:window.scrollby

83.JS中设置时间间隔:setInterval("expr",msecDelay)或setInterval(funcRef,msecDelay)或setTimeou

t

84.JS中的模态显示在IE4+行,在NN中不行:showModalDialog("URL"[,arguments][,features]);

85.JS中的退出之前使用的句柄:function verifyClose(){event.returnValue="we really like you and ho

pe you will stay longer.";}} window.onbeforeunload=verifyClose;

86.当窗体第一次调用时使用的文件句柄:onload()

87.当窗体关闭时调用的文件句柄:onunload()

88.window.location的属性: protocol(http:),hostname(example.com),port(80),host(e

xample.com:80),pathname("/a/a.html"),hash("#giantGizmo",指跳转到相应的锚记),href(全部的信

息)

89.window.location.reload()刷新当前页面.

90.window.history.back()返回上一页,window.history.forward()返回下一页,window.history.go(返回

第几页,也可以使用访问过的URL)

91.document.write()不换行的输出,document.writeln()换行输出

92.document.body.noWrap=true;防止链接文字折行.

93.变量名.charAt(第几位),取该变量的第几位的字符.

94."abc".charCodeAt(第几个),返回第几个字符的ASCii码值.

95.字符串连接:string.concat(string2),或用+=进行连接

96.变量.indexOf("字符",起始位置),返回第一个出现的位置(从0开始计算)

97.string.lastIndexOf(searchString[,startIndex])最后一次出现的位置.

98.string.match(regExpression),判断字符是否匹配.

99.string.replace(regExpression,replaceString)替换现有字符串.

100.string.split(分隔符)返回一个数组存储值.

101.string.substr(start[,length])取从第几位到指定长度的字符串.

102.string.toLowerCase()使字符串全部变为小写.

103.string.toUpperCase()使全部字符变为大写.

104.parseInt(string[,radix(代表进制)])强制转换成整型.

105.parseFloat(string[,radix])强制转换成浮点型.

106.isNaN(变量):测试是否为数值型.

107.定义常量的关键字:const,定义变量的关键字:var

Thursday, January 17, 2008

Generate Ajax J2EE Web applications with jpa2web

What is jpa2web?

Readily available tools like Hibernate (see Resources) have dramatically reduced the impedance created between Java objects and their database storage; specially, the ease with which Java classes can now be annotated to specify the way objects should be persisted. Developers are freed from the onerous task of writing up database integration codes. Hibernate solves the persistence issue; however, Web pages need to be created to handle these elements. A typical scenario for a medium-sized Web application can proceed something like this: The developer starts by coding the Plain Old Java Objects (POJOs) that represent a particular domain model, and then proceeds to create the different transactions and the Web user interface. A subset of the elements of the model will frequently involve non-transactional data. Customers, clients, countries, locations, employees, and companies are typical elements of a business model that are maintained by a few operators.

Why not generate the Web presentation layer to create, add, list, delete, and search these elements from the annotated beans? And why not make this presentation a friendly Ajax experience? These are the main goals of the jpa2web tool, which has the following process flow:

* Input: POJO-annotated beans (and optional templates).
* Output: An Ajax Web application to handle and persist the elements of the model.
* Technologies used: FreeMarker + ZK + Hibernate (see Resources for links to more information on these technologies).

Wednesday, January 16, 2008

失之毫厘,差之千里

失之毫厘,差之千里啊
因为自己一不小心,在头文件里的一个函数声明时落了一个分号,造成:
error C2085: 'NCCancelLogin' : not in formal parameter list和一大堆的乱七八糟的错误信息。
而且错误信息距离事发之地太远。花了偶三个多小时来查找错误,汗.......
贴在这里,免得以后忘记了。"

Monday, January 14, 2008

你还在一页打六张吗?PPT打印技巧

ppt文档有几种打印格式?一种还是两种?

至少是4种-不要和我争,否则我和你讲排列组合最深奥的内容。

ppt不像word文档打印那么简单。它一页没有多少内容。
如果把一个幻灯片打印在一页A4纸上,那么一份普通的ppt文档打印出来,
少则100页,多则几百页,浪费纸不说,自己写道阅读也不方便。

所以,一般都是把几个幻灯片打印在一页上。

这里有个基本概念:幻灯片模式和讲义模式。
在打印预览页里,“打印内容”那里可以选择你要打印的是幻灯片还是讲义。
按照幻灯片打印,则一页只能打印一个幻灯片。
按照讲义,则一页可以选择的打印1,2,3,4,6,9个幻灯片。
即使是一个幻灯片和一个讲义,打印出来也不一样:幻灯片要比讲义大一些。

那么是不是说我们应该选择一页打印9个幻灯片了?
这是我以前常用的打印方式。这样能节省不少纸张。
只是打印出来的效果不是很理想。
有时一页字数太多,单个字就显得太小,看得很吃力。
各个幻灯片之间的间距很大,你不用想都知道,还有更好的方式。

现在教你这种更好的打印方式。
--------
我是付出沉重的代价才学到的,而你只需看懂就可以了。
--------

打开菜单:

文件->打印->属性->布局

等等,你说没有找到“布局”?
你用的是什么型号的打印机啊?...
你该考虑换一个打印机试试.....

继续说
在“每张页数”中选择9个或者16个。
是否打印边框,那就随你的爱好了。
“方向”一般用横向,因为ppt一般是横向的

确定后,再看看“打印”对话框。
确定“打印内容”不是“讲义”,前面说过,幻灯片模式比讲义模式大。
如果错误的选择成打印“讲义”,那就亏大了。
如果你更是愚蠢到“每页幻灯片数”选择成9的话,
那只好恭喜你,又多了一堆草稿纸了。

正确的方法是:
打印内容选择成“幻灯片”,每页幻灯片数是1(当然,你不能选择的)

还有,“打印范围”指的是ppt的幻灯片数,而不是纸张数。
如果你只想打印第一张,前9个,则填写“1-9”
先打印一页,预览一下效果是很必要的。
浪费一张,比浪费几十张好吧。