Enjoy Life

A Ryan Gene Blog!

Wednesday, August 30, 2006

[Code]一些网页技巧

防护网页

1. 禁止打印本网页

代码:

<!--禁止打印(可以打印,但是你打出来的可都是空白)-->
<style media='print'>body {display:none}</style>

说明:

将这段代码加入html网页的head部分,打印菜单在IE上是使用普通的Java脚本是无法禁止的,通过上面的语句可以使打印的主体部分在打印时隐藏,从而达到无法打印的目的

2. 禁止保存网页
代码:

<SCRIPT LANGUAGE="JavaScript">

//防止全部另存为html和mht,但无法防止仅存本页和txt
if(document.all)document.write('<link rel=stylesheet type="text/css" href="/ehp_null.css">')

//禁止本地查看,不信你可以试试(先另存为,然后直接双击打开)

wside=(window.sidebar)?true:false;
var w456=false;
function f369w()

{

document.location="";w456=true;return;
}
if(window.location.protocol.indexOf("file")!=-1){f369w();}
</SCRIPT>

说明:



另存为菜单在IE上是使用普通的Java脚本是无法禁止的,而且所谓的保存禁止都是像本例一样加入一个不存在的CSS样式表或者图象,从而达到不允许保存全部的html和mht页,本例中后面的那一段函数是用来禁止保存后本地打开时显示原网页的

3. 禁止将网页上的一些公章等机密图片保存下来

代码分两段,第一段如下:
<!--去掉IE6的图像栏(有放大缩小另存为等)-->
<META HTTP-EQUIV="ImageToolbar" CONTENT="No">

第一段说明:



这一段禁止IE6中出现那个浮动的图片工具栏,因为工具栏上面提供保存功能,这段代码要加入网页的head部分中

第二段代码:
<SCRIPT LANGUAGE="JavaScript">
//禁止选中
document.onselectstart=new Function("return false")
function nsel()
{
if((document.layers)||wside)
{
var qwe= document.getSelection();
if(qwe!=""){window.find(" ")};
setTimeout("nsel()",20);
}
}
nsel();
//禁止拖拉
function disdrag()
{
if(document.all)
{
document.ondragstart= new Function("return false")
for (I = 0; I< document.images.length; I++)
{

z = document.images(I);
z.galleryImg = 'no';
}
}
}
disdrag();
//禁止非法直接选中拷贝网页(不是很好,当打开这个网页时,你就别想在任何一个应用程序中进行Copy&Parse,但是这个可以防止拷贝屏幕)
function ccd(){clipboardData.clearData();}
function cce()

{

ccd();
setTimeout("cce()",30);
}
cce();
</SCRIPT>

说明:



上面这段代码禁止网页右键的弹出菜单,网页上文本和图象选取,拖拽等,最后一段代码禁止拷贝和粘贴,不推荐使用,因为它定期清除剪贴板,打开这个网页在其他程序之间就无法进行拷贝和粘贴操作

4. 禁止缓存

代码:

<!--禁止缓存-->
<META HTTP-EQUIV="Expires" CONTENT="-1">
<META HTTP-EQUIV="Pragma" CONTENT="No-Cache">

说明:

将上述代码加入网页的head段中即可
5. 其他一些功能

代码1:
<!--去掉SmartTag支持-->
<META NAME="MSSmartTagsPreventParsing" CONTENT="True">
<!--禁止缓存-->
<META HTTP-EQUIV="Expires" CONTENT="-1">
<META HTTP-EQUIV="Pragma" CONTENT="No-Cache">
<!--禁止机器人搜索-->
<META NAME="Robots" CONTENT="NoIndex">

说明:

上面的代码需要加入到网页的head段中

代码2:

<SCRIPT LANGUAGE="JavaScript">
wside=(window.sidebar)?true:false;
var w456=false;
//禁止Opera用户
if(navigator.userAgent.indexOf('Opera')!=-1)

{

alert("This web page does not support Opera Browser.");

window.location="about:blank";
}
//禁止非发使用Iframe连接本网页
if (top.location != self.location)

{

top.location = self.location;
}
//禁止状态栏看到链接地址
function wwddd()
{
window.status=" ";
setTimeout("wwddd()",10);
}
wwddd();
//禁止非法使用(也就是检查域名不正确就重新导向正确的域名,不过用了没法使用IP直接访问,防火墙内的用户可能会看不到)
ppp34=document.referrer.toLowerCase();
if((ppp34.indexOf("http://www.your-domain.com")<0)

&&(w456==false))

this.location.href ="http://www.your-domain.com";
</SCRIPT>



打造W3C HTML 4.01標準的網站 -[]
目前使用Dreamweaver或其他網頁製作軟體做網站編輯,HTML大部份都是以HTML4.0和HTML4.01為主,但是能完全符合標準的卻不多,有些人有這樣的的想法:[能正常再瀏覽器顯示就好],有些人則不清楚原來還有W3C標準的存在,達到W3C標準其實不難,只要多注意一些細節,拷貝教學網範例語法的時候,詳細檢查一下再貼上,如果能直接編輯HTML更好,避免錯誤的發生。
以下我列出幾點是比較常見的錯誤供參考:

1.不可省略雙引號或單引號
錯誤 style=font-size:9pt
正確 style="font-size:9pt"
錯誤 <img src=bg.gif width=140 height=30 alt=text>
正確 <img src="bg.gif" width="140" height="30" alt="text">
錯誤 <a href=home>text</a>
正確 <a href="home">text</a>

