本代码演示了如何使用千位分隔符“,”格式化数字输出//Example for using thousand separator (,) for decimal integer numbers#include <iostream>#include <cstdlib> using namespace std; int m……继续阅读 » 水墨上仙 4年前 (2021-03-20) 2002浏览 2467个赞
C++简单交换堆排序/* Can easily be modified to work with other data types */ void heapsort(int *arr, int n){ int start, end; // heapify the array for(start = (n - 2) / ……继续阅读 » 水墨上仙 4年前 (2021-03-20) 1841浏览 2867个赞
C++面向对象中的多态代码演示//An example of using overriding techniques to demonstrate function with a polymorphism behaviour. #include <iostream> using namespace std; // abstract……继续阅读 » 水墨上仙 4年前 (2021-03-20) 1635浏览 1904个赞
C语言初始化多维数组 //one dimensional array int x[5] = {1,2,3,4,5}; //two dimensional array int y[3][4] = {{1,2,3,4},{5,6,7,8},{9,10,11,12}}; //Three dimens……继续阅读 » 水墨上仙 4年前 (2021-03-20) 2960浏览 740个赞
基于面向对象的C++双向链表代码演示//An example of a simple double linked list using OOP techniques#include <iostream>using namespace std; struct Node{ double value; Node *N,*P; ……继续阅读 » 水墨上仙 4年前 (2021-03-20) 2286浏览 1757个赞
几个非常有用的C字符串函数#include <string.h>#include <stdlib.h> void remchars(char *str, char c);void remcnks(char *str, char *cnk);void replchars(char *str, char c1, char ……继续阅读 » 水墨上仙 4年前 (2021-03-20) 1276浏览 2360个赞
C++异常处理范例代码// Program shows copying one text file from source location// to any other location (destination), plus possibility of changing its name, // and also shows many lan……继续阅读 » 水墨上仙 4年前 (2021-03-20) 2909浏览 428个赞
C++使用key文件进行xor加解密/* The function (en/de)crypts an input data file with an input key file using the XOR method. The use of a key file instead of a plain text key m……继续阅读 » 水墨上仙 4年前 (2021-03-20) 1537浏览 158个赞
C++按单词换行的函数,按照指定的长度对字符串进行换行,如果指定的长度正好在某个单词中间,就往回查找,直到出现空格再换行/* This function takes a string and an output buffer and a desired width. It then copies the string to the buf……继续阅读 » 水墨上仙 4年前 (2021-03-20) 2904浏览 1334个赞
C++演示在不同的范围内不冲突使用同名变量的范例// An example of using the same variable declarations in different scopes in C++ without conflicts #include <iostream> using std::cout;using s……继续阅读 » 水墨上仙 4年前 (2021-03-20) 2818浏览 628个赞
C语言创建pascal三角图形//Procedural Programming technique shows creation of Pascal's Triangl#include <iostream>#include <iomanip>using namespace std;int** comb(int*……继续阅读 » 水墨上仙 4年前 (2021-03-20) 2079浏览 1405个赞
AS3控制键盘的方向键代码package { import flash.display.MovieClip; import flash.events.Event; import flash.events.KeyboardEvent; public class KeyboardController extends MovieClip……继续阅读 » 水墨上仙 4年前 (2021-03-20) 1366浏览 1359个赞
iphone UIActionSheet – pop up list of options// place this code in a UIViewController subclass - (void)debugButtonPressed:(id)sender{ UIActionSheet* action = [[UIActio……继续阅读 » 水墨上仙 4年前 (2021-03-20) 2795浏览 1812个赞
来源: ……继续阅读 » 水墨上仙 4年前 (2021-03-20) 1273浏览 756个赞
最新HTML5标准的网页设计模板,包含了常用的布局元素<!doctype html><!-- I HTML 5 --><html lang="en"><head> <title>New Document</title> <meta charse……继续阅读 » 水墨上仙 4年前 (2021-03-20) 2960浏览 461个赞
纯CSS实现支持IE6的min-width.min_width{ min-width: 500px; /* For good browsers */} * html .min_width { padding: 0 250px; } /* This is for the markup that only appears in IE6 t……继续阅读 » 水墨上仙 4年前 (2021-03-20) 1657浏览 1977个赞
AS3快速生成bmpvar bmpData:BitmapData = new BitmapData(800,800, true, 0x00000000);bmpData.draw (myClip);var bmp:Bitmap = new Bitmap(bmpData); this.addChild(bmp);……继续阅读 » 水墨上仙 4年前 (2021-03-20) 1222浏览 2387个赞
AS3关闭所有声音的代码import flash.media.SoundMixer; SoundMixer.soundTransform = new SoundTransform(0);……继续阅读 » 水墨上仙 4年前 (2021-03-20) 2244浏览 349个赞
这段代码利用了函数指针进行自定义排序function CustomSortProc(Item1, Item2: TListItem; ColumnIndex: integer): integer; stdcall;beginif ColumnIndex = 0 thenResult := CompareText(Item1.Caption,Ite……继续阅读 » 水墨上仙 4年前 (2021-03-20) 1489浏览 262个赞
Delphi ListView 添加新的项目,演示里的ListView包含三栏,第一栏使用caption设置标题,第二栏和第三栏需要使用SubItems对象才操作i := ListView1.Items.Count; with ListView1 do begin ListItem:=Items.Add; ListItem.Caption:= ……继续阅读 » 水墨上仙 4年前 (2021-03-20) 3094浏览 1937个赞
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……继续阅读 » 水墨上仙 4年前 (2021-03-20) 3015浏览 510个赞
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……继续阅读 » 水墨上仙 4年前 (2021-03-20) 3049浏览 1417个赞
objective c一个更好的日志方案代码// Macro voodo? Will not be printed if application is build with -DPRODUCTION// Ex. Log(@"String with %s", @"Formatting");#ifndef PRO……继续阅读 » 水墨上仙 4年前 (2021-03-20) 1528浏览 1922个赞
jQuery使用非常简单的语句实现表格隔行变色效果// jQuery$(function(){ $("tr.stripe:even").css("background-color", "#D0D0D0"); $("tr.stripe:odd").css("……继续阅读 » 水墨上仙 4年前 (2021-03-20) 1815浏览 2240个赞
youtube使用的HTML5 视频播放器<div id="video-player"> <video width="640" height="360" src="/demo/google_main.mp4?2" autobuffer> &……继续阅读 » 水墨上仙 4年前 (2021-03-20) 2800浏览 1513个赞
AS3检查网络链接是否正常,这段代码通过监控一个指定的url来判断链接是否正常import air.net.URLMonitor;import flash.net.URLRequest;import flash.events.StatusEvent; var monitor:URLMonitor = new URLMonitor(new URL……继续阅读 » 水墨上仙 4年前 (2021-03-20) 2696浏览 2306个赞
这段代码非常简单实用,通过链接切换所有checkbox是否选中var tog = false; // or true if they are checked on load $('a').click(function() { $("input[type=checkbox]").attr("……继续阅读 » 水墨上仙 4年前 (2021-03-20) 1639浏览 847个赞
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(); //删除……继续阅读 » 水墨上仙 4年前 (2021-03-20) 1717浏览 2067个赞
CodeIgniter: Redirect Internet Explorer Visitors$this->load->library('user_agent');if($this->agent->browser() == 'Internet Explorer' AND in_arra……继续阅读 » 水墨上仙 4年前 (2021-03-20) 3021浏览 1131个赞
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 ……继续阅读 » 水墨上仙 4年前 (2021-03-20) 2749浏览 2239个赞
AS3检测鼠标移动的方向的代码片段function Start() { stage.addEventListener(MouseEvent.MOUSE_MOVE, CheckDirection); }Start(); var prevX=0;var prevY=0;var curX=0;var curY=0; var di……继续阅读 » 水墨上仙 4年前 (2021-03-20) 2147浏览 1201个赞
AS3下载文件到桌面的代码private var request:URLRequest; private var localRef:FileReference; protected function buttonClick():void { request = new URLRequest("soundbyte.m……继续阅读 » 水墨上仙 4年前 (2021-03-20) 2947浏览 2517个赞
C++希尔排序算法代码template<class T>void ShellSort(T arr[], int N){ inti; intj; intstep; for( step = N/2; step > 0; step/=2) { ……继续阅读 » 水墨上仙 4年前 (2021-03-20) 2298浏览 1535个赞
Java下获取可用CPU数Runtime.getRuntime().availableProcessors()……继续阅读 » 水墨上仙 4年前 (2021-03-20) 3498浏览 2137个赞
JXL导出Excel文件/** * 导出为Excel * @param cdosCategoryKeyWords * @return */ public boolean exportExcel(CDO[] cdosCategoryKeyWords) { HttpServletResponse re……继续阅读 » 水墨上仙 4年前 (2021-03-20) 2907浏览 2398个赞
Java模拟数据结构中栈的进队出队package com.stackANDqueue;import java.io.DataInputStream;import java.io.IOException;/* * 这是一个栈的模拟 * 模拟的是入栈和出栈 */public class Stack { static int MAX =……继续阅读 » 水墨上仙 4年前 (2021-03-20) 2275浏览 1523个赞
ASM 是一个 Java 字节码操控框架。它能够以二进制形式修改已有类或者动态生成类。ASM 可以直接产生二进制 class 文件,也可以在类被加载入 Java 虚拟机之前动态改变类行为。ASM 从类文件中读入信息后,能够改变类行为,分析类信息,甚至能够根据用户要求生成新类。示例中演示的功能: 生成被代理类的子类,并重写所有方法(除java.lan……继续阅读 » 水墨上仙 4年前 (2021-03-20) 1981浏览 2987个赞
C#中的委托,匿名方法和Lambda表达式用法举例来源:http://www.cnblogs.com/niyw/archive/2010/10/07/1845232.html 在.NET中,委托,匿名方法和Lambda表达式很容易发生混淆。我想下面的代码能证实这点。下面哪一个First……继续阅读 » 水墨上仙 4年前 (2021-03-20) 1665浏览 1017个赞
C#委托实现匿名方法// CalculateTax is a delegate that takes a double and returns a doublepublic delegate double CalculateTax(double x);static void Main(string[] args) { CalculateTa……继续阅读 » 水墨上仙 4年前 (2021-03-20) 1927浏览 314个赞
CalculateTax是一个委托,给定一个double值并返回一个double值// CalculateTax is a delegate that takes a double and returns a doublepublic delegate double CalculateTax(double x);static public doub……继续阅读 » 水墨上仙 4年前 (2021-03-20) 1593浏览 1813个赞
C#连接Oracle数据库 //1、添加引用 System.data.oracleClient //2、设置连接字符串 data source是服务名(也就是在客户端sqlplus中需要输入的主机字符串) //3、以下用法和sqlserver Access 用法一直 ……继续阅读 » 水墨上仙 4年前 (2021-03-20) 2928浏览 2184个赞
C#手动为数据库自增字段插入编号 string sqlstr = "SET IDENTITY_INSERT t1 ON;"; lists.Add(sqlstr); sqlstr = "INSERT INTO t1 (i……继续阅读 » 水墨上仙 4年前 (2021-03-20) 1228浏览 2437个赞
C#通过assembly打印公共实例方法 public void Coverage() { writeMethodStart("Coverage"); Assembly assembly = Assembly.LoadFrom("MyApplication.dll"); ……继续阅读 » 水墨上仙 4年前 (2021-03-20) 1191浏览 2683个赞
C#写入字符串到文件或者追加字符串到文件public static void WriteStringToFile(string fileName, string contents) { StreamWriter sWriter = null; try { FileStream fileStre……继续阅读 » 水墨上仙 4年前 (2021-03-20) 2218浏览 257个赞
C#通过对象类型创建对象实例object[] paramObject = new object[] {}; object obj = Activator.CreateInstance(type, paramObject); 或者string className = &qu……继续阅读 » 水墨上仙 4年前 (2021-03-20) 2852浏览 1538个赞