Tuesday 25 December 2012

Getting Timezone ID through javascript

Introduction:

It happens to me most of the time that I need to find user local timezone id in my projects. So here is the solution. Use it in your app and enjoy.


CODE:

<script language="javascript">

function GetUserTimeZoneID(){
    var timezone=String(new Date());
     return timezone.substring(timezone.lastIndexOf('(')+1).replace(')','').trim();
     }


</script>

Wednesday 15 February 2012

Getting value from HashTable

Hi Big,

I have faced this problem many times I junked into the logic. Getting Value/Key from the HashTable is needed every time we work with two values simultaneously. So I thought to write it here. There are two way to do this one is from DictionaryEntry collection and through IDictionaryEnumerator.


HashTable objHash=new HashTable();

objHash.Add(1,"AAA");
objHash.Add(2,"BBB");

1:Getting through DictionaryEntry:

foreach (DictionaryEntry entry in objHash)
            {
                Console.WriteLine(entry.Key.ToString()+","+entry.Value.ToString());
            }

 2:Getting through IDictionaryEnumerator:

            IDictionaryEnumerator objDictionary = objHash.GetEnumerator();

            while (objDictionary.MoveNext())
            {
                Console.WriteLine(objDictionary.Key.ToString()+","+objDictionary.Value.ToString());
            }

Friday 10 February 2012

Programming tips

Hi friends,

Here are some programming tips you can use while developing your application for you or your organization.

  • Before start programming be assure you are very much clear and aware about the requirements. Once you are done with the requirement analysis then only you should start doing this. Partial knowledge can put you in very serious problem. Sometime it may also happen that your client complains that this was not the actual requirement.
  • Once you are done with your first step you can further go for your second step that is creating your flow diagram, DFDs and class diagrams. Remember this is the main steps you are taking which will lead in success/failure of your project. After first step this step is very much clear as you already know what you are going to do. In this step you will design your database structure, flow of your project and many more. It will help your developers in different manner like from now you are freezing your requirements and creating a basic building block which is visible to everyone. Everybody is clear now that what they are going to build.