Sunday, August 14, 2011

Placing Update Progress Control dynamically

Contextual Links


f you're using AJAX UpdateProgress control, you may find it difficuilt to set the best position where you should put it on the page, because user will not see it if he scrolls down (or up) from it. Here is a simple solution which will make your UpdateProgress more user-friendly, because it will set the position on the screen according to user's movement of the mouse. And you will prevent user to click on any button until the postback finishes execution. 

here is the code place the below code in JavaScript SCRIPT LANGUGE=JAVASCRIPT tag, ending with appropriate closing tag

    function SetProgressPosition(e)
    {
      var posx = 0;
      var posy = 0;
       if (!e) var e = window.event;
       if (e.pageX ||  e.pageY) 
        {
          posx = e.pageX;
          posy = e.pageY;
        }
    else if (e.clientX || e.clientY) 
     {
         posx = e.clientX + document.documentElement.scrollLeft;
         posy = e.clientY + document.documentElement.scrollTop;
     }
    document.getElementById('divProgress').style.left = posx - 8 + "px";
    document.getElementById('divProgress').style.top = posy - 8 + "px";
}



________________________________________
the on boy tag plave the code as body onmousemove="SetProgressPosition(event)"
________________________________________
Now place your updateProgress bar tag as (Note : each line has starting < and ending > Kidly include the same in each line)
asp:UpdateProgress ID="UpdateProgress1" runat="server" DisplayAfter="100"
ProgressTemplate
   div class="overlay" id="divProgress"
        Please wait...
      br /
         asp:Image GenerateEmptyAlternateText="true" ID="Image1" runat="server" ImageUrl="~/ajax-loader.gif" Style="margin-top: 7px;" /
  /div
/ProgressTemplate
/asp:UpdateProgress

________________________________________

