C# AccessHelperParameterCache

using System;
using System.Collections;
using System.Collections.Generic;
using System.Data;
using System.Data.OleDb;
using System.Text;

namespace Web.DataAccess
{
    public sealed class AccessHelperParameterCache
    {
        private AccessHelperParameterCache() { }

        private static OleDbParameter[] CloneParameters(OleDbParameter[] originalParameters)
        {
            OleDbParameter[] cloneParameters = new OleDbParameter[originalParameters.Length];
            for (int i = 0; i < cloneParameters.Length; i++)
            {
                cloneParameters[i] = (OleDbParameter)(((ICloneable)originalParameters[i]).Clone());
            }

            return cloneParameters;
        }

        private static Hashtable paramCache = Hashtable.Synchronized(new Hashtable());

        public static void CacheParameterSet(string connectionString, string commandText, params OleDbParameter[] commandParameters)
        {
            if (null == connectionString || string.Empty == connectionString) throw new ArgumentNullException("connectionString");
            if (null == commandText || string.Empty == commandText) throw new ArgumentNullException("commandText");
            if (null == commandParameters || 0 == commandParameters.Length) throw new ArgumentNullException("commandParameters");

            paramCache[connectionString + ":" + commandText] = CloneParameters(commandParameters);
        }

        public static OleDbParameter[] GetCacheParameterSet(string connectionString, string commandText)
        {
            if (null == connectionString || string.Empty == connectionString) throw new ArgumentNullException("connectionString");
            if (null == commandText || string.Empty == commandText) throw new ArgumentNullException("commandText");

            OleDbParameter[] cachedParameters = paramCache[connectionString + commandText] as OleDbParameter[];
            if (null != cachedParameters)
            {
                CloneParameters(cachedParameters);
            }
            return null;
        }
    }
}

C# AccessHelperUtility

using System;
using System.Data.OleDb;
using System.Collections.Generic;
using System.Text;

namespace Web.DataAccess
{
    public sealed class AccessHelperUtility
    {
        private AccessHelperUtility() { }

        public static Dictionary<string, OleDbParameter> OleDbParameterArrayToGDictionary(params OleDbParameter[] paras)
        {
            if (null == paras) throw new ArgumentNullException("paras");
            Dictionary<string, OleDbParameter> retval = new Dictionary<string, OleDbParameter>();
            foreach (OleDbParameter p in paras) retval.Add(p.ParameterName, p);

            return retval;
        }

        public static List<OleDbParameter> OleDbParameterGDictionaryToGList(Dictionary<string, OleDbParameter> paras)
        {
            if (null == paras) throw new ArgumentNullException("paras");

            List<OleDbParameter> retval = new List<OleDbParameter>();
            foreach (string k in paras.Keys) retval.Add(paras[k]);
            return retval;
        }

        public static OleDbParameter[] OleDbParameterGDictionaryToArray(Dictionary<string, OleDbParameter> paras)
        {
            if (null == paras) throw new ArgumentNullException("paras");

            List<OleDbParameter> retval = new List<OleDbParameter>();
            foreach (string k in paras.Keys)
                retval.Add(paras[k]);
            return retval.ToArray();
        }
    }
}

C# DBACCESS

using System;
using System.Data;
using System.Data.OleDb;
using System.Configuration;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;

namespace EastIdea.Class
{
    /// <summary>
    /// 数据操作层,用来进行一些通用的数据库操作。
    /// </summary>
    public class DBAccess
    {

        //连接字符串
        public static readonly string connString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + System.Web.HttpContext.Current.Server.MapPath("/Data/EastIdeaDatabase.mdb");
        //连接数据库
        public static OleDbConnection myConn = new OleDbConnection(connString);


        /// <summary>
        /// 执行SQL语句返回DataTable
        /// </summary>
        /// <param name="sql">SQL语句</param>
        /// <returns>DataTable</returns>
        public static DataTable Select(string sql)
        {
            try
            {
                OleDbConnection conn = new OleDbConnection(connString);
                DataSet ds = new DataSet("dataList");
                OleDbDataAdapter oda = new OleDbDataAdapter(sql, conn);
                oda.Fill(ds);
                return ds.Tables[0];
            }
            catch (Exception ex)
            {
                throw new Exception(ex.Message, ex);
            }

        }

