ASP.NET中常用方法
身份证号检测:
/// <summary>
/// 检验身份证号是否正确
/// </summary>
/// <param name="Id"></param>
/// <returns></returns>
public static bool CheckIDCard(string Id)
{
if (Id.Length == )
{
bool check = CheckIDCard18(Id);
return check;
}
else if (Id.Length == )
{
bool check = CheckIDCard15(Id);
return check;
}
else
{
return false;
}
}
/// <summary>
/// 18位身份证验证
/// </summary>
/// <param name="Id">身份证号</param>
/// <returns></returns>
public static bool CheckIDCard18(string Id)
{
try
{
long n = ;
if (long.TryParse(Id.Remove(), out n) == false || n < Math.Pow(, ) || long.TryParse(Id.Replace('x', '').Replace('X', ''), out n) == false)
{
return false;//数字验证
}
string address = "11x22x35x44x53x12x23x36x45x54x13x31x37x46x61x14x32x41x50x62x15x33x42x51x63x21x34x43x52x64x65x71x81x82x91";
if (address.IndexOf(Id.Remove()) == -)
{
return false;//省份验证
}
string birth = Id.Substring(, ).Insert(, "-").Insert(, "-");
DateTime time = new DateTime();
if (DateTime.TryParse(birth, out time) == false)
{
return false;//生日验证
}
string[] arrVarifyCode = ("1,0,x,9,8,7,6,5,4,3,2").Split(',');
string[] Wi = ("7,9,10,5,8,4,2,1,6,3,7,9,10,5,8,4,2").Split(',');
char[] Ai = Id.Remove().ToCharArray();
int sum = ;
for (int i = ; i < ; i++)
{
sum += int.Parse(Wi[i]) * int.Parse(Ai[i].ToString());
}
int y = -;
Math.DivRem(sum, , out y);
if (arrVarifyCode[y] != Id.Substring(, ).ToLower())
{
return false;//校验码验证
}
return true;//符合GB11643-1999标准}
}
catch { return false; }
}
/// <summary>
/// 15位身份证验证
/// </summary>
/// <param name="Id">身份证号</param>
/// <returns></returns>
public static bool CheckIDCard15(string Id)
{
try
{
long n = ;
if (long.TryParse(Id, out n) == false || n < Math.Pow(, ))
{
return false;//数字验证
}
string address = "11x22x35x44x53x12x23x36x45x54x13x31x37x46x61x14x32x41x50x62x15x33x42x51x63x21x34x43x52x64x65x71x81x82x91";
if (address.IndexOf(Id.Remove()) == -)
{
return false;//省份验证
}
string birth = Id.Substring(, ).Insert(, "-").Insert(, "-");
DateTime time = new DateTime();
if (DateTime.TryParse(birth, out time) == false)
{
return false;//生日验证
}
return true;//符合15位身份证标准
}
catch { return false; }
} /// <summary>
/// 检查身份证号是否存在
/// </summary>
/// <param name="card">身份证号</param>
/// <param name="tableName">表名</param>
/// <returns></returns>
public bool CheckCardIsExist(string card, string tableName, string strWhere)
{
string strSql = " select count(1) from " + tableName + " where Shenfenzheng='" + card + "'";
if (strWhere != "")
{
strSql += " and " + strWhere;
} if (int.Parse(DBUtility.DbHelperSQL.GetSingle(strSql).ToString()) > )
{
return false;
}
else
{ return true;
}
}
#region 将字符串转换为数组
public static string[] GetStrArray(string str)
{
return str.Split(new char[',']);
}
#endregion #region 将数组转换为字符串
public static string GetArrayStr(List<string> list, string speater)
{
StringBuilder sb = new StringBuilder();
for (int i = ; i < list.Count; i++)
{
if (i == list.Count - )
{
sb.Append(list[i]);
}
else
{
sb.Append(list[i]);
sb.Append(speater);
}
}
return sb.ToString();
}
#endregion #region 删除最后结尾的一个逗号
/// <summary>
/// 删除最后结尾的一个逗号
/// </summary>
public static string DelLastComma(string str)
{
return str.Substring(, str.LastIndexOf(","));
}
#endregion #region 删除最后结尾的指定字符后的字符
/// <summary>
/// 删除最后结尾的指定字符后的字符
/// </summary>
public static string DelLastChar(string str, string strchar)
{
return str.Substring(, str.LastIndexOf(strchar));
}
#endregion #region 生成指定长度的字符串
/// <summary>
/// 生成指定长度的字符串,即生成strLong个str字符串
/// </summary>
/// <param name="strLong">生成的长度</param>
/// <param name="str">以str生成字符串</param>
/// <returns></returns>
public static string StringOfChar(int strLong, string str)
{
string ReturnStr = "";
for (int i = ; i < strLong; i++)
{
ReturnStr += str;
} return ReturnStr;
}
#endregion #region 生成日期随机码
/// <summary>
/// 生成日期随机码
/// </summary>
/// <returns></returns>
public static string GetRamCode()
{
#region
return DateTime.Now.ToString("yyyyMMddHHmmssffff");
#endregion
}
#endregion #region 截取字符长度
/// <summary>
/// 截取字符长度
/// </summary>
/// <param name="inputString">字符</param>
/// <param name="len">长度</param>
/// <returns></returns>
public static string CutString(string inputString, int len)
{
ASCIIEncoding ascii = new ASCIIEncoding();
int tempLen = ;
string tempString = "";
byte[] s = ascii.GetBytes(inputString);
for (int i = ; i < s.Length; i++)
{
if ((int)s[i] == )
{
tempLen += ;
}
else
{
tempLen += ;
} try
{
tempString += inputString.Substring(i, );
}
catch
{
break;
} if (tempLen > len)
break;
}
//如果截过则加上半个省略号
byte[] mybyte = System.Text.Encoding.Default.GetBytes(inputString);
if (mybyte.Length > len)
tempString += "…";
return tempString;
}
#endregion #region 清除HTML标记
public static string DropHTML(string Htmlstring)
{
//删除脚本
Htmlstring = Regex.Replace(Htmlstring, @"<script[^>]*?>.*?</script>", "", RegexOptions.IgnoreCase);
//删除HTML
Htmlstring = Regex.Replace(Htmlstring, @"<(.[^>]*)>", "", RegexOptions.IgnoreCase);
Htmlstring = Regex.Replace(Htmlstring, @"([\r\n])[\s]+", "", RegexOptions.IgnoreCase);
Htmlstring = Regex.Replace(Htmlstring, @"-->", "", RegexOptions.IgnoreCase);
Htmlstring = Regex.Replace(Htmlstring, @"<!--.*", "", RegexOptions.IgnoreCase);
Htmlstring = Regex.Replace(Htmlstring, @"&(quot|#34);", "\"", RegexOptions.IgnoreCase);
Htmlstring = Regex.Replace(Htmlstring, @"&(amp|#38);", "&", RegexOptions.IgnoreCase);
Htmlstring = Regex.Replace(Htmlstring, @"&(lt|#60);", "<", RegexOptions.IgnoreCase);
Htmlstring = Regex.Replace(Htmlstring, @"&(gt|#62);", ">", RegexOptions.IgnoreCase);
Htmlstring = Regex.Replace(Htmlstring, @"&(nbsp|#160);", " ", RegexOptions.IgnoreCase);
Htmlstring = Regex.Replace(Htmlstring, @"&(iexcl|#161);", "\xa1", RegexOptions.IgnoreCase);
Htmlstring = Regex.Replace(Htmlstring, @"&(cent|#162);", "\xa2", RegexOptions.IgnoreCase);
Htmlstring = Regex.Replace(Htmlstring, @"&(pound|#163);", "\xa3", RegexOptions.IgnoreCase);
Htmlstring = Regex.Replace(Htmlstring, @"&(copy|#169);", "\xa9", RegexOptions.IgnoreCase); Htmlstring = Regex.Replace(Htmlstring, @"&#(\d+);", "", RegexOptions.IgnoreCase);
Htmlstring.Replace("<", "");
Htmlstring.Replace(">", "");
Htmlstring.Replace("\r\n", "");
Htmlstring = HttpContext.Current.Server.HtmlEncode(Htmlstring).Trim();
return Htmlstring;
}
#endregion #region 清除HTML标记且返回相应的长度
public static string DropHTML(string Htmlstring, int strLen)
{
return CutString(DropHTML(Htmlstring), strLen);
}
#endregion #region TXT代码转换成HTML格式
/// <summary>
/// 字符串字符处理
/// </summary>
/// <param name="chr">等待处理的字符串</param>
/// <returns>处理后的字符串</returns>
/// //把TXT代码转换成HTML格式
public static String ToHtml(string Input)
{
StringBuilder sb = new StringBuilder(Input);
sb.Replace("&", "&");
sb.Replace("<", "<");
sb.Replace(">", ">");
sb.Replace("\r\n", "<br />");
sb.Replace("\n", "<br />");
sb.Replace("\t", " ");
//sb.Replace(" ", " ");
return sb.ToString();
}
#endregion #region HTML代码转换成TXT格式
/// <summary>
/// 字符串字符处理
/// </summary>
/// <param name="chr">等待处理的字符串</param>
/// <returns>处理后的字符串</returns>
/// //把HTML代码转换成TXT格式
public static String ToTxt(String Input)
{
StringBuilder sb = new StringBuilder(Input);
sb.Replace(" ", " ");
sb.Replace("<br>", "\r\n");
sb.Replace("<br>", "\n");
sb.Replace("<br />", "\n");
sb.Replace("<br />", "\r\n");
sb.Replace("<", "<");
sb.Replace(">", ">");
sb.Replace("&", "&");
return sb.ToString();
}
#endregion #region 检查危险字符
/// <summary>
/// 检查危险字符
/// </summary>
/// <param name="Input"></param>
/// <returns></returns>
public static string Filter(string sInput)
{
if (sInput == null || sInput == "")
return null;
string sInput1 = sInput.ToLower();
string output = sInput;
string pattern = @"*|and|exec|insert|select|delete|update|count|master|truncate|declare|char(|mid(|chr(|'";
if (Regex.Match(sInput1, Regex.Escape(pattern), RegexOptions.Compiled | RegexOptions.IgnoreCase).Success)
{
throw new Exception("字符串中含有非法字符!");
}
else
{
output = output.Replace("'", "''");
}
return output;
}
#endregion #region 检查过滤设定的危险字符
/// <summary>
/// 检查过滤设定的危险字符
/// </summary>
/// <param name="InText">要过滤的字符串 </param>
/// <returns>如果参数存在不安全字符,则返回true </returns>
public static bool SqlFilter(string word, string InText)
{
if (InText == null)
return false;
foreach (string i in word.Split('|'))
{
if ((InText.ToLower().IndexOf(i + " ") > -) || (InText.ToLower().IndexOf(" " + i) > -))
{
return true;
}
}
return false;
}
#endregion #region 过滤特殊字符
/// <summary>
/// 过滤特殊字符
/// </summary>
/// <param name="Input"></param>
/// <returns></returns>
public static string Htmls(string Input)
{
if (Input != string.Empty && Input != null)
{
string ihtml = Input.ToLower();
ihtml = ihtml.Replace("<script", "<script");
ihtml = ihtml.Replace("script>", "script>");
ihtml = ihtml.Replace("<%", "<%");
ihtml = ihtml.Replace("%>", "%>");
ihtml = ihtml.Replace("<$", "<$");
ihtml = ihtml.Replace("$>", "$>");
return ihtml;
}
else
{
return string.Empty;
}
}
#endregion #region 获得当前绝对路径
/// <summary>
/// 获得当前绝对路径
/// </summary>
/// <param name="strPath">指定的路径</param>
/// <returns>绝对路径</returns>
public static string GetMapPath(string strPath)
{
if (strPath.ToLower().StartsWith("http://"))
{
return strPath;
}
if (HttpContext.Current != null)
{
return HttpContext.Current.Server.MapPath(strPath);
}
else //非web程序引用
{
strPath = strPath.Replace("/", "\\");
if (strPath.StartsWith("\\"))
{
strPath = strPath.Substring(strPath.IndexOf('\\', )).TrimStart('\\');
}
return System.IO.Path.Combine(AppDomain.CurrentDomain.BaseDirectory, strPath);
}
}
#endregion /// <summary>
/// 写cookie值
/// </summary>
/// <param name="strName">名称</param>
/// <param name="strValue">值</param>
public static void WriteCookie(string strName, string strValue)
{
HttpCookie cookie = HttpContext.Current.Request.Cookies[strName];
if (cookie == null)
{
cookie = new HttpCookie(strName);
}
cookie.Value = strValue;
HttpContext.Current.Response.AppendCookie(cookie);
} /// <summary>
/// 写cookie值
/// </summary>
/// <param name="strName">名称</param>
/// <param name="strValue">值</param>
public static void WriteCookie(string strName, string key, string strValue)
{
HttpCookie cookie = HttpContext.Current.Request.Cookies[strName];
if (cookie == null)
{
cookie = new HttpCookie(strName);
}
cookie[key] = strValue;
HttpContext.Current.Response.AppendCookie(cookie);
} /// <summary>
/// 写cookie值
/// </summary>
/// <param name="strName">名称</param>
/// <param name="strValue">值</param>
/// <param name="strValue">过期时间(分钟)</param>
public static void WriteCookie(string strName, string strValue, int expires)
{
HttpCookie cookie = HttpContext.Current.Request.Cookies[strName];
if (cookie == null)
{
cookie = new HttpCookie(strName);
}
cookie.Value = strValue;
cookie.Expires = DateTime.Now.AddMinutes(expires);
HttpContext.Current.Response.AppendCookie(cookie);
} /// <summary>
/// 读cookie值
/// </summary>
/// <param name="strName">名称</param>
/// <returns>cookie值</returns>
public static string GetCookie(string strName)
{
if (HttpContext.Current.Request.Cookies != null && HttpContext.Current.Request.Cookies[strName] != null)
return HttpContext.Current.Request.Cookies[strName].Value.ToString(); return "";
} /// <summary>
/// 读cookie值
/// </summary>
/// <param name="strName">名称</param>
/// <returns>cookie值</returns>
public static string GetCookie(string strName, string key)
{
if (HttpContext.Current.Request.Cookies != null && HttpContext.Current.Request.Cookies[strName] != null && HttpContext.Current.Request.Cookies[strName][key] != null)
return HttpContext.Current.Request.Cookies[strName][key].ToString(); return "";
} public static string FormatLastString(string _in)
{
return DelLastChar(_in, ",");
}
public static string FormatLastString(string _in, string _sep)
{
return DelLastChar(_in, _sep);
} public static string GetRanDomFileName()
{
return DateTime.Now.ToString("yyyyMMddhhmmss");
} #region MyRegion 弹出框并跳转到指定页面
/// <summary>
/// 弹出框并跳转到指定页面
/// </summary>
/// <param name="txtMessage">弹出框提示信息</param>
/// <param name="url">要跳转到的地址</param>
public void MessageBox(string txtMessage, string url)
{
Page page = (Page)HttpContext.Current.CurrentHandler;
page.ClientScript.RegisterStartupScript(this.GetType(), "message", "alert('" + txtMessage + "');window.location='" + url + "'", true);
}
#endregion /// <summary>
/// 判断最后结尾是否为指定字符,是则删除
/// </summary>
/// <param name="str"></param>
/// <param name="strchar"></param>
/// <returns></returns>
public static string DelLastComma(string str,string strchar)
{
string s = str.Substring(str.Length - , );
if (s == strchar)
{
return str.Substring(, str.Length - );
}
else
{
return str;
}
}
DataTable2Json:
public string DataTable2Json(DataTable dt)
{
if (dt != null && dt.Rows.Count > )
{
StringBuilder jsonBuilder = new StringBuilder();
jsonBuilder.Append("{");
jsonBuilder.Append("\"ds\"");
jsonBuilder.Append(":[");
for (int i = ; i < dt.Rows.Count; i++)
{
jsonBuilder.Append("{");
for (int j = ; j < dt.Columns.Count; j++)
{
jsonBuilder.Append("\"" + dt.Columns[j].ColumnName + "\"");
jsonBuilder.Append(":\"");
jsonBuilder.Append(dt.Rows[i][j].ToString());
jsonBuilder.Append("\",");
}
jsonBuilder.Remove(jsonBuilder.Length - , );
jsonBuilder.Append("},");
}
jsonBuilder.Remove(jsonBuilder.Length - , );
jsonBuilder.Append("]");
jsonBuilder.Append("}");
return jsonBuilder.ToString();
}
else
{
return "{\"ds\":{}}";
}
}
获取数据列表:
/// <summary>
/// 获得数据列表(按页码,每页20条)
/// </summary>
public DataSet GetListresult(int startId, string tableName, string strWhere, string filedOrder)
{
StringBuilder strSql = new StringBuilder();
strSql.Append("SELECT * FROM ( ");
strSql.Append(" SELECT ROW_NUMBER() OVER (");
if (!string.IsNullOrEmpty(filedOrder.Trim()))
{
strSql.Append("order by T." + filedOrder);
}
else
{
strSql.Append("order by T.ID desc");
}
strSql.Append(")AS R, T.* from " + tableName + " T ");
if (!string.IsNullOrEmpty(strWhere.Trim()))
{
strSql.Append(" WHERE " + strWhere);
}
strSql.Append(" ) TT");
strSql.AppendFormat(" WHERE TT.R between {0} and {1}", * (startId - ) + , * startId); return OracleHelper.ExecuteDataset(strSql.ToString());
} /// <summary>
/// 获得数据列表(前几条)
/// </summary>
public DataSet GetList(int top, string tableName, string strWhere, string filedOrder)
{
StringBuilder strSql = new StringBuilder();
strSql.Append("SELECT * FROM ( ");
strSql.Append(" SELECT ROW_NUMBER() OVER (");
if (!string.IsNullOrEmpty(filedOrder.Trim()))
{
strSql.Append("order by T." + filedOrder);
}
else
{
strSql.Append("order by T.ID desc");
}
strSql.Append(")AS R, T.* from " + tableName + " T ");
if (!string.IsNullOrEmpty(strWhere.Trim()))
{
strSql.Append(" WHERE " + strWhere);
}
strSql.Append(" ) TT");
strSql.AppendFormat(" WHERE TT.R between {0} and {1}", , top); return OracleHelper.ExecuteDataset(strSql.ToString());
} /// <summary>
/// 获得数据列表
/// </summary>
/// <param name="top">第几条</param>
/// <param name="tableName">表名</param>
/// <param name="strWhere">条件</param>
/// <param name="filedOrder">按哪个字段,怎样排序 createtime desc</param>
/// <param name="leftjoin">左连接语句 left join userinfo u on T.user_id=u.user_id</param>
/// <param name="display">要显示的字段</param>
/// <returns></returns>
public DataSet GetNewsList(int top, string tableName, string strWhere, string filedOrder, string leftjoin, string display)
{
StringBuilder strSql = new StringBuilder();
strSql.Append("SELECT * FROM ( ");
strSql.Append(" SELECT ROW_NUMBER() OVER (");
if (!string.IsNullOrEmpty(filedOrder.Trim()))
{
strSql.Append("order by T." + filedOrder);
}
else
{
strSql.Append("order by T.ID desc");
}
strSql.Append(")AS R, " + display + " from " + tableName + " T " + leftjoin);
if (!string.IsNullOrEmpty(strWhere.Trim()))
{
strSql.Append(" WHERE " + strWhere);
}
strSql.Append(" ) TT");
strSql.AppendFormat(" WHERE TT.R between {0} and {1}", , top); return OracleHelper.ExecuteDataset(strSql.ToString());
}
/// <summary>
/// 获得查询分页数据
/// </summary>
public DataSet GetPageList(int pageSize, int currentPage, string strWhere, string filedOrder)
{
int topSize = pageSize * currentPage;
StringBuilder strSql = new StringBuilder();
strSql.Append("select top " + pageSize + " Id,USERNAME,DANWEI,TEL,ADDRESS,USERIP,CREATETIME,TITLE,CONTENT,REPLYTIME,REPLYCONTENT,FLAG,PARENTID,ISDISPLAY from dt_ASK");
strSql.Append(" where Id not in(select top " + topSize + " Id from dt_ASK");
if (strWhere.Trim() != "")
{
strSql.Append(" where " + strWhere);
}
strSql.Append(" order by " + filedOrder + ")");
if (strWhere.Trim() != "")
{
strSql.Append(" and " + strWhere);
}
strSql.Append(" order by " + filedOrder); return DbHelperSQL.Query(strSql.ToString());
}
<img src="data:image/gif;base64,你的二进制流" alt=""/>
EncodeJsString:
/// <summary>
/// Encodes a string to be represented as a string literal. The format
/// is essentially a JSON string.
///
/// The string returned includes outer quotes
/// Example Output: "Hello \"Rick\"!\r\nRock on"
/// </summary>
/// <param name="s"></param>
/// <returns></returns>
public static string EncodeJsString(string s)
{
StringBuilder sb = new StringBuilder();
sb.Append("\"");
foreach (char c in s)
{
switch (c)
{
case '\"':
sb.Append("\\\"");
break;
case '\\':
sb.Append("\\\\");
break;
case '\b':
sb.Append("\\b");
break;
case '\f':
sb.Append("\\f");
break;
case '\n':
sb.Append("\\n");
break;
case '\r':
sb.Append("\\r");
break;
case '\t':
sb.Append("\\t");
break;
default:
int i = (int)c;
if (i < || i > )
{
sb.AppendFormat("\\u{0:X04}", i);
}
else
{
sb.Append(c);
}
break;
}
}
sb.Append("\""); return sb.ToString();
}
.aspx:
<img src='<%# GetStatusPicture(Container.DataItem)%>' alt="Status" />
.aspx.cs:
protected string GetStatusPicture(object dataItem)
{
int units = Int32.Parse(DataBinder.Eval(dataItem,"UnitsInStock").ToString());
if (units == )
return "Cancel.gif";
else if (units > )
return "Ok.gif";
else
return "blank.gif";
}
DataView的用法:
DataSet ds = new DataSet();
DataView dv = new DataView();
dv = ds.Tables["TABLE1"].DefaultView;
dv.RowFilter = "字段=条件";//多条件用and连接
repeater1.DataSource = dv;
<a href="<%#Eval("YEWUISLAST") == 0 ? "XXX.aspx?pid="+Eval("YEWUID") : Eval("YEWUMULU").ToString()%>"><%#Eval("YEWUNAME") %></a>
ASP.NET中常用方法的更多相关文章
- ASP.NET中数据棒图,饼图,柱状图的实现
Web中绘制图形的方法大致有: 1. VML方式:功能强大,但是非常麻烦. 推荐:http://www.elook.net.cn/vml/ 2.使用控件:Dandus, Aspose.chart,Co ...
- asp.net中遍历界面上所有控件进行属性设置
* 使用方法: * 前台页面调用方法,重置: protected void Reset_Click(object sender, EventArgs e) { ...
- 【转载】Asp.Net中Cookie对象的作用以及常见属性
Cookie对象是服务器为用户访问存储的特定信息,这些信息一般存储在浏览器中,服务器可以从提交的数据中获取到相应的Cookie信息,Cookie的最大用途在于服务器对用户身份的确认,即票据认证,用户会 ...
- ASP.NET中常用的优化性能的方法
1. 数据库访问性能优化 数据库的连接和关闭 访问数据库资源需要创建连接.打开连接和关闭连接几个操作.这些过程需要多次与数据库交换信息以通过身份验证,比较耗费服务器资源.ASP.NET中提供了连接池( ...
- asp.net中ashx生成验证码代码放在Linux(centos)主机上访问时无法显示问题
最近有个项目加入了验证码功能,就从自己博客以前的代码中找到直接使用,直接访问验证码页面报错如下: 源代码:asp.net中使用一般处理程序生成验证码 Application Exception Sys ...
- ASP.NET中Session的sessionState 4种mode模式
1. sessionState的4种mode模式 在ASP.NET中Session的sessionState的4中mode模式:Off.InProc.StateServer及SqlServer. 2. ...
- Asp.net中存储过程拖拽至dbml文件中,提示无法获得返回值
Asp.net中存储过程拖拽至dbml文件中,提示无法获得返回值,去属性表中设置这时候会提示你去属性表中更改返回类型. 其实存储过程返回的也是一张表,只不过有时候存储过程有点复杂或者写法不规范的话不能 ...
- ASP.NET中后台数据和前台控件的绑定
关于ASP.NET中后台数据库和前台的数据控件的绑定问题 最近一直在学习个知识点,自己创建了SQL Server数据库表,想在ASP.NET中连接数据库,并把数据库中的数据显示在前台,注意,这里的数据 ...
- asp.net中缓存的使用介绍一
asp.net中缓存的使用介绍一 介绍: 在我解释cache管理机制时,首先让我阐明下一个观念:IE下面的数据管理.每个人都会用不同的方法去解决如何在IE在管理数据.有的会提到用状态管理,有的提到的c ...
随机推荐
- 如何备份MySql的数据库
如何备份MySql的数据库 应该说一般的数据库都有BackUp的需求, MySql备份数据库的方式很简单, 但是在网上说得云里雾里, 也应该是我对MySql数据库不熟悉. 目标(Target) : ...
- [转贴]gsoap使用心得!
最近换了个工作环境,现在在大望路这边上班,呵,刚上班接到的任务就是熟悉gsoap!废话少说,现在开始gSoap学习! gSOAP是一个夸平台的,用于开发Web Service服务端和客户端的工具,在W ...
- SharedPreference.Editor的apply跟commit方法的異同
相同点: 1.二者都可提交preference的修改数据 2.二者都是原子操作 区别: 1.apply没有返回值而commit返回boolean表明修改是否提交成功 2.apply是将修改数据原子提交 ...
- [LeetCode] 315. Count of Smaller Numbers After Self (Hard)
315. Count of Smaller Numbers After Self class Solution { public: vector<int> countSmaller(vec ...
- 23个移动app界面上的旋钮和刻度盘设计示例
摘要: 从最初进入电子设备领域,旋钮和刻度盘的由最初的功能性设计转变为时尚的外观设计元素,比如在移动app中.这种转变并意外,旋钮和刻度盘不需要占用移动设备的太多空间,并可以简单地为用户提供一些列 ...
- cocos2d-x拖动滑块控件CCControlSlider
#include "GameMusicSetting.h" bool GameMusicSetting::init() { if(!CCLayer::init()) { retur ...
- BZOJ_1208_&_Codevs_1258_[HNOI2004]_宠物收养所_(平衡树/set)
描述 http://www.lydsy.com/JudgeOnline/problem.php?id=1208 (据说codevs要更新?就不放codevs的地址了吧...) 有宠物和人,每个单位都有 ...
- Java异常错误的面试题及答案
1) Java中什么是Exception? 这个问题经常在第一次问有关异常的时候或者是面试菜鸟的时候问.我从来没见过面高级或者资深工程师的 时候有人问这玩意,但是对于菜鸟,是很愿意问这个的.简单来说, ...
- ReentrantLock Condition 实现消费者生产者问题
import java.util.LinkedList; import java.util.Queue; import java.util.concurrent.ExecutorService; im ...
- HTML页面规范
<!DOCTYPE HTML> <html> <head> <meta charset="UTF-8"> <title> ...