How to Fetch Gmail contact List From your gmail account

Hi Friends,

             Here I am posting  a code to fetch or get gmail contact in our application. For this we need to include some gmail APIs which required while in importing the contact list.
Before code we have to download APIs from HERE .After clicking on this you will get a page like this:

You should include following name spaces
using Google.GData.Client;
using Google.Contacts;
using Google.GData.Extensions;
using System.Collections.Generic;

Then you can use this method...

private List<string> GetContactList(string email, string pwd)
    {

        List<string> lstContacts = new List<string>();

        // Here required your gmail id and password.
        RequestSettings rsLoginInfo = new RequestSettings("", email, pwd);
        rsLoginInfo.AutoPaging = true;
        ContactsRequest cRequest = new ContactsRequest(rsLoginInfo);

        // get contacts list
        Feed<Contact> feedContacts = cRequest.GetContacts();

        // looping the feedcontact entries
        foreach (Contact gmailAddresses in feedContacts.Entries)
        {
            // Looping to read  email addresses
            foreach (EMail emailId in gmailAddresses.Emails)
            {
                lstContacts.Add(emailId.Address);
            }
        }
        
        return lstContacts;      
    }

Hope this will help you ...
Regards,
Rajesh
Learn more »

Cloud Computing on Microsoft Technologies

Cloud computing delivers the ability to provision resources on demand to your users. Cloud computing is enabling a major transformation in which you can turn your datacenter into an IT-as-a-Service platform. This means you can deliver applications to your end users faster than ever, without investing in new infrastructure, training new personnel, or licensing new software. Cloud computing also helps your organization compete in new markets and communicate with customers in new ways. You can drive down the costs of doing business and increase your ability to adapt to changing market conditions.

Because cloud computing changes the way your organization consumes IT, you can change the role of IT in your organization and the way your team thinks about and delivers business success.

Whether in your datacenter, with a service provider, or from Microsoft’s datacenters, Microsoft provides the choice, flexibility, and control to adopt cloud computing in whichever way best meets your unique business needs; whether that be through a private cloud, a public cloud, or a combination of the two.

Microsoft provides the following cloud computing offerings:

Private Cloud

Microsoft private cloud solutions give you the flexibility and control to harness the power of the cloud on your terms. A Microsoft private cloud provides end to end service management giving you deep insight about your applications and workloads so you focus more attention on delivering business value. And with your choice of a hosted, pre-configured, or custom offering, you have the power to find the private cloud solution that fits your unique business needs.



Public Cloud

Windows Azure is the cloud platform that empowers you to develop and run applications with unbounded scalability and ease-of-use. With this flexible platform you can easily scale up or down to meet the demands of your business. With the pay-for-use business model, you don’t waste money on services you won’t use. And Windows Azure allows your developers to develop and run applications quickly, while leveraging current skills to develop applications with .NET, PHP, or Java.

Benefits

The future of the cloud is going to be a hybrid combination of public and private cloud, not one or the other. There will be times when you want to run a workload in a private cloud, then move it up to a public cloud, and later move it back again to your private cloud. We see a Microsoft private cloud as the first step towards building a cloud that allows you to go into the public cloud, which is what we call Windows Azure. With Microsoft, our cloud offerings are designed so that your private cloud and public cloud work together.

Cloud computing on your terms

With Microsoft cloud solutions, you remain in full control whether it is in your datacenter, a partner datacenter, or Microsoft’s datacenters. Only with Microsoft cloud solutions do you get:


   => A common set of management tools.
   => The ability to see all the applications in your traditional, public, and private cloud environments from a single console.
    =>A common set of identity tools.
    =>When users log in, they get access to all the traditional, private, and public cloud services you’ve given them access to.
    =>The ability to develop applications that run in both the private and public cloud.

Find out more about Microsoft’s cloud solution.
Learn more »

How to get query string value in javascript

 

Hi Friends,
Few days ago I need to get the query string value at client side in my application then I got a java script method via searching which returns the query string value.
You just pass the name of the parameter name to the method. Here I am placing the method.


