Enter your email address:


feedburner count

Theory and Thought : New iPhone Developer Agreement 4.0 beta bans many third-party compiler

Labels: ,

Apple, they've just wanted to ban flash developers from their platform, but as collateral damage, even unity, monotouch, titanium etc is banned. Why ? I search all WWW, read many comments, articles, but this is best reason, best Theory from Sean Baggaley (http://blogs.unity3d.com/2010/04/10/unity-and-the-iphone-os-4-0/#comment-12751):

Apple’s only reason for the new T’s & C’s is to ensure a consistent user experience. The user experience is ALL Apple cares about. The developer is secondary. Their design philosophy is entirely focused around the *user*, not the developer. This means controlling as much of the design and production process as possible—the App Store, iTunes, synchronisation, the APIs, the GUI, marketing, packaging design, etc. What many see as control freakery, is actually just an inherent aspect of their approach to design.

When Macs were still based around the PowerPC architecture, Apple were very badly let down by decisions by IBM and Motorola / Freescale (who made the PowerPC chips) which resulted in stagnation of these CPUs. Hence their switch to Intel processors. This experience left its mark on Apple, hence a big part of their philosophy is picking future technologies which they can exert some control over. HTML5 is an open standard which Apple can implement themselves. Flash is not, and would leave Apple dependent on a third party developer which has already proven to be a fair-weather friend at best. (Adobe’s treatment of the Mac version of Premiere is a good example.)

This has nothing to do with Flash’s notoriously poor performance on OS X (and Linux) platforms: Adobe certainly have the resources to fix that if they want to.

Remember, too, that OS X’s entire display technology is built around PDF, and has been since OS X’s first release. So this isn’t an “anti-Adobe” thing. This is a fundamental *philosophical* issue. Flash isn’t owned by Apple. Apple therefore cannot help shape its future, but Apple *do* have some say in the future of HTML5 as one of the two people in charge of its development is an Apple employee. (The other is paid by Google.)

Unlike Unity, Adobe’s pre-compiled Flash tool for producing iPhone apps does not appear to use Apple’s tools at all. This means such apps would not be able to take advantages of SDK updates—something which can easily break legacy apps if not used properly.

Unlike Microsoft, Apple aren’t all that bothered about retaining backwards compatibility over the full life-span of OS X. If a new API lets them improve the end user’s experience, Apple would rather you updated your app(s) to use it, rather than retaining their old interfaces. Apple are utterly ruthless about improving their APIs, and will cheerfully kill off older ones if their new one does things better.

Unity is not (yet) a threat to Apple’s philosophy directly, but Flash is. It’s possible Apple might not be that bothered about losing Unity support for their fully closed platforms—it’s unlikely, but a lot depends on Apple’s future plans—but I suspect they won’t go this far. Unity competes with Director, not Flash, and has uses far beyond games.

I think the key differentiator is that Unity does use Apple’s XCode toolchain as part of its build process. Adobe’s solution does not. It’s therefore much more likely that the latter will more easily fall foul of major changes to the underlying OS—for which Apple, not Adobe, would be blamed by users.

If Adobe’s solution were allowed in, developers might easily find iPhone OS 4 breaks their apps. Who would customers blame? Apple, not Adobe. This is a problem Microsoft have suffered from for years and Apple aren’t about to repeat history.





Time Of Flight and 3D camera

Labels: , ,

