Surendra Sharma

Surendra Sharma

Search This Blog

Friday, February 21, 2014

How to check email content generated by SMTPClient class in C#


Sometimes we want to check that what is the email content generated by SMTPClient class in C#.
Use below code for it

            SmtpClient client = new SmtpClient("localhost", 25);
            client.PickupDirectoryLocation = @"D:\TestApp\";
            client.DeliveryMethod = SmtpDeliveryMethod.SpecifiedPickupDirectory;
            client.Send("a@a.com", "b@b.com", "test subject", "this is body");

It should keep mail file having name like “f73517fb-fac9-473e-966a-7d46659318f8.eml” in D:\TestApp folder.

Its content is something like below
X-Sender: a@a.com
X-Receiver: b@b.com
MIME-Version: 1.0
From: a@a.com
To: b@b.com
Date: 21 Feb 2014 19:38:44 +0530
Subject: test subject
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: quoted-printable

this is body


Please leave your comments or share this tip if it’s useful for you.

Tuesday, February 11, 2014

How to configure work items Check-in Policy in TFS


We need to create a check in policy so that with every check-in, files must be associated with some work items. It helps in log tracking and file modification history.

How to implement it?

Below are steps with screenshots

1.       Click on Settings




2.       Click on Source Control





3.       Select Check-in Policy tab and click on Add… button of Source Control Settings window.






4.       Select Work Items from Add Check-in Policy window and click Ok.





5.       Click Ok.





Please leave your comments or share this tip if it’s useful for you.

Friday, February 7, 2014

How to create sp_executesql in Sybase IQ

In SQL Server, sp_executesql stored procedure is used to execute a dynamic Transact-SQL statement or batch statements.

But in Sybase IQ, there is no such stored procedure. However you can create it as below

CREATE OR REPLACE PROCEDURE usp_executesql(
    IN cSQL VARCHAR(32767))
BEGIN
    EXECUTE IMMEDIATE WITH RESULT SET ON cSQL;
END;

Here cSQL parameter is used as varchar to support ASCII code page supporting 32767 characters in SQL statement.


Please leave your comments or share this tip if it’s useful for you.

Sunday, February 2, 2014

Trek to Doke's Nose, Lonavla



We started early morning of 19 Jan 2014. I wake up at 4:45 AM.
I reached and parked my bike at Shivaji Nagar Railway Station Pune at 6 AM.

I met to other guys of trekking at station. We got our train tickets. It’s Rs. 15 from Pune to Lonavala. We boarded in Train around 6:35. At ShivajiNagar Railway Station train Holt time is only 10-15 sec. We reached to Lonavala around 8:00 AM.

From station we reached to Annapurna Hotel near Bus stand in 10 min. It’s only a walking distance. We finished our breakfast there.

 From Annapurna we reached to Mahavir Square and hired Autos up to Khandala. Its 80 Rs. per Auto. 

From Khandala point we started our trekking around 9:30 AM.
During trekking you will get lots of good scene, greenary everywhere. I tried to capture every beautiful moments.

We reached to Doke Nose point around 12:30 PM. So it was almost 3 hours of trekking.

I experience joy to reach at pinnacle. We clicked snaps, ate snacks.
We started to come back from Doke Nose point. This time we choose another way which was easy and we come down only in 1 hour and reached to Kurwande Village. From there we hired 1 tempo to reach to Railway station. From there we reached to again Annapurna Hotel for our delicious lunch. 

It was 3:50PM and our train was at 5:15 PM. So we watched one local cricket match between Raigad and Lohgad sponsored by Mahindra.

Around 5 PM match was over and Lohgad won it.

From 5:15 PM we again started from Lonavala to Shivaji Nagar. Around 7 PM, I was at Shivajinagar railway station. Pick my bike from Parking area. Parking guys charging 8 Rs. for 4 Hous. So I paid Rs. 40 to them and reached to Home.

With this trekking I met with people from different parts of India  - Hariyana , Maharstra, Bengal, Nagpur, Gujrat. Some of them became friends now. Got new exprerience of terkking and Lonavala. I will try to cover rest of the points in Lonavala in near future.

This is very good time to visit such a place as Summer is yet to start and so one can have a beautiful view while walking from the mountains. 

During trekking always keep 2 water bottles with comfortable dress, cap and sports shoes. Always avoid sandals, chappls etc.
Sharing beautiful moments with you guys. Enjoy snaps.

Happy Trekking!!!

Trip to Pomegranate and Grape farm houses, Saswad, Pune



It was Sunday 26th January. India was celebrating its 65th Republic day.

I got a chance to become guest of Navalakhe family of Saswad. It’s almost 30 km from Pune.

I reached to around 11 AM to Saswad. Their house is typically old Maharstrian style. I was comparing them with old Marathi movies which I watched many during my childhood. Whole locality is maintaining Maharastrian traditional style. Feels Greattt.

I never heard any word in Hindi that start from N like “Ban(arrorw)”. I saw one shop near to Navalakhe family and shop name is “Nmokar”.

Mostly this word indicates about Jain culture. Updating my knowledge.

Navakhake family is much respected in their area and all family members are very down to earth. Their primarily business is farming. They are using all modern and computerize technique for farming.
I realized that they have Original Indian Rose at home which smells extremely good. Also I tested their farm house Raisin (Dried Grapes). I never saw this big size of Raisin before it. 

