Proud to be an Indian?

Seeing what happened yesterday, one of my close friend wrote a mail and expressed his feelings. I thougth to it broadcast his voice on a larger medium.

Here how it goes.

We feel proud while saying we are Indians, right. BULLSHIT !!!

We feel so proud by saying India is emerging to be great nation and we compare ourselves to other nation.

We say we are emerging in technologies, which are outdated or getting faded out.

We say we are the only one nation to have many regilions butinstead of respecting and nurturing it, we fight over religions just to prove that our religion is supreme. Religions were never meant for fighting. They were meant for beliefs and feel the divine in you. They were created to be honest, respectful, helpful, joyful. But instead we divide it. What for??

We say we have rich heritage and great culture, Do you see?, I dont. We label the bending of culture as the progress.

Spoling the heritage by garbaging and and writings your lover names.

We say we have great histroy, great people scarificed lives for the nation. Please dont insult them by saying this. They fought to make india a great nation. Gave lives so that the future INDIANS, irrespective of their families do better and have a good living but now it is our families only.

We so called MODERN INDIAND are SPINLESS.. we don’t respect ourselves, then we should not expect any government to protect us.

We bend rules and regulations and feel proud of doing it. We people bribe government officers and we say they are corrupt.Government is corrupt, they are bastards and n number of things we say, so why do we select them. We dont vote, or vote just for formality without knowing how the candidate is.. Are you kidding me??

Terrorist attacks, Scams, Bribery, we are the reasons for that. Agree or not that is the fact.

Whenever some unlawful incident happen we blame government or officials . Scam happen blame government. Why?? We selected them and so we bear the fruit.

Incident like yesterday and previous too should have been an eye opener but no, we are in sleep and we want to be like that.

We Indians are known as peaceful people, we claim to have the high spirits and come out incident like yesterday in no time. Is that the reason or are we too coward to even accept the fact we are afraid. We are now habituated to such things. In India there is no values for human life. We have no morals for ourselves and we live like salves to this so called Modern and Corporate world. We are not confident enough to keep our head high and live, We forgot to live.

BHAGAT SINGH fought the whole ruling empire just to have a better living condition being a prisoner and we live like prisoner being free.

GHANDHI picture was printed on the currency so that he could be respected, instead we disrespect him by giving the same money in bribe.

GUYS c’mon, We are INDIANS, the largest democratic country in the world. We have it in ourselves. It is our country our own motherland and shouldnt be treating it with entire dignity and respect.

KNOW YOUR RIGHT, BE RESPONSIBLE, BE A CHANGE TO SEE CHANGE. It is the time to step ahead. CMON we surely can do better than burning candles and feeling sorry for the lost one. Make every life count.

Bahubali Mody

“WE HUMANS- we humans, together can make a big diffrence.

So, what life will you choose now?

Updating database using dataset

This topic illustrates how to update data in a database using a DataSet. It is important to remember that you can also insert, update, and delete data in a database directly using a SqlCommand.

Once the DataSet is loaded, you can modify the data, and the DataSet will track the changes.

The DataSet can be considered an in-memory cache of data retrieved from a database. The DataSet consists of a collection of tables, relationships, and constraints. In this example we will show how to use the Delete method on the DataSet to Delete rows from the database.The Database values are updated with those from Dataset using Update method of SqlDataAdapter

Below are some simple steps to preform  Delete operation on Dataset.

STEP  1 : Fill the Dataset with the data you required and bind it to grid.

STEP 2: To Delete a particular row from dataset we required its DatasetIndex, to know the DatasetIndex we perform the delete operation on Grid’s ItemCommand Event.

If e.CommandName = "Delete" Then
 parentset.Tables(0).Rows(e.Item.DataSetIndex).Delete()
End If
dgUser.DataSource = UpdateDatabase(parentset, "OleDb")
dgUser.DataBind()

STEP 3: Create a new instance of OleDbDataAdapter and pass the required parameters, you can either pass OleDbCommand object or write down the Sql statement alongwith the ConnectionString.

Create a instance of OleDbCommandBuilder, it is used to update the changes from Dataset to Database. The parameter required for OleDbCommandBuilder is OleDbDataAdapter with a SELECT Sql statement. The command builder will automatically generate INSERT,UPDATE & DELETE statements for the table and parameters used in SELECT statement.

Public Function UpdateDatabase(ByRef dataSet As DataSet, ByVal Provider As String) As DataSet
If Provider = "OleDb" Then
 Dim dbAdapter As New OleDbDataAdapter("SELECT Sql Statement",ConnectionString)
 Dim objCommandBldr As New OleDbCommandBuilder(dbAdapter)
 dbAdapter.Update(dataSet)
ElseIf Provider = "SQL" Then
 Dim sqlAdapter As New SqlDataAdapter("SELECT Sql Statement",ConnectionString)
 Dim sqlCommandBuilder As New SqlCommandBuilder(sqlAdapter)
 sqlAdapter.Update(dataSet)
End If

Return dataSet

STEP 4: Build & Execute.

Here is the link to download the sample application which will demonstrate the above behavior.

You can also find a detailed explanation of Updating Database using Dataset over here.

Enjoy Coding and Keep Learning🙂

Insert Code Snippet – Tip Of Week#1

Hi guys, do you know you can use already ready code inside your visual studio? Yes certainly you can insert code snippets into your code. You can invoke the “Insert Snippet” by using shortcut “ctrl k + ctrl x”

Be Sunshine Happy :)

