Monday, November 19, 2007

Amazing Graphics..EA Rocks!!!

Check these screenshots of Need for speed Most wanted...amazing graphics...EA Games rocks..









Saturday, November 10, 2007

C# 3.0 - What's new?

Hello! everyone. This is festive time here in India. Yesterday we all celebrated Diwali, festival of light. I must tell you that lot of things have changed, things like playing with crackers, going out with friends and watching the way people decorated their houses using lights and ribbons. Yesterday, after having our Diwali prayer I just watched a movie (CHUCK) @ home and slept at around 11. Nothing new for me and it turned out to be yet another holiday. I wish things remained the same way as they were before.

Now let's talk technology. Microsoft have another a new set of features to C# in its third avatar. There is complete list available at MSDN, but I just wanted to add my comments to it as I study new features one by one. What I am planning is, I'll study one new feature everyday, post it here with my comments.
  1. Implicitly Typed Local Variables
    • Type is inferred by the expression used to initialize the variable
    • Only applicable to local variable
    • Variable declared using keyword 'var'
    • There should be no Type with name 'var' defined in scope. Only then type inferring will work
    • We should initialize the variable where we declaring it
    • Initialized must be an expression.
    • Local variable declaration should not include multiple variables
    • Initializer should not refer to variable itself
    • Some Examples: [ <=> is Same as ]
      var i = 5; <=> int i = 5;
      var s = "Hello";
      <=> string s = "Hello";
      var d = 1.0;
      <=> double d = 1.0;
      var numbers = new int[] {1, 2, 3};
      <=> int[] number = new int[]{1,2,3};
    • Some incorrect use of var:
      var x; // Error, no initializer to infer type from
      var y = {1, 2, 3}; // Error, collection initializer not permitted
      var z = null; // Error, null type not permitted
      var u = x => x + 1; // Error, lambda expressions do not have a type
      var v = v++; // Error, initializer cannot refer to variable itself
    • for, foreach and using (resource acquisition) can also use var. Like,
      int[] numbers = { 1, 2, 3, 4, 5 };
      foreach (var n in numbers) { //Do some thing }
    • COMMENTS
      Why do we need to use var? Everything should be Type Strict. I think this will impact performance as compiler will use some kind of intelligence to find out variable type and it will surely take up some time. This is no scripting language...man this is C#. It will just complicate things even more and add to huge list of keywords that we already have like sealed, virtual, override, abstract, new, internal etc. I don't see any use of this so called added feature.
      Please let me know your opinions.
Currently Listening To: Shadow of the day-LINKIN PARK
~eNjOy cOdinG~

Sunday, November 4, 2007

Debug ASP.net apps on VISTA

There is a lot of criticism going around regarding debugging capabilities of Windows VISTA and Visual Studio 2005. A lot of guys that are using Vista Home (cheapest and all laptops comes with HOME) think that it's only a problem with Vista Home edition and MS must have done this as a marketing gimmick. I think this is not true. Last night I was not able to debug a simple web application on my computer, that's running Windows Vista Ultimate X86 edition. So I just googled for few seconds and solution was in front of me.

You can either go to msdn web Dev blog or check out steps and links given below. Actually all the content that you see below is just copy pasted from above link. So it will be much better if you check out the link.

The Visual Studio team has just released a down loadable hot fix, which fixes problems resulting in such errors, and also enables the ability for Visual Studio 2005 to F5 debug web applications on IIS7 in Vista Home versions.

The following steps should be done to properly configure your IIS7/Vista environment for building ASP.NET web applications using Visual Studio 2005:

  1. Install Visual Studio 2005 SP1
  2. Install Visual Studio 2005 Update for Vista
  3. Install Visual Studio 2005 hot fix for F5 authentication errors
  4. Configure required IIS7 components
  5. Run Visual Studio using the "Run As Administrator" option on the right-click menu
Currently Listening To: What Have I done-LINKIN PARK
~eNjOy LiFe~

Wednesday, October 31, 2007

C# Optimizing Compiler

Let me share nice thing that I noticed about C# compilation model. What I did was, I created a small program to print an Int32 array to console. Then I went into IL and checked out various function calls that C# compiler has made. There was one nice thing that I noticed. C# compiler sometimes optimizes your code by itself. Let me show you,

using System;

namespace Optimization

{

class Program

{
static void Main(string[] args)
{
Int32[] arr ={ 1, 2, 3, 4, 5, 6, 7, 8, 9, 0,11 };
for (Int32 i = 0; i<=arr.Length-1;i++) {
Console.WriteLine(arr[i]);
}
Console.ReadLine();

}

}

}

This is the code that I wrote to print a simple Int32 array. Below is the IL generated by this code snippet.


Compiler stores the array length in line IL_0000. The you can see there is no call to Array.Length property [internally it will call the method get_Length()] which I have used in For loop. Only calls that C# compiler added were to Initialize array, WriteLine() and ReadLine(). C# compiler have optimized our code internally so that there is no need to call Length with every loop iteration. It uses the length that is stored in the beginning to provide a performance boost. So, if you are doing such thing in your code, don't complicate things by declaring a variable just before the for loop just to store array length and use that variable in loop condition. You will be doing that to improve your application's performance but doing such heroics is not needed in this scenario.

I have just started to read about ASP.net internals and currently I am dating HTTPSys driver :). I hope to get this done by November 2nd week.
Currently listening To: SHAGGY Feat. AKON - What's Love
...nJoy CoDiNg...

Tuesday, October 2, 2007

MS Office - One click blog publishing



Hey! guys, do you know how I created this blog entry. I simply wrote some stuff in my new MS Word 2007 and published it with one mouse click to my web blog. It's so damm easy, you only have to set up connection with your blog space provider and your blog account with your MS Word. From then onwards you can just write any content offline and publish it using new utility menu in office 2007. Information given bel;ow is just may be useless to most of you, but this just another document that I prepared long ago. You tend to forget things if you dont use them often :). Take a look at the menu screen shot above:
  • XML
    • Introduction
      • XML vs. HTML
        • xml describe data
        • xml focus on data
        • html display data
        • html focus on how data looks
      • XML
        • Extensible markup language
        • Define your own tags
        • DTD or XML Schema to describe data
      • W3C recommendation