Microsoft Windows 7 and Windows Server 2008 R2 Service Pack 1 Beta Has Released

by Mark Zhou 13. July 2010 17:37

GMT+08:00 Yesterday, Microsoft has released a link in its download center that contains documentation for Windows 7 and Windows Server 2008 R2 Service Pack 1; today, Microsoft TechNet announced the Service Pack 1 Beta  evaluation center, This link contains guides for deploying Windows 7 and Windows Server 2008 R2 SP1 Beta, as well as release notes, break changes and evaluation download registration links.

Currently I am installing the Service Pack 1 for Windows 7 x64, Service Pack 1 brings two important new features that are known as RemoteFX and Dynamic Memory. RemoteFX enhances virtualized desktop environment user experience, which enables hardware graphics acceleration to the Remote Desktop Services (RDS), it is therefore possible to run an Aero-based user interface under a remote desktop connection window; Dynamic Memory is a memory allocation mechanism that applied to the Hyper-V, it allocates host operating system’s memory on-demand. Differed from previous fixed memory size allocation, it makes the usage of memory more efficiently.

Here is a screenshot of the installation process (Restart Required) via Windows Update.

image

I will blog more about RemoteFX once I complete installation and virtual desktops set up.

Tags:

Windows

Windows Live Essentials 14 Beta Released

by Mark Zhou 26. June 2010 03:59

Microsoft has recently released and updated some part of the Windows Live service to the latest version codenamed “Wave 14”, including Windows Live Home, Profile, Photo, Office and Account. unfortunately, Hotmail is not on the first list. The most focused part of this new update, Windows Live Essentials software, was released yesterday.

The new Wave 14 contains updates to Mail, Messenger, Writer, Movie Maker, Photo Gallery, Family Safe and a new member, Windows Live Sync; it also contains a Windows Live social connector for Microsoft Outlook 2010, which can bring social networking connectivity to the Outlook senders and recipients.

Any one interested in this update can download the latest software from http://explore.live.com/windows-live-essentials-beta.

image

Tags:

Microsoft

Live Event: The C# Programming Language (2): Variance

by Mark Zhou 19. May 2010 14:39

This Friday noon I am going to perform a presentation on the Live Meeting. The topic is the variance in C#. Variance (including covariance and contravariance) is a break change to the CLR version 4.0 as well as the C# 4.0. The topic will cover:

  • Generics
  • Closed and Open types
  • Covariance
  • Contravariance
  • Variance in reference types
    • Array covariance and contravariance
    • Interface covariance and contravariance
    • Delegate covariance and contravariance
  • CLR 4.0 built-in co- and contravariance enabled types
    • IEnumerable<out T>
    • Action<in T>
    • Func<in T, out TResult>
  • · Variance rules

Anyone who interested in this topic, please join the Live Meeting event. See below for details.

Series Number

201003

When

May 21st, 2010 12:30 PM to 1:30 PM

Duration

1 hour(s)

Where

Singapore

Topic

The C# Programming Language, Part 2: Variance

Presenter

Mark Zhou

Level

200 (Medium Senior)

Audience

Technical geeks; developers; testers and those who are interested

Meeting URL

https://www.livemeeting.com/cc/microsoft/join?id=44K84N&role=attend&pw=CQw8W%7C*)f

Unable to join the meeting? Follow these steps:

1. Copy this address and paste into your web browser: https://www.livemeeting.com/cc/microsoft/join

2. Copy and paste the required information:
Meeting ID: 44K84N
Entry Code: CQw8W|*)f

Location: https://www.livemeeting.com/cc/microsoft

If you still cannot enter the meeting, contact support.

Tags:

C#

My first Live Meeting event: The feature of C# audio playback is here!

by Mark Zhou 14. May 2010 17:15

Today I presented the feature of the C# to some of the developers in Singapore. The intension to make this presentation is to open a window for the developers to be aware of the newly introduced C# features, and show the demo that C# can make in the industry.

The session contains:

The C# Programming Language overview

What C# can do

What is the future of the C#

The audio playback is available on the Live Meeting: https://www112.livemeeting.com/cc/microsoft/viewFormatHFF/9slr0tq9l6fghk2d/Engine/Default.htm?https%3A%2F%2Fwww112.livemeeting.com%2Fcc%2Fmicrosoft%2FviewFormatHFF%2F9slr0tq9l6fghk2d%2F

Or you can download the file from the Windows Live SkyDrive: http://cid-8a0406089aad8752.skydrive.live.com/browse.aspx/Tech%20Talk

Please ignore the last 28 minutes due to a recording issue, next time it will be better (I will include the Video Playback next time)

Tags:

C# | Tech Talk

ReSharper 5.0 RTM is out!

by Mark Zhou 13. April 2010 18:23

