Search This Blog

June 29, 2008

VS 2008 Shell, Visual Studio Tools for Applications and SQL Native Client are Redists

I tried the simple scenario on my VM Win2k3 as follows:

1. Install SQL Server 2008 RC0 (full install)

2. Uninstall SQL Server 2008 RC0 (full uninstall)

After the full uninstall of RC0, I can still see VS 2008 Shell, Visual Studio Tools for Applications and SQL Native Client on Add/Remove Programs. Those components are Redists. Therefore, after the uninstall, other software still need them.

It is so interesting to know this scenario.

June 25, 2008

SQL Server 2005 can’t be upgraded to SQL Server 2008 RC0 at this moment

When you have SQL server 2005 Enterprise in your PC, and you want to upgrade to SQL Server 2008 RC0, you will find the upgrade fails. That’s because the current SKU of SQL Server 2008 RC0 is Enterprise Evaluation, not Enterprise.

It is impossible for you to upgrade from SQL server 2005 Enterprise to SQL Server 2008 RC0 Enterprise Evaluation. We need to wait until SQL Server 2008 RTM Enterprise is released.

The only thing you can do is install previous SQL Server 2008 CTP first and then upgrade it to SQL Server 2008 RC0. The upgrade will pass.

June 15, 2008

Need to install VSTS 2008 SP1 if your web test and proxy setting fails in VSTS 2008

I posted the issue in the following forum.
http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=3486137&SiteID=1

I try to create a web test using proxy, and the following codes are working in VSTS 2005, but it is not working in VSTS 2008. I got the following error:

Request failed: No connection could be made because the target machine actively refused it IP Address:80

During 1 day search and I find one clean machine to repro, I find the problem .

VSTS 2008 RTM has the bug related to webtest and proxy. That's why it failed in VSTS 2008 RTM , but passed in VSTS 2005.

Because VSTS 2008 SP1 Beta is still in beta version, usually people don't install it. If they don't install it, it means this web test and proxy will not work forever.

After I installed it and ran the test again, the web test passed.

using System;
using System.Collections.Generic;
using System.Text;
using System.Net;
using Microsoft.VisualStudio.TestTools.WebTesting;

public class WebTest3Coded : WebTest
{
public WebTest3Coded()
{
this.PreAuthenticate = false;
NetworkCredential credential;
credential = (NetworkCredential)CredentialCache.DefaultCredentials;
WebProxy proxy = new WebProxy("198.152.203.10", 80);
proxy.Credentials = credential;
this.WebProxy = proxy;
}
public override IEnumerator GetRequestEnumerator()
{
WebTestRequest request1 = new WebTestRequest("http://www.microsoft.com/");
yield return request1;
}
}

April 9, 2008

How to Merge Two Arrays Using C#?

Today I went to the following forum and found someone was asking the question about how to merge two arrays using C#.

http://forums.asp.net/t/1229678.aspx

This question is interesting. Therefore, I spent some time writing source codes using C# as follows. If you want to merge 2 arrays and meet your need, you may try to extend the function.

static public void MergeMultiDimensionArray()
{

int i, j,k,m,p,q;
int[,] array1 = { { 1, 2, 3 }, { 4, 5, 6 } };
int[,] array2 = { { 7, 8, 9 }, { 10, 11, 12 } };
int[,] mergeArray = new int[array1.GetLength(0) + array2.GetLength(0), array2.GetLength(1)];

for (i = 0; i < array1.GetLength(0); i++)
{
for (j = 0; j < array1.GetLength(1); j++)
{
mergeArray[i,j] = array1[i,j];
}

}

for (k = 0; k < array2.GetLength(0); k++)
{
for (m = 0;m< array2.GetLength(1); m++)
{
mergeArray[i, m] = array2[k, m];


}

i++;

}

for (p = 0; p < mergeArray.GetLength(0); p++)
{
for (q = 0; q < mergeArray.GetLength(1); q++)
{
Console.WriteLine(mergeArray[p, q]);
}

}


}

March 26, 2008

Successful upgrade from Windows Vista to Windows XP

I bought a new Gateway PC with Windows Vista Home Premium Version last September. During this period, I have installed lots of software such as Adobe products, Visual Studio .NET 2005, SQL Server 2005, Office 2007, Google and yahoo products. When I ran the program on Windows Vista, the response time was so slow and made my PC down. I needed to use task manager to end the program. If it didn’t work, I needed to reboot my PC. Finally, I made a decision to downgrade from Windows Vista to Windows XP.


Before I did the downgrade, I found that Gateway didn’t give me all drivers inside the CD. I went to http://www.gateway.com/ and found it was not helpful. I called their technical support and that woman said,” If you want to do the downgrade, you will break your warranty. We don’t do it over the phone. ” I was not satisfied with her answer.


Heaven helps those who help themselves. I wanted to give it a try. After I installed Windows XP with SP2, Office 2007 and lots of software, I found that some drivers were missing. Finally I found ccleaner.com has the small program that can check my PC. It was really helpful because it checked how many drivers I needed in my PC and made me download.


