Skip to main content

Posts

Showing posts from July, 2005

Time management !!!

Yesterday, attended my first lecture on Time Management as part of my E-MBA course.

The crux of the matter was to able to save 20 minutes of quality time a day.

Some sample equation...

20 minutes a day
600 minutes a month
7200 minutes a year. i.e 120 hours a year..

For 25 years + more of life time you have got 3000 hours of more time which you can utilise to achieve your life goals..

To manage time ==> is to manage self.
And self management requires some discipline which is not developed overnight.
Patience and practice is required...

More to come...

Really Simple Syndication (RSS)

RSS is a Web content syndication format.
Its acronym stands for Really Simple Syndication.
RSS is a dialect of XML. All RSS files must conform to the XML 1.0 specification, as published on the World Wide Web Consortium (W3C) website.

For more info...
Click here RSS

Sample code to read RSS feed in asp.net..

private DataTable GetRSSFeed(string strURL )
{
//Retrieve the XML data
XmlTextReader reader = new XmlTextReader(strURL);
DataSet ds = new DataSet();
ds.ReadXml(reader) ;
return ds.Tables[2];
}

// for displaying the RSS feed add the following code to the page load event.
private void Page_Load(object sender, System.EventArgs e)
{
string strURL = Server.MapPath
("rss.xml"); //"http://rajeshpillai.blogspot.com/atom.xml";
dgRSS.DataSource = GetRSSFeed(strURL);
dgRSS.DataBind();
}


When the dataset is generated from ReadXML, three tables are created in the dataset, one for each rss, channel and item tag.
Since we are only interested…

Design Pattern - Strategy

Today out of curiosity, I was experimenting with strategy design pattern.
Here's the outcome of my experiment.

Strategy pattern falls under the Behavioral category.

The Intent:
Define a family of algorithms, encapsulate each one, and make them interchangeable. Strategy lets the algorithm vary independently from clients that use it.
The strategy pattern embodies two fundamental principle of object oriented programming. First encapsulate the concept which changes behaviour and program against the interface.

I had written a small notepad application to illustrate the use of strategy.
Other things remaining same, the dynamics of the pattern is applied when using the "find" method in the notepad. Based on the user's selection either a normal "find" alogrithm is invoked or a "regex" based algorithm is used.

The application being trivial, you wont find much regex code. Its used only for demonstration purpose.

Dissecting the application

(1) Program against the i…

.net Reflection Tip

To convert a string to its corresponding type use the following code snippet...
///
/// To get the underlying property type for the object
///
/// The object for which u r finding the property info.
/// The name of the property.. eg. For form object, say finding the Location property
/// The property value.
/// An object containing the underlying propertytype.
private object ConvertStringToPropertyType(object control,
string propertyName,
string val)
{
object result = null;

Type type = control.GetType();
PropertyInfo p = type.GetProperty(propertyName);
Type propertyType = p.PropertyType;

TypeConverter converter = TypeDescriptor.GetConverter(propertyType);
result = converter.ConvertFrom(val);

return result;
}

for eg. if you pass