HTML4.01中有些屬性值沒有加引號是可以通過測試
但在XHTML1.0引號就是必須的,所以建議養成加引號的好習慣

2.標籤必須是一對
<p> </p>
<font></font>
<div></div>
<table><tr><td></td></tr></table>

3.圖片標籤加上文字說明alt="說明"錯誤 <img src="bg.gif" height="50" border="0">
正確 <img src="bg.gif" height="50" border="0" alt="說明文字">

4.非標籤一部分的符號以編碼表示
表單內包含以下符號也必須用編碼表示
< 以 < 表示
> 以 > 表示
& 以 & 表示
程式中的連結 & 也要改用 &
錯誤 <a href="foo.cgi?chapter=1§ion=2">
正確 <a href="foo.cgi?chapter=1&section=2">

5.標籤的順序
錯誤 <b><i>文字</b></i>
正確 <b><i>文字</i></b>

6.註解文字不可包含--符號
錯誤 <!-- OEC--SPACE -->
正確 <!-- OECSPACE -->

7.CSS樣式表的位置與正確寫法
一定要放在<head></head>之間
<link rel="stylesheet" type="text/css" href="style.css">
<style type="text/css">
<!--
body{font-size:9pt;}
-->
</style>

錯誤 <style>
正確 <style type="text/css">

8.使用表格常犯的錯誤
我們在做表格通常會指定寬與高,例如:
<table border="1" width="300" height="55">
<tr><td> 內容 </td></tr>
</table>
這樣做是沒有辦法通過,W3C建議使用CSS來控制標籤元素的高度
.table{
height:55px;
}
<table class="table">
<tr><td> TEXT </td></tr>
</table>
但是若使用太多表格,在CSS一一指定不同高,也不是好方法
其實很簡單將高度height屬性指定在儲存格就可以了通過測試
<table border="0" width="300">
<tr><td height="55"> TEXT </td></tr>
</table>
但這不是w3c希望的標準,建議能夠使用div代替不必要的table

9.同一個id選擇器不可重複使用
一個網頁中id="xx"同一個選擇器不能重複使用,若需要重複請用class="xx"
10.JavaScript寫法
Javascript我們通常會寫為
錯誤 <script language="javascript">
W3C標準必須為程式指定類型type=text/javascript,所以要寫為
正確 <script type="text/javascript">
或者 <script language="javascript" type="text/javascript">
載入外部.js獨立檔案的寫法
正確 <script type="text/javascript" src="script.js"></script>

11. <embed>標籤的爭議
<embed>是Netscape的私有標籤,W3C 從HTML3.2 HTML 4.01 到 XHTML 1.0 中都沒有這個標籤,所以使用<embed>的頁面是不能通過標準測試。
W3C推薦使用 <object> 標籤,用<object>插入flash影片的代碼可以寫為:
<object type="application/x-shockwave-flash" data="index.swf" width="400" height="200">
<param name="movie" value="index.swf">
</object>
但這樣的寫法可能IE5/IE6 Win瀏覽器版本會出現問題
想要符合標準又能在任何瀏覽器下正常顯示,以下幾個連結點提供參考:

torresburriel.com
A List Apart
<embed>標籤因為廣大的受到運用,不再標準範圍引起很大的爭議,
想要解決這個問題,只能等IE瀏覽器對<object>有更好的支持
或者W3C願意收錄<embed>標籤。

12.HTML4.01文件類別宣告的正確寫法 (不可小寫)
用於一般網頁
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
用於框架頁
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Frameset//EN"
"http://www.w3.org/TR/html4/frameset.dtd">
W3C標準測試網址 http://validator.w3.org/
網頁自動測試網址 http://validator.w3.org/check?uri=referer
測試時一定要有「12.文件類別宣告」還有指定文件編碼
<meta http-equiv="Content-Type" content="text/html; charset=big5">
才能順利進行測試動作,開始打造一個萬維標準的網站吧!



40种网页常用小技巧 -[]
1. oncontextmenu="window.event.returnValue=false" 将彻底屏蔽鼠标右键
<table border oncontextmenu=return(false)><td>no</table> 可用于Table

2. <body onselectstart="return false"> 取消选取、防止复制

3. onpaste="return false" 不准粘贴

4. oncopy="return false;" oncut="return false;" 防止复制

5. <link rel="Shortcut Icon" href="favicon.ico"> IE地址栏前换成自己的图标

6. <link rel="Bookmark" href="favicon.ico"> 可以在收藏夹中显示出你的图标

7. <input style="ime-mode:disabled"> 关闭输入法

8. 永远都会带着框架
<script language="JavaScript"><!--
if (window == top)top.location.href = "frames.htm"; //frames.htm为框架网页
// --></script>

9. 防止被人frame
<SCRIPT LANGUAGE=JAVASCRIPT><!--
if (top.location != self.location)top.location=self.location;
// --></SCRIPT>

10. 网页将不能被另存为
<noscript><iframe src=*.html></iframe></noscript>

11. <input type=button value=查看网页源代码
onclick="window.location = "view-source:"+ "http://www.pconline.com.cn"">

12.删除时确认
<a href="javascript: if(confirm("确实要删除吗?"))location="boos.asp?&areyou=删除&page=1"">删除</a>

