<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>YourSearchBuddy &#187; .net</title>
	<atom:link href="http://www.yoursearchbuddy.com/tag/net/feed" rel="self" type="application/rss+xml" />
	<link>http://www.yoursearchbuddy.com</link>
	<description>your search ends here</description>
	<lastBuildDate>Tue, 31 Jan 2012 19:47:00 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.1</generator>
		<item>
		<title>Upload a photo on Facebook and Tag it using C#</title>
		<link>http://www.yoursearchbuddy.com/upload-photo-facebook-tag</link>
		<comments>http://www.yoursearchbuddy.com/upload-photo-facebook-tag#comments</comments>
		<pubDate>Thu, 08 Sep 2011 10:02:57 +0000</pubDate>
		<dc:creator>lokeshlal</dc:creator>
				<category><![CDATA[Technology]]></category>
		<category><![CDATA[TipnTricks]]></category>
		<category><![CDATA[Tutorial]]></category>
		<category><![CDATA[.net]]></category>
		<category><![CDATA[C#]]></category>
		<category><![CDATA[facebook]]></category>
		<category><![CDATA[photo]]></category>
		<category><![CDATA[Tag]]></category>
		<category><![CDATA[Upload]]></category>

		<guid isPermaLink="false">http://www.yoursearchbuddy.com/?p=6110</guid>
		<description><![CDATA[To upload a photo on Facebook, we need to issue a HTTP POST request to https://graph.facebook.com/[USERID]/photos url. and to tag a user we need to issue a normal HTTP GET... <a class="meta-more" href="http://www.yoursearchbuddy.com/upload-photo-facebook-tag">Read more <span class="meta-nav">&#187;</span></a>]]></description>
			<content:encoded><![CDATA[<p>To upload a photo on Facebook, we need to issue a HTTP POST request to <em>https://graph.facebook.com/[USERID]/photos</em> url. and to tag a user we need to issue a normal HTTP GET request to https://graph.facebook.com/[PHOTOID]/tags/[USERID].<br />
[PHOTOID] is the id of the photo that we will upload before tagging it.</p>
<pre>
public void HttpUploadFile(string url, System.Drawing.Image file, string paramName, string contentType, NameValueCollection nvc, string userIdOfCurrentProfile, string access_token)
{
	string boundary = "---------------------------" + DateTime.Now.Ticks.ToString("x");
	byte[] boundarybytes = System.Text.Encoding.ASCII.GetBytes("\r\n--" + boundary + "\r\n");

	HttpWebRequest wr = (HttpWebRequest)WebRequest.Create(url);
	wr.ContentType = "multipart/form-data; boundary=" + boundary;
	wr.Method = "POST";
	wr.KeepAlive = true;
	wr.Credentials = System.Net.CredentialCache.DefaultCredentials;

	Stream rs = wr.GetRequestStream();

	string formdataTemplate = "Content-Disposition: form-data; name=\"{0}\"\r\n\r\n{1}";
	foreach (string key in nvc.Keys)
	{
		rs.Write(boundarybytes, 0, boundarybytes.Length);
		string formitem = string.Format(formdataTemplate, key, nvc[key]);
		byte[] formitembytes = System.Text.Encoding.UTF8.GetBytes(formitem);
		rs.Write(formitembytes, 0, formitembytes.Length);
	}
	rs.Write(boundarybytes, 0, boundarybytes.Length);

	string headerTemplate = "Content-Disposition: form-data; name=\"{0}\"; filename=\"{1}\"\r\nContent-Type: {2}\r\n\r\n";
	string header = string.Format(headerTemplate, paramName, "profileFromTozoy", contentType);
	byte[] headerbytes = System.Text.Encoding.UTF8.GetBytes(header);
	rs.Write(headerbytes, 0, headerbytes.Length);

	System.IO.MemoryStream memoryStream = new System.IO.MemoryStream(0x10000);
	file.Save(memoryStream, System.Drawing.Imaging.ImageFormat.Jpeg);

	byte[] imageBytes = memoryStream.ToArray();
	rs.Write(imageBytes, 0, imageBytes.Length);
	memoryStream.Close();

	byte[] trailer = System.Text.Encoding.ASCII.GetBytes("\r\n--" + boundary + "--\r\n");
	rs.Write(trailer, 0, trailer.Length);
	rs.Close();

	WebResponse wresp = null;
	try
	{
		wresp = wr.GetResponse();
		Stream stream2 = wresp.GetResponseStream();
		StreamReader reader2 = new StreamReader(stream2);
		string photoId = reader2.ReadToEnd();

		//I know, I could have used JSOM library
		int start = photoId.IndexOf("\"",photoId.IndexOf("id") + 4);
		int end = photoId.IndexOf("\"",start + 1);
		photoId = photoId.Substring(start + 1,end - start - 1);

		string tagsURL = "https://graph.facebook.com/" + photoId + "/tags/" + userIdOfCurrentProfile + "?x=20&amp;y=25&amp;access_token=" + access_token + "&amp;method=POST";
		HttpWebRequest wrTag = (HttpWebRequest)WebRequest.Create(tagsURL);
		wrTag.ContentType = "multipart/form-data; boundary=" + boundary;
		wrTag.Method = "POST";
		wrTag.KeepAlive = true;
		wrTag.Credentials = System.Net.CredentialCache.DefaultCredentials;
		WebResponse wrespTag = null;
		wrespTag = wrTag.GetResponse();
		Stream stream2Tag = wrespTag.GetResponseStream();
		StreamReader reader2Tag = new StreamReader(stream2Tag);

	}
	catch (Exception ex)
	{
		if (wresp != null)
		{
			wresp.Close();
			wresp = null;
		}
		//throw ex;
	}
	finally
	{
		wr = null;
	}
}
</pre>
<p>To use this function call it like this</p>
<pre>
NameValueCollection nvc = new NameValueCollection();
nvc.Add("message", "My Comment");

HttpUploadFile("https://graph.facebook.com/" + uid + "/photos?access_token=" + access_token,
    (System.Drawing.Image)outputBitmap, "source", "image/jpeg", nvc);
</pre>
<p>If you need to tag multiple users replace [USERID] in https://graph.facebook.com/[PHOTOID]/tags/[USERID] url and send multiple HTTP request.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.yoursearchbuddy.com/upload-photo-facebook-tag/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Create Tiff Image from multiple images &#8211; C#</title>
		<link>http://www.yoursearchbuddy.com/create-tiff-image-multiple-images</link>
		<comments>http://www.yoursearchbuddy.com/create-tiff-image-multiple-images#comments</comments>
		<pubDate>Mon, 29 Aug 2011 08:09:31 +0000</pubDate>
		<dc:creator>lokeshlal</dc:creator>
				<category><![CDATA[How to?]]></category>
		<category><![CDATA[Information]]></category>
		<category><![CDATA[Technology]]></category>
		<category><![CDATA[Tutorial]]></category>
		<category><![CDATA[.net]]></category>
		<category><![CDATA[C#]]></category>
		<category><![CDATA[Create]]></category>
		<category><![CDATA[Image]]></category>
		<category><![CDATA[Multiple]]></category>
		<category><![CDATA[Tiff]]></category>

		<guid isPermaLink="false">http://www.yoursearchbuddy.com/?p=6006</guid>
		<description><![CDATA[The .NET framework provides very good support for generating and manipulating bitmap images. We can transform images from one form to another and .NET can also be use to generate... <a class="meta-more" href="http://www.yoursearchbuddy.com/create-tiff-image-multiple-images">Read more <span class="meta-nav">&#187;</span></a>]]></description>
			<content:encoded><![CDATA[<p>The .NET framework provides very good support for generating and manipulating bitmap images. We can transform images from one form to another and .NET can also be use to generate multiple page tiff images.</p>
<p>Below is the simple sample code to generate multiple page tiff that might be of some use to someone.</p>
<p>Include System.Drawing</p>
<pre>
Image bmp = Image.FromFile(@"C:\Documents and Settings\All Users\Documents\My Pictures\Sample Pictures\test.jpg");
Image img = Image.FromFile(@"C:\Documents and Settings\All Users\Documents\My Pictures\Sample Pictures\Sunset.jpg");
Bitmap bitmap = (Bitmap)bmp;

//Select the image encoder
System.Drawing.Imaging.Encoder enc = System.Drawing.Imaging.Encoder.SaveFlag;
ImageCodecInfo info = null;
info = (from ie in ImageCodecInfo.GetImageEncoders()
        where ie.MimeType == "image/tiff"
        select ie).FirstOrDefault();
EncoderParameters encoderparams = new EncoderParameters(1);
encoderparams.Param[0] = new EncoderParameter(enc, (long)EncoderValue.MultiFrame);

//Save the bitmap
bitmap.Save(@"C:\Documents and Settings\All Users\Documents\My Pictures\Sample Pictures\test12345.tiff", info, encoderparams);
encoderparams.Param[0] = new EncoderParameter(enc, (long)EncoderValue.FrameDimensionPage);

//add another image
//Repeat this to add multiple images
bitmap.SaveAdd(img, encoderparams);

//close file
encoderparams.Param[0] = new EncoderParameter(enc, (long)EncoderValue.Flush);
bitmap.SaveAdd(encoderparams);
</pre>
]]></content:encoded>
			<wfw:commentRss>http://www.yoursearchbuddy.com/create-tiff-image-multiple-images/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Getting column names from NHibernate Query</title>
		<link>http://www.yoursearchbuddy.com/column-names-nhibernate-query</link>
		<comments>http://www.yoursearchbuddy.com/column-names-nhibernate-query#comments</comments>
		<pubDate>Wed, 10 Aug 2011 11:45:53 +0000</pubDate>
		<dc:creator>lokeshlal</dc:creator>
				<category><![CDATA[Technology]]></category>
		<category><![CDATA[TipnTricks]]></category>
		<category><![CDATA[Tutorial]]></category>
		<category><![CDATA[.net]]></category>
		<category><![CDATA[C#]]></category>
		<category><![CDATA[column]]></category>
		<category><![CDATA[From]]></category>
		<category><![CDATA[Getting]]></category>
		<category><![CDATA[names]]></category>
		<category><![CDATA[Nhibernate]]></category>
		<category><![CDATA[Query]]></category>

		<guid isPermaLink="false">http://www.yoursearchbuddy.com/?p=5583</guid>
		<description><![CDATA[To get the column names from NHibernate Query, we have to use NHibernate.Transform.IResultTransformer here is a small example I have created public class QueryTransformer : NHibernate.Transform.IResultTransformer { private List&#60;string&#62; result... <a class="meta-more" href="http://www.yoursearchbuddy.com/column-names-nhibernate-query">Read more <span class="meta-nav">&#187;</span></a>]]></description>
			<content:encoded><![CDATA[<p>To get the column names from NHibernate Query, we have to use <strong>NHibernate.Transform.IResultTransformer</strong></p>
<p>here is a small example I have created</p>
<pre>
    public class QueryTransformer : NHibernate.Transform.IResultTransformer
    {

        private List&lt;string&gt; result = new List&lt;string&gt;();
        public List&lt;string&gt; columnsNames = new List&lt;string&gt;();

        #region IResultTransformer Members

        public IList TransformList(IList collection)
        {
            return collection;
        }

        public object TransformTuple(object[] tuple, string[] aliases)
        {
            result = new List&lt;string&gt;();
            for (int i = 0; i &lt; tuple.Length; i++)
            {
                //Getting the column Names collection from the aliases object list
                if (!columnsNames.Contains(aliases[i]))
                    columnsNames.Add(aliases[i]);
                //Adding the returned record set
                result.Add(Convert.ToString(tuple[i]));
            }
            return result;
        }

        #endregion
    }
</pre>
<p>Now to get the columns</p>
<pre>
QueryTransformer qt = new QueryTransformer();
IList result = query.SetResultTransformer(qt).List();
</pre>
<p>now <strong>qt.columnsNames</strong> will return the list of column names returned in the query</p>
]]></content:encoded>
			<wfw:commentRss>http://www.yoursearchbuddy.com/column-names-nhibernate-query/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Basic Features Of .NET</title>
		<link>http://www.yoursearchbuddy.com/basic-features-net</link>
		<comments>http://www.yoursearchbuddy.com/basic-features-net#comments</comments>
		<pubDate>Mon, 18 Jul 2011 04:36:11 +0000</pubDate>
		<dc:creator>lokeshlal</dc:creator>
				<category><![CDATA[Information]]></category>
		<category><![CDATA[Technology]]></category>
		<category><![CDATA[TipnTricks]]></category>
		<category><![CDATA[.net]]></category>
		<category><![CDATA[Basic]]></category>
		<category><![CDATA[features]]></category>

		<guid isPermaLink="false">http://www.yoursearchbuddy.com/?p=5493</guid>
		<description><![CDATA[.Net provides very user friendly environment for developing modern web, windows or any kind of application. 1. Easy development of web applications Provides ASP.NET for developing data driven web applications.... <a class="meta-more" href="http://www.yoursearchbuddy.com/basic-features-net">Read more <span class="meta-nav">&#187;</span></a>]]></description>
			<content:encoded><![CDATA[<p>.Net provides very user friendly environment for developing modern web, windows or any kind of application.</p>
<p>1.<strong> Easy development of web applications</strong><br />
Provides ASP.NET for developing data driven web applications. It is based on event driven model providing rich set of server side controls that eases the life of a programmer saving a lot of time.</p>
<p>2.<strong> Multi-Language Support</strong><br />
It support C#, VB.NET, J#, VC++ and other companies are working to make there languages compatible with framework. Thats the feature of MSIL.</p>
<p>3.<strong> Multi-Device Support</strong><br />
Can build windows, web, mobile, PDAs, wireless and any kind of appliation you can think of.</p>
<p>4. <strong>Automatic memory management</strong><br />
This is where Garbage collector comes into picture. Manages the memory issues automatically.<br />
Developer need not to worry about managed resources. Still developer has to dispose of any unmanaged resource used.</p>
<p>5. <strong>Compatibility with COM and COM+</strong><br />
Has a very good support for COM.</p>
<p>6. <strong>No more DLL Hell</strong><br />
Now we can host multiple versions of a Dll on a single machine. Assembly is used for this.</p>
<p>7. <strong>Awesome XML support</strong><br />
.NET supports XML. In fact .NET is the only platform that has built with XML right into the core framework.</p>
<p>8. <strong>Ease of deployment and configuration</strong><br />
Deploying windows applications especially that used COM components were always been a tedious task. Since .NET does not require any registration as such, much of the deployment is simplified. This makes XCOPY deployment viable. Configuration is another area where .NET – especially ASP.NET – shines over traditional languages. The configuration is done via special files having special XML vocabulary. Since, most of the configuration is done via configuration files, there is no need to sit in front of actual machine and configure the application manually. This is more important for web applications; simply FTPing new configuration file makes necessary changes.</p>
<p>9. <strong>Security</strong><br />
Windows platform was always criticized for poor security mechanisms. Microsoft has taken great efforts to make .NET platform safe and secure for enterprise applications. Features such as type safety, code access security and role based authentication make overall application more robust and secure.</p>
<p>10. <strong>Rich Functionality out of the box</strong><br />
.NET framework provides a rich set of functionality out of the box. It contains<br />
hundreds of classes that provide variety of functionality ready to use in your<br />
applications. This means that as a developer you need not go into low level details<br />
of many operations such as file IO, network communication and so on.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.yoursearchbuddy.com/basic-features-net/feed</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Create PDF from HTML using Evo HTML To PDF Using C#</title>
		<link>http://www.yoursearchbuddy.com/create-pdf-html-evo-html-pdf</link>
		<comments>http://www.yoursearchbuddy.com/create-pdf-html-evo-html-pdf#comments</comments>
		<pubDate>Mon, 27 Jun 2011 10:42:41 +0000</pubDate>
		<dc:creator>lokeshlal</dc:creator>
				<category><![CDATA[Information]]></category>
		<category><![CDATA[Product Review]]></category>
		<category><![CDATA[Technology]]></category>
		<category><![CDATA[.net]]></category>
		<category><![CDATA[C#]]></category>
		<category><![CDATA[Create]]></category>
		<category><![CDATA[Evo]]></category>
		<category><![CDATA[From]]></category>
		<category><![CDATA[HTML]]></category>
		<category><![CDATA[pdf]]></category>
		<category><![CDATA[to]]></category>
		<category><![CDATA[Using]]></category>

		<guid isPermaLink="false">http://www.yoursearchbuddy.com/?p=5393</guid>
		<description><![CDATA[If you want to convert HTML to PDF in .NET, then I bet EVO HTML to PDF is one of the best paid tools available in market. In this you... <a class="meta-more" href="http://www.yoursearchbuddy.com/create-pdf-html-evo-html-pdf">Read more <span class="meta-nav">&#187;</span></a>]]></description>
			<content:encoded><![CDATA[<p>If you want to convert HTML to PDF in .NET, then I bet EVO HTML to PDF is one of the best paid tools available in market. In this you just have to render the HTML on a fresh page and pass the reference of this page to the EVO library, do some settings in the code, like repeating headers, setting margins and many more and throw the PDF to the output response stream as an attachment, if you are using ASP.NET or save the file on hard drive.</p>
<pre>
PdfConverter pdfConverter = new PdfConverter();
// set the license key - required
pdfConverter.LicenseKey = ConfigurationManager.AppSettings["EvoKey"];
// set the converter options - optional
pdfConverter.PdfDocumentOptions.PdfPageSize = PdfPageSize.A4;
pdfConverter.PdfDocumentOptions.PdfCompressionLevel = PdfCompressionLevel.Normal;
pdfConverter.PdfDocumentOptions.PdfPageOrientation = PdfPageOrientation.Landscape;
//Similary set the other required properties

//Add header
pdfConverter.PdfDocumentOptions.ShowHeader = true;
pdfConverter.PdfHeaderOptions.HeaderHeight = 25;
//GetHeader() will return the HTML for header
HtmlToPdfArea headerHtmlToPdf = new HtmlToPdfArea(GetHeader(), urlToConvert);
pdfConverter.PdfHeaderOptions.AddHtmlToPdfArea(headerHtmlToPdf);

//Generate PDF from url
byte[] pdfBytes = pdfConverter.GetPdfBytesFromUrl(urlToConvert);

//throw the response or save the file on the hard drive
Response.Clear();
Response.AddHeader("Content-Type", "application/pdf");
Response.AddHeader("Content-Disposition", String.Format("attachment; filename={0}.pdf; size={1}",
                                 pdfFileName, pdfBytes.Length.ToString()));
Response.BinaryWrite(pdfBytes);
Response.End();
</pre>
]]></content:encoded>
			<wfw:commentRss>http://www.yoursearchbuddy.com/create-pdf-html-evo-html-pdf/feed</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>Merging Two Images in .NET</title>
		<link>http://www.yoursearchbuddy.com/merging-images-net</link>
		<comments>http://www.yoursearchbuddy.com/merging-images-net#comments</comments>
		<pubDate>Fri, 24 Jun 2011 02:51:26 +0000</pubDate>
		<dc:creator>lokeshlal</dc:creator>
				<category><![CDATA[Information]]></category>
		<category><![CDATA[Technology]]></category>
		<category><![CDATA[TipnTricks]]></category>
		<category><![CDATA[Tutorial]]></category>
		<category><![CDATA[.net]]></category>
		<category><![CDATA[C#]]></category>
		<category><![CDATA[Images]]></category>
		<category><![CDATA[in]]></category>
		<category><![CDATA[Merging]]></category>
		<category><![CDATA[Two]]></category>

		<guid isPermaLink="false">http://www.yoursearchbuddy.com/?p=5376</guid>
		<description><![CDATA[To merge two images what all we need to know is the what would be the final size of image. that is, equivalent to first image or second image or... <a class="meta-more" href="http://www.yoursearchbuddy.com/merging-images-net">Read more <span class="meta-nav">&#187;</span></a>]]></description>
			<content:encoded><![CDATA[<p>To merge two images what all we need to know is the what would be the final size of image. that is, equivalent to first image or second image or equivalent to sum of both the images. or some another random size.</p>
<p>In this example we will create a final image of size of first image and put the second image at the right bottom of the first image. Like you must have seen few tagged profile images in Facebook, something similar to that.</p>
<p>Get the first image, get the second image. Create a graphics object of first image and draw the second image at the bottom of the first image.  Done.</p>
<pre>
//Using some dummy images
HttpWebRequest webReq = (HttpWebRequest)WebRequest.Create(@"http://www.dam7.com/Images/Sunsets/images/myspace-sunset-images-dam7-0002.jpg");
HttpWebResponse webres = (HttpWebResponse)webReq.GetResponse();
System.Drawing.Image img = System.Drawing.Image.FromStream(webres.GetResponseStream());
System.Drawing.Bitmap bmp = new Bitmap(img);
Graphics g = Graphics.FromImage(img);

HttpWebRequest webReq1 = (HttpWebRequest)WebRequest.Create(@"http://img.alibaba.com/wsphoto/v0/285626651/3-8cm-diameter-round-carabiner-hook-with-laser-engraved-customer-logo-on-it.summ.jpg");
HttpWebResponse webres1 = (HttpWebResponse)webReq1.GetResponse();
System.Drawing.Image img1 = System.Drawing.Image.FromStream(webres1.GetResponseStream());

int original_height = img.Height;
int original_width = img.Width;

g.DrawImage(img1, new Rectangle(new Point(original_width - 100, original_height - 100), new Size(100, 100)));
g.Flush();

img.Save(@"D:\test.jpg");
</pre>
<p>In ASP.NET, you can also write this image to Response output stream.</p>
<p>To create a bigger image, create a new dummy image object and draw both images on it. Simple. Try it yourself.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.yoursearchbuddy.com/merging-images-net/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Simple Indexer Example In C#</title>
		<link>http://www.yoursearchbuddy.com/simple-indexer</link>
		<comments>http://www.yoursearchbuddy.com/simple-indexer#comments</comments>
		<pubDate>Fri, 10 Jun 2011 03:20:33 +0000</pubDate>
		<dc:creator>lokeshlal</dc:creator>
				<category><![CDATA[Information]]></category>
		<category><![CDATA[Technology]]></category>
		<category><![CDATA[.net]]></category>
		<category><![CDATA[C#]]></category>
		<category><![CDATA[Example]]></category>
		<category><![CDATA[Indexer]]></category>
		<category><![CDATA[simple]]></category>

		<guid isPermaLink="false">http://www.yoursearchbuddy.com/?p=5243</guid>
		<description><![CDATA[In this example I will create a simple indexer in C# class indexer_class { List&#60;int&#62; index = new List&#60;int&#62;(); public void set_length(int length) { if (index.Count &#60; length) { index.AddRange(new... <a class="meta-more" href="http://www.yoursearchbuddy.com/simple-indexer">Read more <span class="meta-nav">&#187;</span></a>]]></description>
			<content:encoded><![CDATA[<p>In this example I will create a simple indexer in C#</p>
<pre>
    class indexer_class
    {
        List&lt;int&gt; index = new List&lt;int&gt;();

        public void set_length(int length)
        {
            if (index.Count &lt; length)
            {
                index.AddRange(new int[length - index.Count]);
            }
            else
            {
                index.RemoveRange(length, index.Count - length);
            }
        }

        public int Count
        {
            get
            {
                return index.Count;
            }
        }

        public int this[int i]
        {
            get
            {
                return index[i];
            }
            set
            {
                if (i &lt; index.Count)
                {
                    index[i] = value;
                }
            }

        }
    }
</pre>
<p>How to use this class</p>
<pre>
indexer_class ic = new indexer_class();
ic.set_length(4);
ic[1] = 2;
ic.set_length(2);
for (int i = 0; i &lt; ic.Count; i++)
{
    Console.WriteLine(ic[i]);
}
</pre>
]]></content:encoded>
			<wfw:commentRss>http://www.yoursearchbuddy.com/simple-indexer/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Authenticate User From LDAP &#8211; .NET</title>
		<link>http://www.yoursearchbuddy.com/authenticate-user-ldap-net</link>
		<comments>http://www.yoursearchbuddy.com/authenticate-user-ldap-net#comments</comments>
		<pubDate>Wed, 08 Jun 2011 11:10:26 +0000</pubDate>
		<dc:creator>lokeshlal</dc:creator>
				<category><![CDATA[Technology]]></category>
		<category><![CDATA[Tutorial]]></category>
		<category><![CDATA[.net]]></category>
		<category><![CDATA[active]]></category>
		<category><![CDATA[Authenticate]]></category>
		<category><![CDATA[directory]]></category>
		<category><![CDATA[From]]></category>
		<category><![CDATA[LDAP]]></category>
		<category><![CDATA[User]]></category>

		<guid isPermaLink="false">http://www.yoursearchbuddy.com/?p=5228</guid>
		<description><![CDATA[The following code will authenticate user from LDAP and is written in C#. string domainAndUsername = _domain + @"\" + userName; DirectoryEntry entry = new DirectoryEntry(_ldapConnectionString, domainAndUsername, userPassword); DirectorySearcher search... <a class="meta-more" href="http://www.yoursearchbuddy.com/authenticate-user-ldap-net">Read more <span class="meta-nav">&#187;</span></a>]]></description>
			<content:encoded><![CDATA[<p>The following code will authenticate user from LDAP and is written in C#.</p>
<pre>
string domainAndUsername = _domain + @"\" + userName;
DirectoryEntry entry = new DirectoryEntry(_ldapConnectionString, domainAndUsername, userPassword);
DirectorySearcher search = new DirectorySearcher(entry);
search.Filter = "(SAMAccountName=" + userName + ")";
SearchResult result = search.FindOne();
search.Dispose();
if (result == null)
{
    //Authentication Fail, return null or Do something
    return null;
}
else
{
    //Authenticated User
    //do Some thing
}
</pre>
]]></content:encoded>
			<wfw:commentRss>http://www.yoursearchbuddy.com/authenticate-user-ldap-net/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Handle QueryString Using Reflection In .NET</title>
		<link>http://www.yoursearchbuddy.com/handle-querystring-reflection-net</link>
		<comments>http://www.yoursearchbuddy.com/handle-querystring-reflection-net#comments</comments>
		<pubDate>Fri, 03 Jun 2011 03:25:36 +0000</pubDate>
		<dc:creator>lokeshlal</dc:creator>
				<category><![CDATA[Information]]></category>
		<category><![CDATA[Technology]]></category>
		<category><![CDATA[TipnTricks]]></category>
		<category><![CDATA[.net]]></category>
		<category><![CDATA[C#]]></category>
		<category><![CDATA[Handle]]></category>
		<category><![CDATA[QueryString]]></category>
		<category><![CDATA[Reflection]]></category>
		<category><![CDATA[Using]]></category>

		<guid isPermaLink="false">http://www.yoursearchbuddy.com/?p=5196</guid>
		<description><![CDATA[Recently we encountered an instance where we are required to use the querystring. I created a small class, that will read the query string and return the properties based on... <a class="meta-more" href="http://www.yoursearchbuddy.com/handle-querystring-reflection-net">Read more <span class="meta-nav">&#187;</span></a>]]></description>
			<content:encoded><![CDATA[<p>Recently we encountered an instance where we are required to use the querystring.<br />
I created a small class, that will read the query string and return the properties based on querystring. It will also let u set the properties and generate the querystring for you.</p>
<pre>
//Define public properties, with names same as the names desired in the querystring
public int Property1 { get; set; }
public bool Property2 { get; set; }
public DateTime Property3 { get; set; }

//this method will generate the querystring based on the values of properties
public string GenerateQueryString()
{
    string queryString = string.Empty;

    PropertyInfo[] propertyInfos = GetProperties(); //Get all public properties

    // write property names
    foreach (PropertyInfo propertyInfo in propertyInfos)
    {
        object value = propertyInfo.GetValue(this, null);
        if (value != null)
            queryString += string.Format("{0}={1}&amp;", propertyInfo.Name, Convert.ToString(value));
    }

    if (queryString.Length &gt; 0)
        queryString = queryString.Substring(0, queryString.Length - 1);

    return queryString;
}

//Returns all public properties of an instances of this class
private PropertyInfo[] GetProperties()
{
    PropertyInfo[] propertyInfos;
    Type type = this.GetType();
    propertyInfos = type.GetProperties(BindingFlags.Public | BindingFlags.Instance);

    // sort properties by name
    Array.Sort(propertyInfos,
            delegate(PropertyInfo propertyInfo1, PropertyInfo propertyInfo2)
            { return propertyInfo1.Name.CompareTo(propertyInfo2.Name); });
    return propertyInfos;
}

//This method will populate properties of this object from the querystring
public void GenerateObjectFromQueryString()
{
    PropertyInfo[] propertyInfos = GetProperties();

    // write property names
    foreach (PropertyInfo propertyInfo in propertyInfos)
    {
        if (HttpContext.Current.Request.QueryString.AllKeys.Contains(propertyInfo.Name))
        {
            object value = HttpContext.Current.Request.QueryString[propertyInfo.Name];
            if (propertyInfo.PropertyType == typeof(int))
            {
                propertyInfo.SetValue(this, Convert.ToInt32(value), null);
            }
            if (propertyInfo.PropertyType == typeof(bool))
            {
                propertyInfo.SetValue(this, Convert.ToBoolean(value), null);
            }
            if (propertyInfo.PropertyType == typeof(DateTime))
            {
                propertyInfo.SetValue(this, Convert.ToDateTime(value), null);
            }
        }
    }
}
</pre>
<p>I have only defined few proerpties and few types.</p>
<p>you can also pass a list object, converting the list into a comma seperated string and stoping the GenerateQueryString function to write the Generics value in the querystring.</p>
<pre>
//do not write Generics in query string
if (propertyInfo.PropertyType == typeof(List))
        continue;
</pre>
<pre>
//convert a list of integer into comma seperated string
public string convertListToString(List intArray)
{
    string[] intArrayStr = Array.ConvertAll(intArray.ToArray(), new Converter(Convert.ToString));
    string result = String.Join(",", intArrayStr);
    return result;
}

//convert a comma seperated string into list of integer
public List convertStringToList(string list)
{
    List intList = new List();
    foreach (string s in list.Split(new char[] { ',' }))
    {
        intList.Add(Convert.ToInt32(s));
    }
    return intList;
}
</pre>
<p>To write the query string, use another string type property,and call convertListToString in the getter and convertStringToList in setter of this property and use the list object only, this property will be used internally acting as a proxy for the list object.</p>
<pre>
public string ListIntString
{
 get;
 {
  return convertListToString(List();
 }
 set;
 {
   list =  convertStringToList(value);
 }
}
</pre>
]]></content:encoded>
			<wfw:commentRss>http://www.yoursearchbuddy.com/handle-querystring-reflection-net/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Command line to publish an ASP.NET Web Application Using MSBUILD</title>
		<link>http://www.yoursearchbuddy.com/command-line-publish-aspnet-web-application-msbuild</link>
		<comments>http://www.yoursearchbuddy.com/command-line-publish-aspnet-web-application-msbuild#comments</comments>
		<pubDate>Thu, 26 May 2011 04:56:26 +0000</pubDate>
		<dc:creator>lokeshlal</dc:creator>
				<category><![CDATA[Information]]></category>
		<category><![CDATA[Technology]]></category>
		<category><![CDATA[.net]]></category>
		<category><![CDATA[An]]></category>
		<category><![CDATA[application]]></category>
		<category><![CDATA[ASP]]></category>
		<category><![CDATA[Command]]></category>
		<category><![CDATA[line]]></category>
		<category><![CDATA[MSBUILD]]></category>
		<category><![CDATA[publish]]></category>
		<category><![CDATA[to]]></category>
		<category><![CDATA[Using]]></category>
		<category><![CDATA[web]]></category>

		<guid isPermaLink="false">http://www.yoursearchbuddy.com/?p=5071</guid>
		<description><![CDATA[To publish a web site from command line using Ms Build C:\WINDOWS\Microsoft.NET\Framework\v3.5\msbuild [Path]\WebProject.csproj \"/t:_CopyWebApplication;ResolveReferences;publish\" /p:OutDir=D:\\Project\\Web\\Bin\\ /p:WebProjectOutputDir=D:\\Project\\Web\\ Similarly, To build a web application project from command line we can use C:\WINDOWS\Microsoft.NET\Framework\v3.5\MSBUILD... <a class="meta-more" href="http://www.yoursearchbuddy.com/command-line-publish-aspnet-web-application-msbuild">Read more <span class="meta-nav">&#187;</span></a>]]></description>
			<content:encoded><![CDATA[<p>To publish a web site from command line using Ms Build</p>
<pre>
C:\WINDOWS\Microsoft.NET\Framework\v3.5\msbuild [Path]\WebProject.csproj \"/t:_CopyWebApplication;ResolveReferences;publish\" /p:OutDir=D:\\Project\\Web\\Bin\\ /p:WebProjectOutputDir=D:\\Project\\Web\\
</pre>
<p>Similarly, To build a web application project from command line we can use</p>
<pre>
C:\WINDOWS\Microsoft.NET\Framework\v3.5\MSBUILD [Path]\WebAppliationSolution.sln /t:rebuild /p:configuration=Release
</pre>
<p>We can use different switches to specify what action we would want to do.</p>
<p>like /t:clean is to clean the solution, publish is to publish the solution and there are few other switches as well.<br />
and /p:configuration can have Release or Debug, in which mode we would like to build the project</p>
]]></content:encoded>
			<wfw:commentRss>http://www.yoursearchbuddy.com/command-line-publish-aspnet-web-application-msbuild/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

