这段代码利用了函数指针进行自定义排序function CustomSortProc(Item1, Item2: TListItem; ColumnIndex: integer): integer; stdcall;beginif ColumnIndex = 0 thenResult := CompareText(Item1.Caption,Ite……继续阅读 » 水墨上仙 5年前 (2021-03-20) 1825浏览 2396个赞
Delphi ListView 添加新的项目,演示里的ListView包含三栏,第一栏使用caption设置标题,第二栏和第三栏需要使用SubItems对象才操作i := ListView1.Items.Count; with ListView1 do begin ListItem:=Items.Add; ListItem.Caption:= ……继续阅读 » 水墨上仙 5年前 (2021-03-20) 3169浏览 1362个赞
AS3 删除数组里的重复数据代码function removeDuplicate(arr:Array) : void{ var i:int; var j: int; for (i = 0; i < arr.length - 1; i++){ for (j = i + 1; j < arr.length……继续阅读 » 水墨上仙 5年前 (2021-03-20) 2847浏览 994个赞
AS3对数组进行Push, Pop, Unshift 和 Shift 等操作的代码var myArray:Array = new Array(); // PUSH// Adds one or more elements to the end of an array and returns the new length of the array……继续阅读 » 水墨上仙 5年前 (2021-03-20) 1667浏览 802个赞
objective c一个更好的日志方案代码// Macro voodo? Will not be printed if application is build with -DPRODUCTION// Ex. Log(@"String with %s", @"Formatting");#ifndef PRO……继续阅读 » 水墨上仙 5年前 (2021-03-20) 2578浏览 2312个赞
jQuery使用非常简单的语句实现表格隔行变色效果// jQuery$(function(){ $("tr.stripe:even").css("background-color", "#D0D0D0"); $("tr.stripe:odd").css("……继续阅读 » 水墨上仙 5年前 (2021-03-20) 1558浏览 1651个赞
youtube使用的HTML5 视频播放器<div id="video-player"> <video width="640" height="360" src="/demo/google_main.mp4?2" autobuffer> &……继续阅读 » 水墨上仙 5年前 (2021-03-20) 1615浏览 2782个赞
AS3检查网络链接是否正常,这段代码通过监控一个指定的url来判断链接是否正常import air.net.URLMonitor;import flash.net.URLRequest;import flash.events.StatusEvent; var monitor:URLMonitor = new URLMonitor(new URL……继续阅读 » 水墨上仙 5年前 (2021-03-20) 1744浏览 625个赞
这段代码非常简单实用,通过链接切换所有checkbox是否选中var tog = false; // or true if they are checked on load $('a').click(function() { $("input[type=checkbox]").attr("……继续阅读 » 水墨上仙 5年前 (2021-03-20) 3080浏览 217个赞
Delphi ListView 按标题删除项目,这段代码的遍历是从后往前遍历的for i:=ListView1.Items.Count-1 downto 0 Do if ListView1.Items[i].Caption = Edit1.Text then begin ListView1.Items.Item[i].Delete(); //删除……继续阅读 » 水墨上仙 5年前 (2021-03-20) 1609浏览 2998个赞
CodeIgniter: Redirect Internet Explorer Visitors$this->load->library('user_agent');if($this->agent->browser() == 'Internet Explorer' AND in_arra……继续阅读 » 水墨上仙 5年前 (2021-03-20) 2013浏览 1551个赞
AS3加载Xml文件的代码import flash.events.Event;import flash.net.URLLoader;import flash.net.URLRequest;import flash.display.Loader; private var myXML:XML; // pass the path to the ……继续阅读 » 水墨上仙 5年前 (2021-03-20) 2994浏览 2466个赞
AS3检测鼠标移动的方向的代码片段function Start() { stage.addEventListener(MouseEvent.MOUSE_MOVE, CheckDirection); }Start(); var prevX=0;var prevY=0;var curX=0;var curY=0; var di……继续阅读 » 水墨上仙 5年前 (2021-03-20) 2678浏览 1136个赞
AS3下载文件到桌面的代码private var request:URLRequest; private var localRef:FileReference; protected function buttonClick():void { request = new URLRequest("soundbyte.m……继续阅读 » 水墨上仙 5年前 (2021-03-20) 1690浏览 410个赞
C++希尔排序算法代码template<class T>void ShellSort(T arr[], int N){ inti; intj; intstep; for( step = N/2; step > 0; step/=2) { ……继续阅读 » 水墨上仙 5年前 (2021-03-20) 2542浏览 249个赞
Java下获取可用CPU数Runtime.getRuntime().availableProcessors()……继续阅读 » 水墨上仙 5年前 (2021-03-20) 3281浏览 1324个赞
JXL导出Excel文件/** * 导出为Excel * @param cdosCategoryKeyWords * @return */ public boolean exportExcel(CDO[] cdosCategoryKeyWords) { HttpServletResponse re……继续阅读 » 水墨上仙 5年前 (2021-03-20) 1794浏览 2298个赞
Java模拟数据结构中栈的进队出队package com.stackANDqueue;import java.io.DataInputStream;import java.io.IOException;/* * 这是一个栈的模拟 * 模拟的是入栈和出栈 */public class Stack { static int MAX =……继续阅读 » 水墨上仙 5年前 (2021-03-20) 1918浏览 2362个赞
ASM 是一个 Java 字节码操控框架。它能够以二进制形式修改已有类或者动态生成类。ASM 可以直接产生二进制 class 文件,也可以在类被加载入 Java 虚拟机之前动态改变类行为。ASM 从类文件中读入信息后,能够改变类行为,分析类信息,甚至能够根据用户要求生成新类。示例中演示的功能: 生成被代理类的子类,并重写所有方法(除java.lan……继续阅读 » 水墨上仙 5年前 (2021-03-20) 3209浏览 1443个赞
C#中的委托,匿名方法和Lambda表达式用法举例来源:http://www.cnblogs.com/niyw/archive/2010/10/07/1845232.html 在.NET中,委托,匿名方法和Lambda表达式很容易发生混淆。我想下面的代码能证实这点。下面哪一个First……继续阅读 » 水墨上仙 5年前 (2021-03-20) 2395浏览 1050个赞
C#委托实现匿名方法// CalculateTax is a delegate that takes a double and returns a doublepublic delegate double CalculateTax(double x);static void Main(string[] args) { CalculateTa……继续阅读 » 水墨上仙 5年前 (2021-03-20) 2952浏览 1725个赞
CalculateTax是一个委托,给定一个double值并返回一个double值// CalculateTax is a delegate that takes a double and returns a doublepublic delegate double CalculateTax(double x);static public doub……继续阅读 » 水墨上仙 5年前 (2021-03-20) 2403浏览 989个赞
C#连接Oracle数据库 //1、添加引用 System.data.oracleClient //2、设置连接字符串 data source是服务名(也就是在客户端sqlplus中需要输入的主机字符串) //3、以下用法和sqlserver Access 用法一直 ……继续阅读 » 水墨上仙 5年前 (2021-03-20) 2957浏览 2772个赞
C#手动为数据库自增字段插入编号 string sqlstr = "SET IDENTITY_INSERT t1 ON;"; lists.Add(sqlstr); sqlstr = "INSERT INTO t1 (i……继续阅读 » 水墨上仙 5年前 (2021-03-20) 3249浏览 564个赞
C#通过assembly打印公共实例方法 public void Coverage() { writeMethodStart("Coverage"); Assembly assembly = Assembly.LoadFrom("MyApplication.dll"); ……继续阅读 » 水墨上仙 5年前 (2021-03-20) 2816浏览 1033个赞
C#写入字符串到文件或者追加字符串到文件public static void WriteStringToFile(string fileName, string contents) { StreamWriter sWriter = null; try { FileStream fileStre……继续阅读 » 水墨上仙 5年前 (2021-03-20) 3059浏览 1193个赞
C#通过对象类型创建对象实例object[] paramObject = new object[] {}; object obj = Activator.CreateInstance(type, paramObject); 或者string className = &qu……继续阅读 » 水墨上仙 5年前 (2021-03-20) 2701浏览 1741个赞
C# 打印Assmebly里的 objects Assembly assembly = Assembly.GetAssembly(this.GetType()); Type[] types = assembly.GetTypes(); foreach(Type type in types) { ……继续阅读 » 水墨上仙 5年前 (2021-03-20) 2602浏览 2381个赞
C#生成随机ArrayList public static void RandomizeArrayList(ArrayList arrayList, Random random) { if(arrayList == null) { return; } int count = arrayList.Count; for(int i=……继续阅读 » 水墨上仙 5年前 (2021-03-20) 2935浏览 1434个赞
这段代码演示了System.Collections.Generic的各容器类的用法,包括:Dictionary,KeyValuePair,SortedDictionary,SortedList,HashSet,SortedSet,List,Queue,Stack等类的用法System.Collections.Generic.Dictionary<……继续阅读 » 水墨上仙 5年前 (2021-03-20) 2775浏览 594个赞
C#中判断DataReader是否为空,下面的代码通过DataReader的HasRows属性来判断是否为空if(DataReader.HasRows){//do whatever}……继续阅读 » 水墨上仙 5年前 (2021-03-20) 2548浏览 2109个赞
C#检测DataSet是否为空,下面的代码片段通过判断DataSet的Table数量来判断DataSet是否为空DataSet dt = new DataSet();if (dt.Tables.Count>0) // has tables in it{ //dataset is not empty}else {// otherw……继续阅读 » 水墨上仙 5年前 (2021-03-20) 1827浏览 2718个赞
下面以链接sql server为例,默认情况下连接池的大小为100个,你可以根据需要设定连接池,下面设置为最大75个,最小5个DATA SOURCE=(LOCAL);Initial Catalog=sharejsDB;User ID=root;Password=****;Max Pool SIZE=75;Min Pool SIZE=5;……继续阅读 » 水墨上仙 5年前 (2021-03-20) 3230浏览 2427个赞
下面的代码可以实现异步发送邮件,等邮件发送出去后会自动调用回调函数,这样在发送邮件时就不会卡住程序不动了MailMessage m = new MailMessage ("item@75271.com", "raja@75271.com", "This is the subject ……继续阅读 » 水墨上仙 5年前 (2021-03-20) 2298浏览 1304个赞
C#中通过SSL发送邮件MailMessage m = new MailMessage ("item@75271.com", "raja@75271.com", "This is the subject for the authorized email.", &qu……继续阅读 » 水墨上仙 5年前 (2021-03-20) 2920浏览 2507个赞
C#中使用smtp发送邮件MailMessage m = new MailMessage ("jane@75271.com", "ben@75271.com", "This is the subject for the email.", "This is ……继续阅读 » 水墨上仙 5年前 (2021-03-20) 1773浏览 2406个赞
C#发送HTML格式的邮件MailMessage m = new MailMessage();m.From = new MailAddress("ir@w3mentor.com", "Raja Item");m.To.Add(new MailAddress("su@w3mentor.com"……继续阅读 » 水墨上仙 5年前 (2021-03-20) 2579浏览 602个赞
C#发送带附件的邮件MailMessage m = new MailMessage();m.From = new MailAddress("ir@75271.com", "Raja Item");m.To.Add(new MailAddress("su@75271.com", "S……继续阅读 » 水墨上仙 5年前 (2021-03-20) 2682浏览 224个赞
C#发送邮件并抄送给多个邮件接收者MailMessage m = new MailMessage();m.From = new MailAddress("ir@75271.com", "Raja Item");m.To.Add(new MailAddress("su@75271.com", ……继续阅读 » 水墨上仙 5年前 (2021-03-20) 2326浏览 1671个赞
C#读取命令行参数的代码下面的代码用于从命令行读取参数,参数个数不定,程序将会输出用户在命令行输入的所有参数列表using System; namespace W3M{ class ArgsExample { public static int Main(string[] args) { f……继续阅读 » 水墨上仙 5年前 (2021-03-20) 1589浏览 806个赞
C#创建、读取和修改Excelwindows下我们可以通过 Jet OLE DB访问Excel,就行访问数据库一样// Namespaces, Variables, and Constantsusing System;using System.Configuration;using System.Data; private OleDbData……继续阅读 » 水墨上仙 5年前 (2021-03-20) 2249浏览 2856个赞
C#连接ODBC数据源演示代码// Namespaces, variables, and constantsusing System;using System.Configuration;using System.Data;using System.Data.Odbc; private void CButton_Click(object se……继续阅读 » 水墨上仙 5年前 (2021-03-20) 3228浏览 1990个赞
Asp.Net MVC中如果要通过ActionLink生成链接,传递参数可以通过下面的代码实现<%@ Page Language="C#" MasterPageFile="~/Views/Shared/Site.Master" Inherits="System.Web.Mvc.ViewPage&qu……继续阅读 » 水墨上仙 5年前 (2021-03-20) 2539浏览 1912个赞
ASP.NET MVC中通过Html.ActionLink动态生成链接C# MVC模式下HTML.ActionLink() 用于生成指定Action的丽娜姐,非常有用<%@ Page Language="C#" MasterPageFile="~/Views/Shared/Site.Master" ➥Inh……继续阅读 » 水墨上仙 5年前 (2021-03-20) 1978浏览 2596个赞
C#通过正则表达式去除所有html标签,只要包含在里面的都会被认为是html标签string myInput="<a href=''>clean me up</a><br/>";string strippedString = Regex.Replace(myInput,@&qu……继续阅读 » 水墨上仙 5年前 (2021-03-20) 1448浏览 625个赞