文章分类

站点统计

  • 分类总数: 13 个
  • 文章总数: 145 篇
  • 评论总数: 35 条
  • 附件总数: 59 个
  • 建站日期: 2008-08-18
  • 访问总数: 387352 人次
  • RSS订阅: 文章|评论

ibatis中$与#的区别

KY8 于 2009-10-07 15:35:03 发表其它

在ibatis中,#Property#将会根据实际情况进行类型的转换,
$Property$直接替换为属性的值,不进行类型的处理。
例如:person.name="llz"
$name$=llz
#name#='llz'

被阅128次, 0票 发表评论

SharpZipLib使用示例

KY8 于 2009-03-27 23:53:31 发表.Net

SharpZipLib 是一个免费的Zip操作类库,可以利用它对 ZIP 等多种格式进行压缩与解压。SharpZipLib使用C#编写的,在VB.NET、C#或其他的.NET语言中都可以使用它创建Zip文件、并进行读取 和更新等操作。下载网址:http://www.icsharpcode.net/OpenSource/SharpZipLib /Download.aspx。目前的版本为0.85。

1、创建zip文件,并添加文件:

  1. using (ZipFile zip = ZipFile.Create(@"E:\test.zip")) 
  2.     zip.BeginUpdate(); 
  3.     zip.Add(@"E:\文件1.txt"); 
  4.     zip.Add(@"E:\文件2.txt"); 
  5.     zip.CommitUpdate(); 

2、将文件夹压缩为文件:
(new FastZip()).CreateZip(@"E:\test.zip", @"E:\test\", true, "");
最后一个参数是使用正则表达式表示的过滤文件规则。CreateZip方法有3个重载版本,其中有目录过滤参数、文件过滤参数及用于指定是否进行子目录递归的一个bool类型的参数。
3、将文件添加到已有zip文件中:
using (ZipFile zip = new ZipFile(@"E:\test.zip"))
{
    zip.BeginUpdate();
    zip.Add(@"E:\test.doc");
    zip.CommitUpdate();
}
4、列出zip文件中文件
using (ZipFile zip = new ZipFile(@"E:\test.zip"))
{
    string list = string.Empty;
    foreach (ZipEntry entry in zip)
    {
        list += entry.Name + "\r\n";
    }
    MessageBox.Show(list);
}
5、删除zip文件中的一个文件
using (ZipFile zip = new ZipFile(@"E:\test.zip"))
{
    zip.BeginUpdate();
    zip.Delete(@"test.doc");
    zip.Delete(@"test22.txt");
    zip.CommitUpdate();
}
6、解压zip文件中文件到指定目录下
(new FastZip()).ExtractZip(@"E:\test.zip", @"E:\test\", "");
7、常用类:
ZipInputStream、GZipInputStream用于解压缩Deflate、GZip格式流,ZipOutputStream、GZipOutputStream用于压缩Deflate、GZip格式流。
StreamUtil类包含了几个Stream处理辅助方法:
    ①、Copy(Stream, Stream, Byte[])用于从一个Stream对象中复制数据到另一Stream对象。有多个重写
    ②、ReadFully(Stream, Byte [])用于从Stream对象中读取所有的byte数据。有多个重写

被阅845次, 1票SharpZipLib 发表评论

独立小巧的JavaScript库(7):calendar.js

KY8 于 2009-03-07 12:01:58 发表JavaScript

主要特点有:

  1. 小巧:整个组件代码只有一个文件lhgcalendar.js,大小为5.4K。
  2. 调用简单:你只需要在相应位置添加一个事件来调用主函数即可(参考下面有示列)。
  3. 效率高:你试下就知道了:-)。
  4. 外观还看得过去:呵呵,这个算不上特点,本人界面设计能力差,不过提供的这2种样式还算过得去。
  5. 支持的浏览器:IE6+,Firefox2.0+,Chrome(谷歌浏览器),Opera9.5+,Safari3.0+等。

组件结构

  1. lhgcalendar.js:组件核心文件,其实也就这一个文件:-)。
  2. skin:包含组件图片文件和样式表文件的文件夹。
  3. skin/default.css:组件默认式表文件。
  4. skin/gray.css:灰以样式的样式表文件。

调用方法及参数说明

  1. 在需要调用的页面引入lhgcalendar.js,例如:<script type="text/javascript" src="lhgcalenar.js"></script>
  2. 然后在要调用的位置上引发的事件中加入调用代码,例如:<input type="text" onclick="lhgcalendar();" />
  3. 参数说明:只有一个参数,就 是接收日期的控件的ID,用法见下面的示例
    还有就是在lhgcalendar.js里有个组件的配置对象:var config = { dir : '', skin : 'default' } 中的dir指的是日历显示在控件的下面还右面, 默认是下面,写成'right'就是在右面;skin指的就是皮肤名称。
  4. 注:日期的格式为 M-Y-D

