Saturday, June 28, 2008

Inside Arrays

[Reference : Bill McCarthy - ] - I Liked this and I had the direct content on my Blog. Thank you Bill for a nice Editorial.

Inside Arrays

Drill down on how arrays work and learn some cool tips and tricks for taking advantage of them in .NET.

July 2008 · by Bill McCarthy


Arrays are fundamental building blocks for in-memory storage. Arrays are pervasive in .NET, forming the major backbone of many classes, including virtually all collections. Yet many myths surround arrays, their type safety, and their ability to have non-zero bounds. Where there are myths, there are often coding practices that fail to recognize true best practices.

Expect to see Windows 7 arriving sometime around January of 2010, Veghte wrote.

Addressing the Microsoft partner community, Veghte confirmed that Windows 7 will not be a new kernel, but will be built on Windows Vista. Partners can expect less of a surprise in terms of integration and migration efforts than was the case with Vista.

"You've also let us know you don't want to face the kinds of incompatibility challenges with the next version of Windows you might have experienced early with Windows Vista," Veghte explained. "As a result, our approach with Windows 7 is to build off the same core architecture as Windows Vista so the investments you and our partners have made in Windows Vista will continue to pay off with Windows 7. Our goal is to ensure the migration process from Windows Vista to Windows 7 is straightforward."

So does June 30 really signal the end of Windows XP? The answer is that Windows XP is not quite dead yet, but it is mortally wounded, and will limp along under the legal fine print for a few more years.

For instance, Microsoft plans to continue to provide security updates for Windows XP Service Pack 3 until April of 2014, Veghte explained. So current users of Windows XP can expect almost six more years of patch support.

In terms of buying Windows XP directly instead of Windows Vista, that's a little tricky. Microsoft plans to license Windows Vista Home Edition and Windows XP Starter to low-cost computer makers. XP won't be available for new state-of-the-art PCs after June 30, but there's potentially an extension to that deadline if the PC comes from a "system builder." A Microsoft spokesperson dedescribed the availability of XP licensing by e-mail in this way:

"Windows XP will no longer be available for purchase from Microsoft for general retail and OEM partners as of June 30, 2008
System builders will be able to purchase until January 31, 2009
For Windows XP Starter (in emerging markets) and Windows XP Home for NetBooks and NetTops (formerly known as ULCPCs), the date is June 30, 2010
Per our longstanding practice allowing 'downgrade' rights, enterprise customers and purchasers of Windows Vista Ultimate or Windows Vista Business editions can choose to downgrade to Windows XP Professional if they feel they need more time to get ready for Windows Vista."
The difference between a system builder and an original equipment manufacturer (OEM) such as Dell or HP is that an OEM buys software licensing directly from Microsoft, whereas system builders buy it from distributors, the spokesperson explained. The extended date for system builders isn't a loophole but is part of Microsoft's licening agreement, she added.

"As of Jan. 31, 2009 system builders will no longer be able to get XP from Microsoft," the spokesperson wrote. "Whatever stock they still have at this point, they can use as they wish."

An example of a "NetTop" OEM is Asus with its compact Eee PC offering using XP Home. The One Laptop per Child association falls into the emerging market supplier camp. OLPC had been using open-Sugar Linux OS to supply computers to underprivileged kids, but it also plans to use Windows XP.

OEM computer equipment maker Dell pushed out its June 18 deadline of offering new PCs with Windows XP to June 26. The offer applies to Dell's "XPS 630, 720 H2C and M1730 systems." After that time, users can buy Windows Vista Business or Windows Vista Professional and downgrade to XP Professional. However, it'll cost up to $50 to do so.

Only those who buy Vista Business or Vista Ultimate editions will have XP downgrade rights, and they can only downgrade to XP Professional. Windows Vista Enterprise licensees have similar downgrade rights. Those purchasing the less expensive Vista Basic or Vista Home Edition will not have such XP downgrade rights.