<script type="text/javascript">
function getQuerystring(key, default_) {
        if (default_ == null) default_ = "";
        key = key.replace(/[\[]/, "\\\[").replace(/[\]]/, "\\\]");
        var regex = new RegExp("[\\?&]" + key + "=([^&#]*)");
        var qs = regex.exec(window.location.href);
        if (qs == null)
            return default_;
        else
            return qs[1];
    }
</script>


you just get the query string value like this 
var paraValue=getQuerystring(key, 'ParaName') ;

Hope this will help you...
Rajesh
Learn more »

Converting Multipage TIFF image to PDF

Hi friends
Here I am placing a code to convert tiff image to pdf file. Some time we need to convert the tiff image to pdf file according to the client need .There are a few for .NET including iTextSharp, PDFsharp and PDF Clown. I used iTextSharp because it has a sample that was showing how to create a PDF file from a multipage TIFF image

// creation of the document with a certain size and certain margins  
iTextSharp.text.Document document = new iTextSharp.text.Document(iTextSharp.text.PageSize.A4, 0, 0, 0, 0);  

  

// creation of the different writers  

iTextSharp.text.pdf.PdfWriter writer = iTextSharp.text.pdf.PdfWriter.GetInstance(document, new System.IO.FileStream(Server.MapPath("~/PDF/Output.pdf"), System.IO.FileMode.Create));  

  

// load the tiff image and count the total pages  

System.Drawing.Bitmap bm = new System.Drawing.Bitmap(Server.MapPath("~/FolderLocation/file.tif"));  

int total = bm.GetFrameCount(System.Drawing.Imaging.FrameDimension.Page);  

  

document.Open();  

iTextSharp.text.pdf.PdfContentByte cb = writer.DirectContent;  

for (int k = 0; k < total; ++k)  

{  

    bm.SelectActiveFrame(System.Drawing.Imaging.FrameDimension.Page, k);  

    iTextSharp.text.Image img = iTextSharp.text.Image.GetInstance(bm, System.Drawing.Imaging.ImageFormat.Bmp);  

    // scale the image to fit in the page  

    img.ScalePercent(72f / img.DpiX * 100);  

    img.SetAbsolutePosition(0, 0);  

    cb.AddImage(img);  

    document.NewPage();  

}  

document.Close();  
Learn more »

String Format for Double and Int in C#


