<?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"
	>

<channel>
	<title>Solve IT</title>
	<atom:link href="http://www.laptev.com/index.php?feed=rss2" rel="self" type="application/rss+xml" />
	<link>http://www.laptev.com</link>
	<description>Solving Information Technology problems one at a time</description>
	<pubDate>Tue, 18 May 2010 17:33:54 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.6</generator>
	<language>en</language>
			<item>
		<title>Auto tab text form fields with jQuery</title>
		<link>http://www.laptev.com/?p=16</link>
		<comments>http://www.laptev.com/?p=16#comments</comments>
		<pubDate>Tue, 18 May 2010 17:33:54 +0000</pubDate>
		<dc:creator>admin</dc:creator>
		
		<category><![CDATA[jQuery]]></category>

		<guid isPermaLink="false">http://www.laptev.com/?p=16</guid>
		<description><![CDATA[Problem
Need to auto tab to the next form field when the maximum number of entered  characters is reached.
Solution
Assigned [maxlenght] attribute and [autotab] class to each field you want to auto tab. Add the following code to $(document).ready event:

$&#40;'.autotab'&#41;.keydown&#40;function&#40;event&#41; &#123;
    //save previously entered value prior to keyup event
    $&#40;this&#41;.attr&#40;'prevValue', $&#40;this&#41;.val&#40;&#41;&#41;;
&#125;&#41;;
&#160;
$&#40;'.autotab'&#41;.keyup&#40;function&#40;event&#41; [...]]]></description>
			<content:encoded><![CDATA[<h3>Problem</h3>
<p>Need to auto tab to the next form field when the maximum number of entered  characters is reached.</p>
<h3>Solution</h3>
<p>Assigned [maxlenght] attribute and [autotab] class to each field you want to auto tab. Add the following code to $(document).ready event:</p>

<div class="wp_syntax"><div class="code"><pre class="javascript" style="font-family:monospace;">$<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'.autotab'</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">keydown</span><span style="color: #009900;">&#40;</span><span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span>event<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
    <span style="color: #006600; font-style: italic;">//save previously entered value prior to keyup event</span>
    $<span style="color: #009900;">&#40;</span><span style="color: #000066; font-weight: bold;">this</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">attr</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'prevValue'</span><span style="color: #339933;">,</span> $<span style="color: #009900;">&#40;</span><span style="color: #000066; font-weight: bold;">this</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">val</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
$<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'.autotab'</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">keyup</span><span style="color: #009900;">&#40;</span><span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span>event<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
    <span style="color: #003366; font-weight: bold;">var</span> newValue <span style="color: #339933;">=</span> $<span style="color: #009900;">&#40;</span><span style="color: #000066; font-weight: bold;">this</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">val</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    <span style="color: #006600; font-style: italic;">//see if the textbox had its value changed</span>
    <span style="color: #000066; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span>$<span style="color: #009900;">&#40;</span><span style="color: #000066; font-weight: bold;">this</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">attr</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'prevValue'</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">!=</span> newValue<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
        <span style="color: #006600; font-style: italic;">//see if the number of entered characters is equal or greater</span>
        <span style="color: #006600; font-style: italic;">//than the allowable maxlength</span>
        <span style="color: #000066; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span>newValue.<span style="color: #660066;">length</span> <span style="color: #339933;">&amp;</span>gt<span style="color: #339933;">;=</span> $<span style="color: #009900;">&#40;</span><span style="color: #000066; font-weight: bold;">this</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">attr</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'maxlength'</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
            <span style="color: #006600; font-style: italic;">//set focus on the next field with autotab class</span>
            $<span style="color: #009900;">&#40;</span><span style="color: #000066; font-weight: bold;">this</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">next</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'.autotab'</span><span style="color: #009900;">&#41;</span>.<span style="color: #000066;">focus</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        <span style="color: #009900;">&#125;</span>
        <span style="color: #006600; font-style: italic;">//save newly entered value for the next execution of this event</span>
        $<span style="color: #009900;">&#40;</span><span style="color: #000066; font-weight: bold;">this</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">attr</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'prevValue'</span><span style="color: #339933;">,</span> newValue<span style="color: #009900;">&#41;</span>
    <span style="color: #009900;">&#125;</span>
<span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div>

<p>Hopefully, my comments in the above code is enough to understand how it works.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.laptev.com/?feed=rss2&amp;p=16</wfw:commentRss>
		</item>
		<item>
		<title>TruncationException: Trying to convert return value or output parameter of size XXX bytes to a T-SQL type with a smaller size limit of 8000 bytes.</title>
		<link>http://www.laptev.com/?p=12</link>
		<comments>http://www.laptev.com/?p=12#comments</comments>
		<pubDate>Mon, 26 Jan 2009 04:26:01 +0000</pubDate>
		<dc:creator>admin</dc:creator>
		
		<category><![CDATA[SQL Server]]></category>

		<category><![CDATA[CLR stored procedure]]></category>

		<category><![CDATA[SQL Server 2008]]></category>

		<guid isPermaLink="false">http://www.laptev.com/?p=12</guid>
		<description><![CDATA[Problem
You receive &#8220;TruncationException: Trying to convert return value or output parameter of size XXX bytes to a T-SQL type with a smaller size limit of 8000 bytes&#8221; error while trying to execute CLR stored procedure in SQL Server 2008.
Explanation
CLR stored procedure is trying to return via output parameter string that exceeds 8000 bytes. Declaring output [...]]]></description>
			<content:encoded><![CDATA[<h3>Problem</h3>
<p>You receive &#8220;TruncationException: Trying to convert return value or output parameter of size XXX bytes to a T-SQL type with a smaller size limit of 8000 bytes&#8221; error while trying to execute CLR stored procedure in SQL Server 2008.</p>
<h3>Explanation</h3>
<p>CLR stored procedure is trying to return via output parameter string that exceeds 8000 bytes. Declaring output parameter as nvarchar(MAX) is not enough to overcome 8000 bytes limit.</p>
<h3>Solution</h3>
<p>In order to return strings via CLR procedures that are more than 8000 bytes you need to apply a special attribute called SqlFacet(MaxSize) to the output parameter. </p>
<p>Example in VB.NET:<br />
<code>Public Shared Sub MySP(&lt;SqlFacet(MaxSize:=-1)&gt; ByRef ret As SqlString) </code></p>
<p>Example in C#:<br />
<code>public static SqlString MySP([param: SqlFacet(MaxSize=-1)] SqlString ret)</code></p>
]]></content:encoded>
			<wfw:commentRss>http://www.laptev.com/?feed=rss2&amp;p=12</wfw:commentRss>
		</item>
		<item>
		<title>How to Modify applicationSettings section</title>
		<link>http://www.laptev.com/?p=7</link>
		<comments>http://www.laptev.com/?p=7#comments</comments>
		<pubDate>Wed, 24 Sep 2008 18:51:56 +0000</pubDate>
		<dc:creator>admin</dc:creator>
		
		<category><![CDATA[Uncategorized]]></category>

		<category><![CDATA[Configuration]]></category>

		<category><![CDATA[vb.net]]></category>

		<guid isPermaLink="false">http://www.laptev.com/?p=7</guid>
		<description><![CDATA[Problem
My.Settings.YourSettingName is a read only property for application scope configuration
Explanation
By design you can&#8217;t modify application scope configuration settings, e.g. My.Settings.Setting1 is always read-only.
Solution
You can change the scope of the setting from Application to User, but then the setting will be stored in user.config instead of app.config
Another solution is to access application configuration file directly via [...]]]></description>
			<content:encoded><![CDATA[<h3>Problem</h3>
<p>My.Settings.YourSettingName is a read only property for application scope configuration</p>
<h3>Explanation</h3>
<p>By design you can&#8217;t modify application scope configuration settings, e.g. My.Settings.Setting1 is always read-only.</p>
<h3>Solution</h3>
<p>You can change the scope of the setting from Application to User, but then the setting will be stored in user.config instead of app.config<br />
Another solution is to access application configuration file directly via System.Configuration.Configuration class. Here a small sample that updates LastDownloadDate configuration setting inside applicationSettings/APP.My.MySettings section:<br />
<code><br />
Dim config As System.Configuration.Configuration = ConfigurationManager.OpenExeConfiguration(ConfigurationUserLevel.None)<br />
Dim sec As ClientSettingsSection = config.GetSection("applicationSettings/APP.My.MySettings")<br />
sec.Settings.Get("LastDownloadDate").Value.ValueXml.InnerXml = Now.ToString<br />
sec.SectionInformation.ForceSave = True<br />
config.Save(ConfigurationSaveMode.Modified)<br />
</code></p>
]]></content:encoded>
			<wfw:commentRss>http://www.laptev.com/?feed=rss2&amp;p=7</wfw:commentRss>
		</item>
		<item>
		<title>&#8220;Cannot get IIS pickup directory&#8221; error</title>
		<link>http://www.laptev.com/?p=3</link>
		<comments>http://www.laptev.com/?p=3#comments</comments>
		<pubDate>Wed, 27 Aug 2008 21:31:30 +0000</pubDate>
		<dc:creator>admin</dc:creator>
		
		<category><![CDATA[IIS Solutions]]></category>

		<category><![CDATA[ASP.NET]]></category>

		<category><![CDATA[IIS]]></category>

		<guid isPermaLink="false">http://www.laptev.com/?p=3</guid>
		<description><![CDATA[Problem
You receive &#8220;Cannot get IIS pickup directory&#8221; error while trying to send email via System.Net.Mail namespace in ASP.NET.
Explanation
User account under which the ASP.NET code is being executed doesn&#8217;t have access to the SMTP configuration path in IIS metabase.
Solution

Find out under what domain/user account your ASP.NET application is running
Download MetaAcl tool from here
Run the following command:cscript Metaacl.vbs &#8220;IIS://localhost/SMTPsvc&#8221; your_domain\your_username [...]]]></description>
			<content:encoded><![CDATA[<h3>Problem</h3>
<p>You receive &#8220;Cannot get IIS pickup directory&#8221; error while trying to send email via System.Net.Mail namespace in ASP.NET.</p>
<h3>Explanation</h3>
<p>User account under which the ASP.NET code is being executed doesn&#8217;t have access to the SMTP configuration path in IIS metabase.</p>
<h3>Solution</h3>
<ol>
<li>Find out under what domain/user account your ASP.NET application is running</li>
<li>Download MetaAcl tool from <a target = "_blank" href="http://support.microsoft.com/kb/267904/">here</a></li>
<li>Run the following command:cscript Metaacl.vbs &#8220;IIS://localhost/SMTPsvc&#8221; your_domain\your_username RE</li>
</ol>
<p>The above steps will give your_domain\your_username Read &amp; Enumerate permissions in IIS metabase on SMTPsvc branch.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.laptev.com/?feed=rss2&amp;p=3</wfw:commentRss>
		</item>
	</channel>
</rss>