April 13th, 2010 – After the day Visual Studio 2010 launched, JetBrains announced ReSharper 5.0. ReSharper is the most valuable and helpful RAD tool for Visual Studio product family for developers and ALM managers to deliver the product with rapid and effective. ReSharper 5.0 also targets on Visual Studio 2010 platform, you can see what’s new in this release, or you can download a 30 trial version of ReSharper 5.0 from JetBrain download page.

Tags:

Visual Studio 2010

Visual Studio 2010 Launches Today

by Mark Zhou 12. April 2010 16:28

Visual Studio 2010

April 12th, 2010 PST – Today, Microsoft announces Visual Studio 2010. According to Somasegar’s Blog, This release represents the biggest tools announcement for Microsoft in many years. Visual Studio 2010 is the next generation development platform for Windows, Web and Mobile developers, it enhances the development experience, brings new tools, and introduces new features for application lifecycle management, architecture modeling, development, test, build, source control, lab management and so on.

There will be a keynote in the morning today (PST), you can see the live video from this link.

The trial version will be ready later today. First MSDN subscribers can access the new VS 2010 downloads from MSDN Subscription website, later, the trial versions, VHDs and test drive will be ready on Microsoft Downloads center or Microsoft Store. Visual Studio 2010 trial versions has 30 valid days for evaluation, after that, you need to extend the trial period to 90 days by registering your product online, or purchase an extension license key from Microsoft’s website.

As we discussed earlier in company, our new project will be using Visual Studio 2010, thus I am so exciting to get the installation bits today then deploy it to the company-wide. Here I am putting some screenshots to let the people know the product is released already!

Setup.exe information

image

About Box

image

Visual Studio Start Page

image

Tags:

Visual Studio 2010

Comments are closed since today

by Mark Zhou 5. April 2010 04:11

Recently I have received a lot of spam which may be off-topic, I have reasons to believe these comments are sent through some kind of robots, I received around 20 spam comments per day, I have to manually delete them when I am managing my blog website. It is actually distressed me a lot. I decided to close all the comment features for the entire blog website, to send feedback, please use the Contact link on the navigation bar to write an email to me. Thanks everyone for your understanding.

Tags:

Misc

C# tutorials (10): Integral Types

by Mark Zhou 31. March 2010 14:36

In this page:

  • Integral types
  • Use integral types in C#

Integral types

Integral type is a subset of numeric type in C#. To support mathematical calculations, C# introduced several numeric types that represents different integral numbers, for example, an int value in C# represents a signed 32-bit integral number.

C# supports following integral types:

  • sbyte: Represents a signed 8-bit integer value.
  • byte: Represents an unsigned 8-bit integer value.
  • short: Represents a signed 16-bit integer value.
  • ushort: Represents an unsigned 16-bit integer value.
  • int: Represents a signed 32-bit integer value.
  • uint: Represents an unsigned 32-bit integer value.
  • long: Represents a signed 64-bit integer value.
  • ulong: Represents an unsigned 64-bit integer value.
  • BigInteger: Represents a super integer value that is larger than 264.

An sbyte is an integer that has a range of –128 to 127 (8 bits). A byte is an integer that has a range of 0 to 255 (0x0 to 0xff, 16 bits). these types are used to represent byte-based data, for example, formatted binary data, binary strings, images or file contents.

A short is an integer that has a range of –32768 to 32767 (16 bits). An ushort is an integer that has a range of 0 to 65535 (0x0 to 0xffff, 16 bits). These types are used to manipulate 16-bit data, for example, some P/Invoke API calls need 16-bit integral values.

An int is an integer that has a range of –231 to 231 – 1 (32 bits). An uint is an integer that has a range of 0 to 232 – 1 )0x0 to 0xffffffff, 32 bits). These types are the most frequently used numeric types that represents 32-bit integer data, for example, the int value is used to describe integral values of various constructive types, such as the ID for a record row in database table, a timestamp of CPU, or an index of a specified entry object in a collection.

A long is an integer of 64 bit ranges from –263 to 263 – 1. An ulong is an integer ranges from 0 to 264 – 1. These types are used to represent large integral values, for example, the sample data of a statistical calculation, or a measure result of a geographical engineering.

The BigInteger, introduced in C# 4.0, is a wide range integral type that can represent integers large than 264. To use this type, you need to reference System.Numerics.dll assembly to your project.

The keyword sbyte, byte, short, ushort, int, uint, long, and ulong can be used to declare those integral types in C#, alternatively, you may use its FCL type name in your code. When use C# reserved keywords to reference these types, C# compiler will first replace them with all equivalent FCL type names, then the compiler will compile them into primitive types. For more information about primitive types, please see Dixin Yan’s blog: Understanding .NET primitive types.

This table shows the C# keywords (aliases), FCL type names, as well as the ranges of these integral types in .NET.

C# types (alias)