13. 取得控件的绝对位置
//Javascript
<script language="Javascript">
function getIE(e){
var t=e.offsetTop;
var l=e.offsetLeft;
while(e=e.offsetParent){
t+=e.offsetTop;
l+=e.offsetLeft;
}
alert("top="+t+"/nleft="+l);
}
</script>

//VBScript
<script language="VBScript"><!--
function getIE()
dim t,l,a,b
set a=document.all.img1
t=document.all.img1.offsetTop
l=document.all.img1.offsetLeft
while a.tagName<>"BODY"
set a = a.offsetParent
t=t+a.offsetTop
l=l+a.offsetLeft
wend
msgbox "top="&t&chr(13)&"left="&l,64,"得到控件的位置"
end function
--></script>

14. 光标是停在文本框文字的最后
<script language="javascript">
function cc()
{
var e = event.srcElement;
var r =e.createTextRange();
r.moveStart("character",e.value.length);
r.collapse(true);
r.select();
}
</script>
<input type=text name=text1 value="123" onfocus="cc()">

15. 判断上一页的来源
javascript:
document.referrer

16. 最小化、最大化、关闭窗口
<object id=hh1 classid="clsid:ADB880A6-D8FF-11CF-9377-00AA003B7A11">
<param name="Command" value="Minimize"></object>
<object id=hh2 classid="clsid:ADB880A6-D8FF-11CF-9377-00AA003B7A11">
<param name="Command" value="Maximize"></object>
<OBJECT id=hh3 classid="clsid:adb880a6-d8ff-11cf-9377-00aa003b7a11">
<PARAM NAME="Command" VALUE="Close"></OBJECT>
<input type=button value=最小化 onclick=hh1.Click()>
<input type=button value=最大化 onclick=hh2.Click()>
<input type=button value=关闭 onclick=hh3.Click()>
本例适用于IE

17.屏蔽功能键Shift,Alt,Ctrl
<script>
function look(){
if(event.shiftKey)
alert("禁止按Shift键!"); //可以换成ALT CTRL
}
document.onkeydown=look;
</script>

18. 网页不会被缓存
<META HTTP-EQUIV="pragma" CONTENT="no-cache">
<META HTTP-EQUIV="Cache-Control" CONTENT="no-cache, must-revalidate">
<META HTTP-EQUIV="expires" CONTENT="Wed, 26 Feb 1997 08:21:57 GMT">
或者<META HTTP-EQUIV="expires" CONTENT="0">

19.怎样让表单没有凹凸感?
<input type=text style="border:1 solid #000000">

<input type=text style="border-left:none; border-right:none; border-top:none; border-bottom:

1 solid #000000"></textarea>

20.<div><span>&<layer>的区别?
<div>(division)用来定义大段的页面元素,会产生转行
<span>用来定义同一行内的元素,跟<div>的唯一区别是不产生转行
<layer>是ns的标记,ie不支持,相当于<div>

21.让弹出窗口总是在最上面:
<body onblur="this.focus();">

22.不要滚动条?
让竖条没有:
<body style="overflow:scroll;overflow-y:hidden">
</body>
让横条没有:
<body style="overflow:scroll;overflow-x:hidden">
</body>
两个都去掉?更简单了
<body scroll="no">
</body>

23.怎样去掉图片链接点击后,图片周围的虚线?
<a href="#" onFocus="this.blur()"><img src="logo.jpg" border=0></a>

24.电子邮件处理提交表单
<form name="form1" method="post" action="mailto:****@***.com" enctype="text/plain">
<input type=submit>
</form>

25.在打开的子窗口刷新父窗口的代码里如何写?
window.opener.location.reload()

26.如何设定打开页面的大小
<body onload="top.resizeTo(300,200);">
打开页面的位置<body onload="top.moveBy(300,200);">

27.在页面中如何加入不是满铺的背景图片,拉动页面时背景图不动
<STYLE>
body
{background-image:url(logo.gif); background-repeat:no-repeat;
background-position:center;background-attachment: fixed}
</STYLE>