        /// <summary>
        /// 执行SQL语句,并返回一个是否成功的值
        /// </summary>
        /// <param name="mysql">sql语句</param>
        /// <returns>1为执行成功,0为失败</returns>
        public static int ExecuteSql(string mysql)
        {
            OleDbCommand myCmd = new OleDbCommand(mysql, myConn);
            try
            {
                myConn.Open();
                return myCmd.ExecuteNonQuery();
            }
            catch (Exception ex)
            {
                throw new Exception(ex.Message, ex);
            }
            finally
            {
                myCmd.Dispose();
                myConn.Close();
            }
        }

        /// <summary>
        /// 返回结果集中的第一行第一列ExecuteScalar
        /// </summary>
        /// <param name="mySql">SQL语句</param>
        /// <returns>int</returns>
        public static int ExecuteCount(string mySql)
        {
            OleDbCommand myCmd = new OleDbCommand(mySql, myConn);
            myCmd.CommandText = mySql;
            try
            {
                myConn.Open();
                return (int)myCmd.ExecuteScalar();
            }
            catch (Exception ex)
            {
                throw new Exception(ex.Message, ex);
            }
            finally
            {
                myCmd.Dispose();
                myConn.Close();
            }
        }

        /// <summary>
        /// 执行SQL语句返回OleDbDataReader
        /// </summary>
        /// <param name="mySql">string,SQL语句</param>
        /// <returns>OleDbDataReader</returns>
        public static OleDbDataReader ExecuteSqlDataReader(string mySql)
        {
            OleDbCommand myCmd = new OleDbCommand(mySql, myConn);
            OleDbDataReader myReader;
            try
            {
                myConn.Open();
                myReader = myCmd.ExecuteReader(CommandBehavior.CloseConnection);
                return myReader;
            }
            catch (OleDbException ex)
            {
                throw new Exception(ex.Message, ex);
            }
            finally
            {
                myCmd.Dispose();
            }
        }

    }
}

C# 安全

using System;
using System.Data;
using System.Configuration;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.IO;
using System.Text;
using System.Security.Cryptography;

namespace EastIdea.Class
{
    public class Security
    {
        public Security(string optionalText)
        {

        }

        /// <summary>
        /// 获取 MDE 加密字符串
        /// </summary>
        /// <param name="data">字符串:要加密的数据</param>
        /// <returns>字符串:密文数据</returns>
        #region 获取 MDE 加密字符串
        public static string GetDesEncryptString(string data)
        {
            string KEY_64 = "34671764";
            string IV_64 = "34671764";
            byte[] byKey = System.Text.ASCIIEncoding.ASCII.GetBytes(KEY_64);
            byte[] byIV = System.Text.ASCIIEncoding.ASCII.GetBytes(IV_64);
            DESCryptoServiceProvider cryptoProvider = new DESCryptoServiceProvider();
            int i = cryptoProvider.KeySize;
            MemoryStream ms = new MemoryStream();
            CryptoStream cst = new CryptoStream(ms, cryptoProvider.CreateEncryptor(byKey, byIV), CryptoStreamMode.Write);
            StreamWriter sw = new StreamWriter(cst);
            sw.Write(data);
            sw.Flush();
            cst.FlushFinalBlock();
            sw.Flush();
            return Convert.ToBase64String(ms.GetBuffer(), 0, (int)ms.Length);
        }
        #endregion

