2007年11月24日星期六

What are Lambda Expressions?

English:
Lambda expressions, new in Visual Basic 2008, are a handy addition to any programmer's toolbox. They are callable entities that are defined within a function, and they're first-class citizens; you can return a lambda expression from a function and you can pass lambda expressions to other functions. Lambda expressions were added to Visual Basic 2008, formerly code-named "Orcas," in order to support Language Integrated Queries (LINQ), which adds data programmability to Visual Basic (more on that later). As you use lambda expressions, you will begin to see the power and flexibility they promote. I invite you to sample the basic concepts of lambda expressions, explore their benefits, and witness how to use them to write more expressive programs.

http://msdn.microsoft.com/msdnmag/issues/07/09/BasicInstincts/default.aspx?loc=en

繁體中文:
Lambda 運算式是 Visual Basic 2008 的新增功能,也是所有程式設計師的工具箱不可或缺的利器。它們是定義在函式內的可呼叫實體,且是第一等公民;您可以從函式傳回 Lambda 運算式,也可以將 Lambda 運算式傳遞給其他的函式。Lambda 運算式是 Visual Basic 2008 (原來的名稱代碼為 "Orcas") 新增的部分,為的是要支援 Language Integrated Queries (LINQ),這可以提升 Visual Basic 的資料可程式性 (將於稍後詳述)。隨著您使用 Lambda 運算式,您將會了解到它們的威力與彈性。我竭誠邀請您來體驗 Lambda 運算式的基本概念、探索其優勢,以及目睹如何運用它們來撰寫更具表達力的程式。

http://msdn.microsoft.com/msdnmag/issues/07/09/BasicInstincts/default.aspx?loc=zx

What's New in .NET Framework 3.5 - Extension Methods 延伸方法

English:
With traditional object-oriented development, extending classes is typically achieved by deriving from a base class and enhancing the functionality in the derived class. Visual BasicR still supports these object-oriented concepts, but classes are sometimes marked NotInheritable to prevent modification of their behavior through inheritance. As a result, there is no way to customize these classes. An example of this is the System.String class.

A new feature made available in Visual Basic 2008, however, lets you extend any existing type's functionality, even when a type is not inheritable. And these extension methods play a crucial role in the implementation of LINQ.

http://msdn.microsoft.com/msdnmag/issues/07/11/BasicInstincts/default.aspx?loc=en

繁體中文:
在傳統的物件導向開發架構中,類別的延伸通常涉及以基底類別進行衍生,然後在衍生類別中增強功能。Visual Basic 依然支援這些物件導向的概念,但是類別有時候會標示為 NotInheritable,以防止其行為透過繼承而被修改。於是便沒有自訂類別的方法。如此的範例包括 System.String 類別。

但是,在 Visual Basic 2008 中的新功能,可以讓您延伸任何現有型別的功能,即使該型別為不可繼承的型別。而且這些延伸方法在 LINQ 的實作過程中擔任著關鍵的角色。

許多現有的型別都無法在不中斷現有程式碼的情況下輕易更新。如此的範例包括 IEnumerable(Of T) 介面。為了要支援 LINQ,介面中必須加入新的方法,但是加入新的方法對於介面的改變卻會中斷現有消費者的相容性。加入新的介面也是一個可能性,但是建立新的介面來補充現有的 IEnumerable(Of T) 介面,在設計上會變得奇怪。

此情況所需的是延伸現有型別的方法,讓型別可以在不變更現有合約的前提下新增功能。
http://msdn.microsoft.com/msdnmag/issues/07/11/BasicInstincts/default.aspx?loc=zx

C# Version 3.0 Specification

http://msdn2.microsoft.com/en-us/library/ms364047(VS.80).aspx

Overview of Visual Basic 9.0

http://msdn2.microsoft.com/en-us/library/ms364068(VS.80).aspx

Visual Studio 2008 and .NET Framework 3.5 released!!!


就如原定日期,VS2008終於推出~官方網頁亦更新了,Express版官網使用黑色設計,很神秘的感覺^^
同樣有三大版本 : Professional / Standard / Express
最關心的肯定就是免費且可商業用的Express版本,除了基本VisualBasic / C# / C++ / Visual Web Developer 外,VS2008還多了一個叫Popfly的東西.
對我來說,除了WPF,LinQ外,最想試試VWD整合Expression Web後是如何~Microsoft亦很好地整了一個All-in-One DVD ISO,不用分開下載和安裝了~

Visual Studio Home
http://msdn2.microsoft.com/en-us/vstudio/products/default.aspx
Visual Studio 2008 Express Home
http://www.microsoft.com/express/default.aspx
Download the Visual Studio 2008 Express Edition All-in-One DVD
http://www.microsoft.com/express/download/offline.aspx

