Nibha's World

Wednesday, September 26, 2007

Binding Data Source for asp DropDownList with Dictionary

While I was trying to bind data source (which is dictionary) I got a way to bind data.

The drop down control in .aspx page




DataBinding in .aspx.cs

Dictionary cityDataList = new Dictionary();
cityDataList.Add("DEL", "Delhi");
cityDataList.Add("BOM", "Mumbai");
cityDataList.Add("MAA", "Chennai");
cityDataList.Add("GOI", "Goa");

// Binding dictionary data with DropDownList
foreach (string key in cityDataList.Keys)
{
CityList.Items.Add(new ListItem(cityDataList[key], key));
}

Labels: ,

Monday, July 09, 2007

Catch Error Response xml in case of web services exception

While I was working on web services consumption, there was a issue in web services that if I send any wrong request xml, web service server send a web exception "(500) Internal Server Error." But the actual response xml was not catched through it.
For catching this I was using HTTP Debugger Pro. But HTTP Debugger has one drawback that we cannot use it in release version (It is used only for developement server.) :(
Then I try to catch this issue at the programming logic.

HttpWebRequest req = (HttpWebRequest)WebRequest.Create(requestUrl);

req.Method = "POST";
req.ContentLength = request.Length;
req.ContentType = "text/xml;charset=\"utf-8\"";
req.Accept = "text/xml";
req.Headers.Add("SOAPAction", headerUrl);
req.KeepAlive = false;

Stream str = req.GetRequestStream();
StreamWriter writer = new StreamWriter(str);
writer.Write(request);
writer.Flush();
Stream resp = Stream.Null;
WebResponse response = null;
try
{
response = req.GetResponse();
resp = response.GetResponseStream();
}
catch (WebException ex)
{
HttpWebResponse errResp = ex.Response as HttpWebResponse;

if (errResp == null)
{
throw new WebException("Response was null");
}
using (StreamReader reader = new StreamReader(errResp.GetResponseStream()))
{
string error = reader.ReadToEnd();

throw new WebException(ex.Message + "Error response XML: " + error);
}
}



And Guys it works :)


Tuesday, December 05, 2006

Vegeterian vs Non-Vegeterian

Last week we (Tekriti people) did sharing forum on Veg vs Non-Veg. This was really a type of disputing GD. Few people were in favour of Vegeterian and few were with non-veg. I noticed few things at time of GD that we should not go for such type of discussions with out being prepared.
At the time of GD I was in favour of vegeterian and was not having good things to speak out instead of its against emotional feelings & ethics and I dont like to kill any animal for my pleasure only.
As I thought of writing a post and just search for "Reason for being vegeterian" and I found a lot of reasons.
And then I tried for "Reason for being non vegeterian" and result was intresting, found again 21 resons for being vegeterian, 51 good reasons for being vegeterain and more even in first page.

adding picture of the search:



Thats a intresting fact that being a vegeterian has always good reasons.
I am adding few reasons for being a vegeterian from that search:

* Avoiding meat is one of the best and simplest ways to cut down your fat consumption. Modern farm animals are deliberately fattened up to increase profits. Eating fatty meat increases your chances of having a heart attack or developing cancer.

* A sausage can contain ground up intestines. How can anyone be sure that the intestines are empty when they are ground up? Do you really want to eat the content of a pig's intestines?

* If we eat the plants we grow instead of feeding them to animals, the world's food shortage will disappear virtually overnight. Remember that 100 acres of land will produce enough beef for 20 people but enough wheat to feed 240 people.

* It's must easier to become (and stay) slim if you are a vegetarian. (By 'slim', I do not mean 'abnormally slender' or 'underweight' but rather, an absense of excess weight!)

* If you eat meat, you are consuming hormones that were fed to the animals. No one knows what effect those hormones will have on your health. In some parts of the world, as many as one on four hamburgers contain growth hormones that were originally given to cattle.

* The part about the antibiotics is really scary to me, I talked to a doctor once who told me that people can be really sick and hospitalized and not respond to antibiotics they need to save their life because their bodies have built up these crazy tolerances to them from eating meat and dairy.

