Saturday, February 20, 2010

Story India..

There is a very good compilation of thoughts around India's growth story.. with real facts and figures put together by Mr. Gurcharan Das...

Check it out.. its really informative..
India's Future | Gurcharan Das

Thursday, December 24, 2009

Keeping track of important dates!!!!

I ain't good when it comes down to remembering dates for important events like birthdays and anniversaries. Made an attempt to make life little easier for all the people out there like me. ;)

try out dates reminder

& provide feedback!!!!

Always be part of people's happy moments!!! :)

Tuesday, October 6, 2009

My first blog from US!!!!

Haven't written in a long time now. Things have been keeping me busy lately. But here I am, landed in California US; 3-4 weeks back, started working for new partner. This time it is going to be a while before I take off again.

So how has it been? I would say a little rough. Things are going great at work, with nobody knows what the exact requirements are, nobody at partner site is ready to own the product which supposedly we have to build, wow.. read it as complete fun. With these challenges, I am sure you will agree, life becomes real fun. You work in multiple roles..business analyst.. software designer and then developer, and in the process you learn a lot. And I am learning my bit I guess.

Settling down was another uphill task, which included looking for an apartment, cutting a good deal, buying a car among others. Now, these tasks were tough. I believe I underestimated these. I am expecting Craig List people to send me goodies for all the hits I have made to their site. I should be granted Gold membership with extra privileges. Man, I have spent hours everyday in last 4 weeks looking for a car on craiglist.org. It took me talking to more then 100 people over phone, to check out more then 10cars in person to buy a car, aah, finally manage to buy a Nissan Maxima, V6, 3.0ltr (3000cc).. powerful vehicle!!! Things have become pretty convenient since then, moving around has never been so easy. Public transport in this part sucks!!!

So in a nutshell, its been a roller-coaster ride so far, and hope it remains this much fun.

More soon!!!! (this is first of the US series..)

Monday, June 22, 2009

TextBox control (ASP.NET) to accept only numeric values

Very often for data entry screens in a web-application, we have a requirement for having text-box control to accept only numeric characters.. there is no ready-made control available with available server controls.. but there are couple of simple ways in which we can achieve this kind of behavior..

1. simply use a textbox control, and put a regular expression validator on this box.. with regular expression as \d+.. and you are done..

2. use a simple javascript function to do the same, and grab the keypress event for the box..

function blockNumber(e)
{
var keychar;
var reg;
keychar = String.fromCharCode(e.keyCode);
reg = /\d/;
return reg.test(keychar);
}


this function will block user from entering any character other then numbers.. add this function call as attribute for onkeypress event...

txtMyBox.Attributes.Add("onkeypress", "return blockNumber(event);");


and you are done..

isn't this simple or what!!! :)

Monday, June 8, 2009

Managing Holiday List (Calendar Control ASP.NET)

typical requirement.. to manage custom holiday list to be used in some SLA calculations.. and this was suppose to be conventional web based..
Before this I never played that much with ASP.NET Calendar control.. so I decided to give it a shot..& see if requirement can be met.. and to my surprise.. it shaped-up real fast & good by the late afternoon.. in just couple of hours I had this screen up-n-running!!! :D

steps --- 1. created a table (HolidayList) in DB with single field as Holiday Date.
2. drag asp.net calendar control on the form (refer image above.. left middle side.. )
3. get the holiday list collection from HolidayList table (from DB)...
4. Few events which will make the thing going...
a. OnDayRender - this event is fired when a day is getting rendered on calendar.. & gives 'DayRenderEventArgs e', having the day/cell/url for each day which is getting rendered.. all you need is to check the day with the holiday list.. if matched.. change the look & feel of the cell (viz. Table Cell)..
e.Cell.BackColor = System.Drawing.Color.Silver;
e.Cell.ForeColor = System.Drawing.Color.Black;
e.Cell.Font.Bold = true;

b. OnVisibleMonthChanged - fired when month is changed by user.. all we need to do is to get data for this month.. & keep the collection for DayRendering..
c. OnSelectionChanged - fired when date selection is changed by user.. this event gives me the opportunity to capture the selected date and store it in DB (Holiday List table).. refresh the holiday list collection..
5. dragged a ListBox server control to help me with removal of dates from the list.. allowing multiple selection.. and remove button.. simply check for selected dates & remove them from data table (holiday list.. )
foreach (ListItem lstItem in lstHolidays.Items)
{
if (lstItem.Selected)
{
DateTime dt = Convert.ToDateTime(lstItem.Text);
hlfactory.Delete(dt);
}
}


few other supporting operations required (for data insertion/deletion etc.)... & you are done.. it is this simple!!!


Sunday, May 24, 2009

Visual Studio 2010 and ASP.Net 4.0 (Beta1)

Is it MS running a little too fast in releasing newer versions.. I don't know..
Visual studio 2008.. did anybody get hang of it for its new features (read hang of major parts of new features/enhancements).. no data available on net.. but personal thought.. not really.. as with any medium or big sized company.. they do not move this fast.. they let development infrastructure to mature a bit.. before taking it to Prod box.. and people delivering these systems.. seldom get a chance to become hands-on.. with new technology.. which result in less penetration.. comments??

FYI... Visual Studio 2010 (beta) is already here.. jQuery/Silverlight integrated.. more intellisense for jscript.. integration with MS Office development tools..

this post is more of an announcement of beta release.. my bit in promoting MS products... !!!! :D

Saturday, May 23, 2009

Extending Checkbox Web Control for persisting initial state!!!

so we show list of items with checkboxes to capture responses from user.. and we bind it from values received from data store.. after user has provided input and submitted the response.. on server side we always need some value set to compare the responses provided with initial data values to figure out what has changed..

we figured out a simple solution for this in our project.. creating a simple extension of Checkbox webcontrol class.. 'PersistInitialStateCheckbox' class...
[ToolboxData("<{0}:PersistInitialStateCheckbox runat=server>")]
public class PersistInitialStateCheckbox: System.Web.UI.WebControls.CheckBox { ... }

the only purpose of this control was to introduce one extra property 'InitialState' (a boolean value)..
///


/// Initial Value of the dropdown list
///

[Bindable(true),
Description("Initial Value"),
Category("Custom"),
Browsable(true),
DefaultValue("False")]
public bool IntialState {
get {
if(this.ViewState["IntialState"] != null)
{ return (bool)this.ViewState["IntialState"]; }
return false;
}
set { this.ViewState["IntialState"] = value; }
}

which is rendered along with the control..
protected override void AddAttributesToRender(System.Web.UI.HtmlTextWriter writer)
{
base.AddAttributesToRender(writer);
writer.AddAttribute("InitialValue", IntialState.ToString());
}

so whenever data is posted back.. server code can simply compare the Initial State value with current value..
if (PersistInitialStateCheckbox.IntialState == PersistInitialStateCheckbox.Checked)
{ ... }

Enjoy coding!!! ©