<?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>Counter Helix</title>
	<atom:link href="http://counterhelix.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://counterhelix.com</link>
	<description>Musings on code and other things</description>
	<lastBuildDate>Thu, 27 Sep 2012 20:56:59 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.4.1</generator>
		<item>
		<title>Latest major versions of documents from the getlistitems web service call for sharepoint</title>
		<link>http://counterhelix.com/2012/09/28/latest-major-versions-of-documents-from-the-getlistitems-web-service-call-for-sharepoint/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=latest-major-versions-of-documents-from-the-getlistitems-web-service-call-for-sharepoint</link>
		<comments>http://counterhelix.com/2012/09/28/latest-major-versions-of-documents-from-the-getlistitems-web-service-call-for-sharepoint/#comments</comments>
		<pubDate>Thu, 27 Sep 2012 20:56:13 +0000</pubDate>
		<dc:creator>odnxe</dc:creator>
				<category><![CDATA[Sharepoint]]></category>

		<guid isPermaLink="false">http://counterhelix.com/?p=158</guid>
		<description><![CDATA[I recently ran into an issue where I needed to only get the latest major version of a document with my get list items web service call. Versioning must be set up on the document library Steps to set up &#8230; <a href="http://counterhelix.com/2012/09/28/latest-major-versions-of-documents-from-the-getlistitems-web-service-call-for-sharepoint/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>I recently ran into an issue where I needed to only get the latest major version of a document with my get list items web service call. </p>
<p><strong>Versioning must be set up on the document library</strong></p>
<p>Steps to set up versioning are as follows:</p>
<ol>
<li>Navigate to the document library you wan&#8217;t to do the sharepoint web service call on</li>
<li>Navigate to the document library settings, do this by hovering over &#8220;Settings&#8221; and then clicking &#8220;Document Library Settings&#8221;</li>
<li>Once on the library settings page, find and click the link called &#8220;Versioning settings&#8221;</li>
<li>Once you are the versioning settings for the library make sure the following values are set in the settings page.<br />
<br />Content Approval: Yes/No<br />Document Version History: Create major and minor(draft) versions<br />Draft Item Security: Only users who can edit items<br />Require Chekc Out: Yes/No</li>
<li>Once that is done click the &#8220;Ok&#8221; button</li>
</ol>
<p><strong>Ad user used by the sharepoint web service must have &#8220;Read access&#8221; only.</strong></p>
<p>Steps to set up permissions are as follows</p>
<ol>
<li>Navigate to the document library you wan&#8217;t to do the sharepoint web service call on</li>
<li>Navigate to the document library settings, do this by hovering over &#8220;Settings&#8221; and then clicking &#8220;Document Library Settings&#8221;</li>
<li>Once on the library settings page, find and click the link called &#8220;Permissions for thsi document library&#8221;</li>
<li>From this page, find the user and then make sure said user only has &#8220;Read&#8221; or &#8220;Restricted Read&#8221; permissions only, the main point is that ad user must not be able to edit documents.<br />
<br />A side note is that if the user is part of a group that has enhanced permissions, this wont work, or if it is inheriting permissions, this wont work.<br />It may be simpler to create a new user just for your sharepoint web service consumer.</li>
</ol>
<p>That&#8217;s it, now your sharepoint web service consumer should only get back the latest major versions of documents.</p>
]]></content:encoded>
			<wfw:commentRss>http://counterhelix.com/2012/09/28/latest-major-versions-of-documents-from-the-getlistitems-web-service-call-for-sharepoint/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Doubly Linked List (Once again going to update with lots of comments and intro)</title>
		<link>http://counterhelix.com/2011/08/19/doubly-linked-list-once-again-going-to-update-with-lots-of-comments-and-intro/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=doubly-linked-list-once-again-going-to-update-with-lots-of-comments-and-intro</link>
		<comments>http://counterhelix.com/2011/08/19/doubly-linked-list-once-again-going-to-update-with-lots-of-comments-and-intro/#comments</comments>
		<pubDate>Fri, 19 Aug 2011 03:42:03 +0000</pubDate>
		<dc:creator>odnxe</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://counterhelix.com/?p=138</guid>
		<description><![CDATA[]]></description>
			<content:encoded><![CDATA[<pre class="brush: csharp; title: ; notranslate">
    public class DoublyNode&lt;T&gt;
    {
        private T value;
        private DoublyNode&lt;T&gt; previous;
        private DoublyNode&lt;T&gt; next;

        public T Value
        {
            get { return value; }
            set { this.value = value; }
        }

        public DoublyNode&lt;T&gt; Previous
        {
            get { return previous; }
            set { this.previous = value; }
        }

        public DoublyNode&lt;T&gt; Next
        {
            get { return next; }
            set { this.next = value; }
        }

        public DoublyNode(T value)
        {
            this.value = value;
        }
    }

    public class DoublyLinkedList&lt;T&gt;
    {
        private DoublyNode&lt;T&gt; head;
        private DoublyNode&lt;T&gt; tail;

        public DoublyLinkedList()
        {
            this.head = null;
            this.tail = null;
        }

        public DoublyNode&lt;T&gt; Head
        {
            get { return head; }
        }

        public DoublyNode&lt;T&gt; Tail
        {
            get { return tail; }
        }

        public DoublyNode&lt;T&gt; Search(T value)
        {
            DoublyNode&lt;T&gt; cursor = head;


            while (cursor != null &amp;&amp; !EqualityComparer&lt;T&gt;.Default.Equals(cursor.Value, value))
            {
                cursor = cursor.Next;
            }

            return cursor;
        }

        public void InsertStart(T value)
        {
            DoublyNode&lt;T&gt; node = new DoublyNode&lt;T&gt;(value);

            if (head != null)
            {
                node.Next = head;
                head.Previous = node;
                head = node;
            }
            else
            {
                tail = node;
                head = node;
                return;
            }
        }

        public void InsertEnd(T value)
        {
            DoublyNode&lt;T&gt; node = new DoublyNode&lt;T&gt;(value);

            if (tail != null)
            {
                node.Previous = tail;
                tail.Next = node;
                tail = node;
            }
            else
            {
                tail = node;
                head = node;
                return;
            }
        }

        public void DeleteFirst()
        {
            if (head != null)
            {
                head = head.Next;
                head.Previous = null;
            }
        }

        public void DeleteEnd()
        {
            if (tail != null)
            {
                tail = tail.Previous;
                tail.Next = null;
            }
        }

        public bool InsertAfter(T insert, T value)
        {
            if (insert == null || value == null)
                return false;

            DoublyNode&lt;T&gt; node = Search(insert);

            if (node == null) //didn't find exisinting node
                return false;

            DoublyNode&lt;T&gt; newNode = new DoublyNode&lt;T&gt;(value);
            newNode.Previous = node;

            if (node.Next != null)
                node.Next.Previous = newNode;

            newNode.Next = node.Next;
            node.Next = newNode;

            return true;
        }

        public bool InsertBefore(T insert, T value)
        {
            if (insert == null || value == null)
                return false;

            DoublyNode&lt;T&gt; node = Search(insert);

            if (node == null) //didn't find exisinting node
                return false;

            DoublyNode&lt;T&gt; newNode = new DoublyNode&lt;T&gt;(value);
            newNode.Next = node;

            if (node.Previous != null)
                node.Previous.Next = newNode;

            newNode.Previous = node.Next;
            node.Previous = newNode;

            return true;
        }

        public bool Remove(T value)
        {
            DoublyNode&lt;T&gt; node = Search(value);

            if (node == null)
                return false;

            if (node.Previous == null)
                head = head.Next;
            else
                node.Previous.Next = node.Next;

            if (node.Next == null)
                tail = tail.Previous;
            else
                node.Next.Previous = node.Previous;

            return true;
        }
    }
</pre>
]]></content:encoded>
			<wfw:commentRss>http://counterhelix.com/2011/08/19/doubly-linked-list-once-again-going-to-update-with-lots-of-comments-and-intro/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Singly Linked List (Going to update with comments and intro)</title>
		<link>http://counterhelix.com/2011/08/19/singly-linked-list-going-to-update-with-comments-and-intro/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=singly-linked-list-going-to-update-with-comments-and-intro</link>
		<comments>http://counterhelix.com/2011/08/19/singly-linked-list-going-to-update-with-comments-and-intro/#comments</comments>
		<pubDate>Fri, 19 Aug 2011 03:34:26 +0000</pubDate>
		<dc:creator>odnxe</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://counterhelix.com/?p=130</guid>
		<description><![CDATA[]]></description>
			<content:encoded><![CDATA[<pre class="brush: csharp; title: ; notranslate">
    public class SinglyNode&lt;T&gt;
    {
        private T value;
        private SinglyNode&lt;T&gt; next;

        public T Value
        {
            get { return value; }
            set { this.value = value; }
        }

        public SinglyNode&lt;T&gt; Next
        {
            get { return next; }
            set { this.next = value; }
        }

        public SinglyNode(T value)
        {
            this.value = value;
        }

    }

    public class SinglyLinkedList&lt;T&gt;
    {
        private SinglyNode&lt;T&gt; head;

        public SinglyLinkedList()
        {
            this.head = null;
        }

        public SinglyNode&lt;T&gt; Head
        {
            get { return head; }
        }

        public void Insert(T value)
        {
            SinglyNode&lt;T&gt; node = new SinglyNode&lt;T&gt;(value);
            node.Next = head;
            head = node;
        }

        public void Delete()
        {
            if (head != null)
                head = head.Next;
        }
    }
</pre>
]]></content:encoded>
			<wfw:commentRss>http://counterhelix.com/2011/08/19/singly-linked-list-going-to-update-with-comments-and-intro/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Basic trie data structure implementation (C#)</title>
		<link>http://counterhelix.com/2011/08/16/basic-trie-data-structure-implementation/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=basic-trie-data-structure-implementation</link>
		<comments>http://counterhelix.com/2011/08/16/basic-trie-data-structure-implementation/#comments</comments>
		<pubDate>Tue, 16 Aug 2011 02:41:11 +0000</pubDate>
		<dc:creator>odnxe</dc:creator>
				<category><![CDATA[Data structures and algorithms]]></category>
		<category><![CDATA[csharp]]></category>
		<category><![CDATA[data-structures]]></category>
		<category><![CDATA[Tutorial]]></category>

		<guid isPermaLink="false">http://taksblog.nfshost.com/?p=57</guid>
		<description><![CDATA[Today I want to talk about a cool little data structure called a &#8220;trie&#8221;. The trie gets its name from the word re/trie/val. A trie is a data structure for building memory efficient dictionaries with fast lookups. Tries are the &#8230; <a href="http://counterhelix.com/2011/08/16/basic-trie-data-structure-implementation/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>Today I want to talk about a cool little data structure called a &#8220;trie&#8221;. The trie gets its name from the word re/trie/val. A trie is a data structure for building memory efficient dictionaries with fast lookups. Tries are the foundation for one of the fastest known sorting algorithms <a title="burstsort" href=http://en.wikipedia.org/wiki/Burstsort">(burstsort)</a>, it is also used for spell checking, and is used in applications that use text completion.</p>
<p>Let&#8217;s say I wanted to store the following words in a trie: to, tea, ted, ten, team, a, i, in, inn.</p>
<p><img class="alignnone" title="Trie" src="http://i.imgur.com/U6EZV.png" alt="" width="417" height="345" /></p>
<p><em>Note that the parent node is always null or empty.</em></p>
<p>To find the word /team/, we would traverse the trie starting at <strong>t &gt; e &gt; a &gt; m*</strong></p>
<p>To find the word /in/, we would go <strong>i &gt; n*</strong></p>
<p>If we were to search for the word /te/, it would return false because it doesn&#8217;t end on a node with a marker.</p>
<p><em>* indicates a marker for a complete word.</em></p>
<p>A complete word is indicated by a red star in the diagram. It is also marked by a boolean property in our implementation.</p>
<p>Our first class is the node which represents each node on the trie.</p>
<pre class="brush: csharp; title: ; notranslate">
    public class Node
    {
        char _letter;
        bool _last;
        Dictionary&lt;char, Node&gt; _children;

        protected Node() { }

        public Node(char c)
        {
            _children = new Dictionary&lt;char, Node&gt;();
            _last = false;
            _letter = c;
        }

        public char Letter
        {
            get { return this._letter; }
            set { this._letter = value; }
        }

        public bool Last
        {
            get { return this._last; }
            set { this._last = value; }
        }

        public Dictionary&lt;char, Node&gt; Children
        {
            get { return this._children; }
            set { this._children = value; }
        }

        public Node ChildNode(char c)
        {
            if (Children != null)
            {
                if (Children.ContainsKey(c))
                {
                    return Children1;
                }
            }
            return null;
        }

        public override bool Equals(object obj)
        {
            if (obj == null || this.GetType() != obj.GetType())
                return false;
            
            return Equals(obj);
        }
        
        public bool Equals(Node obj)
        {
            if (obj != null
                &amp;&amp; obj.Letter == this.Letter)
            {
                return true;
            }               

            return false;
        }

        public override int GetHashCode()
        {
            int hash = 13;
            hash = (hash * 7) + this.Letter.GetHashCode();
            return hash;
        }
    }
</pre>
<p>*Edit: updated node class to use a dictionary for faster searches.</p>
<p>Our next class is our actual Trie, it contains each node and only has two operations &#8211; inserting and searching.</p>
<pre class="brush: csharp; title: ; notranslate">
    public class Trie
    {
        private Node _root;

        public Trie()
        {
            _root = new Node(' ');
        }

        public void Insert(string s)
        {
            char[] word = s.ToLower().ToCharArray();

            Node current = _root;

            if (word.Length == 0)
            {
                current.Last = true;
            }

            for (int i = 0; i &lt; s.Length; i++)
            {
                Node child = current.ChildNode(word[i]);
                if (child != null)
                {
                    current = child;
                }
                else
                {
                    current.Children.Add(word[i], new Node(word[i]));
                    current = current.ChildNode(word[i]);
                }

                if (i == word.Length - 1)
                {
                    current.Last = true;
                }
            }
        }

        public bool Search(string s)
        {
            char[] word = s.ToLower().ToCharArray();
            Node current = _root;
            while (current != null)
            {
                for (int i = 0; i &lt; word.Length; i++)
                {
                    if (current.ChildNode(word[i]) == null)
                        return false;
                    else
                        current = current.ChildNode(word[i]);
                }

                if (current.Last == true)
                    return true;
                else
                    return false;
            }
            return false;
        }
    }
</pre>
<p>Implementation in a windows form application.</p>
<pre class="brush: csharp; title: ; notranslate">
    public partial class MainForm : Form
    {
        Trie trie;

        public MainForm()
        {
            InitializeComponent();
        }

        private void MainForm_Load(object sender, EventArgs e)
        {
            trie = new Trie();
        }

        private void findButton_Click(object sender, EventArgs e)
        {
            if (trie.Search(findTextBox.Text.Trim()))
            {
                results.Text = String.Format(&quot;\&quot;{0}\&quot; was found in the trie.&quot;, findTextBox.Text);
            }
            else
            {
                results.Text = String.Format(&quot;\&quot;{0}\&quot; was not found in the trie.&quot;, findTextBox.Text);
            }

            findTextBox.Text = &quot;&quot;;
        }

        private void insertButton_Click(object sender, EventArgs e)
        {
            string phrase = insertTextBox.Text.Trim();

            string[] words = phrase.Trim().Split(' ', ',', ';', '.');

            foreach (string word in words)
            {
                trie.Insert(word);
            }

            trie.Insert(phrase);

            results.Text = String.Format(&quot;\&quot;{0}\&quot; was successfully inserted into trie.&quot;, insertTextBox.Text);

            insertTextBox.Text = &quot;&quot;;
        }

    }
</pre>
<p>Here&#8217;s the implementation in action.</p>
<p>Inserting words into trie.</p>
<p><img class="alignnone" title="Inserting into trie" src="http://i.imgur.com/uY8Ss.png" alt="" width="453" height="132" /></p>
<p><img class="alignnone" title="Step 2" src="http://i.imgur.com/xaAHH.png" alt="" width="452" height="132" /></p>
<p>Searching the trie for a word.</p>
<p><img class="alignnone" title="Step 3" src="http://i.imgur.com/D8OxA.png" alt="" width="455" height="134" /></p>
<p>If a word isn&#8217;t in the trie then we would get a &#8220;false&#8221;.</p>
<p><img class="alignnone" title="Step 4" src="http://i.imgur.com/1pq2p.png" alt="" width="451" height="134" /></p>
]]></content:encoded>
			<wfw:commentRss>http://counterhelix.com/2011/08/16/basic-trie-data-structure-implementation/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>Removing entire directory using SSH</title>
		<link>http://counterhelix.com/2011/08/15/removing-directories-using-ssh/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=removing-directories-using-ssh</link>
		<comments>http://counterhelix.com/2011/08/15/removing-directories-using-ssh/#comments</comments>
		<pubDate>Mon, 15 Aug 2011 19:08:42 +0000</pubDate>
		<dc:creator>odnxe</dc:creator>
				<category><![CDATA[SSH]]></category>

		<guid isPermaLink="false">http://taksblog.nfshost.com/?p=50</guid>
		<description><![CDATA[This is how to recursively delete a specified directory, including all files and all sub directories. rm : remove -rf : recursively delete a specified directory, including all files and all sub directories. (note the f makes it delete without &#8230; <a href="http://counterhelix.com/2011/08/15/removing-directories-using-ssh/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>This is how to recursively delete a specified directory, including all files and all sub directories.</p>
<pre class="brush: bash; title: ; notranslate">
rm -rf DirectoryToDelete
</pre>
<p>rm : remove<br />
-rf : recursively delete a specified directory, including all files and all sub directories. (note the f makes it delete without asking confirmation)</p>
]]></content:encoded>
			<wfw:commentRss>http://counterhelix.com/2011/08/15/removing-directories-using-ssh/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Installing wordpress plugins using SSH</title>
		<link>http://counterhelix.com/2011/08/15/installing-wordpress-plugins-using-ssh/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=installing-wordpress-plugins-using-ssh</link>
		<comments>http://counterhelix.com/2011/08/15/installing-wordpress-plugins-using-ssh/#comments</comments>
		<pubDate>Mon, 15 Aug 2011 19:01:53 +0000</pubDate>
		<dc:creator>odnxe</dc:creator>
				<category><![CDATA[SSH]]></category>
		<category><![CDATA[Tutorial]]></category>

		<guid isPermaLink="false">http://taksblog.nfshost.com/?p=32</guid>
		<description><![CDATA[This is a short tutorial about using SSH to install a wordpress plugin. For this example I&#8217;m going to show you how I installed change directories to where your wp-content/plugins folder is located. use the wget command to download the &#8230; <a href="http://counterhelix.com/2011/08/15/installing-wordpress-plugins-using-ssh/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>This is a short tutorial about using SSH to install a wordpress plugin.</p>
<p>For this example I&#8217;m going to show you how I installed</p>
<ol>
<li>change directories to where your wp-content/plugins folder is located.</li>
<li>use the wget command to download the zip folder.</li>
<li>unzip your newly downloaded plugin</li>
<li>remove that zip folder from your wp-content/plugins folder.</li>
</ol>
<p><strong>Code:</strong></p>
<pre class="brush: bash; title: ; notranslate">
cd /wp-content/plugins
wget http://downloads.wordpress.org/plugin/syntaxhighlighter.zip
unzip syntaxhighlighter.zip
rm syntaxhighlighter.zip
</pre>
<p>So you can use this method to securely manage your wordpress plugins.</p>
]]></content:encoded>
			<wfw:commentRss>http://counterhelix.com/2011/08/15/installing-wordpress-plugins-using-ssh/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
