代码改变世界

随笔档案-2012年08月

一个在线正则表达式验证

2012-08-30 20:30 by hongjiumu, 304 阅读, 收藏,
摘要: http://www.rubular.com/ 阅读全文

把一个json字符串转换成对应的c#类型

2012-08-30 17:16 by hongjiumu, 1068 阅读, 收藏,
摘要: 放弃使用Newtonsoft,自己动手。using System;using System.Collections.Generic;using System.Linq;using System.Text;using System.Reflection;using System.Text.RegularExpressions;namespace ConsoleApplication1{ class Program { static void Main(string[] args) { string str = "[{Attribute... 阅读全文

Edit tbody

2012-08-29 10:04 by hongjiumu, 185 阅读, 收藏,
摘要: You can't use innerHTML on parts of a table.innerHTML can only use to replace the entire table.stop using innerHTML,take some time and learn the DOM.<!--子窗口操作结果--> <div> <table class="innerTable"> <thead> <tr> <th> ... 阅读全文

js子窗口向父窗口传值

2012-08-28 19:14 by hongjiumu, 974 阅读, 收藏,
摘要: 用opener这是一个父窗口~<html><head><title></title><script language="javascript">function win(){window.open("login.html",null,"height=150,width=200");}</script></head><table id="t1"><tr><td id="dd">u 阅读全文

Placing a Method with Eval parameter into a DataList

2012-08-24 18:58 by hongjiumu, 200 阅读, 收藏,
摘要: http://stackoverflow.com/questions/10542098/placing-a-method-with-eval-parameter-into-a-datalist 阅读全文

(转)C#数字转固定长度的字符串

2012-08-24 14:14 by hongjiumu, 32517 阅读, 收藏,
摘要: 关于数字右对齐和用0填充格式化字符串的方法在向文件或者报表输出数字的时候,固定字符串的长度向右对齐,用0填充其余空间的情况很常见。在这种情况下,使用String类(System名称空间)的Format方法就很方便。Format方法可以用参数设置字符串的格式以及指定相应的对象变量,本文提取一些经常用到的数字变换成字符串的情形进行介绍。使用Format方法把数字夹杂在字符串中输出在介绍数字的输出格式之前,首先回顾一下Format方法的基本用法。Format方法的常用情形,就像以下的代码这样把变量夹杂在字符串中处理然后输出。string name = "鈴木";int month 阅读全文

WDBuyNET.DMSFrame.DMSLinq内部方法

2012-08-22 19:00 by hongjiumu, 378 阅读, 收藏,
摘要: /// <summary> /// 如果没有查找出相关编号将返回空值 /// 属性类型是string /// </summary> /// <typeparam name="T">参数实体</typeparam> /// <param name="prevCode">编号前缀符</param> /// <param name="property">参数的属性名称</param> /// <param name="length 阅读全文

Creating instance of type without default constructor in c#

2012-08-22 18:25 by hongjiumu, 245 阅读, 收藏,
摘要: Use this override of the CreateInstance method:public static object CreateInstance( Type type, params object[] args)creates an instance of the specified type using the constructor that best matches the specified parameters.See:http://msdn.microsoft.com/en-us/library/wcxyzt4d.aspx很喜欢这样的做法!值得记牢! 阅读全文

通过类名字符串调用类成员和实例化

2012-08-22 17:30 by hongjiumu, 687 阅读, 收藏,
摘要: using System;using System.CodeDom.Compiler;using Microsoft.CSharp;using System.Reflection;using System.Configuration;namespace ConsoleApplication1{ class Program { static void Main(string[] args) { //在App.Config中读取类的定义字符串 string ClassDefined = ConfigurationM... 阅读全文

(转)c# Regex常用

2012-08-18 18:47 by hongjiumu, 403 阅读, 收藏,
摘要: 一个例子:using System;using System.Text.RegularExpressions;namespace ConsoleApplication1{ Regex regex=new Regex("^[0-9]{1,2}",RegexOptions.IgnoreCase); if(regex.IsMatch("w1")) { Console.WriteLine("OK"); } Console.Read();}上面的代码用来判断字符串以数字开头和结尾,并且最多有2位.Regex regex=new Regex(&q 阅读全文

Ajax请求数据

2012-08-17 09:50 by hongjiumu, 5925 阅读, 收藏,
摘要: <div> <input type="button" value="新增" onclick='location.href="ProductCategoryEdit.aspx?q=<%=GetEncryptQueryString("Action=Add") %>"' /> </div> <div id="pctree"> </div> <script type="text/javascript& 阅读全文

Object.prototype.toString()

2012-08-14 19:18 by hongjiumu, 213 阅读, 收藏,
摘要: Transferred From :http://stackoverflow.com/questions/3250379/what-is-the-call-function-doing-in-this-javascript-statement/3250415#3250415The call method sets the this value of the invoked function to the object passed as first argument.All native object in Javascript contain an internal property cal 阅读全文

利用DllImport来移动文件,真快!

2012-08-03 10:40 by hongjiumu, 257 阅读, 收藏,
摘要: using System;using System.Runtime.InteropServices;namespace ConsoleApplication1{ class Program { [DllImport("kernel32.dll")] static extern bool MoveFile(string lpExistingFile,string lpNewFileName); static void Main(string[] args) { string srcFileName=@"c:\1.txt"; string dstFi... 阅读全文

CodeSmith输出文件

2012-08-02 18:36 by hongjiumu, 1229 阅读, 收藏,
摘要: <%@ CodeTemplate Language="C#" TargetLanguage="C#" ResponseEncoding="UTF-8" Src="" Inherits="OutputFileCodeTemplate" Debug="False" Description="The following template will generate a default ASP.Net code behind." %><%@ Pr 阅读全文

生成的数据库脚本没有注释?

2012-08-02 17:12 by hongjiumu, 300 阅读, 收藏,
摘要: 1,选择Database->Generate Database选中Generate name in empty comment就可以了 阅读全文

sql2005的新分页

2012-08-02 16:19 by hongjiumu, 158 阅读, 收藏,
摘要: 不用not in 的分页:SELECT * FROM(SELECT TOP 3 ROW_NUMBER() OVER(ORDER BY [t0].[CreateTime] DESC) RN,* FROM [Pro_AttributeType] AS [t0] WHERE ([t0].[DeleteFlag] = 0) ) [t0] WHERE RN>2 阅读全文

SQL Profile的使用

2012-08-02 15:46 by hongjiumu, 359 阅读, 收藏,
摘要: 1,进入SQL,选择工具->sql profile2,3,勾上显示所有列和事件,点列筛选器,复制自己的计算机名粘贴进去就OK另外,使用这个也可以。填写的是:就是PID了! 阅读全文

Frame虚拟目录设置(2012080101)

2012-08-01 09:25 by hongjiumu, 195 阅读, 收藏,
摘要: 处理办法:设置虚拟目录为”/“即可。 阅读全文

(转)字符串表达式求值(C#)

2012-08-01 00:01 by hongjiumu, 801 阅读, 收藏,
摘要: 表达式表达法:算术表达式中常见的表示法形式有 中缀、前缀和后缀表示法。中缀表示法是书写表达式的常见方式,而前缀和后缀表示法主要用于科学领域。中缀表示法:中缀表示法是算术表达式的常规表示法。称它为 中缀表示法是因为每个操作符都位于其操作数的中间,这种表示法只适用于操作符巧好对应两个操作数的时候(在操作符是二元操作符如加、减、乘、除以及取模的情况下)。对以中缀表达法书写的表达式进行语法分析时,需要用括号和优先规则排除多义性。Syntax:operand1 operator operand2Example:(A+B)*C-D/(E+F)前缀表示法:前缀表示法中,操作符写在操作数的前面。这种表示法经常 阅读全文