* Water Conservation. It takes 3 to 15 times as much water to produce animal protein as it does plant protein. As a vegetarian I contribute to water conservation.

Wednesday, November 15, 2006

Don and Vivah are hit beside of bad Reviews

In Don Shahrukh Khan has done good work but all his work is criticized out because of comparision between original Don n new one.
Amit Ji fans are not accepting him as another DON.
I saw this movie n found good one. Story was little changed.

Vivah.. as name suggest a typical Indian movie. And ofcourse it is. People are saying "Its too ideal, families are ideal, hero is ideal, heroine is ideal. Unable to digest so idealisty".
But inspite of these review it is said Hit.
Got some reviews about the latest few movies, want to add on my Blog:

1. Vivah
Cast: Shahid Kapur, Amrita Rao.
Director: Sooraj Barjatya.

Pros: Sweet story (I say ofcourse it will be, a very sweet pair (Sahid n Amrita's) is in the movie :) ).
Cons: Outdated film.

Number of weeks: New.

2.
Deadline: Sirf 24 Ghante
Cast: Konkona Sensharma, Irrfan, Rajat Kapoor, Sandhya Mridul and Zakir Hussain
Director: Tanveer Khan.

Pros: Some good thrilling moments.
Cons: Poor sound and background music, poor direction.

Number of weeks: New.


3. Apna Sapna Money Money
Cast: Ritesh Deshmukh, Shreyas Talpade, Celina Jaitley, Koena Mitra, Riya Sen.
Director: Sangeeth Sivan.

Pros: Ritesh Deshmukh.
Cons: Run-of-the-mill sex comedy.

Number of weeks: New.
BO Verdict: Fair opening.

4. Umrao Jaan
Cast: Aishwarya Rai, Abhishek Bachchan, Shabani Azmi.
Director: J P Dutta.

Pros: Ash looks stunning (I say yeah she looks stunning), beautiful sets.
Cons: Too long and melodramatic.

Number of weeks: 1.
BO Verdict: Flop.



5. Don
Cast: Shah Rukh Khan, Priyanka Chopra, Kareena Kapoor, Isha Koppiker, Arjun Rampal, Boman Irani.
Director: Farhan Akhtar.

Pros: Great performances, good music.
Cons: Cannot match the original Don (I say dont compare with old Don), starring Amitabh Bachchan (I say Shahrukh Khan has also done a good job).

Number of weeks: 3.
BO Verdict: Semi-hit.

Sunday, November 05, 2006

'Ameeran' to 'Umrao Jaan Ada'

Day before I went for Umrao Jaan. The most awaited movie for Ash's fans. Well I am not a big fan of her but still wana watch this.
Even if J.P. Dutta was saying that it is totally different from last Umrao Jaan (Rekha's one) but it was quite similar to that movie.
Last Umrao Jaan was SuperB. That was a combination of good and romantic songs and a nice story itself.
This Umrao Jaan, My God.. No Good songs, same old story and story was running too slow.
It was totally non-sense. The strating of movie was also sense less.
Any way Ash was looking stunning in this movie. The movie was only about Ash n Ash. Thats all.

Thursday, October 05, 2006

What the hell this MTNL is..

Since more than 2 year I am using MTNL as mobile connection.
But really fed up with its kind of services.
When try to talk to Customer Care then after a long wait you will be able to get connected and even after that if ask for the problems then no positive feed back. Offf...

When try to send SMS to Airtel STD then it always say "message not send". Offf...

Freinds always complain " if MTNL get connected in a single try then you should feel lucky." Always try 2-3 times or even more to get connected with it. Offf...

A lot of problems n still these people are saying "MTNL hai to sahi hai" (MTNL is best).

Thursday, September 28, 2006

Hip Hip Hurray...

Yesterday our (Me , Gurpreet, Manoj) team won the technical quiz competeion happened in our company.
It was nice to be winner n sing a song Hip Hip Hurray... :)
Will write more about the things happening in my life later.