28. 检查一段字符串是否全由数字组成
<script language="Javascript"><!--
function checkNum(str){return str.match(//D/)==null}
alert(checkNum("1232142141"))
alert(checkNum("123214214a1"))
// --></script>

29. 获得一个窗口的大小
document.body.clientWidth; document.body.clientHeight

30. 怎么判断是否是字符
if (/[^/x00-/xff]/g.test(s)) alert("含有汉字");
else alert("全是字符");

31.TEXTAREA自适应文字行数的多少
<textarea rows=1 name=s1 cols=27 onpropertychange="this.style.posHeight=this.scrollHeight">
</textarea>
32. 日期减去天数等于第二个日期
<script language=Javascript>
function cc(dd,dadd)
{
//可以加上错误处理
var a = new Date(dd)
a = a.valueOf()
a = a - dadd * 24 * 60 * 60 * 1000
a = new Date(a)
alert(a.getFullYear() + "年" + (a.getMonth() + 1) + "月" + a.getDate() + "日")
}
cc("12/23/2002",2)
</script>

33. 选择了哪一个Radio
<HTML><script language="vbscript">
function checkme()
for each ob in radio1
if ob.checked then window.alert ob.value
next
end function
</script><BODY>
<INPUT name="radio1" type="radio" value="style" checked>Style
<INPUT name="radio1" type="radio" value="barcode">Barcode
<INPUT type="button" value="check" onclick="checkme()">
</BODY></HTML>

34.脚本永不出错
<SCRIPT LANGUAGE="JavaScript">
<!-- Hide
function killErrors() {
return true;
}
window.onerror = killErrors;
// -->
</SCRIPT>

35.ENTER键可以让光标移到下一个输入框
<input onkeydown="if(event.keyCode==13)event.keyCode=9">

36. 检测某个网站的链接速度:
把如下代码加入<body>区域中:
<script language=Javascript>
tim=1
setInterval("tim++",100)
b=1
var autourl=new Array()
autourl[1]="www.njcatv.net"
autourl[2]="javacool.3322.net"
autourl[3]="www.sina.com.cn"
autourl[4]="www.nuaa.edu.cn"
autourl[5]="www.cctv.com"
function butt(){
document.write("<form name=autof>")
for(var i=1;i<autourl.length;i++)
document.write("<input type=text name=txt"+i+" size=10 value=测试中......> =》<input type=text
name=url"+i+" size=40> =》<input type=button value=GO

onclick=window.open(this.form.url"+i+".value)><br>")
document.write("<input type=submit value=刷新></form>")
}
butt()
function auto(url){
document.forms[0]["url"+b].value=url
if(tim>200)
{document.forms[0]["txt"+b].value="链接超时"}
else
{document.forms[0]["txt"+b].value="时间"+tim/10+"秒"}
b++
}
function run(){for(var i=1;i<autourl.length;i++)document.write("<img src=http://"+autourl+"/"+Math.random()+" width=1 height=1

onerror=auto("http://"+autourl+"")>")}
run()</script>

37. 各种样式的光标
auto :标准光标
default :标准箭头
hand :手形光标
wait :等待光标
text :I形光标
vertical-text :水平I形光标
no-drop :不可拖动光标
not-allowed :无效光标
help :?帮助光标
all-scroll :三角方向标
move :移动标
crosshair :十字标
e-resize
n-resize
nw-resize
w-resize
s-resize
se-resize
sw-resize

38.页面进入和退出的特效
进入页面<meta http-equiv="Page-Enter" content="revealTrans(duration=x, transition=y)">
推出页面<meta http-equiv="Page-Exit" content="revealTrans(duration=x, transition=y)">
这个是页面被载入和调出时的一些特效。duration表示特效的持续时间,以秒为单位。transition表示使用哪种特效,取值为1-23:
  0 矩形缩小
  1 矩形扩大
  2 圆形缩小
  3 圆形扩大
  4 下到上刷新
  5 上到下刷新
  6 左到右刷新
  7 右到左刷新
  8 竖百叶窗
  9 横百叶窗
  10 错位横百叶窗
  11 错位竖百叶窗
  12 点扩散
  13 左右到中间刷新
  14 中间到左右刷新
  15 中间到上下
  16 上下到中间
  17 右下到左上
  18 右上到左下
  19 左上到右下
  20 左下到右上
  21 横条
  22 竖条
  23 以上22种随机选择一种

39.在规定时间内跳转
<META http-equiv=V="REFRESH" content="5;URL=http://www.51js.com">

40.网页是否被检索
<meta name="ROBOTS" content="属性值">
  其中属性值有以下一些:
  属性值为"all": 文件将被检索,且页上链接可被查询;
  属性值为"none": 文件不被检索,而且不查询页上的链接;
  属性值为"index": 文件将被检索;
  属性值为"follow": 查询页上的链接;
  属性值为"noindex": 文件不检索,但可被查询链接;
  属性值为"nofollow": 文件不被检索,但可查询页上的链接。


注:出处不明,收集整理

posted by Ryan Gene at 1:14 PM 1 comments

Tuesday, August 29, 2006

[Code]C# Capital Initial首字母大写

碰巧用到,记录一下:


using System.Globalization;
using System.Threading;

CultureInfo cultureInfo = Thread.CurrentThread.CurrentCulture;
TextInfo textInfo = cultureInfo.TextInfo;

Console.WriteLine(textInfo.ToTitleCase(title));
Console.WriteLine(textInfo.ToLower(title));
Console.WriteLine(textInfo.ToUpper(title));

posted by Ryan Gene at 5:51 PM 0 comments

[Code]Rico使用初体验

Rico真是个好东西!

具体感受过些时候再写:P

posted by Ryan Gene at 11:12 AM 0 comments

Thursday, August 24, 2006

[Software]Happy Birthday, GTalk


GTalk一岁了,Happy Birthday Gtalk!


posted by Ryan Gene at 1:02 PM 5 comments

Wednesday, August 23, 2006

[Code]用PowerDesigner生成测试数据

PowerDesigner的确是个好东西,现在用它做数据库的辅助开发感觉很好。

PowerDesigner可以自动或半自动地生成一系列的测试数据,不紧可以用来对系统做压力测试,还可以使得开发人员从输入繁琐的测试数据中解脱出来。

下面介绍一下具体操作:

首先在Model -> Test Data Profile里创建测试数据的Profile,差不多就是指一种数据的档案吧,其中可以规定数据的格式,来源等等。如图一:

图一



未完待续...

posted by Ryan Gene at 11:50 AM 2 comments

[Internet]Cheat Sheet: Web 2.0

from: here

注:

Cheet Sheet 这里有个Cheat,想当然的话,意思肯定不好。事实上,这个Cheap Sheet ,的原意的确也是小抄的意思,,所以字典的定义是:A piece of paper with information written down on it that an unethical person might create if they weren't prepared for a test.
由于对考试准备不足,夹带写着考试内容的纸条,此为品行不高的人的作为。
然 而,曾几何时,Cheat Sheet 这个说法走出了贬义的阴影,成为简单说明,步骤说明书。如We asked the IBM Engineer to develop a cheat sheet for this machine.我们要求IBM公司给我们搞个简单的机器操作说明书。
The cheat sheet was attached to the package of the fancy camera.说明书就贴在高级照相机的包装盒上。



Cheat Sheet: Web 2.0

What on earth is it and should you care?

By Will Sturgeon

Published: Monday 21 August 2006

Web 2.0? I'm learning to spot a buzzword when I hear one and I think I just have...
Web 2.0 is one of those phrases which we're hearing a lot about currently. Everybody says they're very excited about it but do they really know what it is?

So what is it?
Well, in the simplest terms it's the phrase being applied to 'the second coming' of the internet. Dot-com investors are partying like it's 1999 and a number of pioneering online services are very much keeping that party exciting, getting everybody talking about the internet once more and its increasing relevance to our lives.

Such as?
Well, web 2.0 is a bit of a catch-all which covers a broad range of new online services, user-generated content, communities and social networking tools. The most popular are sites such as Blogger, Flickr, MySpace, YouTube and Wikipedia and the Godfather of web 2.0 - Google. The phrase also refers to the creation of far greater levels of interactivity, not just between users, or between users and the internet but between complementary online services through mash-ups and web services.

So this is all consumer stuff - photo-sharing and the like?
That's where a lot of the energy is coming from and the services doing the early running have absolutely been focused on driving and exploiting end-user trends. However, the idea that the web is 'where it's at' is not lost on big business. For example web 2.0 covers 'software as a service' (SaaS) - companies are being told they no longer have to buy software but instead should access applications online. Many people aren't yet ready to embrace that move but investors and advocates of SaaS are certainly convinced.

Where'd the name come from?
The 2.0 name is a clear allusion to the naming convention of software updates - this is the internet version 2.0, get it? - which is slightly ironic given the revolution taking place in software as a service isn't good news for traditional client/server software.

Why's that?
Well, to quote Marc Benioff, CEO of salesforce.com: "All of the action is in services. Web 2.0 is where the action is." His company has embraced this move whole-heartedly, providing a portal for all manner of web 2.0 applications aimed at the enterprise - including online word processors and spreadsheets (nobody said web 2.0 had to be limited to interesting, fun applications).

Gartner is also convinced web 2.0 should be a major consideration for businesses.

But should I care?
Absolutely you Luddite. Two or three years ago there was a feeling that innovation online had failed to emerge from the doldrums of the dot-com boom and bust cycle and had hit something of a dead end but now innovation is arguably at its most frenetic level ever. Never underestimate the effect the internet can have on our lives and now all we need is a browser and a broadband connection and there's very little we can't do.

Isn't there a danger that mistakes will be repeated? We've been here before, haven't we?
We've certainly, very famously, seen an internet boom before and history has shown us that bust follows boom but there is some bedrock here. Of course there are question marks over how YouTube will make money, for example - because great ideas and even popularity don't pay the bills - and the next stage for the investors will be monetising the excitement that surrounds web 2.0. Not every service which launches under that banner will survive but a great many will, probably though acquisition in a lot of cases.

Acquisition by whom?
Well Google for starters. The internet giant is absolutely at the heart of web 2.0 and the ability to bring many of these services together to create vast interlinked content offerings will certainly appeal. For the enterprise and end-user Google already offers a number of Office-style applications as a hosted offering. The company is also readying the finished version of its hosted email Exchange-offering.

The more, dare we say 'interesting' web 2.0 content will also appeal to Google as it puts ever more flesh on its content bones.




posted by Ryan Gene at 11:31 AM 0 comments

Monday, August 21, 2006

[Life]A Great Father

Really Touching... A Great Father...


因为考虑到载入速度,嵌入播放器已经移除,可以到以下地址下载观看:
http://www.jinweijie.com/ryan/can1986.wmv



A glimpse of the remarkable father-son bond of Dick and Rick Hoyt, and their inspirational journey together in a triathlon and life itself.


the Original Link: Here

posted by Ryan Gene at 1:55 PM 1 comments

[Code]Asp.net CSS问题

前段时间Sean碰到一个问题,在Html页面里样式都没问题,一旦用到aspx上,就会出现样式丢失的问题。

经过反复调试,终于发现问题所在,css里用的字体设成中文,比如 font-family:黑体; 就会导致当前class当前行下的css失效。

深入的原因没有调查下去,解决办法把css里的中文字体去掉就可以了

我估计可能是因为css的文件编码的问题,css本来就是文本文件,所以存在编码的问题,具体有空再进一步实验。

posted by Ryan Gene at 1:20 PM 1 comments

Saturday, August 19, 2006

[Tricks]在线字体测试

两个在线看字体效果的地址,实用:)

Typetester

Font Tester

posted by Ryan Gene at 9:14 PM 0 comments

Friday, August 18, 2006

[Software]Writely - Now Opened for Registration

Writely,Google's Online Word Processing Application now opened for registration.

主要功能:

  • 在线文字处理

  • 发布到Blog(包括Blogger)

  • 在线文字协作处理



点击这里马上尝试一下

:D

posted by Ryan Gene at 10:54 PM 0 comments

Thursday, August 17, 2006

[Fun]Super Cool Video

Balancing Point In Reverse

非常cool!



Original Link

posted by Ryan Gene at 12:52 PM 4 comments

[Code]用JavaScript执行PostBack

早上实现了在子页面更新数据以后,父页面刷新树的功能

思路:



  • 父页面有个隐藏的html button作为proxy,子页面保存完数据以后,用js调用父页面的html button的触发函数click();

  • 父页面有个asp.net的link button控件,text="",等于也是隐藏的,它负责调用后台cs代码里的负责刷新树的方法;

  • 父页面的html button onclick的时候,__doPostBack('DoRefresh','');



代码:



父页面apsx:
<input type="button" id="DoRefreshProxy" value="DO" onclick="__doPostBack('DoRefresh','');" style="display:none;" />

<asp:linkbutton id="DoRefresh" runat="server" onclick="DoRefresh_Click" CausesValidation=False/>

父页面cs:

protected void DoRefresh_Click(object sender, EventArgs e)
{
this.BindTree(this.tvBuilding.SelectedNodeIndex,1);
}

子页面cs:

Page.RegisterStartupScript("pb","<script>window.opener.document.getElementById('DoRefreshProxy').click();</script>");

posted by Ryan Gene at 11:08 AM 0 comments

[Code]ASP.net按钮提交前执行javascript

here is the code...


<script language=“javascript“>
function doSomething()
{
// 执行自己的javascript
// 继续提交
this.click();
}
</script>
<asp:button onmousedown=“doSomething()“ id=“someButton” Text="提交" runat="server"></asp:button>

posted by Ryan Gene at 10:27 AM 0 comments

Wednesday, August 16, 2006

[Software]Software product documentation

Software product documentation

Learn how to write good documentation for your software

The ideal software would be free of errors and so easy to use that everybody would be familiar with it the minute they start the application. However, this is not the case in real life.

Besides the quality of the software product, there’s something else that makes or breaks the deal: technical support. The better the support software publishers and shareware authors provide, the more users are likely to buy the product.

Technical support for software products can be provided in several ways:
  • online product documentation
  • e-mail assistance
  • access to support forums maintained by software publishers
  • knowledge bases.
Good documentation may exclude in many cases the need for further forms of technical support. It is, however, not easy to write. One of the reasons why this happens is that it is difficult for shareware authors or other software developers to put themselves into the users’ shoes, since they are already thoroughly familiar with the application.

Read Me file

The first thing every software product should have is a text format "Read Me" file that includes the following:
  • Product Name and Version
  • Ship date
  • Company and Author Name
  • Description (like "photo organizer")
  • A What’s New list (this should be a list of fixes and new features)
  • System requirements (hardware like CPU, RAM, disk space, operating systems supported)
  • Price, payment options and instructions
  • Copyright and distribution information (rules for people who want to distribute your product)
  • Contact details (email, phone, fax website and postal address)
The "Read Me" file is important because everybody that might be interested in your product is expecting it, including reviewers, users, or people who want to put your product on a CD for distribution with a magazine or on their website. The idea here is to minimize frustration associated with the information being too difficult to find, therefore you should put all in one place.

The Manual

The other thing shareware authors and software publishers need to provide with their product is the manual. The first thing you should think about when starting to write it is how your users are going to use it. Few are those that will bother reading it all before attempting to use your product. They are more likely to turn to it later, when they try to do something and cannot figure out how to do it, or when they find something they do not understand.

To help them, it is best to organize your documentation by tasks. "How to…" sections are more useful than merely documenting every command in order. Explanations are easier to understand if they are backed by pictures and diagrams, wherever possible. There should also be a chapter labeled "Troubleshooting", which provides answers to the most common problems. At first you will have to guess where those problems may occur, but a couple of upgrades to your product later, the feedback from the people who tried the product will tell you what the most common problems are.

The manual should be broken down into chapters, the first of which telling what the other chapters contain, so that people could readily find what they need.

The interface

Another point worth mentionning is the interface. User friendly is not enough, the interface needs to be navigatable even if the user does not have an overall systems understanding, so screens need to be self-describing.

Online help or online documentation

There is also online help, or online documentation. The documentation put on the website for users to read has to show up in search results. It has to be organized in such a way that users, who are sure to be asking questions like "How can I…" or "Why can't I…" can find the answers quickly. Lots of examples showing how to do various tasks with the software product are also needed. A good idea is to include links to a glossary of terms that might be more difficult to understand.

Always bear in mind that anyone who has had a bad experience with a product tends to remember it for a long time and software is no different. That is why you should strive to make using your product as smooth an experience as possible, something proper support and documentation can help you achieve.
Published date: August 01, 2006

Copyright © 2006, http://www.avangate.com all rights reserved. This article was written by a Web Marketing Specialist at Avangate B.V. The author has in depth knowledge of internet marketing services and website analysis applied to the software industry and e-commerce development. Avangate is an eCommerce platform for electronic software distribution incorporating an easy to use and secure online payment system plus additional marketing and sales tools, such as an affiliate management system, automated cross selling options, software promotion management, software marketing services as well as consultancy on how to increase online software sales.

This article may be reproduced in a website, e-zine, CD-ROM, book, magazine, etc. so long as the above information is included in full, including the link back to this website. Please e-mail at articles@avangate.com , before using the article.



from:Here

posted by Ryan Gene at 9:23 AM 2 comments

Monday, August 14, 2006

[Code]IE Web Controls Tree View + XML

搞了一下ie web control的 tree view,用xml绑定数据

记录分享一下

首先,下载ie web control

点击下载

一路安装好以后,它会谈出一个instruction,要我们build一下,有点像ant

  • 编辑build.bat,在C:\Program Files\IE Web Controls 下(默认安装)
  • 把csc.exe 改称 C:\WINDOWS\Microsoft.NET\Framework\v1.1.4322\csc.exe(默认安装)
  • 保存,运行build.bat

它会build出一个C:\Program Files\IE Web Controls\build目录,里面有个Microsoft.Web.UI.WebControls.dll

接下来

复制C:\Program Files\IE Web Controls\build\Runtime 下所有文件到iis的程序目录,如果没有改的话,应该是C:\Inetpub\wwwroot\webctrl_client\1_0,webctrl_client和1_0两个目录手动建一下。

至此, 安装完毕,接下来,来玩玩tree view

为了方便,可以把ie web controls的按钮添加到toolbox里面 tool -> add/remove toolbox item... browse,选择刚才那个Microsoft.Web.UI.WebControls.dll

toolbox里就多了几个东西,treeview, multipage什么的。


-----------------------------------------------

接下来,是运用tree view的环节,明天再写。

posted by Ryan Gene at 10:31 PM 1 comments

Saturday, August 12, 2006

[Tricks]伪装Mac地址

以前因为某种需要,找了一些修改Mac地址的方法(其实也就是操作系统级别的伪装而已),修改了注册表里的一些值,搞定

昨天又要改,偷懒找了一个软件,不用不知道,一用真方便。

SMAC 2.0

用了它,修改真方便。。。嘿嘿

posted by Ryan Gene at 9:05 AM 1 comments

[Code]JavaScript Selector


刚做完一个小demo,用js模拟了一个selector的东东,想法是这样的:

假页面里的值先填好
如果没有某个参数(fillData),则将form里的值清空,如果带参数,则不要执行清空
打开一个子页面,点击子页面中的某个链接或按钮执行window.opener.location.href =
window.opener.location.href +'?fillData=true';window.close();
父页面(也就是先前说的假页面)就会刷一下,数据出现了


<script language="javascript">
function clearForm(){
for (i=0; i<document.Form1.elements.length; i++){
if (document.Form1.elements[i].type=="text" || document.Form1.elements[i].type=="textarea"){
document.Form1.elements[i].value="";
}
}
}

function checkPara(){
var urlstr = window.document.URL;
var parameterString = urlstr.replace(/.*\?(.*)/, "$1");
var parameterTokens = parameterString.split("&");
var parameterList = new Array();

for (i = 0; i < parameterTokens.length; i++)
{
var parameterName = parameterTokens[i].replace(/(.*)=.*/, "$1");
var parameterValue = parameterTokens[i].replace(/.*=(.*)/, "$1");

parameterList[parameterName] = parameterValue;
}

if( !parameterList["fillData"] )
clearForm();

}
checkPara();
</script>



后续:真实的实现见:
用JavaScript执行PostBack

posted by Ryan Gene at 12:36 AM 0 comments

Wednesday, August 09, 2006

[Comment]Blogger解封?


前段时间就看到部分blogspot.com站点可以访问的消息,但后来又不能访问了

今天突然发现jinweijie.blogspot.com可以访问了。但不知道是暂时的昙花一现呢,还是Google的blogger要杀进中国市场了。

一旦blogspot全面解封,无疑最恐慌的便是微软的space了,相信用space的人对微软的霸道多多少少会感到气愤吧,捆绑live messenger不说,还在用户毫不知情的情况下将msn space升级成live space,而且分辨率支持1024X768以上(反正以下会出现滚动条)。space速度本来就很慢了,升级后竟然在上方还出现了大大的ads banner,微软也应该不是那种靠广告为生的小公司吧,干嘛弄得这么猴急。

微软这种根本不把用户放在眼里的做法是在是让人不敢恭维!

希望blogspot解封,杀杀微软的嚣张气焰!阿门。。。

posted by Ryan Gene at 1:14 PM 4 comments

Sunday, August 06, 2006

[Code]程序员和美工的配合问题

看到Sean Blog的一篇关于美工和程序员的文章,觉得不错。

庆幸和我一起的是Sean,呵呵!我们使用的是解决篇里的第一种方式,因为Sean是那种达到了美工要求极高的那种程度,哈哈:P

程序员和美工存在的矛盾

1. 美工何时参与到项目中来

2. 程序员不懂如何将页面弄得美观,美工也不懂如何向页面中添加代码(即使是使用了Velocity)

3. 程序员和美工是两种完全不同的人,他们关心的事情也完全不同,这就导致两种人对页面代码(html)风格的要求大相径庭??程序员要得是简单易懂,美工要得是美观漂亮

4. 程序员要做的是将数据展现在页面上(使用简单的条件、循环语句),美工要做的是将美丽充满整个屏幕(程序员会叫道:天哪!这么复杂,我怎么用if、else、for来实现)



解决篇:

上面的这几点问题和矛盾从关系上来讲是层层递进的,要一个一个依次解决。先来说说美工何时介入到项目中来,在公司做过的这些项目以及我听说过的项目看,大致有以下几种:1)先有美工制作静态页面,完成后程序员直接向页面中添加程序代码;2)程序员随时和美工沟通,向美工描述页面需求,随要随做;3)程序员自己编写测试页面,然后让美工进行美化。

这3种方式可以说是个有利弊。方式1)对程序员来说绝对是个喜讯,它能使程序员最大限度的远离那些烦人的页面编码,提高程序员工作的含金量。同时,一套完整的页面可以展现全部业务的流程,对程序员开发也起到了规范的作用。但这种方式对美工的要求极高,美工要了解项目的需求,而这一般是达不到的。但可以让了解需求的人为其讲解,或是描绘出希望的页面的样式。这样虽然可以弥补美工对业务了解的不足,但也确实花掉了很多时间(而且是花掉了比较重要的人物的时间,因为了解整体业务的一般都是公司的牛人,他们的时间可是一刻千金呀)。方式2)是一个比较折中的方法,这样做无需太多的准备就可开始编码工作,程序员把握页面内容和样式,向美工详细描述,美工再根据描述设计页面,最后返回给程序员添加代码。这个反馈的过程一般比较迅速,效果也不错,可以达到程序员预期的效果,适用于项目时间要求比较紧的情况。该方式的问题在于没有一个形象化的完整的流程可供程序员参考,一切掌握在程序员手中,容易造成对需求的贪污和系统整体风格的不统一。方式3)一般用于对已有项目的美化上,对美工的要求也很高,她们需要具备在html和其他代码混合体的环境下工作的能力。而且修改的效果一般不是很佳,不到万不得已不推荐使用。

