<?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>.NET Blog</title>
	<atom:link href="http://erishav.com/dotnet/feed/" rel="self" type="application/rss+xml" />
	<link>http://erishav.com/dotnet</link>
	<description>Articles on .Net Technology</description>
	<lastBuildDate>Thu, 19 Mar 2009 04:14:55 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Hash FLV to Mp3 Converter 2.0 Released.</title>
		<link>http://erishav.com/dotnet/2009/hash-flv-to-mp3-converter-20-released/</link>
		<comments>http://erishav.com/dotnet/2009/hash-flv-to-mp3-converter-20-released/#comments</comments>
		<pubDate>Thu, 19 Mar 2009 04:14:55 +0000</pubDate>
		<dc:creator>Rishav</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[.net]]></category>
		<category><![CDATA[rishav software]]></category>
		<category><![CDATA[software]]></category>

		<guid isPermaLink="false">http://erishav.com/dotnet/?p=176</guid>
		<description><![CDATA[Hash FLV to MP3 Converter is one shareware that can perfectly extract audio data from FLV video and convert to MP3 audio format, the conversion is high speed and the output MP3 file have as same as good quality with the source Flash file, the simple and friendly interface makes the program very easy to [...]]]></description>
			<content:encoded><![CDATA[<p>Hash FLV to MP3 Converter is one shareware that can perfectly extract audio data from FLV video and convert to MP3 audio format, the conversion is high speed and the output MP3 file have as same as good quality with the source Flash file, the simple and friendly interface makes the program very easy to use. The Speed with which the FLV files are converted you just cant imagine. The MP3 file converted occupies the least possible space on your HardDisk. The Mp3 file can be played in any of the MP3 Players available in the Market.</p>
<p><a href="http://erishav.com/hashflv2mp3.html"><strong>Download it here</strong></a></p>
<p>Advantages of Using The Hash FLV to Mp3 Converter 2.0</p>
<p>1. Converts any File at 5Mb/Second.</p>
<p>2. Converts and Minimizes the space Used in Memory.</p>
<p>3. A very Easy to Use Visual Interface</p>
<p><a href="http://erishav.com/hashflv2mp3.html"><strong>Download it here</strong></a></p>
]]></content:encoded>
			<wfw:commentRss>http://erishav.com/dotnet/2009/hash-flv-to-mp3-converter-20-released/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Hash HTML Mail Sender 2.0 Released</title>
		<link>http://erishav.com/dotnet/2009/hash-html-mail-sender-20-released/</link>
		<comments>http://erishav.com/dotnet/2009/hash-html-mail-sender-20-released/#comments</comments>
		<pubDate>Thu, 19 Mar 2009 04:11:55 +0000</pubDate>
		<dc:creator>Rishav</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[my software]]></category>
		<category><![CDATA[softwares]]></category>

		<guid isPermaLink="false">http://erishav.com/dotnet/?p=174</guid>
		<description><![CDATA[An update to the Hash HTML mail sender has been released. A great software on .NET.
Downlaod it to try and rate it. It has been completely built on .NET Platform using C#.
All the Bugs from the Previous Version Removed.
Customization and Personalization Option Available for each mail according to username.
Download it Here
Hash HTML Mail Sender is a [...]]]></description>
			<content:encoded><![CDATA[<p>An update to the Hash HTML mail sender has been released. A great software on .NET.</p>
<p>Downlaod it to try and rate it. It has been completely built on .NET Platform using C#.</p>
<p>All the Bugs from the Previous Version Removed.</p>
<p>Customization and Personalization Option Available for each mail according to username.</p>
<p><a title="Hash HTML Mail Sender" href="http://erishav.com/hashhms.html" target="_self"><strong>Download it Here</strong></a></p>
<p>Hash HTML Mail Sender is a bulk e-mail sender with HTML mail support. It is stand-alone software and does not require any additional libraries to be installed. All you need is a connection to the Internet. The program has a built-in SMTP server to deliver e-mail messages directly to e-mail recipients without bypassing your ISP servers. HMP saves your time, money and nerve.!! This a Wonderful and very easy to use software which makes mass emailing a very easy job.</p>
<p><a title="Hash HTML Mail Sender" href="http://erishav.com/hashhms.html" target="_self"><strong>Download it Here</strong></a></p>
<p>The Various features of Hash HTML Mail Sender are menttioned below:</p>
<p>Hash HTML Mail Sender accepts a list of recipients from text files generated by any e-mail management program. The number of addresses is unlimited. You can send e-mail messages to millions of people if you need to. Simply start the program, load your mailing list and press &#8216;Start mailing&#8217;! E-mail sender uses direct multi-thread delivery and ensures 100% usage of your modem. Using standard 56K modem you are able to send hundreds e-mail messages a minute. Hash HTML Mail Sender is a unique program for sending e-mails. The program provides safe, easy and fast way for direct mailing. It saves your time (i.e. money) by sending several messages simultaneously. Hash HTML Mail Sender is a powerful tool for personalized mass mailing.</p>
<p>Secured delivery: Hash HMS delivers e-mail without using your ISP resources. Sending the mail directly to recipient you exclude other Internet nodes from delivery route. Thus, nobody except the recipient can read the message. The messages do not go through your ISP mailing system; they are not logged there and cannot be stored. Therefore, Hash HMS guarantees that only you and your recipients will read the message.</p>
<p>Managed delivery: Using Hash HMS you can control the entire process of mailing. You can start sending e-mail at any time you like, stop it whenever you want to and resume later. All outgoing messages can be personalized for each recipient.</p>
<p>Hash HMS offers you really easy way to organize bulk mailing. Using this software you can send e-mail messages to thousands or even millions of recipients. Only your RAM limits total amount of them! It is as easy as 1-2-3 to create a new e-mail message and send it to 10,000 mailing list members in several minutes using HMP.</p>
<p><a title="Hash HTML Mail Sender" href="http://erishav.com/hashhms.html" target="_self"><strong>Download it Here</strong></a></p>
]]></content:encoded>
			<wfw:commentRss>http://erishav.com/dotnet/2009/hash-html-mail-sender-20-released/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Hash Youtube Downloader Launched</title>
		<link>http://erishav.com/dotnet/2009/hash-youtube-downloader-launched/</link>
		<comments>http://erishav.com/dotnet/2009/hash-youtube-downloader-launched/#comments</comments>
		<pubDate>Mon, 19 Jan 2009 06:41:20 +0000</pubDate>
		<dc:creator>Rishav</dc:creator>
				<category><![CDATA[General]]></category>
		<category><![CDATA[free software]]></category>
		<category><![CDATA[hash software]]></category>
		<category><![CDATA[you tube downloader]]></category>

		<guid isPermaLink="false">http://erishav.com/dotnet/?p=172</guid>
		<description><![CDATA[Hash YouTube Downlaoder©
Hash YouTube Downloader is a powerful, free and easy to use software that allows users to Download the YouTube Videos just at a Click of a Button. So just Install the Software and get all your favorite videos in your HardDisk, iPhone and Cell Phone.
Enjoy Your Videos.
Download Now
The Various Features of the Hash [...]]]></description>
			<content:encoded><![CDATA[<h2 class="style3">Hash YouTube Downlaoder<sup>©</sup></h2>
<p class="style3" align="center"><strong>Hash YouTube Downloader is a powerful, free and easy to use software that allows users to Download the YouTube Videos just at a Click of a Button. So just Install the Software and get all your favorite videos in your HardDisk, iPhone and Cell Phone.</strong></p>
<p class="style3" align="center">Enjoy Your Videos.</p>
<h1 class="style6"><a href="http://www.erishav.com/hashsoft/hashyoutubedownloader.zip">Download Now</a></h1>
<p class="style6"><strong>The Various Features of the Hash YouTube Downloader are mentioned below : </strong></p>
<div><strong>1. It&#8217;s software that allows you to download videos from YouTube in the FLV format.</strong></div>
<div><strong>2. The program is easy to use, just specify the URL for the video you want to download and click the Download Video button!</strong></div>
<div><strong>3. You can use Hash YouTube Downloader to download the videos of your choice from home, at the office or in school.</strong></div>
<div><strong>4. Download Hash YouTube Downloader now and get started downloading your favorite videos from YouTube.</strong></div>
<div><strong>5. It automatically detects the URL of YouTube if you have copied it or its in the clipboard.</strong></div>
<div><strong>6. It shows the file size and actual downloading progress.</strong></div>
<div><strong>7. A very neat, clean, user-friendly and powerful Interface.</strong></div>
<h1 class="style6"><a href="http://www.erishav.com/hashsoft/hashyoutubedownloader.zip">Download Now</a></h1>
]]></content:encoded>
			<wfw:commentRss>http://erishav.com/dotnet/2009/hash-youtube-downloader-launched/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Reading and Writing Values From/Into Windows Registry</title>
		<link>http://erishav.com/dotnet/2009/reading-and-writing-values-frominto-windows-registry/</link>
		<comments>http://erishav.com/dotnet/2009/reading-and-writing-values-frominto-windows-registry/#comments</comments>
		<pubDate>Wed, 14 Jan 2009 11:41:26 +0000</pubDate>
		<dc:creator>Rishav</dc:creator>
				<category><![CDATA[C# Code]]></category>
		<category><![CDATA[Programming Logic]]></category>
		<category><![CDATA[C# help]]></category>
		<category><![CDATA[registry editing]]></category>
		<category><![CDATA[registry reading]]></category>
		<category><![CDATA[regsitry writing]]></category>

		<guid isPermaLink="false">http://erishav.com/dotnet/?p=170</guid>
		<description><![CDATA[Here is the code for read the registry value using C#.
First I’m creating registry key value and string value in local machine as follows,
myKey &#8211;&#62; key value
myValue &#8211;&#62; string name
myReturnValue &#8211;&#62; string value
Code for Registry value Reading using C#&#8230;
using Microsoft.Win32;
try
{
RegistryKey registry = Registry.LocalMachine.CreateSubKey(&#8221;SOFTWARE\\myKey&#8221;);
if (registry != null)
{
MessageBox.Show(registry.GetValue(&#8221;myValue&#8221;));
registry.Close();
}
}
catch (Exception ex)
{
MessageBox.Show (ex.ToString());
}
 
Code for Values writing in Registry using [...]]]></description>
			<content:encoded><![CDATA[<p>Here is the code for read the registry value using C#.</p>
<p>First I’m creating registry key value and string value in local machine as follows,</p>
<p>myKey &#8211;&gt; key value<br />
myValue &#8211;&gt; string name<br />
myReturnValue &#8211;&gt; string value</p>
<p><strong>Code for Registry value Reading using C#&#8230;</strong></p>
<p><span style="color: #800000;">using Microsoft.Win32;</p>
<p>try<br />
{<br />
RegistryKey registry = Registry.LocalMachine.CreateSubKey(&#8221;SOFTWARE\\myKey&#8221;);<br />
if (registry != null)<br />
{<br />
MessageBox.Show(registry.GetValue(&#8221;myValue&#8221;));<br />
registry.Close();<br />
}<br />
}<br />
catch (Exception ex)<br />
{<br />
MessageBox.Show (ex.ToString());<br />
}<br />
</span> </p>
<p><span style="color: #000000;"><strong>Code for Values writing in Registry using C#.</strong></span></p>
<p><span style="color: #800000;">using Microsoft.Win32;</span></p>
<p><span style="color: #800000;">try<br />
{<br />
RegistryKey registry = Registry.LocalMachine.CreateSubKey(&#8221;SOFTWARE\\myKey&#8221;);<br />
if (registry != null)<br />
{<br />
registry.SetValue(&#8221;myValue&#8221;, &#8220;myReturnValue&#8221;);<br />
registry.Close();<br />
}<br />
}<br />
catch (Exception ex)<br />
{<br />
MessageBox.Show (ex.ToString());<br />
}</span></p>
]]></content:encoded>
			<wfw:commentRss>http://erishav.com/dotnet/2009/reading-and-writing-values-frominto-windows-registry/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Hash Notepad++ &#8211; A next gen Powerful Text Editor Launched</title>
		<link>http://erishav.com/dotnet/2009/hash-notepad-a-next-gen-powerful-text-editor-launched/</link>
		<comments>http://erishav.com/dotnet/2009/hash-notepad-a-next-gen-powerful-text-editor-launched/#comments</comments>
		<pubDate>Sun, 11 Jan 2009 07:04:15 +0000</pubDate>
		<dc:creator>Rishav</dc:creator>
				<category><![CDATA[General]]></category>
		<category><![CDATA[hash notepad++]]></category>
		<category><![CDATA[rishav]]></category>
		<category><![CDATA[software review]]></category>
		<category><![CDATA[text editor]]></category>

		<guid isPermaLink="false">http://erishav.com/dotnet/?p=168</guid>
		<description><![CDATA[Download Here
When just getting the job done is work enough, the last thing you need is to waste time having to learn yet another computer application. Your experience with other tools should be relevant to each new application, making it possible to sit down and use that new application right away. That&#8217;s why Hash Notepad++ [...]]]></description>
			<content:encoded><![CDATA[<h2><a title="Hash Notepad" href="http://www.erishav.com/hashnote.html">Download Here</a></h2>
<p>When just getting the job done is work enough, the last thing you need is to waste time having to learn yet another computer application. Your experience with other tools should be relevant to each new application, making it possible to sit down and use that new application right away. That&#8217;s why Hash Notepad++ is so popular. Whether you simply need a powerful replacement for Notepad/Wordpad, a tool for editing your web pages, or a programming IDE, Hash Notepad++ does what you want, the way you would expect. It&#8217;s available from this web site on a try before you buy basis, so please download your trial copy now, and find out just how productive you can be.</p>
<p>Hash Notepad++ is designed to provide the power and functionality to satisfy the most demanding text editing requirements. It can edit files up to the limits of virtual memory, and it will work with the 32-bit and 64-bit editions of Windows® 2000, Server 2003, XP and Vista. Hash Notepad++ has been implemented according to the Windows XP/Vista user interface guidelines, so great attention has been paid to making it easy for both beginners and experienced users. You just need to have .NET frameowork installed on your system to use.</p>
<h2><a title="Hash Notepad" href="http://www.erishav.com/hashnote.html">Download Here</a></h2>
<p>Basic Features of Hashmail Pro</p>
<p>Huge files can be edited, up to the limits of virtual memory.</p>
<p>Supports Universal Naming Convention (UNC) style names, and long file names with spaces.<br />
CUA compliant keyboard commands</p>
<p>Cut, Copy, Paste, Undo, Redo options available.</p>
<p>Options to save file as HTML, RTF and Text format.</p>
<p>Find and Replace feature.</p>
<p>A complete formatting toolbar to format your text as you want.</p>
<p>Insert option to insert Date, Day and Time with many options.</p>
<h2><a title="Hash Notepad" href="http://www.erishav.com/hashnote.html">Download Here</a></h2>
]]></content:encoded>
			<wfw:commentRss>http://erishav.com/dotnet/2009/hash-notepad-a-next-gen-powerful-text-editor-launched/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>SQL Injection : Definition and Prevention</title>
		<link>http://erishav.com/dotnet/2009/sql-injection-definition-and-prevention/</link>
		<comments>http://erishav.com/dotnet/2009/sql-injection-definition-and-prevention/#comments</comments>
		<pubDate>Fri, 09 Jan 2009 05:52:40 +0000</pubDate>
		<dc:creator>Rishav</dc:creator>
				<category><![CDATA[ASP.NET]]></category>
		<category><![CDATA[C# Code]]></category>
		<category><![CDATA[SQL Server Help]]></category>
		<category><![CDATA[safe sql server uasage]]></category>
		<category><![CDATA[SQL Databse]]></category>
		<category><![CDATA[sql server]]></category>
		<category><![CDATA[sql server help]]></category>
		<category><![CDATA[sql server injection]]></category>
		<category><![CDATA[sql server virus]]></category>

		<guid isPermaLink="false">http://erishav.com/dotnet/?p=165</guid>
		<description><![CDATA[SQL injection is a technique that exploits a security vulnerability occurring in the database layer of an application. The vulnerability is present when user input is either incorrectly filtered for string literal escape characters embedded in SQL statements or user input is not strongly typed and thereby unexpectedly executed. It is in fact an instance [...]]]></description>
			<content:encoded><![CDATA[<p><strong>SQL injection is a technique that exploits a security vulnerability occurring in the database layer of an application. The vulnerability is present when user input is either incorrectly filtered for string literal escape characters embedded in SQL statements or user input is not strongly typed and thereby unexpectedly executed. It is in fact an instance of a more general class of vulnerabilities that can occur whenever one programming or scripting language is embedded inside another.</p>
<p></strong>This form of SQL injection occurs when user input is not filtered for escape characters and is then passed into a SQL statement. This results in the potential manipulation of the statements performed on the database by the end user of the application.<br />
<em>Example</em><br />
The following line of code illustrates this vulnerability<br />
<strong>statement = &#8220;SELECT * FROM users WHERE name = &#8216;&#8221; + userName + &#8220;&#8216;;&#8221;</strong><br />
This SQL code is designed to pull up the records of a specified username from its table of users. However, if the &#8220;userName&#8221; variable is crafted in a specific way by a malicious user, the SQL statement may do more than the code author intended.<br />
For example, setting the &#8220;userName&#8221; variable as<strong> a&#8217; or &#8216;t&#8217;='t</strong><br />
renders this SQL statement by the parent language:<br />
<strong>SELECT * FROM users WHERE name = &#8216;a&#8217; OR &#8216;t&#8217;='t&#8217;;</strong><br />
If this code were to be used in an authentication procedure then this example could be used to force the selection of a valid username because the evaluation of &#8216;t&#8217;='t&#8217; is always true.</p>
<p><em>Another Example</em><br />
This form of SQL injection occurs when a user supplied field is not strongly typed or is not checked for type constraints. This could take place when a numeric field is to be used in a SQL statement, but the programmer makes no checks to validate that the user supplied input is numeric.<br />
For example:<br />
<strong>statement := &#8220;SELECT * FROM data WHERE id = &#8221; + a_variable + &#8220;;&#8221;</strong><br />
It is clear from this statement that the author intended a_variable to be a number correlating to the &#8220;id&#8221; field. However, if it is in fact a string then the end user may manipulate the statement as they choose, thereby bypassing the need for escape characters. For example, setting a_variable to<br />
<strong>1;DROP TABLE users</strong><br />
will drop (delete) the &#8220;users&#8221; table from the database, since the SQL would be rendered as follows:<br />
<strong>SELECT * FROM DATA WHERE id=1;DROP TABLE users;</strong></p>
<p><strong>Preventing SQL Injection</strong></p>
<p>To protect against SQL injection, user input must not directly be embedded in SQL statements. Instead, user input must be escaped or filtered or parameterized statements must be used.</p>
<p><span style="text-decoration: underline;"><strong>1. Using Parameterized Statements</strong></span><br />
In some programming languages such as Java and .NET parameterized statements can be used that work with parameters (sometimes called placeholders or bind variables) instead of embedding user input in the statement. In many cases, the SQL statement is fixed. The user input is then assigned (bound) to a parameter.<br />
This is an example using Java and the JDBC API:<br />
<strong><br />
PreparedStatement prep = conn.prepareStatement(&#8221;SELECT * FROM USERS WHERE USERNAME=? AND PASSWORD=?&#8221;);<br />
prep.setString(1, username);<br />
prep.setString(2, password)</strong>;</p>
<p>The same goes for C#:<br />
<strong>using (SqlCommand myCommand = new SqlCommand(&#8221;select * from Users where UserName=@username and Password=@password&#8221;, myConnection))<br />
{<br />
myCommand.Parameters.AddWithValue(&#8221;@username&#8221;, user);<br />
myCommand.Parameters.AddWithValue(&#8221;@password&#8221;, pass);</p>
<p>myConnection.Open();<br />
SqlDataReader myReader = myCommand.ExecuteReader())<br />
&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;.<br />
}</strong></p>
<p>In ASP:<br />
<strong>userName=replace(request.querystring(&#8221;username&#8221;))<br />
userPassword=replace(request.querystring(&#8221;Password&#8221;))<br />
userName=replace(userName,&#8221;&#8216;&#8221;,&#8221;\&#8217;&#8221;)<br />
&#8216;userPassword it&#8217;s a numeric value.<br />
userPassword=cdbl(userPassword)<br />
myConn.execute &#8220;select * from users where name=&#8217;&#8221; &amp; userName &amp; _<br />
&#8220;&#8216; and userPassword=&#8221; &amp; userPassword &amp; &#8221; limit 1&#8243;</strong></p>
<p>In PHP, it&#8217;s usual to just escape the parameters before sending the SQL query:<br />
<strong>$query = sprintf(&#8221;SELECT * FROM Users where UserName=&#8217;%s&#8217; and Password=&#8217;%s&#8217;&#8221;,<br />
mysql_real_escape_string($Username),<br />
mysql_real_escape_string($Password));<br />
mysql_query($query);</strong></p>
<p>For PHP version 5 and MySQL version 4.1 and above, however, you can use a vendor specific extension like msqli for &#8220;true&#8221; prepared statement queries.<br />
<strong>$db = new mysqli(&#8221;localhost&#8221;, &#8220;user&#8221;, &#8220;pass&#8221;, &#8220;database&#8221;);<br />
$stmt = $db -&gt; prepare(&#8221;SELECT priv FROM testUsers WHERE username=? AND password=?&#8221;);<br />
$stmt -&gt; bind_param(&#8221;ss&#8221;, $user, $pass);<br />
$stmt -&gt; execute();</strong><br />
The mysql_real_escape_string adds backslashes (\) to escaped characters like single quotes &#8216; and double quotes &#8220;. Though, you should read this</p>
<p>The magic_quotes_gpc PHP configuration directive affects Get, Post and Cookie values. If turned on, value (It&#8217;s &#8220;PHP!&#8221;) will automagically become (It\&#8217;s \&#8221;PHP!\&#8221;).</p>
]]></content:encoded>
			<wfw:commentRss>http://erishav.com/dotnet/2009/sql-injection-definition-and-prevention/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Boxing and Unboxing technique in C# completely explained</title>
		<link>http://erishav.com/dotnet/2009/boxing-and-unboxing-technique-in-c-completely-explained/</link>
		<comments>http://erishav.com/dotnet/2009/boxing-and-unboxing-technique-in-c-completely-explained/#comments</comments>
		<pubDate>Fri, 09 Jan 2009 05:46:24 +0000</pubDate>
		<dc:creator>Rishav</dc:creator>
				<category><![CDATA[C# Code]]></category>
		<category><![CDATA[Definition of Terms]]></category>
		<category><![CDATA[boxing]]></category>
		<category><![CDATA[difference betwwen boxing and unboxing]]></category>
		<category><![CDATA[unboxing]]></category>

		<guid isPermaLink="false">http://erishav.com/dotnet/?p=162</guid>
		<description><![CDATA[Boxing and unboxing is a essential concept in C# type system. With Boxing and unboxing one can link between value-types and reference-types by allowing any value of a value-type to be converted to and from type object. Boxing and unboxing enables a unified view of the type system wherein a value of any type can [...]]]></description>
			<content:encoded><![CDATA[<div style="text-align: left;">Boxing and unboxing is a essential concept in C# type system. With Boxing and unboxing one can link between value-types and reference-types by allowing any value of a value-type to be converted to and from type object. Boxing and unboxing enables a unified view of the type system wherein a value of any type can ultimately be treated as an object.</p>
<p>Converting a value type to reference type is called Boxing.Unboxing is an explicit operation. C# provides a unified type system. All typesincluding value typesderive from the type object. It is possible to call object methods on any value, even values of primitive types such as int.</p>
<p><strong>The example </strong><br />
<em>using System;<br />
class Test<br />
{<br />
static void Main()<br />
{<br />
Console.WriteLine(3.ToString());<br />
}<br />
}<br />
</em>calls the object-defined ToString method on an integer literal.<br />
<strong>The example<br />
</strong><em>class Test<br />
{<br />
static void Main()<br />
{<br />
int i = 1;<br />
object o = i; // boxing<br />
int j = (int) o; // unboxing<br />
}<br />
}</em></div>
<div style="text-align: left;">An int value can be converted to object and back again to int.<br />
This example shows both boxing and unboxing. When a variable of a value type needs to be converted to a reference type, an object box is allocated to hold the value, and the value is copied into the box.</p>
<p>Unboxing is just the opposite. When an object box is cast back to its original value type, the value is copied out of the box and into the appropriate storage location.</p></div>
<div style="text-align: left;"><strong></strong></div>
<div style="text-align: left;"><strong>Boxing conversions<br />
</strong>A boxing conversion permits any value-type to be implicitly converted to the type object or to any interface-type implemented by the value-type. Boxing a value of a value-type consists of allocating an object instance and copying the value-type value into that instance.</p>
<p>For example any value-type G, the boxing class would be declared as follows:</p>
<p><em>class vBox<br />
{<br />
G value;<br />
G_Box(G g) {<br />
value = g;<br />
}<br />
}</em></p>
<p>Boxing of a value v of type G now consists of executing the expression new G_Box(v), and returning the resulting instance as a value of type object.<br />
Thus, the statements<br />
<em>int i = 12;<br />
object box = i;<br />
</em>conceptually correspond to<br />
<em>int i = 12;<br />
object box = new int_Box(i);<br />
</em><br />
Boxing classes like G_Box and int_Box above dont actually exist and the dynamic type of a boxed value isnt actually a class type. Instead, a boxed value of type G has the dynamic type G, and a dynamic type check using the is operator can simply reference type G. For example,<br />
<em>int i = 12;<br />
object box = i;<br />
if (box is int)<br />
{<br />
Console.Write(&#8221;Box contains an int&#8221;);<br />
}<br />
</em>will output the string Box contains an int on the console.<br />
A boxing conversion implies making a copy of the value being boxed. This is different from a conversion of a reference-type to type object, in which the value continues to reference the same instance and simply is regarded as the less derived type object.</p>
<p>For example, given the declaration<br />
<em>struct Point<br />
{<br />
public int x, y;<br />
public Point(int x, int y)<br />
{<br />
this.x = x;<br />
this.y = y;<br />
}<br />
}</em></p>
<p>the following statements<br />
<em>Point p = new Point(10, 10);<br />
object box = p;<br />
p.x = 20;<br />
Console.Write(((Point)box).x);<br />
</em>will output the value 10 on the console because the implicit boxing operation that occurs in the assignment of p to box causes the value of p to be copied. Had Point instead been declared a class, the value 20 would be output because p and box would reference the same instance.</div>
<div style="text-align: left;">
<strong>Unboxing conversions<br />
</strong>An unboxing conversion permits an explicit conversion from type object to any value-type or from any interface-type to any value-type that implements the interface-type. An unboxing operation consists of first checking that the object instance is a boxed value of the given value-type, and then copying the value out of the instance. unboxing conversion of an object box to a value-type G consists of executing the expression ((G_Box)box).value.</p>
<p>Thus, the statements <em>object box = 12;<br />
int i = (int)box;<br />
</em><br />
conceptually correspond to<br />
<em>object box = new int_Box(12);<br />
int i = ((int_Box)box).value;<br />
</em>For an unboxing conversion to a given value-type to succeed at run-time, the value of the source argument must be a reference to an object that was previously created by boxing a value of that value-type. If the source argument is null or a reference to an incompatible object, an InvalidCastException is thrown.</div>
]]></content:encoded>
			<wfw:commentRss>http://erishav.com/dotnet/2009/boxing-and-unboxing-technique-in-c-completely-explained/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Storing and Retrieving Images from SQL Database.</title>
		<link>http://erishav.com/dotnet/2009/storing-and-retrieving-images-from-sql-database/</link>
		<comments>http://erishav.com/dotnet/2009/storing-and-retrieving-images-from-sql-database/#comments</comments>
		<pubDate>Fri, 09 Jan 2009 05:37:16 +0000</pubDate>
		<dc:creator>Rishav</dc:creator>
				<category><![CDATA[C# Code]]></category>
		<category><![CDATA[SQL Server Help]]></category>
		<category><![CDATA[image in sql]]></category>
		<category><![CDATA[retrieving image from sql]]></category>
		<category><![CDATA[SQL Databse]]></category>
		<category><![CDATA[sql server help]]></category>
		<category><![CDATA[string image in sql]]></category>

		<guid isPermaLink="false">http://erishav.com/dotnet/?p=159</guid>
		<description><![CDATA[To store an image in to sql server using C#, you need to read image file into a byte array. Once you have image data in byte array, you can easity store this image data in sql server using sql parameters. Following code explains you how to do this.
private void cmdSave_Click(object sender, EventArgs e)
{
try
{
//Read Image [...]]]></description>
			<content:encoded><![CDATA[<p><strong>To store an image</strong> in to sql server using C#, you need to read image file into a byte array. Once you have image data in byte array, you can easity store this image data in sql server using sql parameters. Following code explains you how to do this.</p>
<p>private void cmdSave_Click(object sender, EventArgs e)<br />
{<br />
try<br />
{<br />
//Read Image Bytes into a byte array<br />
byte[] imageData = ReadFile(txtImagePath.Text);</p>
<p>//Initialize SQL Server Connection<br />
SqlConnection CN = new SqlConnection(txtConnectionString.Text);</p>
<p>//Set insert query<br />
string qry = &#8220;insert into ImagesStore (OriginalPath,ImageData) _<br />
values(@OriginalPath, @ImageData)&#8221;;</p>
<p>//Initialize SqlCommand object for insert.<br />
SqlCommand SqlCom = new SqlCommand(qry, CN);</p>
<p>//We are passing Original Image Path and<br />
//Image byte data as sql parameters.<br />
SqlCom.Parameters.Add(new SqlParameter(&#8221;@OriginalPath&#8221;,<br />
(object)txtImagePath.Text));</p>
<p>SqlCom.Parameters.Add(new SqlParameter(&#8221;@ImageData&#8221;,<br />
(object)imageData));</p>
<p>//Open connection and execute insert query.<br />
CN.Open();<br />
SqlCom.ExecuteNonQuery();<br />
CN.Close();</p>
<p>//Close form and return to list or images.<br />
this.Close();<br />
}</p>
<p><strong>Now to Read it form Database.</strong><br />
To read images from SQL Server, prepare a dataset first which will hold data from SQL Server table. Bind this dataset with a gridview control on form<br />
Take a look at teh following Code</p>
<p>void GetImagesFromDatabase()<br />
{<br />
try<br />
{<br />
//Initialize SQL Server connection.<br />
SqlConnection CN = new SqlConnection(txtConnectionString.Text);</p>
<p>//Initialize SQL adapter.<br />
SqlDataAdapter ADAP = new SqlDataAdapter(&#8221;Select * from ImagesStore&#8221;, CN);</p>
<p>//Initialize Dataset.<br />
DataSet DS = new DataSet();</p>
<p>//Fill dataset with ImagesStore table.<br />
ADAP.Fill(DS, &#8220;ImagesStore&#8221;);</p>
<p>//Fill Grid with dataset.<br />
dataGridView1.DataSource = DS.Tables["ImagesStore"];<br />
}<br />
catch(Exception ex)<br />
{<br />
MessageBox.Show(ex.ToString());<br />
}<br />
}</p>
]]></content:encoded>
			<wfw:commentRss>http://erishav.com/dotnet/2009/storing-and-retrieving-images-from-sql-database/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Changing the Icon of your Application from its default Image</title>
		<link>http://erishav.com/dotnet/2009/changing-the-icon-of-your-application-from-its-default-image/</link>
		<comments>http://erishav.com/dotnet/2009/changing-the-icon-of-your-application-from-its-default-image/#comments</comments>
		<pubDate>Fri, 09 Jan 2009 05:31:34 +0000</pubDate>
		<dc:creator>Rishav</dc:creator>
				<category><![CDATA[Definition of Terms]]></category>
		<category><![CDATA[General]]></category>
		<category><![CDATA[changing application properties]]></category>
		<category><![CDATA[icon change]]></category>

		<guid isPermaLink="false">http://erishav.com/dotnet/?p=156</guid>
		<description><![CDATA[If you have developed any application, the deafult icon for your application is the icon which is used your OS for an exe file. So what should be done to change the icon to your own icon image.
This is defferent from the icon property of the Form in your appliaction. That is the icon for [...]]]></description>
			<content:encoded><![CDATA[<p>If you have developed any application, the deafult icon for your application is the icon which is used your OS for an exe file. So what should be done to change the icon to your own icon image.<br />
This is defferent from the icon property of the Form in your appliaction. That is the icon for that particular form to be displayed on the title bar of that particular Form.</p>
<p>Follow the steps given below to change the icon of your application.</p>
<p>1. Open up your application in Visual Studio.</p>
<p>2. Go to Project &gt;&gt; (Your Application Name) Properties option.</p>
<p>3. A window opens with many tabs on it.</p>
<p>4. Click on the Application tab.</p>
<p>5. In the Resources Panel under Icon Radio Button, choose your icon image file.<br />
Note: only files with extention(.ico) are accepted.</p>
<p>6. Save and Close the Window.</p>
<p>7. The icon for your appliaction has been changed.</p>
<p>Under this window you can change all the properties of your application. You can add the assembly information about your application. You can sign your appliaction, define various security options, publish your appliaction using the click once. You can also define the prerequistes for a computer system to have inorder to install your appliaction. You can also provide path for downloading the prerequesties. You can also provide the version information and where the updates will be available and many more things.</p>
]]></content:encoded>
			<wfw:commentRss>http://erishav.com/dotnet/2009/changing-the-icon-of-your-application-from-its-default-image/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Validation Controls in ASP.NET &#8211;  A remarkable Feature</title>
		<link>http://erishav.com/dotnet/2009/validation-controls-in-aspnet-a-remarkable-feature/</link>
		<comments>http://erishav.com/dotnet/2009/validation-controls-in-aspnet-a-remarkable-feature/#comments</comments>
		<pubDate>Wed, 07 Jan 2009 05:34:25 +0000</pubDate>
		<dc:creator>Rishav</dc:creator>
				<category><![CDATA[ASP.NET]]></category>
		<category><![CDATA[controls in asp.net]]></category>
		<category><![CDATA[new in ASP.NET 2.0]]></category>
		<category><![CDATA[validation in asp.net]]></category>

		<guid isPermaLink="false">http://erishav.com/dotnet/?p=152</guid>
		<description><![CDATA[Validation controls check user input in SelectionList and TextBox controls. Validation occurs when the form is posted to the server. The validation controls test the user&#8217;s input and, if the input fails any of the validation tests, ASP.NET sends the page back to the client device. When this occurs, the validation controls that detected errors [...]]]></description>
			<content:encoded><![CDATA[<p>Validation controls check user input in SelectionList and TextBox controls. Validation occurs when the form is posted to the server. The validation controls test the user&#8217;s input and, if the input fails any of the validation tests, ASP.NET sends the page back to the client device. When this occurs, the validation controls that detected errors display error messages.</p>
<p>With the exception of the ValidationSummary control, all validation controls must reference a SelectionList or TextBox control. Store the reference in the validation control&#8217;s ControlToValidate property. Because the ValidationSummary control does not reference other controls, it does not contain a ControlToValidate property.</p>
<p>Validation controls include five controls that make comparisons and one control that summarizes any errors that occur. All validation controls must be placed within a Form or Panel control, or inside a control&#8217;s template on a mobile Web page. You can also drag a validation control onto a mobile user control page.</p>
<p>There are six main types of validation controls :-<br />
<strong><span style="text-decoration: underline;">RequiredFieldValidator</span></strong><br />
It checks whether the control have any value. It&#8217;s used when you want the control should not be empty. Set the RequiredFieldValidator control&#8217;s ControlToValidate property to the ID of the SelectionList or TextBox control to validate. If the data value is not present, the RequiredFieldValidator control displays the value of its ErrorMessage property.</p>
<p><strong><span style="text-decoration: underline;">RangeValidator</span></strong><br />
It checks if the value in validated control is in that specific range.  Specify minimum and maximum range values by using the MinimumValue and MaximumValue properties. If the validation fails, the RangeValidator control displays the text in its ErrorMessage property.<br />
Example : TxtCustomerCode should not be more than eight length.</p>
<p><strong><span style="text-decoration: underline;">CompareValidator</span></strong><br />
It checks that the value in controls should match the value in other control. Whether your application compares a control&#8217;s data value to the value in another control or to a literal value, you must specify the data type of the values being compared. Set the data type by using the CompareValidator control&#8217;s Type property.<br />
Example : Textbox TxtPie should be equal to 3.14.</p>
<p><strong><span style="text-decoration: underline;">RegularExpressionValidator</span></strong><br />
When we want the control value should match with a specific regular expression.The RegularExpressionValidator control performs validation by comparing the user input to the regular expression pattern specified in its ValidationExpression property. You can write your own regular expressions or select from a list of predefined expressions. If the user input value in the targeted control does not match the regular expression in the ValidationExpression property, the RegularExpressionValidator control displays the text defined in its ErrorMessage property.</p>
<p><strong><span style="text-decoration: underline;">CustomValidator</span></strong><br />
It is used to define UserDefined validation. Like other validation controls, the CustomValidator control validates input from the TextBox or SelectionList control. Set the CustomValidator control&#8217;s ControlToValidate property to the ID of the control to validate. When a form that contains a CustomValidator control is posted to the server, the CustomValidator control raises its ServerValidate event. You must provide a handler<br />
<em>private void EventHandlerName(<br />
    object source,<br />
    System.Web.UI.WebControls.ServerValidateEventArgs args) { }</em></p>
<p><em></em><br />
<strong><span style="text-decoration: underline;">ValidationSummary</span></strong></p>
<p>Use the ValidationSummary control to present the user with a list of validation errors that occurred when a form was posted to the server. The ValidationSummary also displays a back link (whose text you can customize by setting the BackLabel property) for the user to return to the form and correct the data entry.</p>
]]></content:encoded>
			<wfw:commentRss>http://erishav.com/dotnet/2009/validation-controls-in-aspnet-a-remarkable-feature/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