String Format for Double [C#]

  

The following examples show how to format float numbers to string in C#. You can use static method String.Format or instance methods double.ToString and float.ToString.
Digits after decimal point
This example formats double to string with fixed number of decimal places. For two decimal places use pattern „0.00“. If a float number has less decimal places, the rest digits on the right will be zeroes. If it has more decimal places, the number will be rounded.
[C#]
// just two decimal places
String.Format("{0:0.00}", 123.4567);      // "123.46"
String.Format("{0:0.00}", 123.4);         // "123.40"
String.Format("{0:0.00}", 123.0);         // "123.00"
 
Next example formats double to string with floating number of decimal places. E.g. for maximal two decimal places use pattern „0.##“.
[C#]
// max. two decimal places
String.Format("{0:0.##}", 123.4567);      // "123.46"
String.Format("{0:0.##}", 123.4);         // "123.4"
String.Format("{0:0.##}", 123.0);         // "123"
 
Digits before decimal point
If you want a float number to have any minimal number of digits before decimal point use N-times zero before decimal point. E.g. pattern „00.0“ formats a float number to string with at least two digits before decimal point and one digit after that.
[C#]
// at least two digits before decimal point
String.Format("{0:00.0}", 123.4567);      // "123.5"
String.Format("{0:00.0}", 23.4567);       // "23.5"
String.Format("{0:00.0}", 3.4567);        // "03.5"
String.Format("{0:00.0}", -3.4567);       // "-03.5"
 
Thousands separator
To format double to string with use of thousands separator use zero and comma separator before an usual float formatting pattern, e.g. pattern „0,0.0“ formats the number to use thousands separators and to have one decimal place.
[C#]
String.Format("{0:0,0.0}", 12345.67);     // "12,345.7"
String.Format("{0:0,0}", 12345.67);       // "12,346"
 
Zero
Float numbers between zero and one can be formatted in two ways, with or without leading zero before decimal point. To format number without a leading zero use # before point. For example „#.0“ formats number to have one decimal place and zero to N digits before decimal point (e.g. „.5“ or „123.5“).
Following code shows how can be formatted a zero (of double type).
[C#]
String.Format("{0:0.0}", 0.0);            // "0.0"
String.Format("{0:0.#}", 0.0);            // "0"
String.Format("{0:#.0}", 0.0);            // ".0"
String.Format("{0:#.#}", 0.0);            // ""
 
Align numbers with spaces
To align float number to the right use comma „,“ option before the colon. Type comma followed by a number of spaces, e.g. „0,10:0.0“ (this can be used only in String.Format method, not in double.ToString method). To align numbers to the left use negative number of spaces.
[C#]
String.Format("{0,10:0.0}", 123.4567);    // "     123.5"
String.Format("{0,-10:0.0}", 123.4567);   // "123.5     "
String.Format("{0,10:0.0}", -123.4567);   // "    -123.5"
String.Format("{0,-10:0.0}", -123.4567);  // "-123.5    "
 
Custom formatting for negative numbers and zero
If you need to use custom format for negative float numbers or zero, use semicolon separator;“ to split pattern to three sections. The first section formats positive numbers, the second section formats negative numbers and the third section formats zero. If you omit the last section, zero will be formatted using the first section.
[C#]
String.Format("{0:0.00;minus 0.00;zero}", 123.4567);   // "123.46"
String.Format("{0:0.00;minus 0.00;zero}", -123.4567);  // "minus 123.46"
String.Format("{0:0.00;minus 0.00;zero}", 0.0);        // "zero"
 
Some funny examples
As you could notice in the previous example, you can put any text into formatting pattern, e.g. before an usual pattern „my text 0.0“. You can even put any text between the zeroes, e.g. „0aaa.bbb0“.
[C#]
String.Format("{0:my number is 0.0}", 12.3);   // "my number is 12.3"
String.Format("{0:0aaa.bbb0}", 12.3);          // "12aaa.bbb3"
 
 

String Format for Int [C#]

 

Integer numbers can be formatted in .NET in many ways. You can use static method String.Format or instance method int.ToString. Following examples shows how to align numbers (with spaces or zeroes), how to format negative numbers or how to do custom formatting like phone numbers.
Add zeroes before number
To add zeroes before a number, use colon separator „:“
[C#]
String.Format("{0:00000}", 15);          // "00015"
String.Format("{0:00000}", -15);         // "-00015"
 
Align number to the right or left
To align number to the right, use comma „,“ followed by a number of characters. This alignment option must be before the colon separator.
[C#]
String.Format("{0,5}", 15);              // "   15"
String.Format("{0,-5}", 15);             // "15   "
String.Format("{0,5:000}", 15);          // "  015"
String.Format("{0,-5:000}", 15);         // "015  "
 
Different formatting for negative numbers and zero
You can have special format for negative numbers and zero. Use semicolon separator „;“ to separate formatting to two or three sections. The second section is format for negative numbers, the third section is for zero.
[C#]
String.Format("{0:#;minus #}", 15);      // "15"
String.Format("{0:#;minus #}", -15);     // "minus 15"
String.Format("{0:#;minus #;zero}", 0);  // "zero"
 
Custom number formatting (e.g. phone number)
Numbers can be formatted also to any custom format, e.g. like phone numbers or serial numbers.
[C#]
String.Format("{0:+### ### ### ###}", 447900123456); // "+447 900 123 456"
String.Format("{0:##-####-####}", 8958712551);       // "89-5871-2551"
 
 
 

Learn more »