<?xml version="1.0" encoding="UTF-8"?><!-- generator="WordPress/2.7.1" -->
<rss version="0.92">
<channel>
	<title>codehutch.com</title>
	<link>http://codehutch.com</link>
	<description>Online Code Repository</description>
	<lastBuildDate>Thu, 01 Dec 2011 10:27:17 +0000</lastBuildDate>
	<docs>http://backend.userland.com/rss092</docs>
	<language>en</language>
	
	<item>
		<title>C#: Reverse a String</title>
		<description>Reversing a string in C# is quite easy. The main concept is to treat the string as an array of characters, which is already built-in in C#, and transfer each character to new container in reverse order. Here are the samples of simple and straightforward functions on how to reverse ...</description>
		<link>http://codehutch.com/2011/12/c-reverse-a-string/</link>
			</item>
	<item>
		<title>XOR Encryption</title>
		<description>XOR (Exclusive OR, EOR, EXOR) is a logical operation which results to a true value if exactly one of the two operands has a value of true.

Sample XOR Table



INPUT
OUTPUT


A
B
A ^ B


0
0
0


0
1
1


1
0
1


1
1
0


Using this knowledge we can encrypt characters using their binary values. Take for example the string "ENCRYPT". First, we take ...</description>
		<link>http://codehutch.com/2011/11/xor-encryption/</link>
			</item>
	<item>
		<title>Transact-SQL: Recursive User-defined Function</title>
		<description>T-SQL can be a powerful tool for developers if exploited. It allows you to programatically manipulate your data on the "database-level". This post will show a simple T-SQL script on how to create a recursive user-defined function [UDF] that can be used application-wide via a simple query. To demonstrate, we ...</description>
		<link>http://codehutch.com/2011/10/recursive-user-defined-function-in-t-sql/</link>
			</item>
	<item>
		<title>Export XML into a comma-delimited (CSV) File</title>
		<description>Here is a sample source code on how to read and load xml file via LINQ, extract the data [using a query] and export it to a CSV file.

The XML file (employee.xml)
&#60;xml&#62;
&#60;Employee id="1"&#62;
&#60;Name&#62;John Doe&#60;/Name&#62;
&#60;Position&#62;President&#60;/Position&#62;
&#60;Salary&#62;$500,000&#60;/Salary&#62;
&#60;/Employee&#62;
&#60;Employee id="2"&#62;
&#60;Name&#62;Jane Doe&#60;/Name&#62;
&#60;Position&#62;Vice President&#60;/Position&#62;
&#60;Salary&#62;$250,000&#60;/Salary&#62;
&#60;/Employee&#62;
&#60;Employee id="3"&#62;
&#60;Name&#62;Jen Doe&#60;/Name&#62;
&#60;Position&#62;Manager&#60;/Position&#62;
&#60;Salary&#62;$50,000&#60;/Salary&#62;
&#60;/Employee&#62;
&#60;/xml&#62;



The code
'Libraries
Imports System
Imports System.IO
Imports System.Text
Imports System.Xml.Linq
Imports Microsoft.VisualBasic.FileIO

'=====================================

'Read/Load xml file
Dim employees As XElement ...</description>
		<link>http://codehutch.com/2011/10/export-xml-into-a-comma-delimited-csv-file/</link>
			</item>
	<item>
		<title>Using While Loop instead of Cursor</title>
		<description>There are cases where using Cursor would do you more harm than good. It uses considerably large amount of resources in your server and not to mention that it can cause leaks if not used correctly (Eg. Open without corresponding Close). That's why most T-SQL developer often suggest to avoid ...</description>
		<link>http://codehutch.com/2011/10/using-while-loop-instead-of-cursor/</link>
			</item>
	<item>
		<title>How to Lock a Routine in C#</title>
		<description>This source code shows how to lock a certain routine so it cannot  be accessed/used by another process. To demonstrate this, we will use  Threads.
using System;
using System.Threading;

class ThreadLock
{

private int Tests = 0;

public void TestRun()
{
Thread t1 = new Thread(new ThreadStart(Exec));
t1.Name = "thread 1";
Thread t2 = new Thread(new ThreadStart(Exec));
t2.Name = ...</description>
		<link>http://codehutch.com/2011/10/how-to-lock-a-routine/</link>
			</item>
	<item>
		<title>Moving a File from one Folder/Directory to another</title>
		<description>This is a sample function on how to move a file from one folder/directory to another while considering some factors such as:

	 Is the file available? Or is it being used by another process?
	 Does the file exists?
	Does a file with the same filename exists in the destination folder?

Move File ...</description>
		<link>http://codehutch.com/2011/10/moving-a-file-from-one-folderdirectory-to-another/</link>
			</item>
	<item>
		<title>MSSQL: Split as an alternative to OpenXML</title>
		<description>When working with MSSQL, there are cases where your simple stored procedure (SP) just won't work when deployed to your live server even though it works perfectly on your local PC. I have encountered this problem a couple of days ago where my SP won't work on Windows Azure SQL. ...</description>
		<link>http://codehutch.com/2011/09/mssql-split-as-an-alternate-to-openxml/</link>
			</item>
	<item>
		<title>Telerik Treview NodeClick Event</title>
		<description>I'm currently using Telerik Treeview and I'm fascinated on how great its features are.  I have an example on NodeClick event.

Highlight parent/s when a node is clicked

The Treeview
&#60;telerik:RadTreeView ID="MyTreeview" MultipleSelect="true" OnNodeClick="MyTreeviewClick" /&#62;

Note: MultipleSelect must be set to True
The Click routine
Protected Sub MyTreeviewClick(sender As Object, e As RadTreeNodeEventArgs)
SelectParent(e.Node)
End Sub
Highlight parent function
Protected ...</description>
		<link>http://codehutch.com/2011/05/telerik-treview-nodeclick-event/</link>
			</item>
	<item>
		<title>Extending Gridview Class</title>
		<description>When working on customized Gridview (especially when you're planning to use it multiple times within your solution), you can always create your own class by extending the default Gridview.  So instead of putting all properties inside &#60;asp:GridView&#62; tag like this:
&#60;asp:GridView ID="MyOwnGridViewID" runat="server" CssClass="MyOwnGridViewClass" AllowPaging="true" PageSize="25"&#62;
&#60;!-- As well as other properties ...</description>
		<link>http://codehutch.com/2011/03/extending-gridview-class/</link>
			</item>
</channel>
</rss>

