代码
using System;
using System.Collections.Generic;
using System.Text;
using System.Security.Cryptography;
using System.IO; namespace BaseFunction
{
/// <summary>
/// 常用函数。
/// 作者:苏飞
/// 时间:20090322
/// </summary>
public sealed class Functions
{
static Int32 index; #region 前面补零
/// <summary>
/// 不住位数的数字,前面补零
/// </summary>
/// <param name="value">要补足的数字</param>
/// <param name="size">不齐的位数</param>
/// <returns></returns>
public static string Zerofill(string value, int size)
{
string tmp = "";
for (int i = ; i < size - value.Length; i++)
{
tmp += "";
} return tmp + value;
}
#endregion #region 过滤掉 html代码
/// <summary>
/// 过滤html标签
/// </summary>
/// <param name="strHtml">html的内容</param>
/// <returns></returns>
public static string StripHTML(string strHtml)
{
string[] aryReg ={
@"<script[^>]*?>.*?</script>", @"<(\/\s*)?!?((\w+:)?\w+)(\w+(\s*=?\s*(([""'])(\\[""'tbnr]|[^\7])*?\7|\w+)|.{0})|\s)*?(\/\s*)?>",
@"([\r\n])[\s]+",
@"&(quot|#34);",
@"&(amp|#38);",
@"&(lt|#60);",
@"&(gt|#62);",
@"&(nbsp|#160);",
@"&(iexcl|#161);",
@"&(cent|#162);",
@"&(pound|#163);",
@"&(copy|#169);",
@"&#(\d+);",
@"-->",
@"<!--.*\n"
}; string[] aryRep = {
"",
"",
"",
"\"",
"&",
"<",
">",
" ",
"\xa1",//chr(161),
"\xa2",//chr(162),
"\xa3",//chr(163),
"\xa9",//chr(169),
"",
"\r\n",
""
}; string newReg = aryReg[];
string strOutput = strHtml;
for (int i = ; i < aryReg.Length; i++)
{
System.Text.RegularExpressions.Regex regex = new System.Text.RegularExpressions.Regex(aryReg, System.Text.RegularExpressions.RegexOptions.IgnoreCase);
[i] strOutput = regex.Replace(strOutput, aryRep);
}
//strOutput.Replace("<", "");
//strOutput.Replace(">", "");
strOutput = strOutput.Replace("\r\n", "");
return strOutput;
}
#endregion #region 全角半角转换
/// <summary>
/// 转全角的函数(SBC case)
/// </summary>
/// <param name="input">任意字符串</param>
/// <returns>全角字符串</returns>
///<remarks>
///全角空格为12288,半角空格为32
///其他字符半角(33-126)与全角(65281-65374)的对应关系是:均相差65248
///</remarks>
public static string ToSBC(string input)
{
//半角转全角:
char[] c = input.ToCharArray();
for (int i = ; i < c.Length; i++)
{
if (c == )
{
c = (char);
continue;
}
if (c < )
c = (char)(c + );
}
return new string(c);
} /// <summary> 转半角的函数(DBC case) </summary>
/// <param name="input">任意字符串</param>
/// <returns>半角字符串</returns>
///<remarks>
///全角空格为12288,半角空格为32
///其他字符半角(33-126)与全角(65281-65374)的对应关系是:均相差65248
///</remarks>
public static string ToDBC(string input)
{
char[] c = input.ToCharArray();
for (int i = ; i < c.Length; i++)
{
if (c == )
{
c = (char);
continue;
}
if (c > && c < )
c = (char)(c - );
}
return new string(c);
}
#endregion #region 传入URL返回网页的html代码 /// <summary>
/// 传入URL返回网页的html代码
/// </summary>
/// <param name="Url">URL</param>
/// <returns></returns>
public static string GetUrltoHtml(string Url)
{
try
{
System.Net.WebRequest wReq = System.Net.WebRequest.Create(Url);
// Get the response instance.
System.Net.WebResponse wResp = wReq.GetResponse();
// Read an HTTP-specific property
//if (wResp.GetType() ==HttpWebResponse)
//{
//DateTime updated =((System.Net.HttpWebResponse)wResp).LastModified;
//}
// Get the response stream.
System.IO.Stream respStream = wResp.GetResponseStream();
// Dim reader As StreamReader = New StreamReader(respStream)
System.IO.StreamReader reader = new System.IO.StreamReader(respStream, System.Text.Encoding.GetEncoding("gb2312"));
return reader.ReadToEnd(); }
catch (System.Exception ex)
{
//errorMsg = ex.Message;
}
return "";
} #endregion #region MD5加密字符串。截取字符串 /// <summary>
/// 传入明文,返回用MD%加密后的字符串
/// </summary>
/// <param name="str">要加密的字符串</param>
/// <returns>用MD5加密后的字符串</returns>
public static string ToMD5(string str)
{
return System.Web.Security.FormsAuthentication.HashPasswordForStoringInConfigFile(str, "md5");
}
/// <summary>
/// 截取字符串。
/// </summary>
/// <param name="str">要接取得字符串</param>
/// <param name="number">保留的字节数。按半角计算</param>
/// <returns>指定长度的字符串</returns>
public static string StringCal(string str, int number)
{
Byte[] tempStr = System.Text.Encoding.Default.GetBytes(str);
if (tempStr.Length > number)
{
return System.Text.Encoding.Default.GetString(tempStr, , number - ) + "..";
}
else
return str;
} #endregion #region 删除文件 /// <summary>
/// 删除文件
/// </summary>
/// <param name="FilePath">文件的物理地址</param>
/// <returns></returns>
public static bool DeleteFile(string FilePath)
{
try
{
System.IO.File.Delete(FilePath);
return true;
}
catch
{
//errorMsg = "删除不成功!";
return false;
}
}
#endregion #region 验证——数字部分
/// <summary>
/// 判断是否是实数,是返回true 否返回false。可以传入null。
/// </summary>
/// <param name="strVal">要验证的字符串</param>
/// <returns></returns>
public static bool IsNumeric(string strVal)
{
//System.Text.RegularExpressions.Regex reg1 = new System.Text.RegularExpressions.Regex("-?([0]|([1-9]+\\d{0,}?))(.[\\d]+)?$");
//return reg1.IsMatch(strVal);
//string tmp="";
//判断是否为null 和空字符串
if (strVal == null || strVal.Length == )
return false;
//判断是否只有.、-、 -.
if (strVal == "." || strVal == "-" || strVal == "-.")
return false; //记录是否有多个小数点
bool isPoint = false; //是否有小数点 //去掉第一个负号,中间是不可以有负号的
strVal = strVal.TrimStart('-'); foreach (char c in strVal)
{
if (c == '.')
if (isPoint)
return false;
else
isPoint = true; if ((c < '' || c > '') && c != '.')
return false;
}
return true;
} /// <summary>
/// 判断是否为整数。是返回true 否返回false。可以传入null。
/// </summary>
/// <param name="strVal">要判断的字符</param>
/// <returns></returns>
public static bool IsInt(string strVal)
{
if (strVal == null || strVal.Length == )
return false;
//判断是否只有.、-、 -.
if (strVal == "." || strVal == "-" || strVal == "-.")
return false; //去掉第一个负号,中间是不可以有负号的
if (strVal.Substring(, ) == "-")
strVal = strVal.Remove(, ); foreach (char c in strVal)
{
if (c < '' || c > '')
return false;
}
return true;
} /// <summary>
/// 判断是否为ID串。是返回true 否返回false。可以传入null。
/// </summary>
/// <example >
/// ,1,2,3,4,5,6,7,
/// </example>
/// <param name="strVal">要判断的字符串</param>
/// <returns></returns>
public static bool IsIDString(string strVal)
{
bool flag = false;
if (strVal == null)
return false;
if (strVal == "")
return true;
//判断是否只有 ,
if (strVal == ",")
return false; //判断第一位是否是,号
if (strVal.Substring(, ) == ",")
return false; //判断最后一位是否是,号
if (strVal.Substring(strVal.Length - , ) == ",")
return false; foreach (char c in strVal)
{
if (c == ',')
if (flag) return false; else flag = true; else if ((c >= '' && c <= ''))
flag = false;
else
return false;
}
return true;
} /// <summary>
/// 转换为整数。不是整数的话,返回“-1”
/// </summary>
/// <param name="str">要转换的字符</param>
/// <returns></returns>
public static int StringToInt(string str)
{
//判断是否是数字,是数字返回数字,不是数字返回-1
if (IsInt(str))
return Int32.Parse(str);
else
return -;
} /// <summary>
/// 转换为实数。不是实数的话,返回“-1”
/// </summary>
/// <param name="str"></param>
/// <returns></returns>
public static float StrTofloat(string str)
{
//判断是否是数字,是数字返回数字,不是数字返回-1
if (IsNumeric(str))
return float.Parse(str);
else
return -;
} /// <summary>
/// 验证是否是GUID
/// 6454bc76-5f98-de11-aa4c-00219bf56456
/// </summary>
/// <returns></returns>
public static bool IsGUID(string strVal)
{
if (strVal == null)
return false; if (strVal == "")
return false; strVal = strVal.TrimStart('{');
strVal = strVal.TrimEnd('}'); //长度必须是36位
if (strVal.Length != )
return false; foreach (char c in strVal)
{
if (c == '-')
continue;
else if (c >= 'a' && c <= 'f')
continue;
else if (c >= 'A' && c <= 'F')
continue;
else if ((c >= '' && c <= ''))
continue;
else
return false;
}
return true;
}
#endregion #region 验证——处理字符串部分 /// <summary>
/// 去掉两边的空格,把“'”替换为“'”SBC
/// </summary>
/// <param name="str">要处理的字符串</param>
/// <returns></returns>
public static string StringReplaceToSBC(string str)
{
//过滤不安全的字符
string tstr;
tstr = str.Trim();
return tstr.Replace("'", "'");
} /// <summary>
/// 去掉两边的空格,把“'”替换为“''”DBC
/// </summary>
/// <param name="str">要验证的字符串</param>
/// <returns></returns>
public static string StringReplaceToDBC(string str)
{
//过滤不安全的字符
string tstr;
tstr = str.Trim();
return tstr.Replace("'", "''");
}
/// <summary>
/// 去掉两边的空格,把“'”替换为“”
/// </summary>
/// <param name="str">要验证的字符串</param>
/// <returns></returns>
public static string StringReplaceToEmpty(string str)
{
//过滤不安全的字符
string tstr;
tstr = str.Trim();
return tstr.Replace("'", "");
} #endregion #region 验证——时间部分 /// <summary>
/// 转换时间。不正确的话,返回当前时间
/// </summary>
/// <param name="isdt">要转换的字符串</param>
/// <returns></returns>
public static DateTime StringToDateTime(string isdt)
{
//判断时间是否正确
DateTime mydt;
try
{
mydt = Convert.ToDateTime(isdt);
}
catch
{
//时间格式不正确
return mydt = DateTime.Now;
} return mydt;
} /// <summary>
/// 判断是否是正确的时间格式。正确返回“true”,不正确返回提示信息。
///
/// </summary>
/// <param name="isdt">要判断的字符串</param>
/// <returns></returns>
public static bool IsDateTime(string isdt)
{
//判断时间是否正确
DateTime mydt;
try
{
mydt = Convert.ToDateTime(isdt);
return true;
}
catch
{
//时间格式不正确
//errorMsg = "您填的时间格式不正确,请按照2004-1-1的形式填写。";
return false;
} }
#endregion #region 生成查询条件
/// <summary>
/// 组成查询字符串
/// </summary>
/// <param name="columnName">字段名</param>
/// <param name="keyword">查询条件</param>
/// <param name="hasContent">是否已经有查询条件了,true:加and;false:不加and</param>
/// <param name="colType">1:数字;2:字符串,精确查询;3:字符串,模糊查询,包括时间查询</param>
/// <returns></returns>
public static string GetSearchString(string columnName, string keyword, ref bool hasContent, int colType)
{
if (keyword == "" || keyword == "")
{
return "";
}
else
{
System.Text.StringBuilder tmp = new System.Text.StringBuilder();
switch (colType)
{
case :
//数字
tmp.Append(columnName);
tmp.Append(" = ");
tmp.Append(keyword);
break;
case :
//字符串,精确查询
tmp.Append(columnName);
tmp.Append(" = '");
tmp.Append(keyword);
tmp.Append("' ");
break;
case :
//字符串,模糊查询,包括时间查询
tmp.Append(columnName);
tmp.Append(" like '% ");
tmp.Append(keyword);
tmp.Append("%' "); break;
}
if (hasContent)
tmp.Insert(, " and "); hasContent = true;
return tmp.ToString(); } }
#endregion #region ========解密======== /// <summary>
/// 解密
/// </summary>
/// <param name="Text"></param>
/// <returns></returns>
public static string Decrypt(string Text)
{
return Decrypt(Text, "litianping");
} /// <summary>
/// 解密数据
/// </summary>
/// <param name="Text"></param>
/// <param name="sKey"></param>
/// <returns></returns>
public static string Decrypt(string Text, string sKey)
{
DESCryptoServiceProvider des = new DESCryptoServiceProvider();
int len;
len = Text.Length / ;
byte[] inputByteArray = new byte[len];
int x, i;
for (x = ; x < len; x++)
{
i = Convert.ToInt32(Text.Substring(x * , ), );
inputByteArray[x] = (byte)i;
}
des.Key = ASCIIEncoding.ASCII.GetBytes(System.Web.Security.FormsAuthentication.HashPasswordForStoringInConfigFile(sKey, "md5").Substring(, ));
des.IV = ASCIIEncoding.ASCII.GetBytes(System.Web.Security.FormsAuthentication.HashPasswordForStoringInConfigFile(sKey, "md5").Substring(, ));
System.IO.MemoryStream ms = new System.IO.MemoryStream();
CryptoStream cs = new CryptoStream(ms, des.CreateDecryptor(), CryptoStreamMode.Write);
cs.Write(inputByteArray, , inputByteArray.Length);
cs.FlushFinalBlock();
return Encoding.Default.GetString(ms.ToArray());
} #endregion
} #region 加密、解密字符串
/// <summary>
/// 加密字符串。可以解密
/// </summary>
public class Encryptor
{
#region 加密,固定密钥
/// <summary>
/// 加密
/// </summary>
/// <param name="sourceData">原文</param>
/// <returns></returns>
public static string Encrypt(string sourceData)
{
//set key and initialization vector values
//Byte[] key = new byte[] {0x21, 2, 0x88, 4, 5, 0x56, 7, 0x99};
//Byte[] iv = new byte[] {0x21, 2, 0x88, 4, 5, 0x56, 7, 0x99};
Byte[] key = new byte[] { , , , , , , , };
Byte[] iv = new byte[] { , , , , , , , };
try
{
//convert data to byte array
Byte[] sourceDataBytes = System.Text.ASCIIEncoding.UTF8.GetBytes(sourceData);
//get target memory stream
MemoryStream tempStream = new MemoryStream();
//get encryptor and encryption stream
DESCryptoServiceProvider encryptor = new DESCryptoServiceProvider();
CryptoStream encryptionStream = new CryptoStream(tempStream, encryptor.CreateEncryptor(key, iv), CryptoStreamMode.Write); //encrypt data
encryptionStream.Write(sourceDataBytes, , sourceDataBytes.Length);
encryptionStream.FlushFinalBlock(); //put data into byte array
Byte[] encryptedDataBytes = tempStream.GetBuffer();
//convert encrypted data into string
return System.Convert.ToBase64String(encryptedDataBytes, , (int)tempStream.Length);
}
catch (Exception ex)
{
throw (ex);
}
}
#endregion #region 加密,可以设置密钥
/// <summary>
/// 可以设置密钥的加密方式
/// </summary>
/// <param name="sourceData">原文</param>
/// <param name="key">密钥,8位数字,字符串方式</param>
/// <returns></returns>
public static string Encrypt(string sourceData, string key)
{
//set key and initialization vector values
//Byte[] key = new byte[] {0x21, 2, 0x88, 4, 5, 0x56, 7, 0x99};
//Byte[] iv = new byte[] {0x21, 2, 0x88, 4, 5, 0x56, 7, 0x99}; #region 检查密钥是否符合规定
if (key.Length > )
{
key = key.Substring(, );
}
#endregion char[] tmp = key.ToCharArray();
Byte[] keys = new byte[];
//Byte[] keys = new byte[] { 1, 2, 3, 4, 5, 6, 7, 8 };
Byte[] iv = new byte[] { , , , , , , , }; //设置密钥
for (int i = ; i < ; i++)
{
if (tmp.Length > i)
{
keys = (byte)tmp;
}
else
{
keys = (byte)i;
}
} try
{
//convert data to byte array
Byte[] sourceDataBytes = System.Text.ASCIIEncoding.UTF8.GetBytes(sourceData);
//get target memory stream
MemoryStream tempStream = new MemoryStream();
//get encryptor and encryption stream
DESCryptoServiceProvider encryptor = new DESCryptoServiceProvider();
CryptoStream encryptionStream = new CryptoStream(tempStream, encryptor.CreateEncryptor(keys, iv), CryptoStreamMode.Write); //encrypt data
encryptionStream.Write(sourceDataBytes, , sourceDataBytes.Length);
encryptionStream.FlushFinalBlock(); //put data into byte array
Byte[] encryptedDataBytes = tempStream.GetBuffer();
//convert encrypted data into string
return System.Convert.ToBase64String(encryptedDataBytes, , (int)tempStream.Length);
}
catch (Exception ex)
{
throw (ex);
}
}
#endregion #region 解密,固定密钥
/// <summary>
/// 解密
/// </summary>
/// <param name="sourceData">密文</param>
/// <returns></returns>
public static string Decrypt(string sourceData)
{
//set key and initialization vector values
//Byte[] key = new byte[] {0x21, 2, 0x88, 4, 5, 0x56, 7, 0x99};
//Byte[] iv = new byte[] {0x21, 2, 0x88, 4, 5, 0x56, 7, 0x99};
Byte[] keys = new byte[] { , , , , , , , };
Byte[] iv = new byte[] { , , , , , , , };
try
{
//convert data to byte array
Byte[] encryptedDataBytes = System.Convert.FromBase64String(sourceData);
//get source memory stream and fill it
MemoryStream tempStream = new MemoryStream(encryptedDataBytes, , encryptedDataBytes.Length);
//get decryptor and decryption stream
DESCryptoServiceProvider decryptor = new DESCryptoServiceProvider();
CryptoStream decryptionStream = new CryptoStream(tempStream, decryptor.CreateDecryptor(keys, iv), CryptoStreamMode.Read); //decrypt data
StreamReader allDataReader = new StreamReader(decryptionStream); return allDataReader.ReadToEnd();
}
catch (Exception ex)
{
throw (ex);
}
}
#endregion #region 解密,固定密钥
/// <summary>
/// 解密
/// </summary>
/// <param name="sourceData">密文</param>
/// <param name="key">密钥,8位数字,字符串方式</param>
/// <returns></returns>
public static string Decrypt(string sourceData, string key)
{
//set key and initialization vector values
//Byte[] key = new byte[] {0x21, 2, 0x88, 4, 5, 0x56, 7, 0x99};
//Byte[] iv = new byte[] {0x21, 2, 0x88, 4, 5, 0x56, 7, 0x99}; #region 检查密钥是否符合规定
if (key.Length > )
{
key = key.Substring(, );
}
#endregion char[] tmp = key.ToCharArray();
Byte[] keys = new byte[];
//Byte[] keys = new byte[] { 1, 2, 3, 4, 5, 6, 7, 8 };
Byte[] iv = new byte[] { , , , , , , , }; //设置密钥
for (int i = ; i < ; i++)
{
if (tmp.Length > i)
{
keys = (byte)tmp;
}
else
{
keys = (byte)i;
}
} try
{
//convert data to byte array
Byte[] encryptedDataBytes = System.Convert.FromBase64String(sourceData);
//get source memory stream and fill it
MemoryStream tempStream = new MemoryStream(encryptedDataBytes, , encryptedDataBytes.Length);
//get decryptor and decryption stream
DESCryptoServiceProvider decryptor = new DESCryptoServiceProvider();
CryptoStream decryptionStream = new CryptoStream(tempStream, decryptor.CreateDecryptor(keys, iv), CryptoStreamMode.Read); //decrypt data
StreamReader allDataReader = new StreamReader(decryptionStream); return allDataReader.ReadToEnd();
}
catch (Exception ex)
{
throw (ex);
}
}
#endregion /// <summary>
/// 对需要加密的字串进行MD5加密(针对密码加密)
/// </summary>
/// <param name="ConvertString">需要加密的字串</param>
/// <returns>加密后的字串</returns>
/// <remarks>
/// Modifier: Xiaoliang Ge
/// Modified Date: 2009-12-26
/// </remarks>
public static string MD5EncryptStr(string ConvertString)
{
MD5CryptoServiceProvider md5 = new MD5CryptoServiceProvider();
string t2 = BitConverter.ToString(md5.ComputeHash(UTF8Encoding.Default.GetBytes(ConvertString)),
, );
return t2;
}
} #endregion }

[功能帮助类] 最新的Functions 类 (转载)的更多相关文章

  1. asp.net(C#)实现功能强大的时间日期处理类完整实例

    作者:smartsmile2012 字体:[增加 减小] 类型:转载 时间:2016-06-30我要评论 这篇文章主要介绍了asp.net(C#)实现功能强大的时间日期处理类,封装了针对日期与时间的各 ...

  2. CSerialPort串口类最新修正版(解决关闭死锁问题)

    这是一份优秀的类文件,好多的地方值得我们学习,具体在多线程,事件,自定义消息,类的封装方面等等.Remon提供的串口类网址为:http://codeguru.earthweb.com/network/ ...

  3. CSerialPort串口类最新修正版(解决关闭死锁问题)2014-01-11

    这是一份优秀的类文件,好多的地方值得我们学习,具体在多线程,事件,自定义消息,类的封装方面等等.Remon提供的串口类网址为:http://codeguru.earthweb.com/network/ ...

  4. 简单练习题2编写Java应用程序。首先定义一个描述银行账户的Account类,包括成员变 量“账号”和“存款余额”,成员方法有“存款”、“取款”和“余额查询”。其次, 编写一个主类,在主类中测试Account类的功能

    编写Java应用程序.首先定义一个描述银行账户的Account类,包括成员变 量“账号”和“存款余额”,成员方法有“存款”.“取款”和“余额查询”.其次, 编写一个主类,在主类中测试Account类的 ...

  5. 最新的SqlHelper 类

    最新的SqlHelper 类 摘自:http://www.cnblogs.com/sufei/archive/2010/01/14/1648026.html using System; using S ...

  6. 将封装了envi功能的IDL类导出成java类,方便java调用

    目的:     用IDL将ENVI的功能封装成为IDL的类,并使用IDL的对象导出功能把这些功能类导出为java类,方便java调用.(本来想直接通过GP工具调用的,但是没有授权文件)   操作步骤: ...

  7. Java JVM 类的连接与初始化 [ 转载 ]

    Java类的连接与初始化 (及2013阿里初始化笔试题解析)  转自http://www.cnblogs.com/iceAeterNa/p/4876747.html         Java虚拟机通过 ...

  8. Discuz!数据库操作DB类和C::t类介绍

    类定义文件 DB类: 文件\source\class\class_core.php class DB extends discuz_database {} discuz_database类定义 文件\ ...

  9. ADO.NET基础巩固-----连接类和非连接类

          最近的一段时间自己的状态还是不错的,早上,跑步,上自习看书,下午宿舍里面编程实战,晚上要么练习代码,要么去打球(在不打就没机会了),生活还是挺丰富的. 关于C#的基础回顾就先到前面哪里,这 ...

随机推荐

  1. 【HDOJ】1198 Farm Irrigation

    其实就是并查集,写麻烦了,同样的代码第一次提交wa了,第二次就过了. #include <stdio.h> #include <string.h> #define MAXNUM ...

  2. Http状态码完整说明

    在网站建设的实际应用中,容易出现很多小小的失误,就像mysql当初优化不到位,影响整体网站的浏览效果一样,其实,网站的常规http状态码的表现也是一样, 一些常见的状态码为: 200 - 服务器成功返 ...

  3. [PeterDLax著泛函分析习题参考解答]第1章 线性空间

    1. 证明定理 1. 2. 验证上述结论. 3. 证明定理 3. 4. 证明定理 4. 证明: 由 $$\bex x=\sum_{k=1}^{n-1}a_k\cdot \sum_{j=1}^{n-1} ...

  4. HDU-2500 做一个正气的杭电人

    http://acm.hdu.edu.cn/showproblem.php?pid=2500 做一个正气的杭电人 Time Limit: 1000/1000 MS (Java/Others)    M ...

  5. IIS6、IIS7和IIS8各版本的差别

    一.写在前面 目前市面上所用的IIS版本估计都是>=6.0的.所以我们主要以下面三个版本进行讲解 服务器版本 IIS默认版本 server2003 6.0 server2008 7.0 serv ...

  6. [NOIP2007]奖学金

      题目来源:http://www.luogu.org/problem/show?pid=1093# 2007年NOIP全国联赛普及组 [题目描述 Description] 某小学最近得到了一笔赞助, ...

  7. 理解newid()和newsequentialid()

    原文地址:http://blog.csdn.net/xushichang/article/details/4390957 1.:newsequentialid 函数比起 newid 函数最大的好处是: ...

  8. bayer图像格式

    Bayer数据,其一般格式为:奇数扫描行输出 RGRG……偶数扫描行输出 GBGB…… 根据人眼对彩色的响应带宽不高的大面积着色特点,每个像素没有必要同时输出3种颜色.因此,数据采样时, 奇数扫描行的 ...

  9. 一步一步写一个简单通用的makefile(三)

    上一篇一步一步写一个简单通用的makefile(二) 里面的makefile 实现对通用的代码进行编译,这一章我将会对上一次的makefile 进行进一步的优化. 优化后的makefile: #Hel ...

  10. GRUB损坏后,如何修复windows启动mbr

    今天使用Ghost装系统遇到windows7不能启动的问题,采用下面帖子中的部分命令搞定之. 我自己是直接使用: 插入windows7安装光盘,从光盘启动,在光盘启动完成后,按下shift+f10键, ...