.net - 白牙的日志 - 努力哇!

即刻提升jQuery性能的十个技巧

 

1. 使用最新版本

jQueryTips-Use_Latest

jQuery一直处于不断的开发和改进过程中。 John 和他的团队不断研究着提升程序性能的新方法。

一点题外话,几个月前他还发布了Sizzle,一个据说能在Firefox中把程序性能提升3倍的JS选择器库。

如果你不想时刻关注是否有新版本,然后再花时间下载上传,Google 就又能帮你一把了。他们的服务器上存储了大量Ajax库供您选择。

继续阅读

GitHub的使用笔记

注册免费帐号

   地址 :  http://github.com/singup/free

   问题 : 如何生成 SSH-Public-Key

  

打开 Terminal

输入 ssh-keygen -C username@email.com -t rsa

  这里的邮箱地址需要替换成自己得注册邮箱,在生成过程中会有一些问题要你回答,我是直接Enter过去的

输入 cat .ssh/id_rsa.pub
   
   屏幕上会显示你得SSH-Public-Key,把它复制下来并粘帖到GitHub注册页面得SSH-PublicKey得输入框里。








 

使用

               研究中

Unicode转成汉字

rivate static List SplitByString(string source, string splitStr)
{
string input = source;
List final = new List();
int start = input.IndexOf(splitStr);
if (start > 0)
final.Add(input.Substring(0, start));
while (start < input.Length)
{
string unicode =input.Substring(start,6);

final.Add(unicode);

start += 6;
int end = input.IndexOf(splitStr,start);
if (end == -1)
end = input.Length;
if (start == end) //连续的
continue;
final.Add(input.Substring(start, end - start));
start += end - start;
}
return final;

}

public static string ConverTo(string sourceString)
{

List arrHexString = SplitByString(sourceString, "\\u");

StringBuilder resultString = new StringBuilder("");

foreach (string shexString in arrHexString)
{

if (shexString.Length == 6)
{
string hexString = shexString.Replace(@"\u", "");
string prexString = hexString.Substring(0, 2);
string suffixString = hexString.Substring(2);

byte prex = byte.Parse(prexString, System.Globalization.NumberStyles.AllowHexSpecifier);
byte suffix = byte.Parse(suffixString, System.Globalization.NumberStyles.AllowHexSpecifier);

byte[] unicodeBytes = { suffix, prex };
UnicodeEncoding encoding = new UnicodeEncoding();
resultString.Append(encoding.GetString(unicodeBytes));
}
else
{
resultString.Append(shexString);
}

}

return resultString.ToString();

使用方法

 

 

string input = @”ilyu5357、lily\u6728\u5357lily”;
            string output = ConverTo(input);
            Console.WriteLine(output);

C#对Unix的timestamp进行转换

 

1、将系统时间转换成UNIX时间戳

DateTime dtStart = TimeZone.CurrentTimeZone.ToLocalTime(new DateTime(1970,1,1));
DateTime dtNow = DateTime.Parse(DateTime.Now.ToString());
TimeSpan toNow = dtNow.Subtract(dtStart);
string timeStamp = toNow.Ticks.ToString();
timeStamp = timeStamp.Substring(0,timeStamp.Length7);

2、将UNIX时间戳转换成系统时
string timeStamp = “1176686120″;
DateTime dtStart = TimeZone.CurrentTimeZone.ToLocalTime(new DateTime(1970,1,1));
long lTime = long.Parse(timeStamp + “0000000);
TimeSpan toNow = new TimeSpan(lTime);
DateTime dtResult = dtStart.Add(toNow);

 




Host by is-Programmer.com | Power by Chito 1.3.3 beta | © 2007 LinuxGem | Design by Matthew "Agent Spork" McGee