FCL types

Range

sbyte System.SByte -128 to 127
byte System.Byte 0 to 255
short System.Int16 -32768 to 32767
ushort System.UInt16 0 to 65536
int System.Int32 –231 to 231 – 1
uint System.UInt32 0 to 232 – 1
long System.Int64 –263 to 263 – 1
ulong System.UInt64 0 to 264 – 1

Use integral types in C#

Use integral types in C# is very easy, first, let’s declare some variables with different integral types.

  1. // Declare signed variables.
  2. // All integral types has a default value 0.
  3. byte byteValue;
  4. short shortValue;
  5. int intValue;
  6. long longValue;
  7.  
  8. // Declare unsigned variables.
  9. uint uintValue;
  10. ulong ulongValue;
  11. ushort ushortValue;
  12.  
  13. // Use FCL type names instead of alias.
  14. Int32 int32Value;
  15. UInt64 uint64Value;

Then, you may assign values to these variables:

  1. byteValue = 5;
  2. shortValue = 560;
  3. intValue = -2147000000;

You can use static properties on the type to get the minimum and maximum value of specified integral type:

  1. Console.WriteLine(ushort.MaxValue);
  2. Console.WriteLine(long.MinValue);

You also can apply arithmetic operations (addition, subtraction, multiplication, division, remainder, negation etc.) on these types.

  1. int a = 100, b = 200;
  2. int c = a + b;
  3. int d = a + b - (a * b) / c % c;
  4.  
  5. Console.WriteLine(c);

Of course, if the result of addition is out of range, you must use another integral type that satisfies the boundary. For example,

  1. byte b = 255;
  2.  
  3. // Must use int, or long, because multiplication on two bytes results an integer value.
  4. int t = b * b;
  5.  
  6. Console.WriteLine(c);

Finally, you can use Parse() static method, or static methods on Convert class to convert other types into the specified type.

  1. byte b = 255;
  2.  
  3. // Implicit conversion.
  4. int i = b;
  5.  
  6. // Explicit conversion.
  7. short s = (short)i;
  8.  
  9. // Use Parse() method.
  10. // Generally, Parse() method parses a string value into specified type.
  11. long l = long.Parse("12");
  12.  
  13. // Use Convert class.
  14. // Those methods can convert various types rather than string.
  15. sbyte sb = Convert.ToSByte(b);

Additionally, you may add a special “postfix” to the integral constant to force compiler treat this constant as a certain type. For example:

  1. // The underlying type of "p" is Int64.
  2. var p = 1l;
  3.  
  4. // The underlying type of "q" is UInt64.
  5. var q = 1u;

If you do an arithmetic operation on different integral types, the result will be of type who is more larger. For example, multiply an int with a long, the result will be of long. If overflow, compiler will generate a constant value calculation error.

Tags:

C#

Fun from Dixin's Blog: Protocol of AJAX?

by Mark Zhou 25. March 2010 10:03

