see my article about saving webform data in ASP.NET on code project
http://www.codeproject.com/useritems/AutoSaveFormData.asp
Friday, June 30, 2006
Wednesday, May 03, 2006
A quote
When I was a kid I used to pray every night for a new bike. Then I realized that The Lord doesn't work that way, so I stole one and asked him to forgive me." Erno Philips
Thursday, April 13, 2006
ASP.NET Debug true
“When debug is set to true, asp.net requests will not time out. This is to allow you to debug with visual studio at your own pace without having to worry about the requests suddenly disappearing. Of course in a production environment timeouts are crucial to avoid for requests to be stuck indefinitely, so this is reason #1 to make sure debug is set to false when the application is deployed into production.”
From http://blogs.msdn.com/tess
From http://blogs.msdn.com/tess
Monday, February 13, 2006
Writing Code...
“Writing specifications is like writing a novel. Writing code is like writing poetry"
Tuesday, January 24, 2006
Delegates and Events in C# (1.1)
Delegates and Events in C# (1.1)
An excellent article
http://www.akadia.com/services/dotnet_delegates_and_events.html
An excellent article
http://www.akadia.com/services/dotnet_delegates_and_events.html
Debugging ASP.NET Applications with VS 2003
Debugging ASP.NET Applications with VS 2003
after hours of troubleshooting, I found this
If you created the Web project with a full machine name (like machinename.domainname.something), the Web site is recognized as Internet site. So, the default setting of Internet Explorer will impact on the behavior of logging on. In this case, you need to enable logging on with your current user account in "Internet" area with the IE setting.
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dv_vstechart/html/vsdebug.asp
Thursday, January 19, 2006
Getting Caller method info
Getting Caller method name from method
StackTrace st = new StackTrace();
string str = st.GetFrame(1).GetMethod().Name;
StackTrace st = new StackTrace();
string str = st.GetFrame(1).GetMethod().Name;
Monday, January 16, 2006
Regular Expression
Regular Expression to select HTML elements from the text
<select.*?</select>
.*? is for lazy (non-greedy) capture of the pattern.
<select.*?</select>
.*? is for lazy (non-greedy) capture of the pattern.
Friday, January 06, 2006
SPS 2003 installation Issue
SPS 2003 installation: Installation ended prematurely because of an error
When re-installing SPS 2003 on a Windows 2003 Server, I got the error "Installation ended prematurely because of an error".
To resolve this issue, I’ve to remove the Windows SharePoint Services 2.0 and then run the setup of SharePoint portal server 2003 again. This will make the installation of SharePoint Portal Server 2003
When re-installing SPS 2003 on a Windows 2003 Server, I got the error "Installation ended prematurely because of an error".
To resolve this issue, I’ve to remove the Windows SharePoint Services 2.0 and then run the setup of SharePoint portal server 2003 again. This will make the installation of SharePoint Portal Server 2003
Thursday, January 05, 2006
Notes on C# 2.0 (Nullable Types)
C# 2.0 ( Nullable Types)
Nullable types are constructed using the ? type modifier. This token is placed immediately after the value type being defined as nullable. The type specified before the ? modifier in a nullable type is called the underlying type of the nullable type. Any value type can be an underlying type.
int? i;
Point? nullPoint = null;
i = null;
nullPoint = new Point?(point);
public struct Real
{
int internalVal;
public Real(int realNumber)
{
internalVal = realNumber ;
}
}
Real? real = new Real?(new Real(3));
The null coalescing operator takes as arguments a nullable type to the left and the given nullable type’s underlying type on the right. If the instance is null, the value on the right is returned otherwise the nullable instance value is returned.
int? i;
i = 10;
int j = 20;
string str = Convert.ToString(i ?? j);
MessageBox.Show(str);
The statement (i ?? j) returns i if i is not null, otherwise it returns j.
The new ?? binary operator allows you to conditionally test for null and use an alternative value instead. For example, consider the following assignment.
int myvalue = (x != null ? x : 0);
With the ?? operator, this can be rewritten as:
int myvalue = x ?? 0;
This indicates to assign the value of x to the myvalue variable or 0 in the case that x is null.
Nullable types are constructed using the ? type modifier. This token is placed immediately after the value type being defined as nullable. The type specified before the ? modifier in a nullable type is called the underlying type of the nullable type. Any value type can be an underlying type.
int? i;
Point? nullPoint = null;
i = null;
nullPoint = new Point?(point);
public struct Real
{
int internalVal;
public Real(int realNumber)
{
internalVal = realNumber ;
}
}
Real? real = new Real?(new Real(3));
The null coalescing operator takes as arguments a nullable type to the left and the given nullable type’s underlying type on the right. If the instance is null, the value on the right is returned otherwise the nullable instance value is returned.
int? i;
i = 10;
int j = 20;
string str = Convert.ToString(i ?? j);
MessageBox.Show(str);
The statement (i ?? j) returns i if i is not null, otherwise it returns j.
The new ?? binary operator allows you to conditionally test for null and use an alternative value instead. For example, consider the following assignment.
int myvalue = (x != null ? x : 0);
With the ?? operator, this can be rewritten as:
int myvalue = x ?? 0;
This indicates to assign the value of x to the myvalue variable or 0 in the case that x is null.
Tuesday, December 27, 2005
Tuesday, December 20, 2005
quotes from Debugging the Development Process
quotes from ‘Debugging the Development Process’ , Steve Maguiret)
- Don’t waste the developers’ time on work that does not improve the product.
- Always determine what you’re trying to accomplish, and then find the most efficient and pleasurable way to do it.
- Establish detailed project goals to prevent wasting time on inappropriate tasks.
- Don’t Fix Bugs Later, Fix them now.
- Regularly Stop what you’re doing and look ahead, make little adjustments now to avoid big obstacles later on.
- Each day, ask, “What can I do today to help keep the project on track for the next few months?”
- Don’t waste time working on the wrong problem. Always determine what the real problem is before you try to make a fix.
- People often ask for something other than what they really need. Always determine what they are trying to accomplish before dealing with any request.
- Never commit the dates you know you can’t meet. You’ll hurt everybody involved.
- Beware of recurrent meetings. Make sure they’re worth the disruption they cause.
- Before calling any meeting, be sure you know exactly what you want to achieve and what you need to achieve it. Then make sure you do achieve it.
- Make sure each team member learns one new significant skill at least every two months.
- Watch out for and correct the “It’s too much work” reaction. Train programmers to first consider whether task makes sense and whether it matches up with the project goals and priorities.
- Don’t ship substandard feature. Postpone them until you can implement them properly.
- Give some priority to writing easily shared code. Programmers can’t share each other’s code unless they’re writing it so that it can be shared.
- If your project is slipping, something is wrong. Don’t ignore the cause and demand long hours of the team members. Find and fix the problems.
- Beware of the misguided belief that long hours result in greater productivity. If anything, long hours only hurt productivity.
- Stress the importance of thinking hard, not working hard.
- Train the development team to work efficiently during a normal workday. Don’t allow them to work long hours, which servers only to mask time-wasting activity.
Tuesday, November 22, 2005
event handler: Cannot complete this action
I made an event handler for doclibs to log the document updating and deletion activities. After deployment, the event handler for document library was logging the delete event but giving the exception on update event: “Cannot Complete this action, Please try again.”
After much effort, I found that the problem was with WSS Service Pack 2, and the exception was raised when try to access SPListItem collection.
The issue was because of increased security with WSS sp2.
http://support.microsoft.com/default.aspx?scid=kb;en-us;909455
The resolution is
using System.Security.Principal ...
WindowsImpersonationContext wic = WindowsIdentity.GetCurrent().Impersonate();
//implement OM code here
wic.Undo();
Thursday, November 17, 2005
Attach an Event sink with Multiple Document Libraries
Attach an Event sink with Multiple Document Libraries
There is no easy way in SPS 2003 to attach an event sink with multiple document libraries. You have to iterate each one manually or programmatically, following is the hack for this (SPS 2003)
For existing doclibs
Db: _Site
update lists set
tp_EventSinkAssembly = 'WSSEventSink, Version=1.0.0.0, Culture=neutral, PublicKeyToken=56761703e95c64a0',
tp_EventSinkClass ='WSSEventSink.EventSink'
where tp_ServerTemplate = 101 --doclib
For newly created doclibs
Schema.XML
<List EventSinkAssembly="WSSEventSink, Version=1.0.0.0, Culture=neutral, PublicKeyToken=56761703e95c64a0" EventSinkClass="WSSEventSink.EventSink"
There is no easy way in SPS 2003 to attach an event sink with multiple document libraries. You have to iterate each one manually or programmatically, following is the hack for this (SPS 2003)
For existing doclibs
Db: _Site
update lists set
tp_EventSinkAssembly = 'WSSEventSink, Version=1.0.0.0, Culture=neutral, PublicKeyToken=56761703e95c64a0',
tp_EventSinkClass ='WSSEventSink.EventSink'
where tp_ServerTemplate = 101 --doclib
For newly created doclibs
Schema.XML
<List EventSinkAssembly="WSSEventSink, Version=1.0.0.0, Culture=neutral, PublicKeyToken=56761703e95c64a0" EventSinkClass="WSSEventSink.EventSink"
Friday, January 14, 2005
Wednesday, January 12, 2005
Tuesday, January 11, 2005
Subscribe to:
Posts (Atom)