What makes some people simile and stay sunshine happy, almost all the time? These optimists refuse to get crushed by bad news and spread the sounds of laughter and hope. They are all around us, trying to give those who’re sulking, frowning and sad, a simple lesson in the pursuit of happyness.

Most people are happy if their wishlist is fulfilled. But that’s not real happiness. It’s a fluctuating happiness index which dips if they fall ill or experience heartbreak. Happy energy wouldn’t be dependent on outside factors, it has to come from within. There are people, who have everything they desire and are still unhappy. Choose your emotions and thoughts. Free yourself from past baggage, mistakes and regrets. Choose to be happy.

There’s something about being genuinely happy. Why should your happiness be dependent on tha global economy, your work environment or your spouse’s behaviour?

Moods sway from dark to happy for everyone. Everyone has the power to be totally happy, which is a cultivated art. Can you be really happy in tough times?

Optimism has nothing to do with the future, rather, it is a description of reality. The real definition of optimism was relevent in good and bad times, you just have to choose to be happy, despite whatever happens.

Live life to full, never pay attention to failures. Every minute whatever you do, you should enjoy by saying yes more than by saying no. Always have faith that’s the way to open doors. Once you decide you’ll be happy, that’s what you ‘ll create in your life.

For optimists all experiences are positive, as they bring new opportunity. Hence, happiness is a decision.

Don’t label situations good or bad. When unhappiness onfronts you, rather than running away, exercise the force of will to run through it. It’s not just in thought but in action too. If you have to experiment with new ideas, you’ll experience setbacks. you should not let it intimidate or overwhelm you. Have the will to be happy from inside.

The way to bring happiness is to work honestly and to share. Ther has to be a sense of detachment from external situations.

Work on happiness as a skill to be developed. Let happines be a learnt reaction. You’ll have to work at being happy. But it’ll be rewarding and bring you real joy.

Tell yourself every minute. “It’s in my power to be happy, no matter what!”

How to be Sunshine Happy,

– Don’t label situations or experiences as good or bad.

– Empower yourself to be happy.

– Look within for happiness

– Don’t get affected by bad news

– Choose your emotions. Keep saying, ‘I choose to be happy’

– Conserve your energy, don’t let people sap it

– If you’re hurt, don’t be dependent on anyone else to heal

– Don’t indulge in hurt

– Don’t be imprisoned in you past or have self-pity

Using ParseQueryString to get QueryString Values

Following is the sample code you can use to parse your querystring and return NameValueCollection


protected void Page_Load(object sender, EventArgs e)
 {
 String currurl = HttpContext.Current.Request.RawUrl;
 String querystring = null ;

// Check to make sure some query string variables
 // exist and if not add some and redirect.
 int iqs = currurl.IndexOf('?');
 if (iqs == -1)
 {
 String redirecturl = currurl + "?var1=1&var2=2+2%2f3&var1=3";
 Response.Redirect(redirecturl, true);
 }
 // If query string variables exist, put them in
 // a string.
 else if (iqs >= 0)
 {
 querystring = (iqs < currurl.Length - 1) ? currurl.Substring(iqs + 1) : String.Empty;
 }

// Parse the query string variables into a NameValueCollection.
 NameValueCollection qscoll = HttpUtility.ParseQueryString(querystring);

// Iterate through the collection.
 StringBuilder sb = new StringBuilder("");
 foreach (String s in qscoll.AllKeys)
 {
 sb.Append(s + " - " + qscoll[s] + "");
 }

// Write the result to a label.
 ParseOutput.Text = sb.ToString();

}

This is the front end code ,


<form id="form1" runat="server">
 Query string variables are:
 <asp:label id="ParseOutput" runat="server">
 </asp:label></form>

Hope this Helps🙂

JQuery in Visual Studio

A big part of the appeal of jQuery is that it allows you to elegantly (and efficiently) find and manipulate HTML elements with minimum lines of code. jQuery supports this via a nice “selector” API that allows developers to query for HTML elements, and then apply “commands” to them. One of the characteristics of jQuery commands is that they can be “chained” together – so that the result of one command can feed into another. jQuery also includes a built-in set of animation APIs that can be used as commands. The combination allows you to do some really cool things with only a few keystrokes.

For example, the below JavaScript uses jQuery to find all <div> elements within a page that have a CSS class of “product”, and then animate them to slowly disappear:

$(“div.product”).slideUp(‘slow’).addClass(“removed”);

As another example, the JavaScript below uses jQuery to find a specific <table> on the page with an id of “datagrid1”, then retrieves every other <tr> row within the datagrid, and sets those <tr> elements to have a CSS class of “even” – which could be used to alternate the background color of each row:

$(“#datagrid1 tr:nth-child(even)”).addClass(“even”);

The jQuery library also works well on the same page with ASP.NET AJAX and the ASP.NET AJAX Control Toolkit.

Visual Studio figures out external script references, such as to JQuery, by following special reference comments it finds at the top of .js files:

/// <reference path="jquery-1.2.3.js" />

You can download the JQuery from here. You can get more details on JQuery from http://jquery.com/ .

For intellisense support for JQuery you need to install this Hotfix.

Comment for javascript is written inside for intellisense support. JavaScript has the interesting feature that calling toString on a function returns the code of this function including the comments and thus the doc comments. Here’s a similar example in JavaScript where the documentation is written inside of a class constructor:

jsintellisense

Another difference with C# or VB.NET is that property and event accessors are two different entities in JavaScript. For this reason, to choose where the documentation should be for those members. Properties should be documented in the getter and events in the “adder” for this reason:

js