It may still be possible for those wanting to get Windows XP after the June 30 date to find the boxed software from a retail outlet or over online sales such as E-Bay. The Microsoft spokesperson said that "Retailers and OEMs can keep selling XP for as long as they have stock."

About the Author

Kurt Mackie is online news editor, Enterprise Group, at 1105 Media Inc.

Thursday, June 19, 2008

Creating Editor Web Parts

When a page is placed in Edit Mode, a user can select to edit a Web Part's
control properties. An *EditorPart* control enables a user to edit an
associated Web Part control to modify its layout, appearance, properties,
behavior, or other related characteristics.

Sometimes the default functionality will not be enough for your needs. For
example, a Web Part could have a string property with complicated validation
logic behind it, or you may want a Web Part property to be a filter field.
You may also want a Web Part to be rendered like a drop-down list, which
will contain dynamically loaded information.

To create an *EditorPart* control, you need to implement a control that
derives from the *EditorPart* class. Next, you will have to override the *
ApplyChanges* and the *SyncChanges *methods. *ApplyChanges* applies changes
made in the editor control to the Web Part control being edited when the
user clicks OK or Apply. The *SyncChanges* method gets the current values of
the Web Part control being edited and passes them to the editor so that the
editor control can edit them (this also avoids synchronization problems
between the Web Part and the editor).

Next, to render your custom HTML, you need to override the *
CreateChildControls* and the *RenderContents* functions.

Here is an example of a skeleton for a ZIP Code editor part, which provides
a text box where you can enter a ZIP Code as well as validate it.

public class ZipCodeEditor : EditorPart
TextBox input = null;
Label displaymessage = null;
Literal lineBreak;
protected override void CreateChildControls()
input = new TextBox();
lineBreak = new Literal();
lineBreak.Text = @"
displaymessage = new Label();
protected override void RenderContents(HtmlTextWriter writer)
public override bool ApplyChanges()
//validation logic

//if ValidationSuccessful
ZipCodeWebPart part = (ZipCodeWebPart)WebPartToEdit;
// Update the custom WebPart
part.ZipCode = input.Text;
catch (Exception exc)
//error handling
return true;
public override void SyncChanges()
input.Text = ((ZipCodeWebPart)WebPartToEdit).ZipCode;

To associate the editor part with your Web Part, you will need to override
the *CreateEditorParts* method in the Web Part where you will create the
instances of the editor parts. An example of this is as follows:

public class ZipCodeWebPart : System.Web.UI.WebControls.WebParts.WebPart
protected string _zipcode;
public ZipCodeWebPart()
[Personalizable(PersonalizationScope.Shared), WebBrowsable(false),
WebDescription("The ZipCode")]
public string ZipCode
get { return _zipcode; }
set { _zipcode = value; }
public override EditorPartCollection CreateEditorParts()
ArrayList editorArray = new ArrayList();
ZipCodeEditor edPart = new ZipCodeEditor();
edPart.ID = this.ID + "_editorPart1";
EditorPartCollection editorParts =
new EditorPartCollection(editorArray);
return editorParts;
protected override void RenderContents(HtmlTextWriter writer)
protected override void Render(HtmlTextWriter writer)

How to Export Sharepoint Site and Data?

Use the following command to export complete site information. It shall copy data, list schema, pages, onet and every other thing. However if you configure the view on the webpart zone, it doesnt pick the view.

stsadm -0 export -url http:/// -filename .bak -includeusersecurity -versions 4

Thursday, June 12, 2008

Creating WebBrowsable Properties in WebParts

use WebBrowable along with Personalizable attribute on the Public Property to get property visible in the Editors Section.

for example if you want to display the Public Property Show Zipcode... use the below code.

private string _sZipCode;
Public string SetZipCode
get {return _sZipCode; }
set {_sZipCode = value; }

this would appear in the Misc Section when Modify Webpart is selected.

Monday, June 9, 2008

Sharepoint Layout Toggle Command

if you want to togle the page (sharepoint) to design mode; then use this command directly on the browser: javascript:MSOLayout_ToggleLayoutMode();