I was lucky that I got a chance to visit to their Farm House.

After 30 min rest at their Vada(House), I moved to their Pomegranate and Grape farm houses which is around 4 km

They have 4 Farm houses and this was smallest one. But for me this was even bigger than my imagination. 

We move around to their Pomegranate and Grape farm houses. During this Navalakhe family Head Mr. Ravindra, BSc in Agriculture, was with us and giving us detail information about their farming modern techniques and how they are maintaining the export quality of fruits. He is financially sound so not afraid in apply computerized techniques for farming. 

Here I first time tested Maharastrian Dish “Hurda” as a starter which was made from Jwari with couple of Chatni. Healthy and delicious. Always keep in mind that never drinks water after taking Hurda.

After that it was lunch time. Totally Maharastrian thali waiting for me which include Jwari –Bajara Roti, Baigan Bharta, Pithal, Thecha, Tak, Jalebi, Barfi, Papad, Mutter, Pulav, Bhajiye. What else you need after this. Everything was mouth watering.

I take a walk to their water storage after finishing delicious lunch. First was 10,000 liter and another was 5,00,000 liter storage capacity and collecting water from nearest river.

Then we have small meet up and we play some games.

In evening we have Misal and tea in snacks. Though I was not feeling hungry but I tested Misal as it was famous in that area.

Around 6 PM, I left Saswad and upto 7 PM I reached to Home. 

This was great day in my life where I come to know more about Maharastrian culture.

Bird Watching at Bhigwan, Pune

On the last day of January 2014, up to 2130 hours I was in office. This is not my usual time, but we have project release [Most common scenarios with software guys]. I finished my work and at around 2300 hours I was on my bed. I knew that I will not get enough rest as I have to wake at 0400 hours in morning.

I left my bed at 4:00 AM and up to 5:10 AM I was in office. Office… No no no … now this time not for any technical work but a trip for Bird watching at Bhigwan with office friends.

We were 15 guys including driver and left office premises at 5:35 AM. We have two guides who are husband and wife and ex employee of my company having 7 years of experience in bird activities.

From Pune-Solapur Highway, we covered 110 km distance and reached to Bhigwan Dam in just 2 hours as no traffic was there in early morning.

Mainly people are doing sugarcane farming around Bhigwan. 
From last couple of months I didn’t experience sunrise. But at Bhigwan, I viewed sun was rising from east and its reddish rays are reflected in dam water. It was beautiful seen.

 All guys stood in circle and quickly introduced each other. 2 Guys are from my home town. Good to see them.  Up to 8:00 AM, we finished breakfast with Poha and tea. 

We hired two fishing boats for 14 guys and cost is Rs. 1400 per boat. Each boat had one guide.  

Main attraction in Bhigwan is Flemingo Bird having pink color on bid, wings and legs. Flemingos are migrated from Siberia. I was lucky I got a group of 40-45 Flemingos at one place.

I come to know new information about birds as
Why they are living in groups
How they can cover so much of distance
Why they are flying in V shape
How to identify male and female?

In all birds female look is dull while male is always beautiful. I was thinking about human species, it’s exactly opposite. God is great.

We were in boat for almost 3 hours and got a chance to look to different kinds of birds like Flemingo, stork, Drongo, Coramorent, dove, ducks, Lapwings, grey Heron etc. After that we are on land and spent 1 hour to see different birds.

While coming back, I tried my hands on manual boat with 300-400 meter. Nice experience.

We rest for 30 min and around 1:00 PM we left Bhigwan.

On our way, we had lunch at Kanchan Hotel. They have very delicious food. I tested Tandoori Roti, Veg Maharaja, Paneer Kadai, Lassi, Rice, Dal and Mango Pickle. Lassi was in Kulhad and very tasty.  I recommended visiting this hotel on Satara Road.

From my childhood, I like sound of one bird but I was not aware of its name. Lucky I got that same bird at Bhigwan and when I ask its name to Guide, I come to know that it was Lapwing.

On next day I downloaded Lapwing and Indian Dove sounds from Internet. Whenever I am listening these sounds, I mind started to think about childhood memories related with village and farms.

With this Bird watching trip at Bhigwan, I got nice knowledge and experience about Mother Nature and birds. We all like birds but we are not familiar with them. Now I can say I am aware of some of them.

Thursday, January 30, 2014

How to fix error ‘need a correlation name’ in Sybase IQ

Suppose you have two tables TableA and TableB. Both these table contains ID column. Now if you are trying to access ID column as below

SELECT ID FROM TableA INNER JOIN TableB ON TableA.ID = TableB.ID 

You will get Sybase IQ error Column 'Column Name' found in more than one table -- need a correlation name.

Whenever you are using JOIN clause with more than one table and trying to access same field name from the table then you will get this error.

How to fix it?

Solution:-

Always make sure to use table name as prefix with column name before accessing it as below

SELECT TableA.ID FROM TableA INNER JOIN TableB ON TableA.ID = TableB.ID 

SQL SERVER generates error Ambiguous column name 'ID' for similar condition as discussed in my another article How to fix error Ambiguous column name 'Column Name' in SQL Server 


Please leave your comments or share this tip if it’s useful for you.