As you can see, most important part is javascript which is responsible for the movement of the UpdateProgress. That javascript is triggered with the "onmousemove" part of the body tag. In order to set UpdateProgress style, use this styel sheet:
________________________________________
.overlay
{
 border: black 1px solid;
 padding: 5px;
 z-index: 100;
 width: 100px;
 position: absolute;
 background-color: #fff;
-moz-opacity: 0.75;
 opacity: 0.75;
 filter: alpha(opacity=75);
 font-family: Tahoma;
 font-size: 11px;
 font-weight: bold;
 text-align: center;

________________________________________


As you can see, there is a part which makes UpdateProgress semi-transparent, which will make it look even better. 


And that's all, very simple, but very effective!
 Code in Action

How to Change your Office 2007 Product Key:

Are you looking to change a Microsoft Office 2007 product license key, serial number or CD key? One common method used to change the product key for 2007 Microsoft Office programs or suites is to uninstall or remove Microsoft Office and then reinstall the program. Another approach is to edit your registry, reset and change the product serial key without uninstalling and reinstalling 2007 Office system suites.

1. Click Start -> Run
2. Type regedit in the box and click OK
3. Navigate to the following path:
HKEY_LOCAL_MACHINE \Software\Microsoft\Office\12.0\Registration
Within Registration, there is subkey that may resemble the following:
{30120000-0011-0000-0000-0000000FF1CE}
4. Under Registration, you might find several subkeys that contain a combination of alphanumeric characters. Each key is specific to a program installed on your computer.Open each subkey to view and identify the Office product version by the ProductName registry entry in the right pane. For example:
ProductName=Microsoft Office Professional Plus 2007
6. 
Once you have located the subkey that contains the Office product you wish to change the license key for, delete the following registry entries by right clicking on the registry entry in the subkey, click Delete, and select 
Yes:DigitalProductID
ProductID
7. Close regedit
8. Start Microsoft Word, Excel, Outlook or another Office application. Office 2007 should now prompt you to enter a new 25 character product key
Enter a valid product key, and click OK
9. If prompted to choose your preferred type of Microsoft Office 2007 installation, select Install Now
10. Microsoft Office 2007 should now be updated with your new CD key

Get offline maps for your Mobile (work with GPS/without GPS)

Here's a tutorial which will guide you that how to get Google Map Offline on you Java Enabled phone. This works in most of the SE phones which have Java MIDP 2.0. While writing i assume that you are already familiar with Installing games, applications and transferring files to your phone from the PC.You Need: 
A PC with internet connection.
Windows XP/Vista (not tried with others)
USB Chord of your SE phone.

Step 1:You need the application of Mini-Google-Maps (mgmaps for short)
DOWNLOAD

Choose "Stable (v1.3x)" and platform "Generic"
Click on [jar] as we are going to use SE mobile phones, [jad] file is not required. You will now be asked to save the file. Please save it on your desktop (makes things easier )

Step 2:
Now we need the map "tiles" which comprise the maps used by mgmaps.
To download these, and a custom area map, you need a tool called gMapMaker. (You need MS .NET Framework v2.0 to run gMapMaker)
DOWNLOAD 

Step 3:

Now we need to create a map file for a custom area.
Go 
here and use the tool to create a ".map" file. Save this to your desktop too.

INSTRUCTIONS:
1. Find the area that You want to get a map of.
2. Draw a line around the area that You want mapped, by placing markers around in sequence. A single click places a marker, a click on a marker removes it. It is also possible to drag markers around after they have been placed.
3. Specify zoom levels, map type, and detail level. WARNING: The maximum detail level can freeze Your browser for upto 5 minutes, depending on the complexity of the shape and other factors.
4. Press the "Generate!" button. Wait for the script to generate everything. As a side note, Mozilla Firefox does the processing much much faster than IE does.

Be careful and do not select a huge map size. Also select a modest zoom level. Level 17 is not needed, it will just clog up your memory.
Step 4:
Now open gMapMaker.
You should see something like this (the fields may differ)
screenshot_1.jpg
In "operating mode" select "MGMaps mode use a .map file"
Click on "Go.." You will now be asked for the .map file which was saved on the desktop. Select it. gMapMaker will now download the tiles of your map. Please be patient, this can take a while.
Step 5:
A folder should be created in "C:/Program Files/gMapMaker"(Windows XP) Or "C:/Desktop" (Windows Vista)

It will contain another folder "MGMapsCache". Copy this to your memory card or phone memory (If it has enough space)
Step 6:
Now install the application "mgmaps.jar" in your mobile phone the usual way. Start the application. Go to menu->settings->map browsing
Mark the fields of "Stored Maps" and "Offline mode"
If your maps are inside the phone memory, Put the storage path as "C:/MGMapsCache", or if your maps are in the memory card put it as "E:/MGMapsCache". Select more->save
Restart the application. Press till it shows "Google Maps"
If it does not show even after pressing repeatedly, go to menu->settings->map types. Here you will find something as "Not Available(Google)" Select it and mark "Google Maps"
The maps should now be seen.

Dwongrading form Vista to XP


Step 1.
Download the SATA Driver from your Vendor site of from Intel www.intel.com/support/chipsets/imsm/index.htm
Extract the file to a floppy or other location using third party tool. (Do a google for extracting) it should have the follwing files on extracted location.
iaahci.cat
iaahci.inf
iastor.cat
iastor.inf
iastor.sys
license.txt
readme.txt
txtsetup.oem

Step 2. Create a folder on harddisk with same name as of XP Cd, Copy the content of our CD to your hard disk (Lets Say c:\winxp_vol)





Step 3. 
Navigate to c:\winxp_vol\i386, Open txtsetup.sif in notepad
Find [SourceDisksFiles] Scroll to he last entry of this section. Add the follwing to the last line.
iastor.sys=1,,,,,,4_,4,1,,,1,4
Step 3. Open the txtSetup.oem from extracted folder (or Floppy Drive).
Step 4. Search for [HardwareIds.scsi.iaStor_ICH8M]
Step 5. Open txtsetup.sif and Find [HardwareIdsDatabase] Scroll to the last record under [hardwareIdsdatabase] and paste each ID so it looks like the following.
[HardwareIdsDatabase]
entry1
entry2
entry3 etc....
PCI\VEN_8086&DEV_282A&CC_0104="iastor"
PCI\VEN_8086&DEV_2829&CC_0106="iastor"
PCI\VEN_8086&DEV_2822&CC_0104="iastor"
PCI\VEN_8086&DEV_2821&CC_0106="iastor"
PCI\VEN_8086&DEV_2682&CC_0104="iastor"
PCI\VEN_8086&DEV_2681&CC_0106="iastor"
PCI\VEN_8086&DEV_27C3&CC_0104="iastor"
PCI\VEN_8086&DEV_27C6&CC_0104="iastor"
PCI\VEN_8086&DEV_27C1&CC_0106="iastor"
PCI\VEN_8086&DEV_27C5&CC_0106="iastor"
PCI\VEN_8086&DEV_2652&CC_0104="iastor"
PCI\VEN_8086&DEV_2652&CC_0106="iastor"
PCI\VEN_8086&DEV_2653&CC_0106="iastor"

Step 6. Next we need to find [Scsi.Load] scroll down to the last entry and add the following to the bottom a[Scsi.Load]
iastor=iastor.sys,4
Next Find [SCSI] scroll down to the bottom again and add the following
[SCSI]
iastor = "Intel(R) 82801HEM SATA RAID Controller (Mobile ICH8M-E)"
iastor = "Intel(R) 82801HEM/HBM SATA AHCI Controller (Mobile ICH8M-E/M)"
iastor = "Intel(R) 82801HR/HH/HO SATA RAID Controller (Desktop ICH8R)"
iastor = "Intel(R) 82801HR/HH/HO SATA AHCI Controller (Desktop ICH8R)"
iastor = "Intel(R) 631xESB/632xESB SATA RAID Controller (Server/Workstation ESB2)"
iastor = "Intel(R) 631xESB/632xESB SATA AHCI Controller (Server/Workstation ESB2)"
iastor = "Intel(R) 82801GHM SATA RAID Controller (Mobile ICH7MDH)"
iastor = "Intel(R) 82801GR/GH SATA RAID Controller (Desktop ICH7R/DH)"
iastor = "Intel(R) 82801GR/GH SATA AHCI Controller (Desktop ICH7R/DH)"
iastor = "Intel(R) 82801GBM SATA AHCI Controller (Mobile ICH7M/DH)"
iastor = "Intel(R) 82801FR SATA RAID Controller (Desktop ICH6R)"
iastor = "Intel(R) 82801FR SATA AHCI Controller (Desktop ICH6R)"
iastor = "Intel(R) 82801FBM SATA AHCI Controller (Mobile ICH6M)"
Note. 
Replacce the name of the driver with Iastor for each driver see above.

Save txtSetup.sif
Step 7. Create a folder like c:\winxp_vol\$OEM$\$1\Drivers\SATA
Copy the extracted file to this folder
IAAHCI.cat
IAAHCI.inf
IASTOR.cat
IASTOR.inf
IASTOR.sys

Step 8. The iastor.sys need to be made into a cab. for this run the command from command prompt
Makecab C:\CDNAME\$OEM$\$1\Drivers\SATA\iastor.sys C:\CDNAME\$OEM$\$1\Drivers\SATA\iastor.sy_
you can now delete the file iastor.sys.
In the C:\CDNAME\$OEM$\$1\Drivers\SATA you should now have the following files
IAAHCI.cat
IAAHCI.inf
IASTOR.cat
IASTOR.inf
IASTOR.sy_

Step 9. Copy the iastor.sy_ into c:\winxp_vol\i386 folder.
Step 10. Open dosnet.inf in notepad (This is locted at c:\winxp_vol\i386 folder)
Step 11. FIND [Floppy.Files2] and copy the following "d1,iastor.sys" directly underneath
like so
[Floppy.Files2]
d1,iastor.sys

Do the same for [Files]
[Files]
d1,iastor.sys

Save dosnet.inf

Step 12. Open Notepad and enter
[Unattended]
OemPnpDriversPath="DRIVERS\SATA"
OemPreinstall=Yes
DriverSigningPolicy=Ignore
NonDriverSigningPolicy=Ignore

[Data]
MsDosInitiated=No
Save the file in C:\CDNAME\i386 called winnt.sifwe now have the edited CD.
Final Step. Save the contenet as bootable iso image and burn using any birning engine. Make sure to make the image as bootable XP image, You can download the boot image from Microsoft or other engine.
Insert the CD and reboot you machine now you will be able to install Windows XP without problem.
If you face any problem, Please post acomment or write to me.

Thanks
Happy Installing....

How to get GPRS on windows Mobile


GPRS are most commom these days, but unfortunaltly getting GPRS on windows mobile is very tedeous. I get GPRS working on my Windows Mobile with very tedeous process.
To get the GPRS working on my phone i made a lot of call to customer care of my mobile operator, but they have no clear way to get it working on my moble, The setting send by mobile operator was not working and get discared.
So i decide to compile the step to get the GPRS working on my Windows Mobile with Vodafone India.
Here are the steps
1. Get GPRS activated on your SIM by calling the Customer Care.
2. Go to Start --> Setting
3. Tap the connections TAB.
4. Select Connection.
5. Select New Modem Connection.
6. Enter Name for connection.
7. Select a mode as Celllar line (GPRS)
8. Enter Access Point name www.
9. Click Finish.
10. Click Ok the OK to return banck to main screen.
11. Select Managemy Proxy Server.
12. Enter 10.10.1.100 in the Proxy Sever Box.
13. Select Advance
14. Select HTTP and enter 10.10.1.100 and port name 9201.
15. Enter 10.10.1.100 and port name 9201 in WAP, Secure WAP, and SOCKS
16. Click OK.
17. Yoy are done.

Enjoy GPRS on you windows Mobile.

Installing XP on Dell Inspiron 1525


o install Windows XP on dell indpiron, Follwos the step.
Before you install XP, you must first configure a setting in BIOS else XP CD will not detect your hardisk

In BIOS:
Onboard Devices -> Flash Cache Module -> Set Off
Onboard Devices -> SATA Operation -> Set ATA

now proceed with installing XP with a bootable XP CD.
Now First of any driver installation install
R153997 Mobile Chipset
http://supportapj.dell.com/support/downloa...7&fileid=205326
Then you can install other driver in any order. The driver can be downloaded from DELL
http://supportapj.dell.com

Happy Installing.....

Singlton Pattern


Singlton Pattern
In software engineering, the singleton pattern is a design pattern that is used to restrict instantiation of a class to one object (an implementation of the mathematical concept of singleton). This is useful when exactly one object is needed to coordinate actions across the system. The concept is sometimes generalized to systems that operate more efficiently when only one object exists, or that restrict the instantiation to a certain number of objects (say, five). Some consider it an anti-pattern, judging that it is overused, introduces unnecessary limitations in situations where a sole instance of a class is not actually required, and introduces global state into an application

Implementation
Implementation of a singleton pattern must satisfy the single instance and global access principles. It requires a mechanism to access the singleton class member without creating a class object and a mechanism to persist the value of class members among class objects. The singleton pattern is implemented by creating a class with a method that creates a new instance of the class if one does not exist. If an instance already exists, it simply returns a reference to that object. To make sure that the object cannot be instantiated any other way, the constructor is made protected (not private, because reuse and unit test could need to access the constructor). Note the distinction between a simple static instance of a class and a singleton: although a singleton can be implemented as a static instance, it can also be lazily constructed, requiring no memory or resources until needed. Another notable difference is that static member classes cannot implement an interface, unless that interface is simply a marker. So if the class has to realize a contract expressed by an interface, it really has to be a singleton.
The singleton pattern must be carefully constructed in multi-threaded applications. If two threads are to execute the creation method at the same time when a singleton does not yet exist, they both must check for an instance of the singleton and then only one should create the new one. If the programming language has concurrent processing capabilities the method should be constructed to execute as a mutually exclusive operation.
The classic solution to this problem is to use mutual exclusion on the class that indicates that the object is being instantiated


Simple way

This solution is thread-safe without requiring special language constructs, but it may lack the laziness of the one below. The INSTANCE is created as soon as the Singleton class is initialized. That might even be long before getInstance() is called. It might be (for example) when some static method of the class is used. If laziness is not needed or the instance needs to be created early in the application's execution, or your class has no other static members or methods that could prompt early initialization (and thus creation of the instance), this (slightly) simpler solution can be used:
 public class Singleton
{
   private static final Singleton INSTANCE = new Singleton();

   // Private constructor prevents instantiation from other classes
   private Singleton() {}
   public static Singleton getInstance() {
      return INSTANCE;
   }
 }
C#
/// <summary>
/// Thread-safe singleton example created at first call
/// </summary>
public sealed class Singleton
{
    private static Singleton _instance = new Singleton();

    private Singleton() { }

    public static Singleton Instance
    {
        get
        {
           return _instance;
        }
    }
}

Issue with Singleton Pattern

  1. Hides dependencies – A component that uses one or more singletons is hiding crucial information about your dependencies. It doesn’t take long for calls to a singleton to creep through your code base like kudzu, slowly attaching itself to every class in the system. Exposing that dependency forces you to think about it as you use a component. It also makes it more reusable as the caller can understand its requirements and how they might be satisfied.
  2. Hard to test – The hidden coupling of users on a singleton makes testing a nightmare as there is no way to mock out or inject a test instance of the singleton. Also, the state of the singleton affects the execution of a suite of tests such that they are not properly isolated from each other.
  3. Hard to subclass – Since initialization occurs in a singleton in static code, it is not amenable to subclassing because subclasses inherit the initialization code without the chance to override it.
  4. It’s a lie! (in most Java systems) – Singletons in Java are based on static variables, which are held per-classloader, not per-VM. In most systems of any complexity these days (any based on an app server, OSGi, Eclipse, plugins, etc) many classloaders will be involved. In that case, it is quite easy for two plugins to create their own instance of a singleton. Sometimes this is done by design and is desirable. But it’s also easy to screw up. It’s also usually critical that the singleton get created in the right classloader, which can make lazily constructing the singleton tricky.
  5. A singleton today is a multiple tomorrow – It’s not at all unusual to discover that you now need 2 or more of something you previously only needed one of. Hard-coding the singleton pattern into your code makes it impossible to satisfy that demand later. This probably seems really weird if it hasn’t happened to you, but it has happened more than once to me.

When to use
There are still some cases where singletons are a valid choice.
One is logging. Logging is so pervasive that unless you use some fairly heavy-handed dependency injection or AOP, it is not feasible to inject every class in the system with a logger. Instead, this is a case where using static methods or singletons are probably worth the compromise.
Another common use is to obtain a handle to a service locator (think JNDI) that knows how to access everything else. This is actually one way to change your entire system from using many singletons to using one singleton that knows how to find the others. This is a valid technique that addresses some of the inherent problems (mockability, testing) with singletons and may be a less invasive change to a legacy code base.
Swing or other client-side UIs are another case where singletons may be a valid choice. In the case of a Java desktop app, it is likely that you have more complete control over your deployment environment than you do in a server-side application. In this case, it can be acceptable to have a manager class managing some state as a singleton in the VM. However, my preference would be to go the extra step to expose that dependency.

Factory method pattern


Factory method pattern
 The factory method pattern is an object-oriented design pattern to implement the concept of factories.
Like other creational patterns, it deals with the problem of creating objects (products) without specifying the exact class of object that will be created. The factory method design pattern handles this problem by defining a separate method for creating the objects, which subclasses can then override to specify the derived type of product that will be created. More generally, the term factory method is often used to refer to any method whose main purpose is creation of objects
DefinitionThe essence of the Factory Pattern is to "Define an interface for creating an object, but let the subclasses decide which class to instantiate. The Factory method lets a class defer instantiation to subclasses
Benefits and variantsAlthough the motivation behind the factory method pattern is to allow subclasses to choose which type of object to create, there are other benefits to using factory methods, many of which do not depend on subclassing. Therefore, it is common to define "factory methods" that are not polymorphic to create objects in order to gain these other benefits. Such methods are often static.
Descriptive names
A factory method has a distinct name. In many object-oriented languages, constructors must have the same name as the class they are in, which can lead to ambiguity if there is more than one way to create an object (see overloading). Factory methods have no such constraint and can have descriptive names. As an example, when complex numbers are created from two real numbers the real numbers can be interpreted as Cartesian or polar coordinates, but using factory methods, the meaning is clear (the following examples are in Java):
class Complex
{
     public static Complex fromCartesian(double real, double imag) {
         return new Complex(real, imag);
     }

     public static Complex fromPolar(double modulus, double angle) {
         return new Complex(modulus * cos(angle), modulus * sin(angle));
     }

     private Complex(double a, double b) {
         //...
     }
}

 Complex c = Complex.fromPolar(1, pi); // Same as fromCartesian(-1, 0)
When factory methods are used for disambiguation like this, the constructor is often made private to force clients to use the factory methods.
Encapsulation
Factory methods encapsulate the creation of objects. This can be useful if the creation process is very complex, for example if it depends on settings in configuration files or on user input.
Consider as an example a program to read image files and make thumbnails out of them. The program supports different image formats, represented by a reader class for each format:
public interface ImageReader {
    public DecodedImage getDecodedImage();
}

public class GifReader implements ImageReader {
    public DecodedImage getDecodedImage() {
        return decodedImage;
    }
}

public class JpegReader implements ImageReader {
    // ....
}
Each time the program reads an image it needs to create a reader of the appropriate type based on some information in the file. This logic can be encapsulated in a factory method:
public class ImageReaderFactory {
    public static ImageReader getImageReader(InputStream is) {
        int imageType = determineImageType(is);

        switch(imageType) {
            case ImageReaderFactory.GIF:
                return new GifReader(is);
            case ImageReaderFactory.JPEG:
                return new JpegReader(is);
            // etc.
        }
    }
}
The code fragment in the previous example uses a switch statement to associate an imageType with a specific factory object. Alternatively, this association could also be implemented as a mapping. This would allow the switch statement to be replaced with an associative array lookup.
Limitations
There are three limitations associated with the use of the factory method. The first relates to refactoring existing code; the other two relate to inheritance.
The first limitation is that refactoring an existing class to use factories breaks existing clients. For example, if class Complex was a standard class, it might have numerous clients with code like:
Complex c = new Complex(-1, 0);
Once we realize that two different factories are needed, we change the class (to the code shown earlier). But since the constructor is now private, the existing client code no longer compiles.
The second limitation is that, since the pattern relies on using a private constructor, the class cannot be extended. Any subclass must invoke the inherited constructor, but this cannot be done if that constructor is private.
The third limitation is that, if we do extend the class (e.g., by making the constructor protected -- this is risky but possible), the subclass must provide its own re-implementation of all factory methods with exactly the same signatures. For example, if class StrangeComplex extends Complex, then unless StrangeComplex provides its own version of all factory methods, the call StrangeComplex.fromPolar(1, pi) will yield an instance of Complex (the superclass) rather than the expected instance of the subclass.
All three problems could be alleviated by altering the underlying programming language to make factories first-class class members
Example
C#
public interface IPizza
{
    decimal Price { get; }
}

public class HamAndMushroomPizza : IPizza
{
    decimal IPizza.Price
    {
        get
        {
            return 8.5m;
        }
    }
}

public class DeluxePizza : IPizza
{
    decimal IPizza.Price
    {
        get
        {
            return 10.5m;
        }
    }
}

public class HawaiianPizza : IPizza
{
    decimal IPizza.Price
    {
        get
        {
            return 11.5m;
        }
    }
}

public class PizzaFactory
{
    public enum PizzaType
    {
        HamMushroom,
        Deluxe,
        Hawaiian
    }

    public static IPizza CreatePizza(PizzaType pizzaType)
    {
        IPizza ret = null;

        switch (pizzaType)
        {
            case PizzaType.HamMushroom:
                ret = new HamAndMushroomPizza();

                break;
            case PizzaType.Deluxe:
                ret = new DeluxePizza();

                break;
            case PizzaType.Hawaiian:
                ret = new HawaiianPizza();

                break;
            default:
                throw new ArgumentException("The pizza type " + pizzaType + " is not recognized.");
        }

        return ret;
    }
}

public class PizzaLover
{
    public static void Main(string[] args)
    {
        Dictionary<PizzaFactory.PizzaType, IPizza> pizzas = new Dictionary<PizzaFactory.PizzaType, IPizza>();

        foreach (PizzaFactory.PizzaType pizzaType in Enum.GetValues(typeof(PizzaFactory.PizzaType)))
        {
            pizzas.Add(pizzaType, PizzaFactory.CreatePizza(pizzaType));
        }

        foreach (PizzaFactory.PizzaType pizzaType in pizzas.Keys)
        {
            System.Console.WriteLine("Price of {0} is {1}", pizzaType, pizzas[pizzaType].Price);
        }
    }
}

Output:
Price of HamMushroom is 8.5
Price of Deluxe is 10.5
Price of Hawaiian is 11.5

Detecting Post Back in Through Javascript


Some time we need to do some functionality in a page using JavaScript when page load for the first time only, The best way to do is to detect Post back and then perform the functionlaity in JavaScript.
Here is the way to achive.
Place the following code in javaScript block

 window.onload = isPostBack;    function isPostBack()    
{     
  var chkPostBack = '<%= Page.IsPostBack ? "true" : "false" %>';
       if(chkPostBack == 'false')
       {
        alert('Page loaded First Time');
       }   
     else
       {
         alert('Post back');
       }
 }
Happy Coding...

How to change the Volume Licensing product key of Windows XP


Steps to change the volume licensing product key

This article describes two methods for how to change the Windows XP product key after a Volume Licensing installation to resolve the issue. One method uses the Windows Activation Wizard graphical user interface (GUI) and the other method uses a Windows Management Instrumentation (WMI) script. The Activation Wizard method is easier. However, if you must change the product key for multiple computers, the script method is more suitable.

Method 1: Use the Activation Wizard

Important This section, method, or task contains steps that tell you how to modify the registry. However, serious problems might occur if you modify the registry incorrectly. Therefore, make sure that you follow these steps carefully. For added protection, back up the registry before you modify it. Then, you can restore the registry if a problem occurs. For more information about how to back up and restore the registry, click the following article number to view the article in the Microsoft Knowledge Base:
322756  (http://support.microsoft.com/kb/322756/ ) How to back up and restore the registry in Windows
If you only have a few volume licensing product keys to change, you can use the Activation Wizard.

Note We recommend that you run System Restore to create a new restore point before you follow these steps.
Deactivate Windows

  1. Click Start, and then click Run.
  2. In the Open box, type regedit, and then click OK.
  3. In the navigation pane, locate and then click the following registry key:
    HKEY_LOCAL_MACHINE\Software\Microsoft\WindowsNT\Current Version\WPAEvents
  4. In the topic pane, right-click OOBETimer, and then click Modify.
  5. Change at least one digit of this value to deactivate Windows.
Reactivate Windows and add new product key

  1. Click Start, and then click Run.
  2. In the Open box, type the following command, and then click OK.
    %systemroot%\system32\oobe\msoobe.exe /a
  3. Click Yes, I want to telephone a customer service representative to activate Windows, and then clickNext.
  4. Click Change Product key.
  5. Type the new product key in the New key boxes, and then click Update.

    If you are returned to the previous window, click Remind me later, and then restart the computer.
  6. Repeat steps 1 and 2 to verify that Windows is activated. You receive the following message:
    Windows is already activated. Click OK to exit.
  7. Click OK.
  8. Install Windows XP Service Pack 1a or a later version of Windows XP.
If you cannot restart Windows after you install Windows XP SP1 or a later version of Windows XP, try the following steps:
  1. Restart your computer and start pressing F8 until you see the Windows Advanced Options menu.
  2. Select Last Known Good Configuration from the menu and press ENTER. This option starts Windows by using a previous good configuration.
  3. Repeat steps 1 through 8 under "Reactivate Windows and add new product key."
If you can install SP1 or a later version of Windows XP and you can restart Windows, you have resolved the issue. If the issue has not been resolved, try method 2 or see the "Next Steps" section for more troubleshooting resources.

Installing Windows Mobile 6.5 on Asus P320 (Updated)


It was great experiance for me to install Windows Mobile 6.5 on my Asus P320, To make it easy i am sharing the step with you all.
First of all Download the WM 6.5 ROM  formhttp://forum.xda-developers.com/showthread.php?p=3542813

1.   Down Load and UNZIP  P320 NEW ROM.  
2.   Directly copy folder “(Folder u have got by unzipping” into the root directory of your micorSD card. 
3.   Advised  to Backup all your Contacts & Messages Using any backup application.
4.   Keep the battery in charge during upgrade procedure.
5.  Press and hold Volume Down key (on left side, shown below) and poke reset button (on bottom side), the system will boot up.
6.  Then release reset button and continue to hold Volume Down key until the  screen shows writing percentage.
     Sometime it will show TTFT USB, it means you have not placed the Flash file inside the Root Folder If it will show Plug the USB  & dont plug.What u have to do is place the FLASH FILE inside the correct folder , as i said in above also.
7. The system will start installation automatically.  It will re-start when system installation is completed. 
8. System will start upgrading after touch panel calibration and date/time setting.

Note:You wont be able to  acess the Start Menu at first Startup, so kindly copy all the files whic are under "Copy all the files which are inside this folder to windows of ur ASUS P30 Phone" folder.
to Windows folder of P320
IF NOT ABLE TO SEE WINDOWS FOLDER IN YOUR PC, FOLLOW THE STEPS.
Go to Control Panel>> Open Folders Tap, Click on View, Uncheck "Hide protected windows operating system files" .
 Enjoy the new look of you Windows Mobile 6.5 :)

Using CASE to transform a result set from multiple rows into a summary row


 Consider the situation where sales data is stored in a table by month. One row is stored per month with a table structure that looks like the following:
CREATE TABLE prodsales
 (product char(3),
  mnth    smallint,
  sales   money)

In this table, sales amounts (sales) are stored by month (mnth) and product code (product). The mnth column stores an integer value ranging from 1 (for January) to 12 (for December). You can use the following single SQL statement to product one row per product with 12 totals, one for each month:

SQL Statement will go like this

SELECT product,
  SUM(CASE mnth WHEN 1 THEN sales ELSE NULL END) AS jan,
  SUM(CASE mnth WHEN 2 THEN sales ELSE NULL END) AS feb,
  SUM(CASE mnth WHEN 3 THEN sales ELSE NULL END) AS mar,
  SUM(CASE mnth WHEN 4 THEN sales ELSE NULL END) AS apr,
  SUM(CASE mnth WHEN 5 THEN sales ELSE NULL END) AS may,
  SUM(CASE mnth WHEN 6 THEN sales ELSE NULL END) AS jun,
  SUM(CASE mnth WHEN 7 THEN sales ELSE NULL END) AS jul,
  SUM(CASE mnth WHEN 8 THEN sales ELSE NULL END) AS aug,
  SUM(CASE mnth WHEN 9 THEN sales ELSE NULL END) AS sep,
  SUM(CASE mnth WHEN 10 THEN sales ELSE NULL END) AS oct,
  SUM(CASE mnth WHEN 11 THEN sales ELSE NULL END) AS nov,
  SUM(CASE mnth WHEN 12 THEN sales ELSE NULL END) AS dec
FROM prodsales
GROUP BY product  
This statement will generates a row for each product with twelve monthly sales totals. The CASE expression causes the sales amount to by added to the appropriate bucket by checking the mnth column. If the month value is for the appropriate “month bucket”, then the sales amount is added using SUM; if not, then NULL is specified, thereby avoiding adding anything to the SUM. Using CASE expressions in this manner simplifies aggregation and reporting. It provides a quick way of transforming normalized data structures into the more common denormalized formats that most business users are accustomed to viewing on reports.
Happy Coding :)

Placing Google Adsense to your each post, (Blogengine.net)


Placing Google Adsense to your each post, (Blogengine.net)
When my Google Adesne approved, i had tried a lot of variation and did code alteration, so that my Adsense Ad appear in my each post. After doing a varity of code variation found a very simple way to implemet this.
To make this easy for all of you i am sharing my method with you all.
1. Get you adesnes code in any text editor, like Notepad.
2. Navigate to theme/<yourthema>/PostView.ascx
3. Edit the PostView.ascx
4. Find out the "PlaceHolder ID="BodyContent" runat="server" tag
5. Paste your Adsens Code just below this tag.(Please note that the script should after PlaceHolder tag and before the closing of div tag
6. Save the code. an dthat 's it.
Enjoy the injection of you Google Adsense Ad to your each post automatically,
Note: As this is an ASCX page you can download the page, edit on your local machine the upload to you site. No need to recompile and republish the entire site.

Method Overloading in Web Services


By default Web Services do not support ‘Method Overloading’.

 Reason:
When data is passed to an XML Web service it is sent in a request and when it is returned it is sent in a response. Therefore, if an XML Web service contains two or more XML Web service methods with the same name, no uniquely identification will be there. Hence it will produce error
To implement method overloading in webservices first you must set the MessageNameattribute of your webservice then set your webservice binding ConformsTo attribute toWsiProfiles.None and that’s it! Note that you can do second step in your Web.Config file for all webservices.
Below is an exaple to implement, Overloading in web service.
Modify the attribute as:
[WebService(Namespace = "http://tempuri.org/")]
[WebServiceBinding(ConformsTo = WsiProfiles.None)]
          
   Complete Code:

[WebService(Namespace = "http://tempuri.org/")]
[WebServiceBinding(ConformsTo = WsiProfiles.None)]
public class Service : System.Web.Services.WebService
{
    public Service () {
    }

    [WebMethod]
    public string HelloWorld()
    {      
        return "hello";
    }

    [WebMethod(MessageName = "HelloWorld2")]
    public string HelloWorld(int i)
    {
        return "Overloading";
    }   
}

A short note on Agile Methodology


Agile methodology is an adaptive methodology, its people oriented.
Here are some of the other characteristics of the Agile
Methodology.

1. Delivery frequently.
2. Good ROI for client.
3. Test frequently.
4. Collaborative approach.

Agile methodology is more of people oriented. Agile methodology helps us to increase productivity and reduce risks.
There are 2 popular agile methods- Extreme programming (XP) and Scrum.
 
People believe that there is less documentation in Agile. But agile also includes documentation and it can be used either
a small or a large projects. In agile Development, testing is also integrated throughout the life cycle. But for the testers,
they will not have a good business requirement. So they have to get the details from the client or through the developer.
The testers will do more of Quality Assurance work than testing.  
 
 Agile Methodology- Characteristics
 Ø  Frequent Delivery
 Ø  More Iterations
 Ø  Test frequently
 Ø  Less defects
 
Agile is software development methodology. It is very effective where Client frequently changes his requirement. 
Since it has more iteration so you can assure a solution that meets clients requirement. More than one build deployement
for a project. It involves more client interection and testing effort. There are two methods by which this methodology 
can be implemented:-
 
1- Scrum
2- Extreme Progamming
 
Scrum: Each iteration would called a scrum which can be a 1- 2 Months.In Scrum Client prioritise his requirements
what he want first. If developer did not meets all the requirement which was being fixed for a perticular scrum than
rest of the development part would be transferred to the next scrum (would be delievered in the next build),  means
developer cann't increase time decided for a scrum It’s fixed.
 
Extreme Programming (XP): here iteration period would be less than in scrum , which is being 2-4 weeks.
Here developer prioritize what to do first on the basis of client requirement. This duration which was being fixed for a
iteration, can be increase if the some development part is still pending. The build would deploy with having all the client 
needs. Thus iteration period is not fixed here it can be increase. but iteration should meets all the client's requirement in 
this build. More attention is required for testing in XP.
 
Apart from all the above answers, just add this important point. There are many flavors of Agile Development:
1- Agile Manifesto
2- (XP) Extreme Programming
3- Scrum
4- Crystal
5- Context Driven Testing
6- Lean Development
7- (Rational) Unified Process
 
 
Agile development methodology attempts to provide many opportunities to assess the direction of a project throughout
the development lifecycle.  This is achieved through regular cadences of work, known as sprints or iterations, at the end
of which teams must present a shippable increment of work. 
Thus by focusing on the repetition of abbreviated work cycles as well as the functional product they yield, agile methodology
could be described as “iterative” 
and “incremental.”  In waterfall, development teams only have one chance to get each aspect of a project right. In an agile 
paradigm, every aspect of development — requirements, design, etc. — is continually revisited throughout the lifecycle. 
When a team stops and re-evaluates the direction of a project every two weeks, there’s always time to steer it in another direction. 
 
The results of this “inspect-and-adapt” approach to development greatly reduce both development costs and time to market. 
Because teams can gather requirements at the same time they’re gathering requirements, the phenomenon known as
“analysis paralysis” can’t really impede a team from making progress.
 And because a team’s work cycle is limited to two weeks, it gives stakeholders recurring opportunities to calibrate releases
for success in the real world. 
 
In essence, it could be said that the agile development methodology helps companies build the right product. Instead of 
committing to market a piece of software that hasn’t even been written yet, agile empowers teams to optimize their release
as it’s developed, to be as competitive as possible in the marketplace. 
In the end, a development agile methodology that preserves a product’s critical market relevance and ensures a team’s 
work doesn’t wind up on a shelf, never released, is an attractive option for stakeholders and developers alike.

AJAX Page life cycle


Asynchronous Postback

An asynchronous postback sends some page data to the server, receives a response, and updates a part of the page. Assume the following scenario for an asynchronous postback:
  • The page contains a ScriptManager control, and the control's SupportsPartialRendering andEnablePartialRendering properties are both true.
  • The page contains an UpdatePanel control, and the control's ChildrenAsTriggers property is true.
  • A button inside the UpdatePanel control initiates an asynchronous postback.
  • A response from the server is returned successfully.
The following client events occur, in this order:
  1. The button inside the UpdatePanel is clicked, which initiates an asynchronous postback.
  2. The PageRequestManager instance raises the initializeRequest event.
  3. The PageRequestManager instance raises the beginRequest event.
  4. The request is sent to the server.
  5. The response is received by the client.
  6. The PageRequestManager instance raises the pageLoading event.
  7. The PageRequestManager instance raises the pageLoaded event.
  8. The Application instance raises the load event.
  9. The PageRequestManager instance raises the endRequest event.
For more information, see Working with Partial-Page Rendering Events.
Note that the load event of the Application instance is raised after the PageRequestManagerpageLoadedevent and before its endRequest event.

Multiple Asynchronous Postbacks

Multiple asynchronous postbacks can occur when users initiate a new request before a previously initiated request has finished processing on the server or in the browser. Assume the following scenario for multiple asynchronous postbacks:
  • The page contains a ScriptManager control and the control's SupportsPartialRendering andEnablePartialRendering property are both true.
  • The page contains an UpdatePanel control.
  • A button inside the UpdatePanel control that initiates an asynchronous postback is clicked two times. The second click occurs while the server is processing the request initiated by the first click.
  • A response to the first request is returned successfully from the server.
The following client events occur, in this order:
  1. A button inside the UpdatePanel is clicked, which initiates an asynchronous postback.
  2. The PageRequestManager instance raises the initializeRequest event.
  3. The PageRequestManager instance raises the beginRequest event.
  4. The request is sent to the server.
  5. The button is clicked again, which initiates a second asynchronous postback.
  6. The PageRequestManager instance raises the initializeRequest event for the second button click.
  7. The PageRequestManager instance raises the endRequest event for the first button click.
  8. The PageRequestManager instance raises the beginRequest event for the second button click.
  9. The request initiated by the second click is sent to the server.
  10. The response is received for the second click.
  11. The PageRequestManager instance raises the pageLoading event.
  12. The PageRequestManager instance raises the pageLoaded event.
  13. The Application instance raises the load event.
  14. The PageRequestManager instance raises the endRequest event.
The default behavior of asynchronous postbacks is that the most recent asynchronous postback takes precedence. If two asynchronous postbacks occur in sequence, and if the first postback is still being processed in the browser, the first postback is canceled. If the first postback has been sent to the server, the server processes the second request when it arrives and does not return the first request. For information about how to give precedence to a specific asynchronous postback, see Giving Precedence to a Specific Asynchronous Postback.