123.表分区
CREATE TABLE T_NEW
(ID NUMBER PRIMARY KEY, TIME DATE) PARTITION BY RANGE (TIME)
(
PARTITION P1 VALUES LESS THAN (TO_DATE('2011-9-1', 'YYYY-MM-DD')),
PARTITION P2 VALUES LESS THAN (TO_DATE('2011-10-1', 'YYYY-MM-DD')),
PARTITION P3 VALUES LESS THAN (TO_DATE('2011-11-1', 'YYYY-MM-DD')),
PARTITION P4 VALUES LESS THAN (TO_DATE('2011-12-1', 'YYYY-MM-DD')),
PARTITION P5 VALUES LESS THAN (MAXVALUE)
)
124.asp.net执行顺序
public override void ProcessRequest(HttpContext context)
protected override void OnPreInit(EventArgs e)
protected override void OnInit(EventArgs e)
protected override void OnInitComplete(EventArgs e)
protected override void OnPreLoad(EventArgs e)
protected override void OnLoad(EventArgs e)
protected override void OnLoadComplete(EventArgs e)
protected override void OnPreRender(EventArgs e)
protected override void OnPreRenderComplete(EventArgs e)
protected override void OnSaveStateComplete(EventArgs e)
protected override void Render(HtmlTextWriter writer)
2011-10-26
125.解决弹出winform界面卡死现象
Thread thread = new Thread(new ThreadStart(target));
AddItemToListBox(“启动服务器端程序”);
thread.Start();
private delegate void AddItemToListBoxDelegate(string str);
private void AddItemToListBox(string str){
if (this.listBox1.InvokeRequired){
AddItemToListBoxDelegate d = AddItemToListBox;
this.listBox1.Invoke(d, str);
}
else
{
this.listBox1.Items.Add(str + " " + DateTime.Now.ToString());
this.listBox1.SelectedIndex = this.listBox1.Items.Count - 1;
this.listBox1.ClearSelected();
}
}
126.xml中去掉无效字符
public static string ReplaceLowOrderASCIICharacters(string tmp)
{
StringBuilder info = new StringBuilder();
foreach (char cc in tmp)
{
int ss = (int)cc;
if (((ss >= 0) && (ss <= 8)) || ((ss >= 11) && (ss <= 12)) || ((ss >= 14) && (ss <= 32)))
info.AppendFormat(" ", ss);//&#x{0:X};
else info.Append(cc);
}
return info.ToString();
}
127.split分隔字符串
string[] strs = content.Split(new string[] { "</root>" }, StringSplitOptions.RemoveEmptyEntries);
128.得到随机数
private string CalRandomNum(){
string md5Value = string.Empty;
Random rd = new Random();
for(int j = 0;j < 8;j++){
md5Value += rd.Next(0, 9).ToString();}
return md5Value;
}
129.xml相关处理
XmlDocument xml = new XmlDocument();
xml.LoadXml(xmlTemp);
XmlNode node = xml.SelectSingleNode("//md5");
XmlNodeList current = xml.GetElementsByTagName("current");
XmlNodeList total = xml.GetElementsByTagName("total");
node.InnerText = "pass";
xmlTemp = xml.InnerXml;
130.c#算md5值
byte[] result = Encoding.Default.GetBytes(md5Value.Trim());
MD5 md5 = new MD5CryptoServiceProvider();
byte[] output = md5.ComputeHash(result);
return BitConverter.ToString(output).Replace("-", "");
2011-10-27
131.一个线程安全的单例
private static MainDataControl instance;
private static object syncLock = new object();
protected MainDataControl()
{
}
public static MainDataControl Instance()
{
lock (syncLock)
{
if (instance == null)
{
instance = new MainDataControl();
}
return instance;
}
}
2011-11-1
132.insert数据库主键id并发的问题
一般主键都采用自增的方式即可防止并发,但如果实际项目中不能采用自增方式,用lock解决
lock (this)
{
object o = DataCollectionAccess.Instance().GetMaxOrigValueID(building_id);
if (o == null || o == DBNull.Value){
f_origvalueid = building_id + "0000000001";
}
else
{
string id = o.ToString().Substring(10, 10);
int num = int.Parse(id);
num += 1;
id = "";
for (int i = 0; i < 10 - num.ToString().Length; i++)
{
id += "0";
}
id += num.ToString();
f_origvalueid = building_id + id;
}
if (!DataCollectionAccess.Instance().SaveXmlData(f_origvalueid, building_id, f_meterid, f_meterparamid, f_origvalue,f_collecttime, f_collectionid, f_energyitemcode)){}
}
133.extjs tree只展示二级菜单
root.expand(false, true, function(root) {
root.expandChildNodes() });
134.架构师注意的问题
•高性能web开发中要注意的地方
•高安全性web开发中要注意的地方和防止办法
•有大量字段的用户表的设计方案和优缺点
•强烈建议大家总结一下平时面向某个方面的解决方案,
最好一个个列出来比较一下,面试的时候就能系统的描述了
•高性能服务器
•分布式缓存
•分布式事务
•数据库负载