Resource:
An Overview of Microsoft Visual Studio 2008 White Paper
Visual Studio 2008 and .NET Framework 3.5 Training Kit
Get up to speed on Visual Studio 2008
Visual C# 2008 Keybinding Reference Poster
.NET Framework 3.5 Common Namespaces and Types Poster

2007年11月22日星期四

Ulead PhotoImpact X3


PhotoImpact一向是我愛用的軟件,Corel收購了Ulead後,推出Corel Paint Shop Pro Photo X2,其實功能上和PhotoImpact重疊,還以為會放棄PhotoImpact,但今日上Corel台灣網見到新一代,叫Photo Impact X3 (對著CS3而命名?不是的話,為什麼不直接叫第13代) ,從一般公司命名規則看,Paint Shop Pro只是X2,那是否PhotoImpact比PSP還高級?而新一代X3不知是否可以保留一貫"手到拿來"的UI設計,但新功能如下...

2007年11月13日星期二

Visual Studio 2008 11月底推出



上星期Microsoft公告了VS2008會起11月底推出。

換句話說又是各大.NET Programmer既喜又怕的時候,似乎Visual Studio的週期是兩至三年,VS 2003 (.NET 1.1)=>VS 2005 (.NET2.0)=>VS 2008(.NET3.5)相差時間相若,短短幾年時間是否足夠讓程式員去吸引都成問題~

VS 2008包括Visual Basic 9.0,Visual C# 3.0ASP.NET 3.5.而.NET Framework 3.5下包含Windows Presentation Foundation (WPF),Windows Communication Foundation (WCF),Windows Workflow Foundation (WF)等等,另外除了比較出名的LINQ,ADO.NET Entity Framework之外,還有很多新特性,例如Microsoft Popfly Explorer去管理Web Project,亦會整合Expression Web去做Layout Design,至於Silverlight 1.1 Project就不會包括在內。

而免費的Free Version Visual Studio Express版本同樣會有,更詳細可以去MSDN睇睇.


Link:
November Release for Visual Studio 2008 and the .NET Framework 3.5
Learn more about Visual Studio 2008
How to use solutions and projects between Visual Studio 2005 and 2008
Overview of Visual Basic 9.0
Overview of C# 3.0

由VB.NET轉寫C#的後遺症

為未來著想,現在我新Project都盡量用C#寫,除左想識多一種語言之外,日後轉往其他語言都會易一些。

其實由VB.NET轉寫C#真的沒有難度可言,只是事乎肯不肯去習慣新Syntax,能不能排除起步時比正常慢的Coding速度,

當然先決條件就是你對VB.NET已經熟悉,和不是死記Syntax去操作.NET Framework。

就像我自己,這個星期把部份Project轉成C# Port,短短的時間我現在都可以寫C#了~(自信-_-")
不過就令我想起早6,7年我還是寫VB6的時候,經常網上見到有人說寫VB會壞手勢,到現在我主力寫C#時,就覺得所言甚是。

或者未接觸過的人不知道,在C#中,是case-sensitive,如果你寫"If..."是不接受的,
Visual Studio亦不會幫你轉換,要寫做小寫"if",當然Class,Member,Method等等都是,

其次是C#是Strong Type語言,以往在VB中,interger,object,string如果是數字的話,都可以相加,或者用"&"做String,
但在C#中,一定要指名Type才可以。

很多情況下都要轉Type,始終C#是一種很嚴謹的語言。
還有很多很多的不同,在此不能盡錄。不過的確經常VB.NET <> C#交替使用會令syntax在腦中打結,有時寫C#會打Dim;寫VB.NET打"//"就Comment....

但我轉移C#的參考材料就可以睇返我之前寫的Blog文 : 開始學習C#

2007年11月3日星期六

ASP.NET NNTP Newsgroup Reader - SharpNext

這個程式其實已經寫了很久,差不多都有一年多。
除了沒有時間外,技術問題都有不少,但現在都算是有點成果...

基本功能完成後,會把它由現在的Visual Basic轉成C#。
其實現在還有的主要問題就是解碼問題,由文字上的Base64,QP Code解碼,至附件的UUEncode,Multi Part Message都還未完美。

假如問我寫NNTP類的軟件最需要什麼,我想我會答:(就是應付字串String的功夫。準確地在不同情況下取得String的Index,由Bytes和String之間轉換等等,都是考功夫的。)

名字都取好了~叫SharpNext,意思就是C# NNTP Extent,因為基本功能完成後,除了轉成C#外,還有很多Customize的元素想加入。
Domain也Reg好了SharpNext.com,希望這次不會再半途而廢吧。

Demo Link: http://www.miawork.com/nntp
sharpnext01.png