问题2.3.4.虽然表现出来的问题各不相同,但解决的方法却很相似。首先,美工要养成一些程序员编码时惯有的习惯,比如:文件命名要有意义、html代码要根据层次进行缩进等。其次,页面代码的一些细节也要注意,比如,使用居中或右对齐标签来取代空格,必须使用空格时也要用“ ”,不使用

标签,尽量使用表格等。再次,如果在条件允许的情况下,美工也可以学习一下夹杂在页面中的各种程序代码,了解其语义和工作原理,这将对与程序员的合作起到很大的帮助的。最后,就是程序员要在向页面文件中添加代码前先对页面代码做一下审核工作,在这里并不是看美工的页面是否美观,而是看在原有页面代码的基础上是否能够使用简单的条件、循环语句来显示数据(比如,页面布局过于复杂,不能通过简单的循环来显示所有数据),否则就需要修改页面代码直到能满足要求为止。

posted by Ryan Gene at 10:06 AM 6 comments

[Tricks]Accessing blogspot(如何正常访问blogspot)

Sometimes I got 404 error on www.pkblogs.com. I don't know why but I guess the problem happened on particular network provider because Tracy Tang who is using a different network provider has no problem on this issue.

Pkblogs is not that reliable in China :P. After searching, I got another blogspot Gateway - www.inblogs.net, working as just the same as pkblogs. Need sometime to see whether the www.inblogs.net is stable. :D

