<?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>Mu-mon-kan &#187; coding</title>
	<atom:link href="http://jungshadow.com/blog/category/coding/feed/" rel="self" type="application/rss+xml" />
	<link>http://jungshadow.com/blog</link>
	<description>The Gateless Barrier</description>
	<lastBuildDate>Sat, 10 Apr 2010 04:48:53 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0</generator>
		<item>
		<title>Working with Git on Dreamhost</title>
		<link>http://jungshadow.com/blog/2010/03/24/working-with-git-on-dreamhost/</link>
		<comments>http://jungshadow.com/blog/2010/03/24/working-with-git-on-dreamhost/#comments</comments>
		<pubDate>Wed, 24 Mar 2010 06:01:25 +0000</pubDate>
		<dc:creator>jared</dc:creator>
				<category><![CDATA[coding]]></category>
		<category><![CDATA[environment]]></category>

		<guid isPermaLink="false">http://jungshadow.com/blog/?p=78</guid>
		<description><![CDATA[Preamble Though I gained most of these insights by reading this very informative site, I need to retype things in my own words to catalog my own trials and tribulations while satisfying my own thought process (or lack-thereof). Mind you, I&#8217;m not adding much (if anything) to the original post&#8230;just my own perspective and tailored [...]]]></description>
			<content:encoded><![CDATA[<h4>Preamble</h4>
<p>Though I gained most of these insights by reading <a href="http://progit.org/book/ch4-7.html" title="ProGit: Gitosis">this very informative site</a>, I need to retype things in my own words to catalog my own trials and tribulations while satisfying my own thought process (or lack-thereof). Mind you, I&#8217;m not adding much (if anything) to the original post&#8230;just my own perspective and tailored to a Dreamhost environment.</p>
<h4>Prerequisites</h4>
<p>No one likes passwords and all of the baggage attached to them (e.g. typing them, changing them, etc&#8230;). To avoid typing passwords when connecting to the server (which becomes a requirement/necessity for git a bit later on) we generate public/private keys using ssh-keygen:</p>
<blockquote><p><code>$ ssh-keygen -t rsa -C "user@email.com"</code></p></blockquote>
<blockquote><p><strong>NB:</strong> I&#8217;m not going to go into the particulars of <acronym title="Rivest, Shamir and Adleman">RSA</acronym>. <a href="http://en.wikipedia.org/wiki/Rsa" title="RSA">Wikipedia has a pretty good primer</a>.</p></blockquote>
<p>Executing the command generates a sequence of password requests followed by the generated key fingerprint and randomart image (example output shown below with sensitive bits removed and set off by asterisks):</p>
<blockquote><pre>Generating public/private rsa key pair.
Enter file in which to save the key (/Users/<b>username</b>/.ssh/id_rsa):
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in /Users/<b>username</b>/.ssh/id_rsa.
Your public key has been saved in /Users/<b>username</b>/.ssh/id_rsa.pub.
The key fingerprint is:
<strong>*fingerprint*</strong>
The key's randomart image is:
<strong>*randomart*</strong>
</pre>
</blockquote>
<p>You&#8217;ll need to move <code>~/.ssh/id_rsa.pub</code> to the server as it will be needed later in the process.</p>
<h4>Setting Up Gitosis</h4>
<p>Before starting, it&#8217;s important to note 2 things:</p>
<ol>
<li>Wherever you put Gitosis, it will take over the account preventing you from ssh-ing into it directly.</li>
<li>When you connect to the repository, the full path to the location where the files are kept is not necessary (and it will fail).</li>
</ol>
<p>All of the following instructions take place on the server hosting the repository. First, create a src folder to store all the bits of code:</p>
<blockquote><pre>$ mkdir ~/src
$ cd ~/src</pre>
</blockquote>
<p>Download the latest version of git:</p>
<blockquote><p><code>$ wget http://kernel.org/pub/software/scm/git/git-1.7.0.2.tar.gz</code></p></blockquote>
<p>Decompress the file:</p>
<blockquote><p><code>$ tar -xvvzf git-1.7.0.2.tar.gz</code></p></blockquote>
<p>Change to the new directory and install:</p>
<blockquote><pre>$ cd git-1.7.0.2
$ ./configure -prefix=$HOME/local NO_MMAP=1
$ make
$ make install</pre>
</blockquote>
<blockquote><p><strong>NB:</strong> Your prefix path may be different depending on your preferences. You&#8217;ll want to specify the root of the directory that contains (if they currently exist) the <em>bin</em>, <em>lib</em>, and similar directories.</p></blockquote>
<p>Create a directory to contain localized Python additions.</p>
<blockquote><p><code>$ mkdir -p ~/local/lib/python2.4/site-packages</code></p></blockquote>
<p>Add these additions to .bashrc and .bash_profile:</p>
<blockquote><pre># lines for gitosis
export PYTHONPATH=$HOME/local/lib/python2.4/site-packages/
export PATH=$HOME/local/bin:$PATH</pre>
</blockquote>
<p>Before installing Python setuptools, you can add a <code>.pydistutils.cfg</code> file that adds a bit more fine-grained control to this (and future) installation. You can create this file with your editor-of-choice or by executing the following lines:</p>
<blockquote><pre>$ echo "[install]" >> ~/.pydistutils.cfg
$ echo "install_lib = ~/local/lib/python\$py_version_short/site-packages" >> ~/.pydistutils.cfg
$ echo "install_scripts = ~/local/bin" >> ~/.pydistutils.cfg</pre>
</blockquote>
<p>The previous lines create a <code>.pydistutils.cfg</code> which looks like this:</p>
<blockquote><pre>[install]
install_lib = ~/local/lib/python$py_version_short/site-packages
install_scripts = ~/local/bin</pre>
</blockquote>
<p>As an example, in an environment using Python version 2.4.4, libraries would be installed to <code>~/local/lib/python2.4/site-packages</code>.</p>
<p>After setting up the optional config, install Python setuptools (<code>setuptools-0.6c11-py2.4.egg</code> was the latest version at the time of writing):</p>
<blockquote><pre>$ cd ~/src
$ wget http://pypi.python.org/packages/2.4/s/setuptools/setuptools-0.6c11-py2.4.egg
$ sh setuptools-0.6c11-py2.4.egg</pre>
</blockquote>
<p>Install the latest version of Gitosis:</p>
<blockquote><pre>$ cd ~/src
$ git clone git://eagain.net/gitosis.git
$ cd gitosis/
$ python setup.py install --prefix=$HOME/local</pre>
</blockquote>
<p>Using your publickey, initialize Gitosis:</p>
<blockquote><p><code>$ gitosis-init &lt; id_rsa.pub</code></p></blockquote>
<p>There still remains one minor problem: the permission on the post-update hook:</p>
<blockquote><pre>$ chmod 755 ~/repositories/gitosis-admin.git/hooks/post-update</pre>
</blockquote>
<blockquote><p><strong>NB:</strong> This issue was supposedly fixed with a newer version of setuptools, but I still ran into the issue.</p></blockquote>
<p>Now, everything should be configured correctly.</p>
<h4>Using Gitosis</h4>
<p>Gitosis, by default, puts everything into a repositories directory. Git is used to administer Gitosis, so it&#8217;s necessary to checkout the Gitosis Admin project. On your local computer:</p>
<blockquote><pre>$ cd ~/<strong>your_projects_directory</strong>
$ git clone user@domain.tld:gitosis-admin.git
$ cd gitosis-admin</pre>
</blockquote>
<p>To add a repository or add a user to a group, the file to edit is <code>gitosis.conf</code>. Below is an example configuration:</p>
<blockquote><pre>[gitosis]

# just for initial testing, set the loglevel to DEBUG
loglevel = DEBUG
# if none of the repositories are going to use gitweb
gitweb = no
# if git-daemon isn't running
daemon = no

# the default group
[group gitosis-admin]
writable = gitosis-admin
members = user1

# another user group
[group anothergroup]
# the repository to write to
writable = newrepository
# refers to the previous group and adds another user for just this project
members = @gitosis-admin user2

# a new repository
[repos newrepository]
owner = Some Owner
description = Description of the project</pre>
</blockquote>
<p>The users refer to the keys in the <code>keydir</code>. If any new users are to be added to the project, their public keys must be added to the <code>keydir</code> and the names added to the appropriate groups in <code>gitosis.conf</code>. Gitosis handles all access control.</p>
<p>Push the new config changes:</p>
<blockquote><pre>$ git commit -am 'Added new group and new repository. Also added new user key.'
$ git push</pre>
</blockquote>
<p>Everything should work fine. Now to add the new repository.</p>
<blockquote><pre>$ cd ~/<strong>your_projects_directory</strong>
$ mkdir newrepository
$ git init
$ git remote add origin user@domain.tld:newrepository.git
# add new files, commit, etc...
$ git push origin master:refs/heads/master</pre>
</blockquote>
<p>The line <code>git push origin master:refs/heads/master</code> is only necessary the first time. Once the link is established, every subsequent push should just entail a <code>git push</code>.</p>
<h4>Pitfalls During Installation</h4>
<p>After configuring everything, I attempted to create a new repository. This is where I started running into problems:</p>
<blockquote><pre>ERROR:gitosis.serve.main:Repository read access denied
fatal: The remote end hung up unexpectedly</pre>
</blockquote>
<p>The issue was a conflicting line in the authorized_keys file (i.e. an original key that I added to the server to ease the login process).</p>
<p>Then I ran into this problem:</p>
<blockquote><pre>fatal: 'repositories/newrepos.git' does not appear to be a git repository
fatal: The remote end hung up unexpectedly</pre>
</blockquote>
<p>I was adding the path <code>repositories</code> without realizing that referring to it was unnecessary.</p>
<p>The biggest issue I ran into, and it was extremely irritating since it returned false positives, was assuming the post-update hook issue was fixed with the latest setuptools. It wasn&#8217;t. During a push, it looks like everything is updating fine in git, but no changes are being made on the remote server.</p>
<p>Hope this all was helpful.</p>
]]></content:encoded>
			<wfw:commentRss>http://jungshadow.com/blog/2010/03/24/working-with-git-on-dreamhost/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Regarding window.location</title>
		<link>http://jungshadow.com/blog/2009/07/15/regarding-windowlocation/</link>
		<comments>http://jungshadow.com/blog/2009/07/15/regarding-windowlocation/#comments</comments>
		<pubDate>Wed, 15 Jul 2009 23:54:24 +0000</pubDate>
		<dc:creator>jared</dc:creator>
				<category><![CDATA[coding]]></category>
		<category><![CDATA[hash]]></category>
		<category><![CDATA[javascript]]></category>
		<category><![CDATA[navigation]]></category>
		<category><![CDATA[web development]]></category>
		<category><![CDATA[window.location]]></category>

		<guid isPermaLink="false">http://jungshadow.com/blog/2009/07/15/regarding-windowlocation/</guid>
		<description><![CDATA[Discussion of window.location.hash property, issues with its use, and effect.]]></description>
			<content:encoded><![CDATA[<p>I ran across something new (at least, new to me) today. Using <code>window.location.hash</code>, if the same value is being assigned to the hash, the browser looks at it as a non-operation. The value needs to be reset first before reassigning the same value (e.g. for the purpose of resetting the view to the top of a dynamic list). I&#8217;ve noticed this behavior in <a title="The Firefox browser" href="http://getfirefox.com">Firefox 3</a> and <a title="The Safari browser" href="http://www.apple.com/safari">Safari 3+</a>.</p>
<p>I rarely write about coding issues, but it might be a good way to catalog my findings for my own reference. My apologies to everyone else.</p>
<p><em>Update:</em> I thought this could use an example.</p>
<pre><code>
var hashVar = 'content-top';

// ASSERT: hashVar contains the same value as window.location.hash
window.location.hash = hashVar;

// Expected behavior: Window scrolls back to the 'content-top' id
// Demonstrated behavior: Window does nothing
</code>
</pre>
<p>The way that I solved this was to reset the window.location.hash value to an empty string before the reassignment.</p>
<pre>
<code>
var hashVar = 'content-top';

window.location.hash = 'adkcj';
window.location.hash = hashVar;

// Expected behavior: Window scrolls back to the 'content-top' id
// Demonstrated behavior: Window scrolls back to the 'content-top' id
</code>
</pre>
<p><em>Update 2:</em> Apparently, Firefox, in the latest update, changed the behavior of the <tt>hash</tt> property. If the value is &#8220;zero-ed out&#8221;&#8212;if you will&#8212;the entire page refreshes. I&#8217;ve amended the script above so that <tt>hash</tt> is given a (hopefully) non-id value. Feel free to use a real word, but I didn&#8217;t want to take the off-chance of hitting an id I&#8217;m using.</p>
]]></content:encoded>
			<wfw:commentRss>http://jungshadow.com/blog/2009/07/15/regarding-windowlocation/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>I have no idea</title>
		<link>http://jungshadow.com/blog/2006/10/31/i-have-no-idea/</link>
		<comments>http://jungshadow.com/blog/2006/10/31/i-have-no-idea/#comments</comments>
		<pubDate>Tue, 31 Oct 2006 20:43:56 +0000</pubDate>
		<dc:creator>jared</dc:creator>
				<category><![CDATA[ajax]]></category>
		<category><![CDATA[coding]]></category>
		<category><![CDATA[evil]]></category>
		<category><![CDATA[google]]></category>
		<category><![CDATA[gripes]]></category>
		<category><![CDATA[microsoft]]></category>
		<category><![CDATA[news]]></category>

		<guid isPermaLink="false">http://jungshadow.com/blog/2006/10/31/i-have-no-idea/</guid>
		<description><![CDATA[I&#8217;m not sure how I feel about this. There&#8217;s something unsavory about it. Currently Rocking Out To: Jah Work &#8211; Ben Harper]]></description>
			<content:encoded><![CDATA[<p>I&#8217;m not sure how I feel about <a title="What the hell are they up to?" href="http://www.techcrunch.com/2006/10/31/here-comes-microsoft-20-embracing-lighweight-open-source-apps-online/">this</a>.  There&#8217;s something unsavory about it.</p>
<p><strong>Currently Rocking Out To:</strong> <em>Jah Work</em> &#8211; <a title="Awesome Musician" href="http://www.benharper.net/">Ben Harper</a></p>
]]></content:encoded>
			<wfw:commentRss>http://jungshadow.com/blog/2006/10/31/i-have-no-idea/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Web 2 Oh Too Much</title>
		<link>http://jungshadow.com/blog/2006/10/05/web-2-oh-too-much/</link>
		<comments>http://jungshadow.com/blog/2006/10/05/web-2-oh-too-much/#comments</comments>
		<pubDate>Fri, 06 Oct 2006 04:43:45 +0000</pubDate>
		<dc:creator>jared</dc:creator>
				<category><![CDATA[ajax]]></category>
		<category><![CDATA[coding]]></category>
		<category><![CDATA[imogen]]></category>
		<category><![CDATA[javascript]]></category>
		<category><![CDATA[progress]]></category>
		<category><![CDATA[web 2.0]]></category>

		<guid isPermaLink="false">http://www.jungshadow.com/blog/2006/10/05/web-2-oh-too-much/</guid>
		<description><![CDATA[OK . . . I understand the hype and fascination with Web 2.0–which, incidentally, is an unfortunate name since the web itself hasn&#8217;t really evolved, just the flavor of applications being run on it, but I guess you have to market it somehow–but I feel the interactivity is being used for trendy, unnecessary, inaccessible, and, [...]]]></description>
			<content:encoded><![CDATA[<p>OK . . . I understand the hype and fascination with <em>Web 2.0</em>–which, incidentally, is an unfortunate name since the web itself hasn&#8217;t really evolved, just the flavor of applications being run on it, but I guess you have to market it somehow–but I feel the interactivity is being used for trendy, unnecessary, inaccessible, and, sometimes, annoying purposes.  I&#8217;m constantly inundated with flashing widgets with drag-and-drop functionality for . . . what purpose?  Do I go to a website to play with the widgets?  Maybe some, but, most of the time, no.  Does this functionality benefit everyone?  After listening to the EO Webcast today, these thoughts plagued me throughout the day.  A great deal of this new technology is used for it&#8217;s slick &#8220;wow&#8221; factor and much of it that could improve the site&#8217;s accessibility falls by the wayside.  <em>Sure, I can make the site </em>cool<em> for 85% of the world . . . but what does that make the site for the other 15?</em>  I know that I sometimes fall prey to time constraints in my own applications.  If I don&#8217;t have time to make it <a title="why can't the government make better looking webpages?" href="http://www.section508.gov/">508</a> accessible, then I skip that step.  However, I am always <acronym title="eXtensible HyperText Markup Language">XHTML</acronym> and <acronym title="Cascading Style Sheets">CSS</acronym> compliant.  Hopefully, that&#8217;s half the battle.</p>
<p>Simplicity is not a bad thing.  I try to design the way I live.  Objects don&#8217;t end up in my house unless they have a functional purpose (at least not the objects <em>I</em> buy.)  So, I try to model my web apps the same way.  Some of the greatest websites are the simplistically functional (check out <a title="the online dictionary" href="http://dictionary.reference.com">dictionary.com</a> if you&#8217;re looking for a great, recent example how simplicity can improve usability.)  I absolutely encourage experimentation and the sharing of ideas and blogs are a great medium to accomplish this.  So, by all means, let me know what you think about this issue.  I&#8217;m not trying to keep anyone from doing <em>cool</em> things, but I am trying to keep the largest number of users in mind.</p>
<p><strong>Currently Rocking Out To:</strong> <em>Goodnight and Go</em> &#8211; <a title="A little sugary, but makes me smile" href="http://www.imogenheap.co.uk">Imogen Heap</a></p>
]]></content:encoded>
			<wfw:commentRss>http://jungshadow.com/blog/2006/10/05/web-2-oh-too-much/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
	</channel>
</rss>
