2007年6月15日 星期五

由天瓏書局排行,看國內技術趨勢

     由天瓏書局的中文書暢銷排行http://tlsj.tenlong.com.tw/WebModule/TopSale/topSaleDispAction.do?chi=1 ,可以看到目前最流行的,就是 ASP.NET AJAX 了, 前10本內有三本是講 ASP.NET AJAX。

 

其他,ASP.NET 2.0 有一本。

以前10 名來看各個主題的比例,結果如下

 

主題

比例 (%)

ASP.NET AJAX

30

ASP.NET

40

AJAX

40

Microsoft 產品

50

Web

70

 

台灣的開發人員的習性是:看來不得不用的時候,才會去認真學。因此由前十大中文暢銷書,可以看到一些趨勢。

 

因此得到一個結論:

台灣市場目前最流行的是做 AJAX 的網站,而使用微軟技術的佔大宗。而市場上的需求,也是建置Web 網站。

 

2007年6月8日 星期五

Identity in asp.net 2.0

It's realy complicated. Please make sure the difference between the Application_BeginRequest event and duration page excution //operation system thread identity (win32) System.Security.Principal.WindowsIdentity.GetCurrent(); //managed thread identity System.Threading.Thread.CurrentPrincipal.Identity; //asp.net user identity (may be GenericPricipal) HttpContext.Current.User.Identity; // consider the client user windows identity that logon to iis Request.LogonUserIdentity; 再加上多種變化
  1. 使用者有無 windows identity (ex:有無登入domain?)
  2. IIS 上有無勾選 anonymous?有無勾選windows intergration?
  3. application pool 上的 identity 是跑哪一個?(network service? local system? domain user?)
  4. web.config 上設的authentication mode (None, Winows, Forms)
  5. web.config 上有無設 ? 是否有指定 username, password?
這些變化,在Request 進行的過程中(befault autentication, page execution, async thread),上述四種identtity都可能有不同的值。而這些值都是有意義的。 It's really complicated.

enum description

When i make an enum like following public enum SalaryType { ByHour, ByMonth }; I ususaly need to describe the meaning by text. So I need the following code switch( employee.EmployeeType) { case Employee.ByHour: Console.WriteLine("By hour"); break; .... } the code was seperated by definition and client code. I found some code , and it so useful public enum SalaryType { [Description("By hour')]ByHour, [Description("By month")] ByMonth }; public static string GetDescription(Enum value) { FieldInfo fi= value.GetType().GetField(value.ToString()); DescriptionAttribute[] attributes = (DescriptionAttribute[])fi.GetCustomAttributes( typeof(DescriptionAttribute), false); return (attributes.Length>0)?attributes[0].Description:value.ToString(); }

Enterprise Library 3.1

Enterprise Library 3.1 又發佈了。 改版愈來愈快。對於我來說,真是件好事。 也希望 Web Client Software Factory 也能快點改用 EL 3.1 的版本,這樣才一致。

2007年6月5日 星期二

Restore dabase 時,磁碟路徑改變

當將Production 資料庫備份後,想還原到開發的資料庫伺服器時,發現開發與正式機器的磁碟代號不同,結果無法restore

怎麼辦呢?查了一下語法,是可以解決的。
語法如下
RESTORE DATABASE [EInvoice] FROM DISK = N'E:\EInvoice.bak' WITH FILE = 1, NOUNLOAD, STATS = 10
, MOVE 'EInvoice2_Log' TO 'E:\DB\EInvoice_log.ldf'
, MOVE 'EInvoice2_Data' TO 'E:\DB\EInvoice_log.mdf'

2007年6月1日 星期五

Event "EntryDelayCreated" on interface type "TimeSheetNotification.Services.Contracts.IEntryDelayService" for instance id "8f3ff2ac-ef5a-4e0c-a6e9-7f1b6ce33df1" cannot be delivered.

在開發WF ,且使用 SqlPersistenceService 時,一直出現這個錯誤
Event "EntryDelayCreated" on interface type "TimeSheetNotification.Services.Contracts.IEntryDelayService" for instance id "8f3ff2ac-ef5a-4e0c-a6e9-7f1b6ce33df1" cannot be delivered.

而其InnerException 的 message 卻為
Workflow with id "90541a57-f759-4baa-84c5-8e613f59f46d" not found in state persistence store.

怎麼看也看不懂!

使用profiler追蹤了 sql statements 後,發現有一段如下

declare @p10 int
set @p10=0
declare @p11 uniqueidentifier
set @p11=NULL
exec InsertInstanceState @uidInstanceID='8F3FF2AC-EF5A-4E0C-A6E9-7F1B6CE33DF1',@state=0x,@status=3,@unlocked=1,@blocked=0,@info=N'Type
''TimeSheetNotification.Entities.ProjResource'' in Assembly ''TimeSheetNotification.Entities, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null'' is not marked as
serializable. Type ''TimeSheetNotification.Entities.ProjResource'' in Assembly ''TimeSheetNotification.Entities, Version=1.0.0.0, Culture=neutral,
PublicKeyToken=null'' is not marked as serializable.',@ownedUntil=''9999-12-31 23:59:59:997'',@ownerID=default,@nextTimer=''9999-12-31 23:59:59:997'',@result=@p10
output,@currentOwnerID=@p11 output
select @p10, @p11

原來,我在workflow 中,有使用了ProjResource的business entity,但卻未給定 Serializable 的屬性,以致於當workflowruntime 在序列化我的workflow 時失敗了,因此,無法再找回來。

話又說回來,為何當初序列化失敗時,不是直接出現錯誤,而是將錯誤訊息寫到資料庫呢?

務必將Windows 保持到最新狀態

        剛剛看了一篇文章,針對木馬程式做了一些剖析。http://blog.darkthread.net/blogs/darkthreadtw/archive/2007/06/01/816.aspx

 

        結論是,不要以為您沒有開過奇怪的email 附件、沒有下載過好像無害卻是木馬的程式,也沒有執行之。就以為不會中標了。

       

        事實上,只要不了心開了某個網頁,然後攻擊您的作業系統漏洞,就有可能中毒。

        也有可能是正常的網站,被植入了一小段javascript,然後您開啟該網站,就暗地裡被開啟到有問題的網頁。

 

因此,務必將Windows 保持到最新狀態。

同時,也必須更新您的防毒程式病毒特徵碼。最好自行檢查一下。

 

 

 

PS:  不要好奇地去開啟該 blog 中描述的問題網站。一旦開啟,而您的防毒程式沒有動作,您就可能中毒了。當然,沒有防毒程式就更慘了。

 

Share with Facebook