点击下载此文件

被阅1784次, 0票Calendar 发表评论

小巧独立的Javascript库(6):jsTree.js

KY8 于 2009-03-01 17:58:32 发表JavaScript

is an open soure treeview control written in JavaScript.

I wrote the script for my phpXplorer system. The script is not intended to be a website menu.
Due to use of the DOM the script only works in modern browsers like MSIE > 5.0, Netscape/Mozilla/Firefox and Opera.
Without support for dead Browsers the size of the script is only 12kb and there are no browser switches inside the code.
A funny feature is that the treeview is able to define its data definition by itself.
Try to click on the node images of this little example tree with the left mouse button.

点击下载

http://www.webxplorer.org/jsTree/

被阅846次, 0票jsTree 发表评论

小巧独立的Javascript库(5):Ajax.js

KY8 于 2009-03-01 16:56:51 发表JavaScript

1、MicroAjax.js

MicroAjax is one of the smallest and easiest AJAX libraries. Usage:

  1. microAjax("/resource/url"function (res) { 
  2.   alert (res); 
  3. });

Download:trunk version (svn)  minified version (841 byte)

Help:FAQ


2、jx - JavaScript Ajax Library

jx is a small toolkit for providing AJAX support in JavaScript. It has two different version - jx and jxs.

Features

  • Supports GET method
  • Supports JSON.
  • Small Size (>1 KB compressed / 2.3 KB with all the comments)
  • Very easy to use.

 

被阅642次, 0票Ajax 发表评论

小巧独立的Javascript库(3):Sizzle JavaScript Selector Library

KY8 于 2009-03-01 16:21:20 发表JavaScript

Sizzle是 一个纯js写的CSS选择器引擎,js大师Resig的作品.据说,相比其它主流javascript库,在Firefox 3下快4倍, Opera 9下快3倍, Safari 3下快1.5倍.而且Resig正在说服其它主流的javascrip库的基础CSS选择器引擎也采用Sizzle,目前准备引入Sizzle框架有: jQuery(1.3以上版本已经使用), MochiKit, Prototype, and Dojo.他们的目标也很简单,就是把大家的力量集中在一个统一的CSS选择器引擎上,不用各自为政.

A pure-JavaScript CSS selector engine designed to be easily dropped in to a host library.

Features:

  • Completely standalone (no library dependencies)
  • Competitive performance for most frequently used selectors
  • Only 4KB minified and gzipped
  • Highly extensible with easy-to-use API
  • Designed for optimal performance with event delegation
  • Clear IP assignent (all code held by the Dojo Foundation, contributors sign CLAs)

Code Features:

  • Provides meaningful error messages for syntax problems
  • Uses a single code path (no XPath)
  • Uses no browser-sniffing
  • Caja-compatible code

Source Code:

http://github.com/jeresig/sizzle/tree/master

Discussion:

http://groups.google.com/group/sizzlejs

Documentation

http://wiki.github.com/jeresig/sizzle

点击下载

被阅797次, 0票Sizzle CSS Selector 发表评论

小巧独立的Javascript库(2):DomReady.js

KY8 于 2009-03-01 16:14:02 发表JavaScript

window.onload事件可以安全的执行javascript,因为该事件是在页面完全加载完后才开始执行(包括页面内的图片、flash等 所有元素),不会因为JS需要对某个DOM 操作,而页面还没有加载该节点而引起错误。但是这种安全是需要付出代价的:如果某些图片(或者一些别的东西)加载特别慢,那么load事件会等到很久之后 才会触发。针对这个问题,一些JS框架提供了一些补充方法。如:jquery的$(document).ready()、mootools的 domready事件。都是在页面的DOM加载完毕后立即执行,而不需要等待漫长的图片下载过程。如果不使用这些框架,可以使用这个独立的DomReady.js

使用方法:

  1. <html lang="en"> 
  2. <head> 
  3.     <script src="domready.js" type="application/javascript"></script> 
  4.     <script type="application/javascript"> 
  5.         DomReady.ready(function() { 
  6.             alert('dom is ready'); 
  7.         }); 
  8.     </script> 
  9. </head> 
  10. <body> 
  11.  
  12. </body> 
  13. </html> 
被阅869次, 0票DomReady 发表评论
1 / 19 / 145 | « 1 2 3 4 » |
Powered by MiniBoke v2.0.0.8 Build 0828

Copyright © 2008 开源吧!. All rights reserved.

粤ICP备07500939号