Instructions:
if your blogspot address is: somelink.blogspot.com, visit www.inblogs.net/somelink instead.

If you got the problem like me, change the gateway to have a try.

posted by Ryan Gene at 8:19 AM 0 comments

Thursday, August 03, 2006

[Tricks]去掉Blogger的Banner(Blogger的广告)

去掉最上面blogger那个banner的办法:

进入控制台,编辑模版,在标签前<head>加上
<noscript>
<head></head>
</noscript>

在</body>后(</body>在比较后面的地方)加上

<noscript>
<body></body>
</noscript>


保存,发布,就可以了。

:P

--------------------------------------------

补充:(Thank you, Sally)

#b-navbar {
height: 0px;
visibility: hidden;
display: none;
}

copy and paste the CSS code above inside <.head.> section. :)

posted by Ryan Gene at 7:19 PM 3 comments

Wednesday, August 02, 2006

[Code]IE Bug or ?

前几天在做一个小东西的时候碰到如下情况:

环境:
  • IE 6.0.2900.2180.xpsp_sp2_gdr.050301-1519
  • Visual Studio 2003
  • IIS 6.0

用了一个ASP.Net的Validator,由于外面的table的宽度是固定的,而Validator是Dynamic出现的,所以当Validator出现时(操作:输入不符合规则的字符,鼠标直接点下面奖金那一行的textbox),把所在的TR撑开,本来,光标的focus应该是落在下面的textbox上,撑开以后,原来focus的位置正好变成Validator的位置,结果就是原来不能编辑的Validator可以输入字符了。

截图如下:

1. 2. 3. 4.

IE的bug?

posted by Ryan Gene at 5:20 PM 2 comments

Tuesday, August 01, 2006

[Comment]www.ie7.com

check out ie7.com:

http://www.ie7.com

How does Microsoft feel about this site? haha



posted by Ryan Gene at 12:37 PM 2 comments

Name:
Location: Shanghai, Shanghai, China

Powered by Blogger
Powered by Writely

Add to Google

Site Feed