(Pasted from Dixin's Blog, copyright (c) by Dixin Yan)

This is a true story. This morning I went to office by train of Beijing subway, and 4 developers were sitting next to me and talking about Web development and their Web product. After a while, someone asked an interesting question: What is the protocol of AJAX?

Dev A said, “Its protocol is XML.”
Dev B argued, “No. The protocol should be Silverlight.”
Dev C was confused, “As I remember, it should be something sounds like HttpSilverlight.”
D spoke like a dev lead, “No you all didn’t get the point. AJAX itself is a kind of protocol. So, the protocol of AJAX is just AJAX.”

So finally, they made the agreement.

Tags:

Misc

C# tutorials (9): Assignment

by Mark Zhou 24. March 2010 16:25

In this page:

  • Assign values to variables and constants
  • Assignment relevant questions

Assign values to variables and constants

In the last post I mentioned variables and constants in C#, variable stores a value of which data is subject to change during the program running, constant stores a value whose data is not able to change during its lifecycle. I also mentioned before you can use the variables or constants, you must give them initial values. Today I am talking about how to assign values to variables and constants.

In C#, an assignment operator (=) can evaluate the value of the right side operand and then assign it to the left side variable (because constant is a special type of variable, I will use variable to refer both invariant and variant data). Assignment operator is binary, which means this operator has to take two operands to work. The typical usage of the assignment operator is like this:

[type] <variable-name> <=> <expression> [, <variable-name2> <=> <expression2> [, …]] <;>

Let me explain the signs I used to describe the syntax:

  • [ ]: Indicates the terms appear in the parentheses body are optional.
  • < >: Indicates the terms appear in the parentheses body are required.
  • : Indicates the terms before the ellipsis can appear one or more times.

The symbolic syntax above can define a variable with a specific type and an initial value. For example,

  1. int intNumber = 1;

defines an integer variable with initial value 1.

Note, please pay attention to the distinctions between definition and declaration. When we declare a variable, we just tells the compiler the name and the type of that variable; when we define a variable, the name, the type and the initial value are given to the compiler. I see some abuse of these two terms in a lot of books, although sometimes we really don’t care which term we are using, but I still want to clarify the difference. Please make it in your mind.

Except define an integer variable, you can assign different variables with different types and values. For example:

  1. int intValue = 1;
  2. uint unsignedIntValue = 2;
  3. long longValue = -32767;
  4. ulong unsignedLongValue = 65536;
  5. double doubleValue = 1e+15;
  6. decimal decimalValue = 10000000000000000000;

These variables are numbers. Different numeric types have different value boundaries. for a complete list of numeric types and its value ranges, please see this link.

I may go deep into those types when I refer to C# type system in the further posts.

You may also define more than one variables in a same line of code, use a comma to separate each definitions. For example:

  1. string s1 = "My", s2 = "New", s3 = "HDTV";
  2. int i, j = 0, k = 1, l;

In this example, I defined 3 string variables, “My”, “New” and “HDTV” in a same line; in the second line, I defined 4 integer variables, i, j and l is 0, k is 1.

Note, you cannot assign different types of variable in a same line, for example, this line will lead a compiler error:

  1. string s = "Hello", int i = 1;

If you really want to do so, change the comma sign to a semi-comma to resolve the compiler error:

  1. string s = "Hello"; int i = 1;

A semi-comma differentiates two C# statements, the compiler will treat the above line as two independent statements, the following code is equivalent to the above:

  1. string s = "Hello";
  2. int i = 1;

Furthermore, you can assign values in a same line as a chain, for example:

  1. int i, j, k = i = j = 3;

We can also decouple declaration from definition, for example:

  1. int i;
  2. string s;
  3.  
  4. i = 1;
  5. s = "Hello";

To assign a value to a constant, put a const keyword before the type of the variable. For example:

  1. const double pi = 3.1415926;
  2. const string httpPrefix = "http://";
  3.  
  4. double area = 2 * 2 * pi;
  5. string url = httpPrefix + "www.markzhou.com";

As I aforementioned, constants are compiled to its actual value (literal) to optimize the executable.

Assignment relevant questions

Q1: Can I assign a return value from a method to a constant?
A: No. Constant must be assigned with a constant expression, that is, an expression that consists of constants, or predefined values from the system, and (if applied) the operations on these types (such as addition, subtraction, multiplication, division, increment, decrement, bit-and, bit-or, bit-not, logical/conditional operations etc.).

Q2: Does this code compile?

  1. string s1, s2, s3 = "Hello";
  2. object o1, o2 = new object { };

A: Yes. Compiler will treat s1, s2 as declarations, s3 as definition. The same mechanism applies to the second line. But please be aware, the following code has no declaration. Because the compiler will automatically add a default value to int types (will introduce later):

  1. int i, j, k;

The above line is equivalent to:

  1. int i = default(int), j = default(int), k = default(int);

Also equivalent to:

  1. int i = 0, j = 0, k = 0;

Q3: Can I assign a string value to an int variable?
A: No. C# is restricted as a strong typed programming language. You cannot assign a different value to a type that is not compatible. For example, you may assign a long integer to an int variable because it is implicitly convertible from long to int, but you cannot assign a int value to a string. The only way to do this is using conversions (will introduce later).

Q4: Does C# return a value from an assignment? is that value right-evaluated?
A: C# returns a value for a assignment statement, however, unlike the C programming language, C# does not returns the value of the right operands of an assignment statement. For example:

  1. class A { }
  2. class B : A { }
  3. class C : B { }
  4.  
  5. class Program
  6. {
  7.     static void Main(string[] args)
  8.     {
  9.         A a = new A();
  10.         B b = new B();
  11.         C c = new C();
  12.  
  13.         Console.WriteLine((b = c).GetType()); // Demo.C
  14.         Console.WriteLine((a = b = c).GetType());  // Demo.C
  15.     }
  16. }

The first output is “Demo.C”, expression “b = c” return a type of Demo.C, the right value is of type Demo.C, the left value is of type Demo.B; The second output is “Demo.C”, expression “a = b = c” returns a value of type Demo.C, but a, b, c is of type Demo.A, Demo.B and Demo.C. As you can see, C# doesn’t evaluate the value of an assignment expression strictly from the left or right. C# always evaluates assignment expression by its calculated underlying value.

Tags:

C#

Powered by BlogEngine.NET 1.5.0.7

About Mark Zhou

Mark Zhou is a Windows Application developer, He currently works in an IT related company in Singapore. He has some working experience with Microsoft as well.

View Mark's profile on Windows Live
View Mark's Windows Live Spaces

Visitors

world map hits counter

Recent Comments

Comment RSS