Jack.Lee -- 开发空间

2009年8月19日 #

使用WMI获取远程机器的时间

using System.Management;

   public static DateTime? GetSystemTime(string computerName) {
     using (
       ManagementObjectSearcher searcher = new ManagementObjectSearcher(
         string.Format(@"\\{0}\root\cimv2", computerName),
         "SELECT * FROM Win32_UTCTime"
       )
     ) {
       foreach (ManagementObject time in searcher.Get()) {
         int year = Convert.ToInt32(time.GetPropertyValue("Year"));
         int month = Convert.ToInt32(time.GetPropertyValue("Month"));
         int day = Convert.ToInt32(time.GetPropertyValue("Day"));
         int hour = Convert.ToInt32(time.GetPropertyValue("Hour"));
         int minute = Convert.ToInt32(time.GetPropertyValue("Minute"));
         int second = Convert.ToInt32(time.GetPropertyValue("Second"));
         return new DateTime(year, month, day, hour, minute, second,
DateTimeKind.Utc).ToLocalTime();
       }
       return null;
     }
   }

posted @ 2009-08-19 23:09 Jack.Lee 阅读(82) 评论(0) 编辑

2009年8月17日 #

Oracle中一个表过多的字段

      今天一同事拿了一个Oracle的表,10w行记录select count(*)要6s。发现原来有40个字段,其中两个是BLOB,占空间202M。后建议他把两个BLOB字段分出去,并Rebuild原表,表的大小下降到27M。这时再select count(*),速度提高至600ms。

posted @ 2009-08-17 22:09 Jack.Lee 阅读(52) 评论(0) 编辑

2009年8月8日 #

Web Worker

      Html5中加入了一个新的概念Web Worker。
      什么是Web Worker?简单来说就是通过javascript创建一个后台线程(或者叫工作者线程),执行一些特殊的任务。比如耗时比较长的数据处理。避免了传统的javascript执行长时间操作时界面无响应的弊端,提高性能及用户体验。后台线程和界面线程之间的通讯使用的是XmlHttpRequest的机制。这个和Ajax类似,不同的是Ajax是客户端和服务器端通讯,而Web Worker和界面线程是在同一个客户端进程中。

posted @ 2009-08-08 23:40 Jack.Lee 阅读(242) 评论(0) 编辑

仅列出标题  

导航

统计信息

News