代码改变世界

随笔档案-2012年09月

PetaPoco使用

2012-09-26 23:46 by hongjiumu, 4154 阅读, 收藏,
摘要: <?xml version="1.0" encoding="utf-8" ?><configuration> <connectionStrings> <add name="connectionStringName" connectionString="server=localhost;database=0914;uid=sa;password=850414;" /> </connectionStrings></configuration>usi 阅读全文

委托理解

2012-09-24 18:18 by hongjiumu, 273 阅读, 收藏,
摘要: 委托在本质上是一个类,我们用delegate关键字声明的所有委托都继承自System.MulticastDelegate。后者又继承自System.Delegate类,System.Delegate类则继承自System.Object。委托既然是一个类,那么它可以被定义在任何地方,既可以定义在类的内部,也可以定义在类的外部。正如很多资料上所说的,委托是一种类型安全的函数回调机制,它不仅能够调用实例方法,也能调用静态方法,并且具备按顺序执行多个方法的能力。由于委托继承自System.MulticastDelegate类,自然也继承MulticastDelegate类的字段、属性和方法。这些成员中 阅读全文

如何解决sql server2008:将字符串转换为 uniqueidentifier 时出现语法错误

2012-09-17 17:25 by hongjiumu, 2222 阅读, 收藏,
摘要: declare @parentKey char(36) set @parentKey='B4B519EF-13F9-4F85-A382-21362F337D9D' select [Pro_ProductCategory].[CategoryName]+'('+ cast((select COUNT(1)from Pro_ProductMST where ProductModelKey in (select ModelKey from Pro_ProductModel where CategoryKey=[Pro_ProductCategory].Category 阅读全文

c++连接mssql

2012-09-17 14:22 by hongjiumu, 2059 阅读, 收藏,
摘要: # include <iostream>//# include "stdafx.h"# include <iomanip># import "c:\program files\common files\system\ado\msado15.dll" no_namespace rename("EOF", "EndOfFile")int main(){ ::CoInitialize(NULL); try { _ConnectionPtr pConn("ADODB.Connection& 阅读全文

第一个c++

2012-09-17 09:39 by hongjiumu, 199 阅读, 收藏,
摘要: # include <iostream> int main(){ std::cout << "Hello, world!" << std::endl; getchar(); return 0;} 阅读全文

NClass,终于找到了可以绘制类图的工具了!

2012-09-16 12:18 by hongjiumu, 3169 阅读, 收藏,
摘要: 以前用Visio绘制类图很不规范,很多地方需要耍小聪明,后来看到网上讲pd可以,但是我找了很久就是不行,总不至于要买吧!后来听说NClass,c# open source!下来一看,非常满意!以后就用这个了,说出来,心里好高兴,也希望在找类图工具的同人们带来好消息!呵呵! 阅读全文

C#类型转换3

2012-09-15 16:57 by hongjiumu, 234 阅读, 收藏,
摘要: namespace WDBuyNET.DMSFrame.Utils{ public static class TypeExtentions { public static bool IsPrimitive(this Type t) { bool result; if (t.IsGenericType) { result = (TypeExtentions.IsNullableType(t) && TypeExtentions.IsPrimitive(Nulla... 阅读全文

C#类型转换2

2012-09-15 16:55 by hongjiumu, 324 阅读, 收藏,
摘要: namespace WDBuyNET.DMSFrame.Utils.Helpers{ public static class TypeHelper { public static object ChangeType(Type targetType, object val) { object result; if (val == null) { result = null; } else { ... 阅读全文

C#类型转换1

2012-09-15 16:52 by hongjiumu, 456 阅读, 收藏,
摘要: namespace WDBuyNET.DMSFrame.Utils.Helpers{ public static class ReflectionHelper { public class TypeLoadConfig { private bool copyToMemory; private bool loadAbstractType; private string targetFilePostfix; public bool CopyToMemory ... 阅读全文

css中的内容溢出

2012-09-15 16:31 by hongjiumu, 440 阅读, 收藏,
摘要: 内容溢出是指当设置好了一个层的宽和高后,由于内容比较多的缘故,导致内容溢出了设定好的宽度和高度。要想在所有浏览器中都有这中效果 我们就需要这样来做 把 height:auto; overflow:auto; 这样所有的浏览器中效果就会一样了。 阅读全文

利用js来判断浏览器的类型

2012-09-12 18:45 by hongjiumu, 214 阅读, 收藏,
摘要: 有人喜欢用ie,有人喜欢用firefox,还有人喜欢用260,虽然名字可能有很多种,但是内核只有几种.ie内核,netscape内核!怎么用js来判断各种浏览器的类型呢?在不同的浏览器中对js的支持程度,语法要求都大不一样,下面的代码为判断代码:<script type="text/javascript"> var getOs=function(){ var OsObject=""; if(navigator.userAgent.indexOf("MSIE")>0){ return "MSIE"; 阅读全文

checkbox与说明文字无法对齐的问题

2012-09-12 11:43 by hongjiumu, 1029 阅读, 收藏,
摘要: 其实很简单,真的灰常简单,把要对齐的每个标签,都加一个css属性:vertical-align:middle; 比如说我有一个checkbox,后面跟一个超链接,原来的HTML代码是这样的:<input type=checkbox id="the_id" name=checkbox style="vertical-align:middle;" /> <a href="the_link" title="the_title" ></a> 修改之后是这样的:<input type 阅读全文

js修改css样式表解析(转)

2012-09-12 10:22 by hongjiumu, 540 阅读, 收藏,
摘要: js修改css样式表解析(转)2009-12-30 14:57abc.cssCSS code.class1{width:10px;background-color: red;}HTML code<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"><HTML><HEAD><link rel="stylesheet" type="text/css" href="abc.css" /><TITLE 阅读全文

javascript获取的层(div)高度

2012-09-12 10:21 by hongjiumu, 425 阅读, 收藏,
摘要: <!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><meta http-equiv="Content-Type" content="text/html; charset=gb23 阅读全文

(转)javascript选择id class

2012-09-12 10:20 by hongjiumu, 1070 阅读, 收藏,
摘要: <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"><html><head><title> 使用javascript通过className来获取元素 </title><meta http-equiv="Content-Type" content="text/html; charset=gb2312" /></head><style>.red{color: #F00;}# 阅读全文

点的html

2012-09-11 16:54 by hongjiumu, 167 阅读, 收藏,
摘要: 点的html1,&middot;2,&#8226; 阅读全文

List<T>.Contains(T item)为什么我把两封一样的邮件经分析后一模一样的数据mail_data先后导入进去,第2封信还是会加到mailList里去 ?? 搞不懂..

2012-09-10 15:48 by hongjiumu, 300 阅读, 收藏,
摘要: 方法1: static void Main(string[] args) { TestClass tc1 = new TestClass(); tc1.i = 1; TestClass tc2 = new TestClass(); tc2.i = 1; List<TestClass> list = new List<TestClass>(); list.Add(tc1); Console.WriteLine(lis... 阅读全文

一个可以生成复杂结构的json数据的简单例子

2012-09-08 17:53 by hongjiumu, 832 阅读, 收藏,
摘要: using System;using System.Collections.Generic;using System.Linq;using System.Text;using System.Reflection;namespace ConsoleApplication1{ class Program { static void Main(string[] args) { StringBuilder builder = new StringBuilder(); User user = new User("abc"... 阅读全文

使用this作为方法的参数

2012-09-08 10:18 by hongjiumu, 456 阅读, 收藏,
摘要: <table><tbody> <tr id="test"><td></td></tr></tbody></table>document.getElementById("test").setAttribute("onclick","Test()");var Test=function(){ alert(Object.prototype.toString.call(this));};结果显示: [object Window] 阅读全文

js做带编辑,保存,删除,添加功能的表格

2012-09-06 19:18 by hongjiumu, 725 阅读, 收藏,
摘要: <!--产品属性处理部分开始--> <table id="productAttributeBlock" class="tabEditList" style="width:100%;"> <thead> <tr> <th> 属性类型 </th> <th> ... 阅读全文

<input type="text"> 的document.getElementById("").value和document.getElementById("").getAttribute("value")不相同

2012-09-06 18:07 by hongjiumu, 4732 阅读, 收藏,
摘要: <!--产品属性处理部分开始--> <table id="productAttributeBlock" class="tabEditList" style="width:100%;"> <thead> <tr> <th> 属性类型 </th> <th> ... 阅读全文

(转)C#的排列组合类

2012-09-06 09:12 by hongjiumu, 368 阅读, 收藏,
摘要: //-----------------------------------------------------------------------------////算法:排列组合类////版权所有(C)Snowdust//个人博客http://blog.csdn.net/snowdust&http://snowdust.cnblogs.com//MSN&Emailsnowdust77@sina.com////此源代码可免费用于各类软件(含商业软件)//允许对此代码的进一步修改与开发//但必须完整保留此版权信息////调用方法如下:////1.GetPermutation(T[ 阅读全文

(转)一维字符串数组之间组合问题的C#实现

2012-09-06 00:31 by hongjiumu, 1566 阅读, 收藏,
摘要: 如题,最近需要处理一些字符串数组之间相互无重组合的实际问题。把问题抽象出来,实际就是数学中的排列组合问题,思想很简单,只是在实现上着实花了一些功夫,而且代码尚需进一步优化,写下来希望能和大家一起探讨,欢迎大家提建议,以使程序能进一步优化。问题描述:假设现有三组字符,如下{k1,k2},{k3,k4},{k5}要求三组数据组合,组合的每一个结果必须包含三组中的字符,且不重复。针对这种少量的数组,通过排列组合我们可以计算出组合数量N = 2*2*1 = 4 (种)结果如下:k5k3k1k5k4k1k5k3k2k5k4k2思想很简单的,我实际问题抽象成了二维数组,实际就是一维数组中n个一维数组的组合 阅读全文

Js中冒号的作用

2012-09-05 09:31 by hongjiumu, 598 阅读, 收藏,
摘要: Js中冒号的作用:1,声明对象的成员;2,switch语句的分支;3, 三元表达式。(1)声明对象的成员:var Book={ Name:'法', Price:100, Discount:function(rate){ this.Price*=rate; }};alert(Book.Price);Book.Discount(0.8);alert(Book.Price);2.switch语句分支vara=2;switch(a){ case0: alert('0'); break; case1: alert('1'); break; case2: a 阅读全文

文件上传

2012-09-04 23:52 by hongjiumu, 187 阅读, 收藏,
摘要: NeatUpload 阅读全文

getElementById() dosen't find <input type="hidden" runat="server"/>

2012-09-04 10:36 by hongjiumu, 388 阅读, 收藏,
摘要: getElementById() dosen't find <input type="hidden" runat="server"/><asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server"><input id="divPosition" type="hidden" value="12" 阅读全文

(转)Javascript如何正确使用getElementById,getElementsByName() and getElementsByTagName()

2012-09-03 23:29 by hongjiumu, 622 阅读, 收藏,
摘要: Web标准下可以通过getElementById(),getElementsByTagName() and getElementsByName()访问Document中的任一个标签。(1)getElementById():getElementById()可以访问Document中的某一特定元素,顾名思义,就是通过ID来取得元素,所以只能访问设置了ID的元素。(2)getElementsByName():getElementsByName()是通过Name属性来获得元素。但注意区别:getElementById()中是element,而getElementsByName是elements。显而易 阅读全文

(Transfered)DOM最常用的方法和属性(Javascript DOM编程艺术,DOM Scripting)

2012-09-02 16:04 by hongjiumu, 437 阅读, 收藏,
摘要: What this section covers:Creating nodesDuplicating nodesInserting nodesRemoving nodesReplacing nodesManipulating nodesFinding nodesNode propertiesTraversing the node treeThis section contains a list of some of the most useful methods and properties provided by the Document Object Model.They are arra 阅读全文