<?xml version="1.0" encoding="UTF-8"?>
<!-- generator="wordpress/1.5.1-alpha" -->
<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/"
>

<channel>
	<title>JDev</title>
	<link>http://jdev.blogsome.com</link>
	<description>Latest code snippets</description>
	<pubDate>Wed, 23 Sep 2009 18:12:33 +0000</pubDate>
	<generator>http://wordpress.org/?v=1.5.1-alpha</generator>
	<language>en</language>

		<item>
		<title>Oracle Equivalent for &#8220;Use Database&#8221; Command</title>
		<link>http://jdev.blogsome.com/2009/09/23/oracle-equivalent-for-use-database-command/</link>
		<comments>http://jdev.blogsome.com/2009/09/23/oracle-equivalent-for-use-database-command/#comments</comments>
		<pubDate>Wed, 23 Sep 2009 18:11:56 +0000</pubDate>
		<dc:creator>Administrator</dc:creator>
		
	<category>Code</category>
	<category>oracle</category>
		<guid>http://jdev.blogsome.com/2009/09/23/oracle-equivalent-for-use-database-command/</guid>
		<description><![CDATA[	ALTER SESSION SET CURRENT_SCHEMA = schema

]]></description>
			<content:encoded><![CDATA[	<p>ALTER SESSION SET CURRENT_SCHEMA = <em>schema</em>
</p>
]]></content:encoded>
			<wfw:commentRss>http://jdev.blogsome.com/2009/09/23/oracle-equivalent-for-use-database-command/feed/</wfw:commentRss>
	</item>
		<item>
		<title>Substring in Sql Server</title>
		<link>http://jdev.blogsome.com/2009/07/09/substring-in-sql-server/</link>
		<comments>http://jdev.blogsome.com/2009/07/09/substring-in-sql-server/#comments</comments>
		<pubDate>Thu, 09 Jul 2009 17:06:24 +0000</pubDate>
		<dc:creator>Administrator</dc:creator>
		
	<category>Code</category>
	<category>SQL Server</category>
		<guid>http://jdev.blogsome.com/2009/07/09/substring-in-sql-server/</guid>
		<description><![CDATA[	Suppose values in your fields contain a period, and you want to return all characters that come before it. This is how you do in SQL Server: 
	select substring(column1, 1, charindex(&#8217;.', column1)-1 )from myTable
]]></description>
			<content:encoded><![CDATA[	<p>Suppose values in your fields contain a period, and you want to return all characters that come before it. This is how you do in SQL Server: </p>
	<p><em><strong>select substring</strong>(column1, 1, <strong>charindex</strong>(&#8217;.', column1)-1 )<br /><strong>from </strong>myTable</em></p>
]]></content:encoded>
			<wfw:commentRss>http://jdev.blogsome.com/2009/07/09/substring-in-sql-server/feed/</wfw:commentRss>
	</item>
		<item>
		<title>Capitalize First Letter in JavaScript</title>
		<link>http://jdev.blogsome.com/2009/06/10/capitalize-first-letter-in-javascript/</link>
		<comments>http://jdev.blogsome.com/2009/06/10/capitalize-first-letter-in-javascript/#comments</comments>
		<pubDate>Wed, 10 Jun 2009 13:47:10 +0000</pubDate>
		<dc:creator>Administrator</dc:creator>
		
	<category>Code</category>
	<category>javascript</category>
		<guid>http://jdev.blogsome.com/2009/06/10/capitalize-first-letter-in-javascript/</guid>
		<description><![CDATA[	Here is a function based on excellent code from Philip M at http://www.codingforums.com/showthread.php?t=168661 that capitalizes the first letter of each word:
	function caps(str){&nbsp;&nbsp; &nbsp;return str.toLowerCase().replace(/\b[a-z]/g,function(w){return w.toUpperCase()});}
	&nbsp;
]]></description>
			<content:encoded><![CDATA[	<p>Here is a function based on excellent code from Philip M at <a href="http://www.codingforums.com/showthread.php?t=168661" target="_self">http://www.codingforums.com/showthread.php?t=168661</a> that capitalizes the first letter of each word:</p>
	<p><em>function caps(str){<br />&nbsp;&nbsp; &nbsp;return str.toLowerCase().replace(/\b[a-z]/g,function(w){return w.toUpperCase()});<br />}</em></p>
	<p>&nbsp;</p>
]]></content:encoded>
			<wfw:commentRss>http://jdev.blogsome.com/2009/06/10/capitalize-first-letter-in-javascript/feed/</wfw:commentRss>
	</item>
		<item>
		<title>Check if Column is Empy in SQL Server</title>
		<link>http://jdev.blogsome.com/2009/04/15/check-if-column-is-empy-in-sql-server/</link>
		<comments>http://jdev.blogsome.com/2009/04/15/check-if-column-is-empy-in-sql-server/#comments</comments>
		<pubDate>Wed, 15 Apr 2009 12:48:58 +0000</pubDate>
		<dc:creator>Administrator</dc:creator>
		
	<category>Code</category>
	<category>SQL Server</category>
		<guid>http://jdev.blogsome.com/2009/04/15/check-if-column-is-empy-in-sql-server/</guid>
		<description><![CDATA[	WHERE datalength(ColumnName)&gt; 0&nbsp; shows non-empty fields

]]></description>
			<content:encoded><![CDATA[	<p>WHERE datalength(ColumnName)&gt; 0&nbsp; shows non-empty fields
</p>
]]></content:encoded>
			<wfw:commentRss>http://jdev.blogsome.com/2009/04/15/check-if-column-is-empy-in-sql-server/feed/</wfw:commentRss>
	</item>
		<item>
		<title>Replace single quotes in transact-sql</title>
		<link>http://jdev.blogsome.com/2009/03/09/replace-single-quotes-in-transact-sql/</link>
		<comments>http://jdev.blogsome.com/2009/03/09/replace-single-quotes-in-transact-sql/#comments</comments>
		<pubDate>Mon, 09 Mar 2009 21:23:34 +0000</pubDate>
		<dc:creator>Administrator</dc:creator>
		
	<category>Code</category>
	<category>SQL Server</category>
		<guid>http://jdev.blogsome.com/2009/03/09/replace-single-quotes-in-transact-sql/</guid>
		<description><![CDATA[	If you have single quotes in your text values, and you need to insert them in a SQL Server database the recommended approach is to use parameterized stored procedures. They will handle single quotes seamlessly.
	However, there may be cases when you may need to construct an insert statement without resorting to parameters. In such cases, [...]]]></description>
			<content:encoded><![CDATA[	<p>If you have single quotes in your text values, and you need to insert them in a SQL Server database the recommended approach is to use parameterized stored procedures. They will handle single quotes seamlessly.</p>
	<p>However, there may be cases when you may need to construct an insert statement without resorting to parameters. In such cases, to handle text that contains single quotes you may have to use the Transact-SQL <em>Replace </em>function:</p>
	<pre class="libCScode"><em></em><em>REPLACE ( string_expression , string_pattern , string_replacement )</em></pre>
	<p>An example that escapes single quotes by adding another single quote before it:</p>
	<p><em>Declare @temp as varchar(64)<br />Set&nbsp; @temp= (select &#8230;&nbsp; from &#8230;)<br />Set @temp = Replace(@temp, &#8216;&#8221;&#8217;,&#8221;&#8221;'&#8217;)</em></p>
	<p>In other words, you need 4 single quotes as a second argument, and 6 single quotes as a second argument to escape single quotes.</p>

</p>
]]></content:encoded>
			<wfw:commentRss>http://jdev.blogsome.com/2009/03/09/replace-single-quotes-in-transact-sql/feed/</wfw:commentRss>
	</item>
		<item>
		<title>Export Unicode From GridView to Excel</title>
		<link>http://jdev.blogsome.com/2009/02/12/export-unicode-from-gridview-to-excel/</link>
		<comments>http://jdev.blogsome.com/2009/02/12/export-unicode-from-gridview-to-excel/#comments</comments>
		<pubDate>Thu, 12 Feb 2009 20:18:21 +0000</pubDate>
		<dc:creator>Administrator</dc:creator>
		
	<category>Code</category>
	<category>.NET</category>
		<guid>http://jdev.blogsome.com/2009/02/12/export-unicode-from-gridview-to-excel/</guid>
		<description><![CDATA[	This solution was found on http://razvan.cosma.name/weblog/index.php?entry=entry090116-161656
	private void ExportToExcel(string strFileName, GridView gv)&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Response.ClearContent();&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Response.ContentType = &quot;application/excel&quot;;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Response.AddHeader(&quot;content-disposition&quot;, &quot;attachment; filename=&quot; + strFileName);&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Response.Charset = &quot;&quot;;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Response.ContentEncoding = System.Text.Encoding.Unicode;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Response.BinaryWrite(System.Text.Encoding.Unicode.GetPreamble());&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; this.EnableViewState = false;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; System.IO.StringWriter sw = new System.IO.StringWriter();&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; HtmlTextWriter htw = new HtmlTextWriter(sw);&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; gv.RenderControl(htw);&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Response.Write(sw.ToString());&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; HttpContext.Current.ApplicationInstance.CompleteRequest();&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; } 
	
	&nbsp;
	&nbsp;
	&nbsp;
]]></description>
			<content:encoded><![CDATA[	<p>This solution was found on <a target="_self" href="http://razvan.cosma.name/weblog/index.php?entry=entry090116-161656">http://razvan.cosma.name/weblog/index.php?entry=entry090116-161656</a></p>
	<p>private void ExportToExcel(string strFileName, GridView gv)<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Response.ClearContent();<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Response.ContentType = &quot;application/excel&quot;;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Response.AddHeader(&quot;content-disposition&quot;, &quot;attachment; filename=&quot; + strFileName);<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Response.Charset = &quot;&quot;;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Response.ContentEncoding = System.Text.Encoding.Unicode;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<strong>&nbsp;&nbsp; Response.BinaryWrite(System.Text.Encoding.Unicode.GetPreamble());</strong><br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; this.EnableViewState = false;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; System.IO.StringWriter sw = new System.IO.StringWriter();<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; HtmlTextWriter htw = new HtmlTextWriter(sw);<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; gv.RenderControl(htw);<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Response.Write(sw.ToString());&nbsp;&nbsp;&nbsp;&nbsp; <br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; HttpContext.Current.ApplicationInstance.CompleteRequest();<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; } </p>
	<p><a target="_self" href="http://razvan.cosma.name/weblog/index.php?entry=entry090116-161656"></a></p>
	<p>&nbsp;</p>
	<p>&nbsp;</p>
	<p>&nbsp;</p>
]]></content:encoded>
			<wfw:commentRss>http://jdev.blogsome.com/2009/02/12/export-unicode-from-gridview-to-excel/feed/</wfw:commentRss>
	</item>
		<item>
		<title>Some Regular Expressions for Java</title>
		<link>http://jdev.blogsome.com/2009/02/11/some-regular-expressions-for-java/</link>
		<comments>http://jdev.blogsome.com/2009/02/11/some-regular-expressions-for-java/#comments</comments>
		<pubDate>Wed, 11 Feb 2009 04:01:43 +0000</pubDate>
		<dc:creator>Administrator</dc:creator>
		
	<category>Code</category>
	<category>java</category>
		<guid>http://jdev.blogsome.com/2009/02/11/some-regular-expressions-for-java/</guid>
		<description><![CDATA[	If you need to find text lines that start with an alphanumeric characters:
	String reg =&quot;\\w+&quot;;&nbsp;&nbsp; 
	In other words, an alphanumeric character that gets repeated 1 or more times. 
	&nbsp;To find text lines that start with a whitespace and contain other characters after it, use the following regex:
	String&nbsp; reg = &quot;\\s.+&quot;; 
	&nbsp;That is, first find a [...]]]></description>
			<content:encoded><![CDATA[	<p>If you need to find text lines that <strong>start </strong>with an alphanumeric characters:</p>
	<p><strong>String reg =&quot;\\w+&quot;;&nbsp;&nbsp; </strong></p>
	<p>In other words, an alphanumeric character that gets repeated 1 or more times. </p>
	<p>&nbsp;To find text lines that start with a <strong>whitespace </strong>and contain other characters after it, use the following regex:</p>
	<p><strong>String&nbsp; reg = &quot;\\s.+&quot;; </strong></p>
	<p>&nbsp;That is, first find a whitespace, then any character repeated 1 or more times.</p>
	<p>&nbsp;</p>
]]></content:encoded>
			<wfw:commentRss>http://jdev.blogsome.com/2009/02/11/some-regular-expressions-for-java/feed/</wfw:commentRss>
	</item>
		<item>
		<title>Select Individual Columns From Table Information Schema</title>
		<link>http://jdev.blogsome.com/2009/01/29/select-individual-columns-from-table-information-schema/</link>
		<comments>http://jdev.blogsome.com/2009/01/29/select-individual-columns-from-table-information-schema/#comments</comments>
		<pubDate>Thu, 29 Jan 2009 19:50:16 +0000</pubDate>
		<dc:creator>Administrator</dc:creator>
		
	<category>Code</category>
	<category>SQL Server</category>
		<guid>http://jdev.blogsome.com/2009/01/29/select-individual-columns-from-table-information-schema/</guid>
		<description><![CDATA[	The &#8216;desc&#8217; command to get a list of table fields that is common in Oracle and MySql will fail in SQL Server. It turns out it is not sql-standard compliant. Instead, SQL Server uses the following command:
	sp_columns myTableName
	This will display detailed information about table structure.
	If you need just individual columns, use the following command:
	select column_name, [...]]]></description>
			<content:encoded><![CDATA[	<p>The &#8216;desc&#8217; command to get a list of table fields that is common in Oracle and MySql will fail in SQL Server. It turns out it is not sql-standard compliant. Instead, SQL Server uses the following command:</p>
	<p><em>sp_columns myTableName</em></p>
	<p>This will display detailed information about table structure.</p>
	<p>If you need just individual columns, use the following command:</p>
	<p><em>select column_name, data_type, character_maximum_length, * &nbsp; <br />from information_schema.columns<br />where table_name = &#8216;myTableName&#8217;</em></p>
	<p><em>order by ordinal_position&nbsp; </em></p>
	<p>&nbsp;</p>
]]></content:encoded>
			<wfw:commentRss>http://jdev.blogsome.com/2009/01/29/select-individual-columns-from-table-information-schema/feed/</wfw:commentRss>
	</item>
		<item>
		<title>Upload Excel File Without Saving It</title>
		<link>http://jdev.blogsome.com/2009/01/06/upload-excel-file-without-saving-it/</link>
		<comments>http://jdev.blogsome.com/2009/01/06/upload-excel-file-without-saving-it/#comments</comments>
		<pubDate>Tue, 06 Jan 2009 21:31:11 +0000</pubDate>
		<dc:creator>Administrator</dc:creator>
		
	<category>.NET</category>
	<category>Excel</category>
		<guid>http://jdev.blogsome.com/2009/01/06/upload-excel-file-without-saving-it/</guid>
		<description><![CDATA[	Here is a discussion of the captioned issue with a solution posted at the end of the page, pointing to a third-party solution.

]]></description>
			<content:encoded><![CDATA[	<p>Here is a <a href="http://stackoverflow.com/questions/262341/get-data-from-an-uploaded-excel-file-without-saving-to-file-system" target="_self">discussion </a>of the captioned issue with a solution posted at the end of the page, pointing to a <a href="http://www.codeplex.com/ExcelDataReader" target="_self">third-party solution</a>.
</p>
]]></content:encoded>
			<wfw:commentRss>http://jdev.blogsome.com/2009/01/06/upload-excel-file-without-saving-it/feed/</wfw:commentRss>
	</item>
		<item>
		<title>Split a string into words in Java</title>
		<link>http://jdev.blogsome.com/2008/11/13/split-a-string-into-words-in-java/</link>
		<comments>http://jdev.blogsome.com/2008/11/13/split-a-string-into-words-in-java/#comments</comments>
		<pubDate>Thu, 13 Nov 2008 17:54:20 +0000</pubDate>
		<dc:creator>Administrator</dc:creator>
		
	<category>Code</category>
	<category>java</category>
		<guid>http://jdev.blogsome.com/2008/11/13/split-a-string-into-words-in-java/</guid>
		<description><![CDATA[	Use a Pattern&nbsp; class from the java.util.regex package to split a long string into separate words in Java.
	A Pattern is a compiled representation of a regular expression.    
	String str = &quot;a&nbsp;&nbsp;&nbsp;&nbsp; very long&nbsp;&nbsp; string&nbsp;&nbsp; possibly with&nbsp;&nbsp; line breaks&nbsp; ,&nbsp; tab&nbsp;&nbsp; delimiters etc&quot;;
	Pattern p = Pattern.compile(&quot;[,\\s]+&quot;);String[] arr = p.split(str);&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; 
]]></description>
			<content:encoded><![CDATA[	<p>Use a Pattern&nbsp; class from the java.util.regex package to split a long string into separate words in Java.</p>
	<p>A Pattern is a <a href="http://java.sun.com/j2se/1.4.2/docs/api/java/util/regex/Pattern.html#sum" target="_self">compiled representation of a regular expression.</a>    </p>
	<p><em>String str = &quot;a&nbsp;&nbsp;&nbsp;&nbsp; very long&nbsp;&nbsp; string&nbsp;&nbsp; possibly with&nbsp;&nbsp; line breaks&nbsp; ,&nbsp; tab&nbsp;&nbsp; delimiters etc&quot;;<br /></em></p>
	<p><em>Pattern p = Pattern.compile(&quot;[,\\s]+&quot;);<br />String[] arr = p.split(str);&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; </em></p>
]]></content:encoded>
			<wfw:commentRss>http://jdev.blogsome.com/2008/11/13/split-a-string-into-words-in-java/feed/</wfw:commentRss>
	</item>
	</channel>
</rss>
