Thursday, 19 May 2011

Get bytes from Stream in c#

I know you may think what is the need of this post as this is very minor or simple to think and write. But, whenever I need to get bytes from a stream object, I always forgot it. This is simple but most of the times we used to Google. So, planned to write it to remember at least myself next time.
public byte[] GetBytesFromStream(Stream stream)
{
byte[] buffer = new byte[16 * 1024];
using (MemoryStream ms = new MemoryStream())
{
int read;
while ((read = stream.Read(buffer, 0, buffer.Length)) > 0)
{
ms.Write(buffer, 0, read);
}
return ms.ToArray();
}
}

Check list exists in SharePoint site

This is very generic issue all SharePoint developers face at initial stages. As there is no default method available in SharePoint API to check whether if list exists in the SharePoint site, everyone write the below code:
SPList list = web.Lists["Task List"];
If(list != null)
{
//Some code on list.
}
This is not correct to code like this. We all know generics and collections in c#. SPWeb.Lists is a collection and if you want to get one object from collection either we need to pass index or the key. If that didn’t find in the collection it gives us the exception. So, in our example if the Sharepoint site don’t have list named “Task List” then you will give run time exception in the line 1 itself. So, there is no point of checking whether list object is null. So, here is where many people stuck at. As Lists is plain collection object there is no other way of checking for the list exists in collection other than below.
private static bool ListExists(SPWeb web, string listName)
{
try
{
SPList list = web.Lists[listName];
}
catch
{
return false;
}
return true;
}
I know what you are thinking [Is this solution right?]. Yes, unfortunately there is no other way. So, we have to use this to check whether list exists in a SharePoint site.

Saturday, 16 April 2011

How to go to SharePoint Webpart Maintenance page for any page

This is one of the great tips we have in SharePoint. There are many scenarios why we need this. I had very tough time to migrate a SharePoint 2007 site to SharePoint 2010 site. What happened was,
  1. The other team deployed a custom web part 2 years ago.
  2. Used that web part on different pages in that site.
  3. They have taken the site template from the option "save site as template".
  4. After an year, they have removed  that web part from the site collection.
  5. But, with the same site template they have taken in the step #3, they created few sites in the same site collection after they removed the web part from environment.
  6. Remember, the site template still has the references to that custom web part. So, when I try to migrate it always fails..
Sometimes it is very difficult to find what is causing the problem. The sites created were not published sites. So, I cannot go to Edit Properties of the page and go to web part maintenance page from there. As the default.aspx page is directly in the root of the site/web I do not have any other choice to go to web part maintenance page. After a long research I found from Google that the querystring ?contents=1 will do job for me.

Resolution:
In SharePoint, for any web part ASPX page if you append the querystring ?contents=1 then it automatically redirects to the web part maintenance page.

Example: 
For the SharePoint site page
http://mossurl/default.aspx the web part maintenance page url is
http://mossurl/default.aspx?contents=1

Tuesday, 22 March 2011

Rihanna New Latest Photo Shoot At Event

Cute Singer Rihanna New Latest Photo Shoot At Event

Selena Gomez Latest Photo Shoot In Amazing Dress

Selena Gomez Latest Photo Shoot In Amazing Dress

15 Best National Geographic Adventurist Pictures

National geographic is too big tv channel and its so popular because they discovers a lot of new things and much more. An adventure is defined as an exciting or unusual experience; it may also be a bold, usually risky undertaking, with an uncertain outcome. The term is often used to refer to activities with some potential for physical danger, such as skydiving, mountain climbing and or participating in extreme sports. The term also broadly refers to any enterprise that is potentially fraught with physical, financial or psychological risk, such as a business venture, a love affair, or other major life undertakings. This is really not cool for normal humans but this is really superb experience. here i am going to post some adventurist pictures.

6 Beautiful And Romantic Destinations For Honeymoon Travel

Everyone wants to go to the beautiful places to enjoy and have some days off from the busy routines and life. If you are planning the same then, here’s a selection of some of the most romantic destinations on the planet where you can go and make your vacations or honeymoon travel memorable.

UNITED STATES

Aspen Colorado:

Aspen is said to be the beautiful place where one feels sanctuary and peace. It is not only a best place for celebrations but it offers more than that. It is believed to be the Skier’s paradise. It is a great al fresco spot where you can visit both in summer and winters. It is rich with beautiful and astounding views and landscapes. You can have the chance o hiking here. If you travel 15 miles southwest of Aspen to Maroon Bells without the cars (because they are not allowed) you need to do hiking, there is all meadows that are rich in their mysterious beauty. While hiking you can enjoy the fresh air of mountains and witness the beauty of nature. If you cover more distance of 40 miles northwest of Aspen there is Glenwood Ho springs, a place known for its indulgence and camping trips. You can have the horse riding as well as to curl up in your lodge in front of a roaring bright fire. The place offers you romantic drives of carriage and sleigh ride. For the dance lovers pubs, discos and bars have been built there. So one can enjoy to the fullest being there, do not miss the chance to go with your other half and take pleasure.Glenwood Hot Springs, just 40 miles northwest of Aspen, is a perfect romantic indulgence. You can also get your romantic Western adventure fix with a visit to T Lazy 7 Ranch with its horseback rides and camping trips.