        /// <summary>
        /// 获取 MDE 解密字符串
        /// </summary>
        /// <param name="data">字符串:要解密的数据</param>
        /// <returns>字符串:解密后的数据</returns>
        #region 获取 MDE 解密字符串
        public static string GetDesDencryptString(string data)
        {
            string KEY_64 = "34671764";
            string IV_64 = "34671764";

            byte[] byKey = System.Text.ASCIIEncoding.ASCII.GetBytes(KEY_64);
            byte[] byIV = System.Text.ASCIIEncoding.ASCII.GetBytes(IV_64);
            byte[] byEnc;
            try
            {
                byEnc = Convert.FromBase64String(data);
            }
            catch
            {
                return null;
            }
            DESCryptoServiceProvider cryptoProvider = new DESCryptoServiceProvider();
            MemoryStream ms = new MemoryStream(byEnc);
            CryptoStream cst = new CryptoStream(ms, cryptoProvider.CreateDecryptor(byKey, byIV), CryptoStreamMode.Read);
            StreamReader sr = new StreamReader(cst);
            return sr.ReadToEnd();
        }
        #endregion

        /// <summary>
        /// 获得 MD5 加密方法
        /// </summary>
        /// <param name="inputString">字符串:要加密的字符串</param>
        /// <returns>字符串:密文字符串</returns>
        #region 获取 MD5 加密方法
        public static string GetMd5EncryptString(string inputString)
        {
            Byte[] clearBytes = new UnicodeEncoding().GetBytes(inputString);
            Byte[] hashedBytes = ((HashAlgorithm)CryptoConfig.CreateFromName("MD5")).ComputeHash(clearBytes);
            return BitConverter.ToString(hashedBytes);
        }
        #endregion
    }
}

PHP php标头以纯文本格式查看页面

<? header('Content-type: text/plain'); ?>

XHTML hacer queunbotónparezcaun enlace con CSS

<!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=utf-8" />
<title>Documento sin título</title>
<style type="text/css">
     .submit {
     	background: transparent;
     	border-top: 0;
     	border-right: 0;
     	border-bottom: 1px solid #00F;
     	border-left: 0;
     	color: #00F;
     	display: inline;
    	margin: 0;
    	padding: 0;
    }
    
    *:first-child+html .submit {		/* hack needed for IE 7 */
    	border-bottom: 0;
    	text-decoration: underline;
    }
    
    * html .submit {				/* hack needed for IE 5/6 */
    	border-bottom: 0;
    	text-decoration: underline;
    }
	
   
    
 

</style>
</head>

<body>
   <input class="submit" type="submit" value="Submit Form">
</body>
</html>

C# 当您单击其中一个项目时,如何判断控制上下文菜单的形式

/// <summary>
/// Copy selected item from DGV.
/// </summary>
/// <param name="sender">A ToolStripDropDownItem</param>
/// <param name="e"></param>
private void copyToolStripMenuItem_Click(object sender, EventArgs e)
{
    // The context menu strip called this method, so we need to determine which DGV it was clicked on
    {
        ToolStripDropDownItem item = sender as ToolStripDropDownItem;
        if (item == null) // Error
            return;
        ContextMenuStrip strip = item.Owner as ContextMenuStrip;
        grid = strip.SourceControl as DataGridView;
    }
    if (grid == null) // Control wasn't a DGV
        return;
    DataObject data = grid.GetClipboardContent();
    Clipboard.SetDataObject(data);
}

Other 在谷歌搜索音频文件

-inurl:(htm|html|php) intitle:"index of" +"last modified" +"parent directory" +description +size +(wma|mp3) "BANDA/CANCIÓN"

Visual Basic 表中的SSRS颜色每隔一行

=IIf(RowNumber(Nothing) mod 2 = 0, "Beige", Nothing)

Other 用Ruby编写一个文件

=begin
r - Open a file for reading. The file must exist.
w - Create an empty file for writing. If a file with the same name already exists its content is erased and the file is treated as a new empty file.
a - Append to a file. Writing operations append data at the end of the file. The file is created if it does not exist.
r+ - Open a file for update both reading and writing. The file must exist.
w+ - Create an empty file for both reading and writing. If a file with the same name already exists its content is erased and the file is treated as a new empty file.
a+ - Open a file for reading and appending. All writing operations are performed at the end of the file, protecting the previous content to be overwritten. You can reposition (fseek, rewind) the internal pointer to anywhere in the file for reading, but writing operations will move it back to the end of file. The file is created if it does not exist.
=end

File.open(local_filename, 'w') {|f| f.write(doc) }