After I downloaded them and installed them, I still found l needed one more audio driver. Without it, I couldn’t play MP3. Finally I found the driver, High Definition Audio, in realtek.com. After I installed it, I could play MP3.


Now when I launch so many programs on Windows XP machine ,the speed is really faster than Vista’s. I want to say: I successfully “upgrade” from Windows Vista to Windows XP.

March 20, 2008

The error of Web Application Stress Tool : MSVCP50.dll was not found

If you install Web Application Stress Tool on Windows Vista, you might have the following error.

The application has failed to start because MSVCP50.dll was not found. Re-installing the application may fix the problem.

You need to download msvcp50.DLL and put it in c:\windows\system32 folder.

After that, just run setup.exe. It should work.

March 17, 2008

Microsoft provides an excellent website of virtual labs

We know that Microsoft has so many products. How can you get familiar with all of them very well unless you are a super man?

If your work can let you get familiar with all Microsoft products, your company must be very excellent. Per the job descriptions posted on Dice, CareerBuilder or Monster, you probably feel frustrated because some companies need more experienced candidates with different technical skills in different products. I think it is hard for them to find those people.

Everything starts from zero. If you don’t know one of Microsoft products now, you can just go to the following website.

http://msdn2.microsoft.com/en-us/virtuallabs/default.aspx

You can register online, download the individual lab manual and make some practice. You will improve your skills gradually.

March 16, 2008

I like Google Reader

Everyone knows that blogs are very popular now. If you want to see your friends’ blogs, but these are in different websites, how can you access them easily? Do you want to open your browser and go to the individual website? It is not smart to do so.

Google Reader provides a good way for bloggers to read people’s blogs easily. You just login to www.google.com/reader using your username and password. You can add subscription by typing the URL of friend’s blog individually. Next time you can read them easily. I like Google Reader.

March 13, 2008

Google provides the excellent search function of free ebooks

If I find some IT books such as Visual Studio.NET 2008, C# 3.0, WPF, WCF, or SQL Server are excellent in Barnes and Nobles, do you think I will buy them soon? The answer is no.

I will go back to my apartment, open my notebook, go to Google main page and enter the name of the book title. I will see lots of websites provide free ebooks and I can download them easily. Why should I buy these expensive books? Google really provides the excellent search function of free ebooks.

February 13, 2008

WCF Contracts

Today I was surfing Microsoft E-Learning, I learned WCF has 5 contracts as follows:

1. Service contract

A service contract defines the operations that a service supports, and maps to a portType in Web Service Description Language (WSDL). Service contracts are implemented as .NET Framework interfaces that are annotated with the ServiceContract attribute.

[ServiceContract]
public interface IMyContract { ...}

2. Operation contracts

Operation contracts define the individual operations that a service supports and map to operations in WSDL. Operations are defined by adding methods to a Service Contract interface that is annotated with the OperationContract attribute.

[OperationContract]
void SomeOperation();

3. Data contracts
Data contracts define how complex types are serialized when they are used in WCF service operations. They are defined by applying the DataContract and DataMember attributes to classes.

[DataContract]
public class SomeType{ [DataMember] public int ID;}

4. Message contracts
Message contracts describe the entire SOAP message format. They can use data contracts and serializable types to emit schema for complex types, and they also make it possible to control the SOAP message headers and body explicitly, by using a single type. Message contracts provide a simple method to add custom SOAP headers to incoming and outgoing messages.

[MessageContract]
public class MyRequest {
[MessageHeader] public string field1;
[MessageBody] public string field2;
}

5. FaultContract
WCF service reports errors by using Fault objects. Fault contracts document the errors that WCF code is likely to produce, and WCF maps Fault objects to SOAP faults. Note that the type specified in the FaultContract does not have to be an exception, although it often will be.

[OperationContract]
[FaultContract(typeof(DivideByZeroException))]
void SomeMethod();

A Fault is generated by throwing a FaultException:

throw new FaultException<DivideByZeroException>(

The Process of Implementing a Service Contract
The following code example shows how to define a WCF service contract by using a .NET Framework interface. The ServiceContract attribute is applied to the interface, and each of the methods defined in the interface has the OperationContract attribute applied to it. Note that any methods that are not marked with OperationContract are not visible to clients.

[ServiceContract]
public interface IOrderService
{
[OperationContract]
void CreateOrder(int orderNumber);

[OperationContract]
void AddItemToOrder(int orderNumber, Item itm);

[OperationContract]
Order GetOrderDetails(int orderNumber);
}

The following code example shows how to implement a WCF service contract by using a .NET Framework class that implements a service contract interface. Note that the implementing class does not require any special attributes.

public class OrderService : IOrderService
{
void CreateOrder(int orderNumber)
{
// implementation details
}

void AddItemToOrder(int orderNumber, Item itm)
{
// implementation details
}

Order GetOrderDetails(int orderNumber)
{
// implementation details
}
}

The following code example shows how to implement a WCF data contract. The DataContract attribute is used to define a data contract class and DataMember attributes define the class members that take part in the contract.

[DataContract]
public class Order
{
[DataMember]
public int OrderNumber;
[DataMember]
public String ClientName;
...
}

Do you think it is a good interview question ?