FRANCE

Paris:


Paris the city of fragrance is one of the best romantic destinations. How amiable would it be to walk with your loved one along the quais, while riding on bateau mouches around the Ile de la Cite. It would be the memorable trip for the visitors. You can go there and take pleasure in its beautiful public parks, sidewalk cafes, art museums, churches and palaces. Paris is said to be the city of lovers, if you want to know the reason then you need to visit tomb of Abelard and Heloise at Pere Lachaise Cemetery.


UNITED STATES

New York


Another city of allure which absorbs the world’s beauty in it is none other than NYC. The city which possesses every entertainment and pleasure, it amuses its visitors through its Shopping, museums, theater, river cruises, fantastic dining, and much more. Fresh up your love and feelings by having a carriage ride in Central Park in the spring or skating at the Rockefeller Center in the winter. Make your visit charming and remembering by taking a trip in the neon lights of Times Square along with a spectacular Broadway show, or make your way to the alternative SoHo and funky Greenwich Village. The city which is always there to facilitate you where you can embrace up on the Staten Island Ferry, or walk transversely the Brooklyn Bridge and have your romantic candlelit dinner at any one of New York’s tremendous bistro’s.


AUSTRALIA

Hayman Island, Whitsundays Queensland


An island with crystal clear water, immaculate sandy beaches and a world-renowned reef make this the classic sun, sand and sea romantic paradise island holiday is the best place to have the celebrations. It is well known for its luxurious surroundings and tasty chefs and cuisines that are mouthwatering even to talk about. It is truly said as quintessence of romantic indulgence. Person feels oneself to be in a heaven like places while being surrounded by a huge mere puddle overlooking tropical vistas and sandy white beaches.


CARIBBEAN

Nassau Bahamas


The place offers the greatest variety of places to eat, nightlife, and resorts. Amble the paved streets, indulge in water sports, have a shopping for traditional Bahamian handicrafts, or sip cocktails overlooking the ocean. You have the option to take a horse ride or a carriage tour to witness the beauty of place. Check out the Changing of the Guard every other Saturday at the Government House; make a trip to the Straw Market to purchase some handmade souvenirs.


ITALY

Venice

Venice the city of romance is a very alluring place. It has the competency of winning your heart. It is sated with canals, bridges, and centuries old buildings have the guts to make your heartbeats fast. An evening gondola ride along the Venice canals is a charming one. Rialto Bridge and the Bridge of Sighs are two beautiful bridges which you must visit.


Some Important Questions For Visa Interview

Visa interview are considered as a threat for the interviewees and they are afraid that why they are going through such drill but immigration authorities basically ask for these interviews just to know why you want to go to other country? Who you are? And want to explore some thing about your personality. Following can be the interview questions that might be asked by the immigration authorities.


1. Why move to Australia

This question is most asked to the immigrant who wants to move to Australia. Actually you will come across this question many times in the application form as well so every time the reason provided should be same because if you will change it that will put them in suspicion and doubt about you.

2. What is your profession

If you want to stay in Australia for long time and want to do job there than you have to explain that in what way and how you can benefit to economy and market of the country. If you are skilled and you have those required talents that are in demand in Australia then you can easily move to that place.

3. Family ties

This is the most asked question as immigration authorities will ask you about your family and if luckily your family already exists in Australia then it is easy for you to get visa but the other way round does not mean that you can not qualify for the visa.

4. What is your income

Immigration authorities ask this question to know that whether you will be able to support your self and your family in Australia and you are not going to act as a burden. If you are self sufficient and have handsome salary then it will be easy for you to get visa.

5. How long will you stay

You should know exactly that why you are going to Australia and for how long you have plans to stay there.

6. Scenario questions

Immigration authorities will ask many “what if” questions these are situational questions that will put you in bit confusion. Like if this will happen then what will you do? Before answering such questions you have to firstly think properly about the answers in your mind and then reply to them.

Be clear, confident, fair and honest while giving your answers after doing your part this is their responsibility that whether they consider you as eligible to go to Australia or not.

Piecha Mercedes ML - Photos And Detail

The tuning firm Piecha Design has released a new program for the Mercedes ML called the Evorian RS. This kit also fits the GL-class X164, and consists of a front spoiler with integrated LED daytime running lights, new side skirts, chrome aerowings, and a rear diffuser. Exhaust sound and performance was improved with a Quadro-4-tube exhaust system and dual chrome plated exhaust tips. For the wheels and suspension on the Mercedes ML, Piecha hooked it up with new rims and tires, and a H&R coilover suspension kit to lower the ride height 35 mm in the front, and 50 mm at the rear. Performance tuning features a Power Converter Intermedia RC, to improve the acceleration and response time of the Mercedes ML pedal at low speeds.

Actress Teertha New Latest Beautiful Photo Shoot

Actress Teertha New Latest Beautiful Photo Shoot