Gesturetek là nhà sản xuất ra thuật toán 3D sensing dựa trên nguyên lý Time Of Flight, có thể hiểu là họ có quyền sở hưu trí tuệ về mặt software. Gesturetek liên kết với Canesta (http://www.canesta.com) để sản xuất ra chip 3D sensing, chip sẽ được nhúng vào thuật tóan để tính toán việc capture và dựng lại mô hình 3D, chip này Canesta định bán đại trà cho các nhà sản xuất thiết bị OEM để tích hợp vô sản phẩm của họ. Có thể Microsoft đã mua chip này và gắn cho Camera Project Natal của họ. Hiện Canesta
cũng đã bán chip cho Hitachi để tích hợp vô Tivi của họ, người dùng có thể gesture để control TV menu http://news.cnet.com/8301-17938_105-10253925-1.html.

Về thuật toán Time Of Flight :



Hầu hết chúng ta ai cũng biết ánh sáng phải mất thời gian để đi từ điểm này đến điểm khác. Ví dụ hạt photon của ánh sáng đi từ ngôi sao này đến ngôi sao khác có thể tốn thời gian hàng trăm triệu năm , mà ta gọi là triệu năm ánh sáng. Do ánh sáng có tốc độ, nếu ta biết thời gian ta có thể tính khoảng cách. Ánh sáng trỏ tới mỗi pixel trên sensor của camera được phản chiếu từ nhiều nguồn trong cảnh quan trước ống kính. Canesta chip đo được khoảng thời gian ánh sáng trải qua đề đi từ khung cảnh đến pixel trên sensor, do đó nó 1 tính được khoảng cách của điểm sáng đó tới pixel trên sensor. Sau khi đo khoảng cách từ hàng triệu điểm trên vật thể, Canesta sẽ dụng lại mô hình 3D wireframe của vật thể đó. Các bạn có hình dung ra được chưa, ví dụ cái mũi của chúng ta, khoảng cách từ đỉnh mũi và chân lổ mũi tới camera sẽ khác nhau, Camesta sẽ thu thập được hàng triệu điểm ảnh từ cái mũi của chúng ta và do biết được khoảng cách nó biết được chiều sâu dựng lại được mô hình 3D của cái mũi.



Về cơ bản , chip của Canesta dùng nguyên lý hơi giống nguyên lý của radar. Ở Radar, sóng radio được phát ra, từ angten cho tới đối tượng , sau đó sống radio được phản ngược lại, lúc đó radar đo được khoảng cách của đối tượng. Nhưng ở Canesta , sóng radio được thanh bằng ánh sáng hồng ngoại. Vì sao dùng hồng ngoại, vì hồng ngoại mắt người không nhìn thấy được, và nó không bị phụ thuộc vào ánh sáng môi trường đang là tối (ban đêm, trong phòng tắt đèn) hay đang sáng. Trên chip sẽ có các timers , nó bắn liên tục các photon hồng ngoại tới vật thể , và no sẽ thu được một mãng khoảng cách trả về , và nó dùng mãng khoảng cách này để dụng lại mô hình 3D của vật thể. Một tính tóan này đều nào trên 1 con chip , do đó không làm ảnh hướng đến CPU của thiết bị xài tới nó.
Việc ứng dụng chip này là vô tận, có thể kể : hệ thp61ng cảnh báo an tòan cho xe ôtô có thể detect những object nguy hiểm ngoài tầm nhìn của tài xế, điện thoại 3D hologram như trong phim star war, điều khiển giao diện hương trình bằng cách Gesture như phim Minority Report, dùng hỗ trợ cho vũ khi trong chiến tranh. Ôi vô vàn không kể hết, kỹ nguyên mới sắp bắt đầu, y chang như trong cácc phim khoa học giả tưởng.



Project Natal : phân tích chi tiết về mặt công nghệ, dự đoán giá và đối thủ

Labels: , , , ,






Trước khi đi chi tiết vào kỷ thuật đằng sau Project Natal thì xin dẫn nhập một chút . Chẳng là dạo gần đây đang tham gia một dự án research Multi Touch table tương như Microsoft Surface (http://www.microsoft.com/surface/) nên mình hiểu rất rõ về cơ chế motion detect của camera và hồng ngoại. Khi xem Microsoft show hàng Project Natal thì lúc đầu mình thấy nó rất giống PlayStaion 2 eyetoy đã từng chơi rất lâu từ thời PS2 . Cũng dùng cơ thể để tương tác với các object trong game mà không cần controller .


Đây là EyeToy Play trailer :

Link : http://www.youtube.com/watch?v=6D_EniA3YZc

Đây là game EyeToy Play: Hero :

http://www.youtube.com/watch?v=7OXF_uVy6tI&feature=related


Đây là game Eyetoy Boxing :

http://www.youtube.com/watch?v=dj3UrfjbGIs&feature=related


Còn đây là game Eyetoy Virtual Fighter :

http://www.youtube.com/watch?v=w3UOufHgwh0&feature=related


Nhưng sau khi xem kỹ lại kỹ thuật capture thì 2 công nghê này khác nhau. \

Công nghệ của Sony Playstion eyetoy trên PS2 là công nghệ motion detect 2D bình thường, hầu hết các camera về an ninh đều có khả năng này và một số software cho webcam trên pc cũng có khả năng này. Eyetoy nó detect được vật thể chuyện động , sau đó extract đối tượng ra khỏi background , rồi sau đó detect va chạm giữa đội tượng thật và đồi tượng 3D, nhưng chỉ giới hạn detect ở mức độ 2D.

Công nghệ ở project Natal, ta thấy rõ là mức độ kinh hoàng hơn , mọi chuyển động của người thật đều được true mapping 1:1 chính xác gần như hòan hảo. Người thật giơ tay trái → nhân vật 3D giơ tay trái, người thật đá chân phải → nhân vật 3D đá chân phải, người thật khum người xuống , → nhân vật 3D khum người xuống. Rõ ràng là hơn Ps2 eyetoy.

Nhưng cái shock nhất ở đây là 2 công nghệ này bắt ngưồn từ 1. Có thể nói nó cùng cha đẻ, có thể coi PS2 Eyetoy là version 1 chỉ detect được 2D , còn Project Natal là version 2 detect được 3D.


Bây giờ mình sẽ đi vô chi tiết nguồn gốc bí ẩn đằng sau Project Natal.


Chuyện kể rằng ngày xửa ngày xưa xa lắm rồi ở đất nước Israel có 1 công ty nhỏ đựoc thành lập lấy tên là 3DV Systems, họ gồm những thành viên đam mê lĩnh vưc computer vision nghiên cứu vể khả năng tương tách giữa máy tính và con người. Họ đã nghiên cưu ra công nghệ gọi là Time Of Flight , tính khỏan cách từ vật thể đến camera dựa trên thời gian bay của ánh sáng hồng ngoại từ camera tới vật thể và đi ngược trở lại camera. Kỹ thuật Time Of Flight này sẽ được bàn kỹ hơn .Năm 2000 họ đã release một camera có khả năng capture 3D đặt tên nó là Zcam. Zcam có chip 3D sensor để capture được chiều sâu của đối tượng (cột tọa độ Z trong đồ họa 3D) và dựng lại đối tượng 3D dạng thô rồi chuyền tới ứng dụng để sử lý tiếp, Zcam còn có khả năng detect đựoc hand and body gesture để truyền lệch đến ứng dụng xử lý.

3DV dự định sẽ tung ra sản phẩm camera 3D Zcam vào cuối năm 2008 , dự định sẽ bán với giá 69.9$ thấp hơn Ps2 Eyetoy (lúc mới ra buulde eyetoy + game là $100). Nhưng cuối cùng sản phẩm đã không có mặt trên thị trường. Vì sao ? Tại vì Micrsoft đã mua lại quyền sử dụng công nghệ 3D capture này. Đây cũng là nguồn gốc tạo ra Project natal mà các bạn đã thấy.

Trước khi tiếp tục bài viết rất dài này , các bạn hãy xem qua một số tech show của 3DV, các bạn sẽ mườn tượng được mối liên hệ của nó tới Project Natal :


Capturing Depth - A human face : http://www.3dvsystems.com/gallery/movies/Face.mpg


Video conferencing with the background of your choice :

http://www.3dvsystems.com/gallery/movies/Background%20Replacement.mpg


Tracking full body :

http://www.3dvsystems.com/gallery/movies/Skeleton.mpg


Immersion in virtual reality :

http://www.3dvsystems.com/gallery/movies/VirtualGame.mpg


Let your fingers do the trick (gesture để điều khiển menu và chương trình):

http://www.3dvsystems.com/gallery/movies/Vista%20Flip%203D.mpg

http://www.3dvsystems.com/gallery/movies/Windows%20Media%20Center.mpg

Throw a ball at your TV :

http://www.3dvsystems.com/gallery/movies/VirtualSquash.mpg



A new gaming experience:


http://www.3dvsystems.com/gallery/movies/Flight%20Simulator.mpg


http://www.3dvsystems.com/gallery/movies/Boxing%20-%20Heavy%20Bag.mpg


http://www.3dvsystems.com/gallery/movies/Boxing%20-%20The%20ring.mpg


http://www.3dvsystems.com/gallery/movies/Boxing%20Mix%20No%20MX.mov



Mình tiếp tục bài viết, bên cạnh 3DV system , còn có một công ty khác cũng sở hữu công nghệ Time of Flight này là Gesturetek. Công ty này sở hữa thương hiệu 3D Depth Sensing ứng dụng kỹ thuật Time of Flight and và Gesture series, hiện cả 2 đại gia Sony và Microsoft đều mua công ngjệ của Gesturetek cho Ps2 Eyetoy và Xbox 360 Camera Vision. Trong trang web này , các bạn có thể thấy demo (flash) y chang như những gì Microsoft Project Natal đã trình diễn http://www.gesturetek.com/3ddepth/introduction.php


Scroll chuột xuống cuối trang web bạn sẽ thấy logo Eyetoy và Xbox360 http://www.gesturetek.com/3ddepth/introduction.php



Vấn để chúng ta cần phân tích thêm là ở chỗ , Sony đã mua bản quyền hồi năm 2005 http://www.gesturetek.com/press/press_feb17_05.php , và sau đó 1 năm sau năm 2006 Microsoft mới mua bản quyền http://www.gesturetek.com/press/press_may10_06.php


Và theo mình biết thì chưa thấy sản phẩm game motion gesture nào trên xbox360 ra đời (ai biết thì bổ sung dùm mình). Và cho mãi tới hôm nay , năm 2009 , Microsoft mới sghow hàng, và quay lại trang này http://www.gesturetek.com/3ddepth/introduction.php ta lại thấy công nghệ của Gesturetek đã tiến bộ hơn xưa, đã đạt đến khả năng capture 3D motion. Vậy câu hỏi đặt ra là tại sao Sony lại không show hàng tương tự như Microsoft , vì cả 2 đều cùng một nguồn như nhau mà. Có 3 giả thuyết :

  • Giả thuyết 1 : Microsoft lại chơi trò độc quyền, tung tiền mua đứt công nghệ 3D Sensing này cho tới năm 2015, và Gesturetek không được bán 3D sensing tới cty khác, chỉ được bán kỹ thuật Gesture Recognite .

  • Giả thuyết 2 : Sony muốn làm tiền, chế thêm cái sensor cầm trên tay để bán kiếm thêm tiền, vì Eyetoy mà ap dụng 3D sensing vô thì y chang Project Natal.

  • Giả thuyết 3 : 3D sensing của Gesturetek ra sau khi có PS3 Eye trên thị trường, do Sony đã lỡ sản xuất ra PS3 Eye tràn lan trên thị trường rồi , bây giờ để gắn chip 3D sensing vô thì phải ra model PS3 Eye version 2 , gamer người đã mua Ps3 Eye version đầu sẽ phản đối, buộc sony phải tao thêm phụ kiện đi kèm với Ps3 Eye cũ mà ta đã thấy ở E3 2009.


Một điều thú vị nũa là Jonny Lee, anh chàng nổi tiếng trên youtube hacking wiimote để biến bàn tay của mình thành điều khiển gesture ứng dụng từ xa như Minority Report movies cũng được mời về tham gia dự án này Project natal của Microsoft.


Sự việc càng ngày càn hấp d7ã, nên mình mở topic này ra để mọi người đưa ra cácc giả thuyết .


Về phần mình thì mình đưa ra giả thuyết thế này :

  • Microsoft muống độc quyền cong nghệ Time Of Flight nên đã mua cả 3DV và Gestureek.

  • Giá của Natal 3D camera sẽ khoản 69.99$ bằng với giá Zcam mà 3DV định reselase cuối năm 2008 .







XNA Game Studio Express 1.0 released

Labels: ,

This is so cool ! In the past, I used PlayStation 2 Linux Development Kit to write applications / demo for my PS2. But this ps2 kit is very hard to learn, very small library was supplied, and I must use C++ to code, this is a nightmare. And now, Microsoft has released XDA Game Studio, I'm so excited. I can use C# to develop game now, not only for PC but also next-gen console XBox 360 . Oh, hoo hoo \^_^/ .

Some link:





C# 2.0 : Nullable Types

Labels:

Problem

// User Class
public class User
{
private int userID;
private DateTime registeredDate;


public User() {}

public int UserID
{
get { return userID; }
set { userID = value; }
}

public DateTime RegisteredDate
{
get { return registeredDate; }
set { registeredDate = value; }
}
}


// Create User from a DataReader
public virtual User CreateUserFromReader(IDataReader reader)
{
User item
= new User();

item.UserID
= (int)reader["UserID"];
// throw exception if reader["RegisteredDate"] equals null
item.RegisteredDate = (DateTime)reader["RegisteredDate"];

return item;
}
Because C# 1.1 does not support null value for DateTime so the example above will throw exception if reader["RegisteredDate"] equals null.
Solution
Old schoold soltution :
// Create User from a DataReader
public virtual User CreateUserFromReader(IDataReader reader)
{
User item
= new User();

item.UserID
= (int)reader["UserID"];
if (!reader.IsDBNull(reader.GetOrdinal("RegisteredDate")))
{
item.RegisteredDate
= (DateTime)reader["RegisteredDate"];
}
else
{
item.RegisteredDate
= new DateTime(1900,1,1,0,0,0,0);
}

return item;
}
Now in C#2.0 we can resolve null problem by declaration RegisteredDate as nullable DateTime with ? symbol :

// User Class
public class User
{
private int userID;
private DateTime? registeredDate;


public User() {}

public int UserID
{
get { return userID; }
set { userID = value; }
}

public DateTime? RegisteredDate
{
get { return registeredDate; }
set { registeredDate = value; }
}
}


// Create User from a DataReader
public virtual User CreateUserFromReader(IDataReader reader)
{
User item
= new User();

item.UserID
= (int)reader["UserID"];
item.RegisteredDate
=
(reader.IsDBNull(reader.GetOrdinal(
"RegisteredDate"))) ?
null : (DateTime)reader["RegisteredDate"];
return item;
}
Nullable type
Nullable types are constructed using ? type modifier.
Example :
int? age;
string? name;
DateTime? birthday;

A nullable type has two public read-only properties: HasValue and Value. When HasValue is true, the Value property returns the contained value. When HasValue is false, an attempt to access the Value property throws an exception.
DateTime? registeredDay;

// throw exception if RegisteredDate is null
registeredDay = user.RegisteredDate;
if (user.HasValue)
{
registeredDay
= user.RegisteredDate
}
else
{
registeredDay
= null;
}
Null colalescence
C# 2.0 introduces a new operator called the null coalescing operator denoted by
double question marks ?? . If the instance is null, the value on the right is returned
otherwise the nullable instance value is returned.

int x = 10;
int? y = null;
int z = y ?? x;

response.write(z);
// z = 10

y
= 99;
int k = y ?? x;
response.write(k);
// k = 99




C# 2.0 : Partial types

Labels:

What is Partial types ?
Partial types is types that allow classes, structs, and interfaces to be broken into multiple pieces stored in different source files for easier development and maintenance. Additionally, partial types allow separation of machine-generated and user-written parts of types so that it is easier to augment code generated by a tool.

Problems
While it is good programming practice to maintain all source code for a type in a single file, sometimes a type becomes large enough that this is an impractical constraint. Furthermore, programmers often use source code generators (such as CodeSmith) to produce the initial structure of an application, and then modify the resulting code. Unfortunately, when source code is emitted again sometime in the future, existing modifications are overwritten.

Solution
A new type modifier, partial, is used when defining a type in multiple parts. The following is an example of a partial class that is implemented in two parts.

Part one :
public partial class Customer
{
private int id;
private string name;
private string address;
private List<Order> orders;

public Customer()
{
}
}

Part two :
public partial class Customer
{
public void SubmitOrder(Order order)
{
orders.Add(order);
}
public bool HasOutstandingOrders()
{
return orders.Count > 0;
}
}
When the two parts above are compiled together, the resulting code is the same as if the class had been written as a single unit:
public class Customer
{
private int id;
private string name;
private string address;
private List<Order> orders;

public Customer()
{
}

public void SubmitOrder(Order order)
{
orders.Add(order);
}

public bool HasOutstandingOrders()
{
return orders.Count > 0;
}
}




C# 2.0 : Anonymous Methods

Labels:

What is Anonymous Method ?
C# 2.0 introduce new method named Anonymous Methods. Anonymous Methods are Inline Delegate.

Old school Delegate :

this.btnLogin.Click += new System.EventHandler(this.btnLogin_Click);
void btnLogin_Click(object sender, System.EventArgs e)
{
Response.Write(
"tui ne");
}


Anonymous Method :

this.btnLogin.Click += delegate { Response.Write("tui ne"); }




C# 2.0 : Generic methods

Labels:

This is a typical non-generic method :

void AddMultiple(List<Customer> customers, params Customer[] values)
{
foreach (Customer value in values)
{
customers.Add(value);
}
}

In order to add mutiple customer into List :

List<Customer> customers = new List<Customer>();
AddMultiple(customers,
new Customer(),
new
Customer(), new Customer());

However, the method above only works with type . To have it work
with any List , the method must be written as a generic method.
A generic method has one or more type parameters specified in <
and > delimiters after the method name :

void AddMultiple<T>(List<T> customList, params T[] values)
{
foreach (T value in values)
{
customList.Add(value);
}
}

Finally, we can add any type to generic List :

List<int> listInteger = new List<int>();
AddMultiple
<int>(listInteger, 1, 2, 3, 4);

List
<Customer> customers = new List<Customer>;
AddMultiple
<Customer>(customers,
new
Customer(),
new Customer(),
new Customer(),
new Customer());

In the example above, since the first regular argument is type List
listInteger, and the subsequent arguments are of type int 1, 2, 3 ,
4
the compiler can reason that the type parameter must be int. Thus,
we can use shorter syntax without specifying the type parameter
(<int>) :
List<int> listInteger = new List<int>();
AddMultiple(listInteger,
1, 2, 3, 4);

The same for the second scenario :

List<Customer> customers = new List<Customer>();
AddMultiple(customers,
new Customer(),
new Customer(),
new Customer(),
new
Customer());




C# 2.0 : Constraints in Generics

Labels:

Problem

public class Dictionary<K, V>
{
public void Add(K key, V value)
{
...
if (key.CompareTo(x) < 0) {...} // Error, no CompareTo method
...
}
}

Since the type argument specified for K could be any type, the
only members that support CompareTo are memberss that implement
IComparable Interface such as Equals, GetHashCode, ToString...
A Compile-time error occurs in the example above.

Solution

public class Dictionary<K, V> where K: ICompareable
{
public void Add(K key, V value)
{
...
if (key.CompareTo(x) < 0) {...}
...
}
}

The Declaration above ensure that any type argument supplied for K
is a type that implements IComparable. It is possible to specify
any number of interface and type parameters as constraints :

public class Dictionary<K, V>
where K: ICompareable
<K>, IPersistable
where V: Entity
{
public void Add(K key, V value)
{
...
if (key.CompareTo(x) < 0) {...}
...
}
}





C# 2.0 : How to create Generics

Labels:

Generic Class with one parameter

This is a typical Non-generic Class :
public class List
{
object[] items;

public void Add(object item) {....}
public object this[int index] {...}
}
Generic Class : in order to create generics class we use the type argument T in < and > after class name.
public class List<T>
{
[T] items;

public void Add(T item) {....}
public T this[int index] {...}
}
Using Generic class :
List<int> listInteger = new List<int>;
listInteger.Add(
1);
listInteger.Add(
2);
listInteger.Add(
3);
listInteger.Add(
new Customer()); // Compile-time error

Note:
T : type argument.
List : is List of Integer type. The List type is called a constructed type. Every occurrence of T is replaced with the type argument int. When an instance of List is created, the native storage of the items array is an int[] rather than object[]. If we add a Customer into List , then compiler will report error.

Generic Class with more than one parameters

Generic type declarations may have any number of type parameters. The List example above has only one type parameter, but a generic Dictionary class might have two type parameters, one for the type of keys and one for the type of values.

public class Dictionary<K,V>
{
public void Add(K key, V value) {...}
public V this[K key] {...}
}
When Dictionary is used, two type arguments would have to be supplied :

Dictionary<string, Customer> dict = 
new
Dictionary<string, Customer>();
dict.Add(
"Hung", new Customer());
Customer customer
= dict["Hung"];




C# 2.0 Generics

Labels:

Generics Overview

  • Use generic types to maximize code reuse, type safety, and performance.

  • The most common use of generics is to create collection classes.

  • The .NET Framework class library contains several new generic collection classes in the System.Collections.Generic namespace. These should be used whenever possible in place of classes such as ArrayList in the System.Collections namespace.

  • You can create your own generic interfaces, classes, methods, events and delegates.

  • Generic classes may be constrained to enable access to methods on particular data types.

Why Generics ?

Type safety casting & performance:

Using generics is not only safer than general old collection class (such as ArrayList, Collections...) but also significantly faster.

C# 1.1 :
ArrayList customers = new ArrayList();
Customer customer
= new Customer();

// Boxing --> descrease performance. No type-checking
customers.Add(customer);
// Boxing --> descrease performance. No type-checking
customers.Add("Some string");

// throw exception
// Customer customer = customers[0];

C# 2.0 :

List<Customer> customers = new List<Customers>();
Customer customer
= new Customer();

// No Boxing, no casting --> increase performance.
customers.Add(customer);

// Type-Checking : Compile-time error
customers.Add("Some string");

// No UnBoxing, no casting --> increase performance .
// Not throw exception

Customer customer2 = customers[0];

// UnBoxing --> decrease performance
Customer customer2 = (customer)customers[0];




Asp.net 2.0 Profile problem in new Web Application Project model : ProfileCommon not found

Labels:

I spent a lot of time to find out root of problem when using asp.net 2.0 Profile feature in new Web Application Project model. With VS 2005 Website model, when we edit Profile section
in web.config, Vs 2005 will automatic generate strong-typed class ProfileCommon. Developers
can use this generation class/ object by using intellisense feature of vs 2005.

Web.config :



Code-behind :



Unfortunately, Web Application Project model does not automatic generate strong-typed
ProfileCommon to mapping profile section in web.config. In order to use this Profile, we must hand coding mapping class :



Using ProfileCommon :

Hope next release of Web Application Project (SP1) will support automatic generate strong-typed Profile Mapping. Currently, we can do hand-coding or using WebProfile generator from Tim McBride



T-SQL : How get only Time Part in DateTime value

Labels:

DECLARE @CurrentDate datetime
SET @CurrentDate = '8/3/2006 4:09:00 PM'
SET @CompareDate = '8/3/2006 4:09:00 PM'

Get Time part as nvarchar or char :
Using :
select right(convert(nvarchar,@CurrentDate,120),9)
Or :
SELECT Convert(CHAR(24), @CurrentDate,108)

How to compare only time part in DateTime value , we use DatePart function :


DatePart(hour, @CurrentDate) >= DatePart(hour, @CompareDate) AND
DatePart(minute, @CurrentDate) >= DatePart(minute, @CompareDate) AND
DatePart(second, @CurrentDate) >= DatePart(second, @CompareDate) AND



Recently Released Exams !

The following exams went live between April 14 and June 2, 2006 and are now available for registration at both Pearson VUE and Prometric sites around the world.

70-235

English

TS: Developing Business Process and Integration Solutions by Using Microsoft BizTalk Server 2006

70-282

English

Designing, Deploying, and Managing a Network Solution for a Small- and Medium-Sized Business

70-442

English

PRO: Designing and Optimizing Data Access by Using Microsoft SQL Server 2005

70-526

English

TS: Microsoft.NET Framework 2.0 - Windows-Based Client Development

70-547

English

PRO: Designing and Developing Web-Based Applications by Using the Microsoft.NET Framework

70-548

English

PRO: Designing and Developing Microsoft Windows-Based Applications by Using the Microsoft .NET Framework

70-549

English

PRO: Designing and Developing Enterprise Applications by Using the Microsoft.NET Framework

70-551

English

UPGRADE: MCAD Skills to MCPD Web Developer by Using the Microsoft.NET Framework

70-552

English

UPGRADE: MCAD Skills to MCPD Windows Developer by Using the Microsoft.NET Framework

70-553

English

UPGRADE: MCSD Microsoft.NET Skills to MCPD Enterprise Application Developer by Using the Microsoft .NET Framework: Part 1

70-554

English

UPGRADE: MCSD Microsoft.NET Skills to MCPD Enterprise Application Developer by Using the Microsoft .NET Framework: Part 2

71-262

English

TS: Microsoft Office Live Communications Server 2005 - Implementing, Managing, and Troubleshooting






Microsoft Asia Security RoadShow 2006

I've just received "Microsoft Security RoadShow 2006" Invitation from Microsoft, but the show will be taken in my working day , I'm wondering should I go to this event





SQL 2000 - SQL 2005 Database Upgrade : Database Diagrams problem

Labels:

I restored Sql Server database 2005 from Sql Server 2000, then I want to add a new diagram, but when I click "Database Diagrams" there an error message "Database diagram support objects cannot be installed because this database does not have a valid owner. To continue, first use the Files page of the Database Properties dialog box or the ALTER AUTHORIZATION statement to set the database owner to a valid login, then add the database diagram support objects. ". Follow these steps to resolve this problem:
1. Right Click on your database, choose properties
2. Goto the Options Page
3. In the Dropdown at right labeled "Compatibility Level" choose "SQL
Server 2005(90)"
4. Press OK.

The alternating method, you can run sthis store procedure:

EXEC sp_dbcmptlevel 'yourDB', '90';
GO
ALTER AUTHORIZATION ON DATABASE::yourDB TO "yourLogin"
GO
USE [yourDB]
GO
EXECUTE AS USER = N'dbo' REVERT
GO





Team System Brings Project Management to Visual Studio

New features of Visual Studio 2005 Team System (VSTS) will help project managers in two ways: a set of built-in reports will allow project managers to quickly see project status and a set of extensible methodologies will provide specific guidance on how to organize and track a software development project. The reporting tools are useful for any development project that uses VSTS’s source-code control and work-item tracking systems. The methodologies, however, will require organizations to either adopt a specific way of managing their projects or modify the provided methodologies to suit their specific needs.

For background information on VSTS, including its architecture, see "Visual Studio Team System Targets Multiple Roles" on page 20 of the Feb. 2005 Update.

Tools for Project Managers

Many software project managers spend a great deal of time collecting status information from individual developers and testers and trying to collate that information into a useful report. Development teams using the VSTS source-code control system and work-item tracking databases will find that much of that data collection is performed automatically, allowing project managers to perform higher-level tasks such as analyzing trends or transferring work from one developer to another to equalize work loads.

VSTS can create reports from multiple data sources, including its automated code testing, source-code control, and work-item tracking systems, giving project managers a more complete view of their project. Some of the statistics that VSTS can generate include the following:

Bug find and fix rates show the number of bugs found each day compared with the number fixed. The net number of bugs fixed each day is an important tool in helping project managers estimate when a project will reach its quality goals.

Code churn measures the number of lines of code in the project that are being added, deleted, or changed. Since any change to the source code of a project introduces the possibility of a bug, reducing code churn is important to stabilizing a project in preparation for release.

Bugs per developer allows project managers to see which developers are overloaded with bugs to fix and which have time available, helping managers balance the work load.

Number of test cases passing and failing is an important measure of the overall health of a project.

Code coverage shows what percentage of the application’s source code is being exercised by automated test suites and helps managers analyze the effectiveness of their tests. If large portions of the source code are not covered by any automated test, then a manager knows that the number of test cases passing will not provide a complete view of the quality of the application.

Reports Available in Many Formats

Project managers can view and update project information in several ways.

Excel. Excel provides few project management features, but many software project managers rely on it, including those on Microsoft’s own product teams. What Excel excels at is creating, maintaining, and sorting lists of information and generating charts. VSTS allows project managers to view lists of work items within Excel spreadsheets. An Excel add-in can automatically update spreadsheets with the latest data and can update VSTS with any changes made to the spreadsheet.

Project. Although Project is Microsoft’s product for general-purpose project management, it is rarely used for software project management. Nonetheless, Project has some capabilities that make it useful—most notably its support for visually displaying a project’s timeline as either a Gantt or a Pert chart. VSTS can automatically generate a Project file for a project schedule and includes a plug-in so that any schedule changes made within Project are reflected in VSTS.

Web site. Because the middle tier of VSTS is built on top of Windows SharePoint Services (WSS), every software project automatically has an associated SharePoint site that allows developers, testers, and project managers to view and update project data.

SQL Reporting. The data tier of VSTS uses SQL Server, so project managers will be able to use SQL Reporting Services to automatically generate and distribute reports, such as daily or weekly bug status.

Methodologies Provide Process Guidance

In addition to providing reporting tools that are broadly useful to teams, VSTS provides mechanisms for enforcing specific development methodologies. Webster defines methodology as "a body of methods, rules, and postulates employed by a discipline." A software development methodology, such as Extreme Programming, is a set of methods and rules that define how a software project is designed and created. Extreme Programming, for example, stresses the need for frequent, small releases of the project and the creation of software tests before the writing of code.

The final version of VSTS will support two Microsoft-developed methodologies—one for a highly formalized software development process, and one for a less formalized, more iterative, process. Organizations can use or customize one of the methodologies supported by VSTS, use a methodology developed by themselves or by third parties, or use no methodology at all.

In addition, Microsoft hopes to create a market for third parties to sell other popular methodologies, such as Extreme Programming.

Agile Framework Defines Roles, Workstreams

Beta 2 of Visual Studio 2005 (which will be the first beta of VSTS) will include one Microsoft methodology, Microsoft Solutions Framework (MSF) for Agile Software Development (previously known as MSF Agile). The Agile methodology defines a software development process that incorporates several rounds, or iterations, of product planning, coding, testing, and feedback. Although Agile can be used by any development team, it was designed with a typical IT enterprise development team in mind.

The Agile methodology defines several roles, with each member of the team taking on one or more roles:

Architect—responsible for designing the technical foundations of the application, including its usability, reliability, maintainability, performance, and security.

Business analyst—responsible for defining the business needs the application fulfills and working with customers to understand the scenarios and quality of service requirements.

Project manager—responsible for delivering the application on time and within budget.

Developer—responsible for implementing the application within the agreed schedule.

Tester—responsible for assessing and communicating the state of the application, including any problems.

Release manager—responsible for the rollout of the application, coordinating the project with other operations, and certifying any releases for shipment or deployment.

In addition to defining roles, the Agile methodology defines a set of activities performed by each role. For example, the "Fix a Bug" activity is associated with the developer role. These activities are then grouped into workstreams that span roles. The "Fix a Bug" activity, for example, is part of a larger workstream that includes the following steps:

  • Open a bug (tester)
  • Triage bugs (project manager)
  • Fix a bug (developer)
  • Verify a fix (tester)
  • Close a bug (tester)

VSTS supports this methodology by automatically updating a work item, assigning it from one person to the next as it moves through a workstream. In the case of a bug, once a bug is entered by a tester, a work item is automatically created for the project manager to triage the bug. Similarly, once a bug is fixed, the work item is assigned to the tester for verification.

CMMI Coming Later

In addition to the Agile framework, future versions of VSTS will also provide the Microsoft Solutions Framework for CMMI Process Improvement—a more formal methodology that is compliant with the Capability Maturity Model Integration (CMMI), a set of process management guidelines developed by Carnegie Mellon University’s Software Engineering Institute. Although seldom used by corporate IT departments and broad-market commercial software developers, some government organizations require that their vendors adhere to CMMI guidelines.

CMMI defines five maturity levels, ranging from Level 1 (ad hoc) to Level 5 (optimizing). Microsoft hopes to have a methodology for Visual Studio (VS) 2005 that meets the requirement for CMMI Level 3, which requires that "the standard process for developing and maintaining software across the organization is documented, including both software engineering and management processes, and these processes are integrated into a coherent whole."

Microsoft has yet to provide details on the CMMI framework, but has said that support will not be included in Beta 2 of VS 2005, expected in Apr. 2005.

You Can Go Your Own Way

Adopting a methodology, whether defined by Microsoft or by a third party, is a significant undertaking. Every development team has some "rules of the road"—they may not be formalized or even written down, but they exist nonetheless, and managers will need to understand their team’s current processes before adopting new, more complex, ones.

In addition, the methodologies used by VSTS are defined by a complex XML schema and modifying them (or creating new methodologies) not only requires specific knowledge of VSTS but of XML as well. Most organizations will want to rely on outside consultants or trainers to do this work.

Resources

The VSTS source-code control system is outlined in "VS 2005 Checks in New Source Control" on page 24 of the Feb. 2005 Update.

VS 2005 features for individual developers are described in "Visual Studio Renews Pitch for Developers" on page 21 of the Dec. 2004 Update.

The Visual Studio Team System home page is lab.msdn.microsoft.com/teamsystem/default.aspx.

For more information on CMMI, see www.sei.cmu.edu/cmmi.