摘要: 要实现异步编程,就需要正确的实现IAsyncResult接口。IAsyncResult共有四个属性: <!--?XML:NAMESPACE PREFIX = "[default] http://www.w3.org/1999/xhtml" NS = "http://www.w3.org/1999/x 阅读全文
posted @ 2013-12-08 11:45 Joe·Zhou 阅读(3019) 评论(0) 推荐(1)
摘要: 在讨论这个问题之前,先学习一下时间片的概念。时间片即CPU分配给各个程序的时间,每个进程被分配一个时间段,称作它的时间片,即该进程允许运行的时间,使各个程序从表面上看是同时进行的。如果在时间片结束时进程还在运行,则CPU将被剥夺并分配给另一个进程。如果进程在时间片结束前阻塞或结束,则CPU当即进行切换。而不会造成CPU资源浪费。(百度百科)多线程正是充分利用利用时间片,从而充分利用CPU的宝贵资源来提高执行效率。但是创建线程和销毁线程的开销都比较大,但线程数量太多时,性能会很差,因为操作系统需要在它们之间切换,消耗的内存也也很大。 在执行很多任务时,开辟更多线程对于性能提升没有太大意义,反而. 阅读全文
posted @ 2013-12-07 19:23 Joe·Zhou 阅读(1267) 评论(0) 推荐(2)
摘要: 本来想穷举所有密码,算法要么就嵌套太深,要么就特别耗内存(会溢出).后来选了一个简单重复概率很低的算法.代码如下:# -*- coding:utf-8 -*-''' @ user: joe.zhou @ date: 2013-8-30 @ function: 生成随机密码字典'''import randomclass Dictor(): CSet=' abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789~!@#$%^&*()_-+=/*:;\'&quo 阅读全文
posted @ 2013-08-30 16:54 Joe·Zhou 阅读(1787) 评论(2) 推荐(0)
摘要: 引擎渲染速度竞赛 条数据 × 次渲染测试建议在高版本的浏览器上进行测试,避免浏览器停止响应测试环境:开始测试» 阅读全文
posted @ 2013-08-02 17:17 Joe·Zhou 阅读(1913) 评论(2) 推荐(0)
摘要: 很多时候我们需要按时间间隔执行一个任务,当满足一定条件时停止执行.此插件旨在解决这一经常遇到的问题.jTimer:(function ($) { $.extend({ timer: function (action,context,time) { var _timer; if ($.isFunction(action)) { (function () { _timer = setInterval(function () { ... 阅读全文
posted @ 2013-07-17 11:09 Joe·Zhou 阅读(507) 评论(0) 推荐(0)
摘要: http://www.codeproject.com/Articles/325228/Choosing-technologies-for-NET-project 阅读全文
posted @ 2013-06-22 10:01 Joe·Zhou 阅读(253) 评论(0) 推荐(0)
摘要: MS的链表是一个双向链表,自己实现一个单向链表。 阅读全文
posted @ 2013-03-20 11:59 Joe·Zhou 阅读(304) 评论(0) 推荐(0)
摘要: 一个基于jQuery的分页控件。 阅读全文
posted @ 2013-03-18 17:10 Joe·Zhou 阅读(432) 评论(2) 推荐(0)
摘要: 目标:让Repeater支持Ajax回调方案:利用asp.net的Callback机制控件代码:using System;using System.ComponentModel;using System.Web.UI;using System.Web.UI.WebControls;namespace Web.AjaxControl{ public delegate string DoCallback(string arg); [ToolboxData("")] public class AjaxRepeater : Repeater,INamingContainer,ICa 阅读全文
posted @ 2013-03-12 15:37 Joe·Zhou 阅读(1351) 评论(0) 推荐(0)
摘要: 有10000个无序排列的数字(1<=N<=9999),其中有一个重复的数字,设计一个算法快速高效的找到重复数字。 public class Cacl { public int GetRepeatNumber(int[] arr) { while (true) { int t = arr[0]; if (arr[t] != t) { arr[0] = arr[t]; arr[t] = t; ... 阅读全文
posted @ 2013-02-26 18:00 Joe·Zhou 阅读(335) 评论(2) 推荐(1)
摘要: 1 class Program 2 { 3 static void Main(string[] args) 4 { 5 MetadataConfigurationManager.Config(""); 6 string json = "{\"ID\":\"000001\",\"Name\":\"order000001\",\"Details\":[{\"ID\":\"000001\",\"Name\":\& 阅读全文
posted @ 2013-02-01 15:50 Joe·Zhou 阅读(728) 评论(0) 推荐(0)
摘要: 1 (function ($) { 2 $.fn.getData = function (itemTag) { 3 var obj; 4 if (itemTag) { 5 obj = []; 6 this.find(itemTag).each(function () { 7 obj.push($(this).getData()); 8 }); 9 return obj;10 }11 else {... 阅读全文
posted @ 2013-01-24 19:46 Joe·Zhou 阅读(605) 评论(0) 推荐(0)
摘要: number.xml:<?xml version="1.0" encoding="utf-8"?><?xml-stylesheet type="text/xsl" href="number.xsl" ?><root> <start>6</start></root>number.xsl:<?xml version="1.0" encoding="utf-8" ?><xsl:styleshe 阅读全文
posted @ 2012-09-25 10:48 Joe·Zhou 阅读(392) 评论(0) 推荐(0)
摘要: string data = "Name=zhoulq&Sex=" + HttpUtility.UrlEncode("男"); byte[] msg=Encoding.UTF8.GetBytes(data); HttpWebRequest req = HttpWebRequest.Create("http://localhost:1256/Accept.aspx") as HttpWebRequest; req.ContentType = "application/x-www-form-urlencoded... 阅读全文
posted @ 2012-09-19 14:38 Joe·Zhou 阅读(520) 评论(9) 推荐(0)
摘要: 效果:CSS:/*accordion*/.accord{ background-color: #fff; margin: 0px; border: solid 1px #99BBE8; border-collapse: collapse; vertical-align: middle;}.accord dd{ display:none; margin-left: 0px; text-align: center;}.accord dt{ font-weight: bold; text-align: left; padding: 5... 阅读全文
posted @ 2012-07-08 11:57 Joe·Zhou 阅读(384) 评论(0) 推荐(0)
摘要: 效果:代码: 1 /*tab*/ 2 .tabs 3 { 4 display: block; 5 width: 100%; 6 margin: 0px; 7 padding-left: 0px; 8 text-align: center; 9 }10 .tabs li11 {12 list-style: none;13 float: left;14 position: relative;15 top: 1px;16 margin: 0 .2em 0 0;17 border-bottom: 0;18 ... 阅读全文
posted @ 2012-07-06 19:42 Joe·Zhou 阅读(589) 评论(0) 推荐(0)
摘要: HTML代码:<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml" ><head> <title>网格控件测试</title> <link href="Style/site.css" 阅读全文
posted @ 2012-06-08 19:06 Joe·Zhou 阅读(776) 评论(0) 推荐(0)
摘要: 看了一下Microsoft的一个Template的JQuery插件,总是感觉使用起来特别别扭,我还是自己写一个吧。代码如下:(function($) { $.fn.template = function(tmpl, arrayData) { if ($.isArray(arrayData) && tmpl) { var pReg = /\$\{\s*[a-zA-Z]+(\.[a-zA-Z]+)*\s*\}/g; var places = tmpl.match(pReg); var props = new A... 阅读全文
posted @ 2012-06-07 22:44 Joe·Zhou 阅读(571) 评论(0) 推荐(0)
摘要: 契约:using System;using System.ServiceModel;namespace WcfAsync{ [ServiceContract] public interface ICalculatorService { [OperationContract(AsyncPattern = true)] IAsyncResult BeginAdd(decimal x,decimal y,AsyncCallback callback,object state); decimal EndAdd(IAsyncResult ar)... 阅读全文
posted @ 2012-01-03 18:36 Joe·Zhou 阅读(750) 评论(2) 推荐(0)
摘要: 效果:js:$.fn.extend({ JPager: function (cfg, pageIndex, pageSize) { if (cfg && pageIndex > 0 && pageSize>0) { var token = "#" + this.attr("id"); this.empty(); var pageFirst = function () { $(token).JPager(cfg, 1, pageSize); }; var pagePre = function () ... 阅读全文
posted @ 2012-01-02 16:28 Joe·Zhou 阅读(602) 评论(0) 推荐(0)