<?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/"
	xmlns:georss="http://www.georss.org/georss" xmlns:geo="http://www.w3.org/2003/01/geo/wgs84_pos#" xmlns:media="http://search.yahoo.com/mrss/"
	>

<channel>
	<title>Feral Chicken</title>
	<atom:link href="http://feralchicken.wordpress.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://feralchicken.wordpress.com</link>
	<description>take a walk on the wild side!</description>
	<lastBuildDate>Sun, 10 Jul 2011 05:48:23 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.com/</generator>
<cloud domain='feralchicken.wordpress.com' port='80' path='/?rsscloud=notify' registerProcedure='' protocol='http-post' />
<image>
		<url>http://s2.wp.com/i/buttonw-com.png</url>
		<title>Feral Chicken</title>
		<link>http://feralchicken.wordpress.com</link>
	</image>
	<atom:link rel="search" type="application/opensearchdescription+xml" href="http://feralchicken.wordpress.com/osd.xml" title="Feral Chicken" />
	<atom:link rel='hub' href='http://feralchicken.wordpress.com/?pushpress=hub'/>
		<item>
		<title>Finding the cutset with Boost</title>
		<link>http://feralchicken.wordpress.com/2011/01/11/finding-the-cutset-with-boost/</link>
		<comments>http://feralchicken.wordpress.com/2011/01/11/finding-the-cutset-with-boost/#comments</comments>
		<pubDate>Wed, 12 Jan 2011 02:53:05 +0000</pubDate>
		<dc:creator>alextsui05</dc:creator>
				<category><![CDATA[Logs]]></category>

		<guid isPermaLink="false">http://feralchicken.wordpress.com/?p=187</guid>
		<description><![CDATA[Personally, I&#8217;ve always been ashamed of not writing many programs to work with graphs, but being able to do figure this one out was really nice. Here are the basic includes for the sample program. Strictly speaking, the graph itself is restricted to the first three template parameters. The first two parameters tell you how [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=feralchicken.wordpress.com&amp;blog=5985195&amp;post=187&amp;subd=feralchicken&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>Personally, I&#8217;ve always been ashamed of not writing many programs to work with graphs, but being able to do figure this one out was really nice.</p>
<p><pre class="brush: cpp;">
#include &lt;boost/config.hpp&gt;
#include &lt;iostream&gt;
#include &lt;string&gt;
#include &lt;boost/graph/edmonds_karp_max_flow.hpp&gt;
#include &lt;boost/graph/adjacency_list.hpp&gt;
#include &lt;boost/graph/read_dimacs.hpp&gt;
#include &lt;boost/graph/graph_utility.hpp&gt;
</pre></p>
<p>Here are the basic includes for the sample program.</p>
<p><pre class="brush: cpp; first-line: 7;">

// Use a DIMACS network flow file as stdin.
// Example file found inline at: http://lpsolve.sourceforge.net/5.5/DIMACS_maxf.htm
// Usage: max_flow &lt; max_flow.dat
int
main()
{
  using namespace boost;

  typedef adjacency_list_traits&lt;vecS, vecS, directedS&gt; Traits;
  
  // define our graph with so-called internal properties
  typedef adjacency_list&lt;listS, vecS, directedS, 
  // vertex properties
    property&lt;vertex_name_t, std::string,
    property&lt;vertex_color_t, default_color_type&gt; &gt;,
  // edge properties
    property&lt;edge_capacity_t, long,
    property&lt;edge_residual_capacity_t, long,
    property&lt;edge_reverse_t, Traits::edge_descriptor&gt; &gt; &gt; 
  &gt; Graph;

  Graph g;
</pre></p>
<p>Strictly speaking, the graph itself is restricted to the first three template parameters. The first two parameters tell you how the edges and vertices are represented. In our case, they are both stored in <code>std::vectors</code> &#8211; the first two <code>vecS</code> are special types defined in Boost for that. There&#8217;s the usual <a href="http://www.boost.org/doc/libs/1_45_0/libs/graph/doc/using_adjacency_list.html#sec:choosing-graph-type">tradeoffs</a> to consider and it&#8217;s nice to not have to worry about it. The last parameter tells you if you have a directed or undirected graph &#8211; again, using a special Boost type.</p>
<p>All of the properties following the first three are internal properties, which can basically be thought of as associated data specific to either the vertices or the edges. They are internal properties because they are attached to the graph itself, but Boost gives you the option to keep it external if you want. There are a bunch of graph predefined properties that you only bring in when you run an algorithm that makes use of them. In particular, Edmonds-Karp max flow makes use of vertex colors internally.</p>
<p><pre class="brush: cpp; first-line: 29;">
  // make references to the internal properties of the graph
  property_map&lt;Graph, edge_capacity_t&gt;::type 
    capacity = get(edge_capacity, g); 
  property_map&lt;Graph, edge_reverse_t&gt;::type 
    rev = get(edge_reverse, g); 
  property_map&lt;Graph, edge_residual_capacity_t&gt;::type 
    residual_capacity = get(edge_residual_capacity, g); 
  property_map&lt;Graph, vertex_color_t&gt;::type 
    color = get(vertex_color, g); 

  Traits::vertex_descriptor s, t;
</pre></p>
<p>We get references to some of the properties for passing to the algorithm. In this way, we&#8217;ll retain the colored vertices and can get what we really want out of max flow, which is the cutset.</p>
<p><pre class="brush: cpp; first-line: 40;">
  // read in the graph from stdin
  read_dimacs_max_flow(g, capacity, rev, s, t);

  long flow = edmonds_karp_max_flow(g, s, t,
    capacity_map( capacity )
    .reverse_edge_map( rev )
    .residual_capacity_map( residual_capacity )
    .color_map( color ));
</pre></p>
<p>Here we load in the graph from a dimacs file. Go to the site in the header comment to get a sample file. We pass in all of our relevant data structures to <code>edmonds_karp_max_flow</code>, the last argument being all of the property maps bundled together using those helper functions that chain together.</p>
<p><pre class="brush: cpp; first-line: 48;">
  std::cout &lt;&lt; &quot;number of vertices: &quot; &lt;&lt; num_vertices(g) &lt;&lt; std::endl;

  std::cout &lt;&lt; &quot;c  The total flow:&quot; &lt;&lt; std::endl;
  std::cout &lt;&lt; &quot;s &quot; &lt;&lt; flow &lt;&lt; std::endl &lt;&lt; std::endl;

  std::cout &lt;&lt; &quot;c flow values:&quot; &lt;&lt; std::endl;
  graph_traits::vertex_iterator u_iter, u_end;
  graph_traits::out_edge_iterator ei, e_end;

  const char* name = &quot;abcdef&quot;;
  for (boost::tie(u_iter, u_end) = vertices(g); u_iter != u_end; ++u_iter)
  {
    for (boost::tie(ei, e_end) = out_edges(*u_iter, g); ei != e_end; ++ei)
    {
      if (capacity[*ei] &gt; 0)
        std::cout &lt;&lt; &quot;f &quot; &lt;&lt; name[*u_iter] &lt;&lt; &quot; &quot; &lt;&lt; name[target(*ei, g)] &lt;&lt; &quot; &quot;
                  &lt;&lt; (capacity[*ei] - residual_capacity[*ei]) &lt;&lt; &quot; &quot;
                  &lt;&lt; &quot;(&quot; &lt;&lt; residual_capacity[*ei] &lt;&lt; &quot;)&quot; &lt;&lt; std::endl;
    }
  }
</pre></p>
<p>Above is just printing out the flow. Notice how <code>vertices</code> returns a pair of vertex iterators. <code>boost::tie</code> is a macro that lets you assign multiple variables at the same time, like assigning tuples in Perl. You can see how the property maps work &#8211; they map the edge or vertex descriptor to the property associated with that descriptor.</p>
<p><pre class="brush: cpp; first-line: 68;">
  std::cout &lt;&lt; std::endl &lt;&lt; &quot;the min cut:&quot; &lt;&lt; std::endl;
  for (boost::tie(u_iter, u_end) = vertices(g); u_iter != u_end; ++u_iter)
  {
    for (boost::tie(ei, e_end) = out_edges(*u_iter, g); ei != e_end; ++ei)
    {
      if (color[*u_iter] == color[s] &amp;&amp; color[target(*ei, g)] == color[t])
      {
        // damn yeah
        std::cout &lt;&lt; name[*u_iter] &lt;&lt; &quot;-&quot; &lt;&lt; name[target(*ei, g)];
        std::cout &lt;&lt; &quot; (&quot; &lt;&lt; capacity[*ei] &lt;&lt; &quot;)&quot; &lt;&lt; std::endl;
      }
    }
  }
</pre></p>
<p>Finally, this is how to actually get the edges that make up the cutset from the colored vertices. The vertices will be colored based on which partition it ends up being on, and the cut edges are precisely the ones that bridge between the partitions ie. the ones that go from a vertex of one color to a vertex of the other color.</p>
<h2>Thoughts</h2>
<p>I really had a tough time looking for the usable types and the interfaces to these types. The above program was mostly part of an example program in the documentation, tweaked to include the color map and the code that uses the information to extract the edges. It took my the longest time to figure out how to pass in the color map to the algorithm that I wanted it to use. Even then, I wasn&#8217;t sure that I would get something useful in return and it just took rounds of attempted compiles and runs to see what all of the code actually does. I feel like this was much harder than it should have been, but I wonder if it&#8217;s something that someone with experience with templated C++ would have an easier time with. It just seems like there&#8217;s nothing like a straightforward equivalent of the Java API.</p>
<p>Well let&#8217;s post this before I go crazy from the way the editor eats the templates in the C++ code when I toggle between visual and HTML editing.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/feralchicken.wordpress.com/187/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/feralchicken.wordpress.com/187/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/feralchicken.wordpress.com/187/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/feralchicken.wordpress.com/187/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/feralchicken.wordpress.com/187/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/feralchicken.wordpress.com/187/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/feralchicken.wordpress.com/187/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/feralchicken.wordpress.com/187/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/feralchicken.wordpress.com/187/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/feralchicken.wordpress.com/187/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/feralchicken.wordpress.com/187/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/feralchicken.wordpress.com/187/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/feralchicken.wordpress.com/187/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/feralchicken.wordpress.com/187/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=feralchicken.wordpress.com&amp;blog=5985195&amp;post=187&amp;subd=feralchicken&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://feralchicken.wordpress.com/2011/01/11/finding-the-cutset-with-boost/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="" medium="image">
			<media:title type="html">alextsui05</media:title>
		</media:content>
	</item>
		<item>
		<title>New desktop</title>
		<link>http://feralchicken.wordpress.com/2011/01/05/new-desktop/</link>
		<comments>http://feralchicken.wordpress.com/2011/01/05/new-desktop/#comments</comments>
		<pubDate>Thu, 06 Jan 2011 07:59:45 +0000</pubDate>
		<dc:creator>alextsui05</dc:creator>
				<category><![CDATA[Logs]]></category>

		<guid isPermaLink="false">http://feralchicken.wordpress.com/?p=184</guid>
		<description><![CDATA[For Christmas, I got a sweet new desktop computer, which is definitely going to come in handy for who-knows-what sort of crazy algorithms I&#8217;ll be running in the years to come. Without further ado, the details: Intel i7 950 Asus P6X58D-E Motherboard OCZ Gold PC12800 DDR3 Triple Channel Memory OCZ Vertex 60GB SSD Thermaltake TR2 [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=feralchicken.wordpress.com&amp;blog=5985195&amp;post=184&amp;subd=feralchicken&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>For Christmas, I got a sweet new desktop computer, which is definitely going to come in handy for who-knows-what sort of crazy algorithms I&#8217;ll be running in the years to come. Without further ado, the details:</p>
<ul>
<li>Intel i7 950</li>
<li>Asus P6X58D-E Motherboard</li>
<li>OCZ Gold PC12800 DDR3 Triple Channel Memory</li>
<li>OCZ Vertex 60GB SSD</li>
<li>Thermaltake TR2 RX 750W PSU</li>
<li>Scythe Mugen SCINF-1000 Heatsink</li>
</ul>
<p>Thanks Tuan for the help!</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/feralchicken.wordpress.com/184/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/feralchicken.wordpress.com/184/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/feralchicken.wordpress.com/184/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/feralchicken.wordpress.com/184/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/feralchicken.wordpress.com/184/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/feralchicken.wordpress.com/184/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/feralchicken.wordpress.com/184/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/feralchicken.wordpress.com/184/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/feralchicken.wordpress.com/184/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/feralchicken.wordpress.com/184/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/feralchicken.wordpress.com/184/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/feralchicken.wordpress.com/184/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/feralchicken.wordpress.com/184/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/feralchicken.wordpress.com/184/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=feralchicken.wordpress.com&amp;blog=5985195&amp;post=184&amp;subd=feralchicken&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://feralchicken.wordpress.com/2011/01/05/new-desktop/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
	
		<media:content url="" medium="image">
			<media:title type="html">alextsui05</media:title>
		</media:content>
	</item>
		<item>
		<title>Vim sessions and map leader</title>
		<link>http://feralchicken.wordpress.com/2011/01/03/vim-sessions-and-map-leader/</link>
		<comments>http://feralchicken.wordpress.com/2011/01/03/vim-sessions-and-map-leader/#comments</comments>
		<pubDate>Mon, 03 Jan 2011 21:09:08 +0000</pubDate>
		<dc:creator>alextsui05</dc:creator>
				<category><![CDATA[Logs]]></category>

		<guid isPermaLink="false">http://feralchicken.wordpress.com/?p=177</guid>
		<description><![CDATA[So a common use case when you&#8217;re hacking away at a project in an IDE is that you&#8217;ve got several files open in tabs in different locations. You can have this using Vim by opening tabs or split window views, and it&#8217;s really nice especially when you&#8217;ve got full 1080p worth of screen space to [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=feralchicken.wordpress.com&amp;blog=5985195&amp;post=177&amp;subd=feralchicken&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>So a common use case when you&#8217;re hacking away at a project in an IDE is that you&#8217;ve got several files open in tabs in different locations. You can have this using Vim by opening tabs or split window views, and it&#8217;s really nice especially when you&#8217;ve got full 1080p worth of screen space to exploit. The problem is when you exit Vim, you have to close all your tabs and you lose all of your context, especially when you put the project away for a little while, it can be annoying to open up all the files. There&#8217;s a simple fix for that, and it&#8217;s the <code>mksession</code> command.</p>
<p>Just running <code>:mksession</code> in Vim will create a snapshot of your tab and window layout etc. and save it in a session file. You can check the help on the command for the exact details. Here&#8217;s a convenient mapping that lets me hit <code>,wq</code> and have all files written and tabs saved in a session file.</p>
<pre>let mapleader=","
:map &lt;leader&gt;wq :wa:mksession!:qa
:map &lt;leader&gt;ls :source Session.vim</pre>
<p>So my map leader is the comma. Hitting that puts Vim in a mode where if you complete one of the map rules, the corresponding command will be executed.</p>
<p>The first command executes three commands. First, it writes all files that are open. Then it creates a session file into <code>Session.vim</code> in the current working directory. The exclamation mark means overwrite <code>Session.vim</code> if it exists already. Last, it exits out of Vim by closing all open tabs.</p>
<p>The second command sets up Vim from the <code>Session.vim</code> in the current working directory. You run this the very first thing you do when you open Vim in the directory where your work is at, and your workspace is restored to exactly the way you left it.</p>
<p>I guess having the map leader is what makes this effective because it opens up a whole new range of keystrokes for defining new mappings. Some other ideas: toggle paste mode when pasting from the system clipboard. I always have to type <code>:set paste</code> and <code>:set nopaste</code> whenever I need to bring stuff into Vim through the clipboard without having the indentation go haywire, but you now I&#8217;ve got this in my rc file:</p>
<pre>set pastetoggle=pp</pre>
<p>Any other ideas people have? Did you already know about this? I&#8217;m constantly learning new stuff about Vim &#8211; that is, whenever I&#8217;m not just using it to do work and actually poking about the documentation and configuration.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/feralchicken.wordpress.com/177/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/feralchicken.wordpress.com/177/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/feralchicken.wordpress.com/177/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/feralchicken.wordpress.com/177/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/feralchicken.wordpress.com/177/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/feralchicken.wordpress.com/177/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/feralchicken.wordpress.com/177/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/feralchicken.wordpress.com/177/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/feralchicken.wordpress.com/177/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/feralchicken.wordpress.com/177/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/feralchicken.wordpress.com/177/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/feralchicken.wordpress.com/177/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/feralchicken.wordpress.com/177/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/feralchicken.wordpress.com/177/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=feralchicken.wordpress.com&amp;blog=5985195&amp;post=177&amp;subd=feralchicken&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://feralchicken.wordpress.com/2011/01/03/vim-sessions-and-map-leader/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="" medium="image">
			<media:title type="html">alextsui05</media:title>
		</media:content>
	</item>
		<item>
		<title>Hi 2011</title>
		<link>http://feralchicken.wordpress.com/2011/01/02/hi-2011/</link>
		<comments>http://feralchicken.wordpress.com/2011/01/02/hi-2011/#comments</comments>
		<pubDate>Sun, 02 Jan 2011 09:53:36 +0000</pubDate>
		<dc:creator>alextsui05</dc:creator>
				<category><![CDATA[Logs]]></category>

		<guid isPermaLink="false">http://feralchicken.wordpress.com/?p=175</guid>
		<description><![CDATA[WordPress just emailed to say that I averaged one post per month in 2010 and that that is great. I guess I can do better. I even missed the first post opportunity on January 1, 2011 &#8211; not a great start blogging&#8230; On the other hand, I made a good start programming on my sweet [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=feralchicken.wordpress.com&amp;blog=5985195&amp;post=175&amp;subd=feralchicken&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>WordPress just emailed to say that I averaged one post per month in 2010 and that that is great. I guess I can do better. I even missed the first post opportunity on January 1, 2011 &#8211; not a great start blogging&#8230;</p>
<p>On the other hand, I made a good start programming on my sweet new desktop &#8211; I owe a shout-out and some details about my new desktop on Wednesday. It took a while but I figured out how to find the edges in a min-cut of a graph in C++ using the Boost library. It was *such* a headache trying to figure things out from the docs and making sense of the generic code. I think I&#8217;ll give it some time to sink in but I&#8217;ll definitely write about how its done, my impression of BGL, and thoughts on graphs in general by Friday. Along the way, I found yet more cool stuff with vim, which I&#8217;ll write about on Monday.</p>
<p>Winter quarter starts here at UC Davis tomorrow. Aside from taking courses in algorithms, network theory, and neuroimaging, I&#8217;m going to be a TA for introductory C programming. The prof said besides teaching the language, he also wanted to introduce applications, both old and new, to sort of motivate/reinforce the learning. It&#8217;s an interesting question: what&#8217;s new and interesting that people are doing with C? This is an ongoing question to think about and try to answer this quarter.</p>
<p>If there&#8217;s some new year&#8217;s resolution that I&#8217;ll take seriously, it&#8217;s to read more code. I&#8217;m going to renew my efforts in following some interesting open source projects and mailing lists, follow some bugs, and read some code that way. I don&#8217;t know yet what I&#8217;ll write about as commentary, but there&#8217;s bound to be interesting things worth mention.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/feralchicken.wordpress.com/175/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/feralchicken.wordpress.com/175/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/feralchicken.wordpress.com/175/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/feralchicken.wordpress.com/175/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/feralchicken.wordpress.com/175/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/feralchicken.wordpress.com/175/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/feralchicken.wordpress.com/175/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/feralchicken.wordpress.com/175/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/feralchicken.wordpress.com/175/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/feralchicken.wordpress.com/175/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/feralchicken.wordpress.com/175/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/feralchicken.wordpress.com/175/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/feralchicken.wordpress.com/175/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/feralchicken.wordpress.com/175/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=feralchicken.wordpress.com&amp;blog=5985195&amp;post=175&amp;subd=feralchicken&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://feralchicken.wordpress.com/2011/01/02/hi-2011/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
	
		<media:content url="" medium="image">
			<media:title type="html">alextsui05</media:title>
		</media:content>
	</item>
		<item>
		<title>Some ANN code in Erlang + recent thoughts</title>
		<link>http://feralchicken.wordpress.com/2010/10/24/some-ann-code-in-erlang-recent-thoughts/</link>
		<comments>http://feralchicken.wordpress.com/2010/10/24/some-ann-code-in-erlang-recent-thoughts/#comments</comments>
		<pubDate>Mon, 25 Oct 2010 04:56:30 +0000</pubDate>
		<dc:creator>alextsui05</dc:creator>
				<category><![CDATA[Erlang]]></category>

		<guid isPermaLink="false">http://feralchicken.wordpress.com/?p=173</guid>
		<description><![CDATA[There was a point in time this summer where I found this Erlang tutorial on artificial neural networks &#8211; you can find it here. Apparently, it&#8217;s an aggregation of a series of blog posts written up by this guy a few years back. When I was following through doing it, I had a bit of [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=feralchicken.wordpress.com&amp;blog=5985195&amp;post=173&amp;subd=feralchicken&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>There was a point in time this summer where I found this Erlang tutorial on artificial neural networks &#8211; you can find it <a href="http://www.trapexit.org/index.php/Erlang_and_Neural_Networks">here</a>. Apparently, it&#8217;s an aggregation of a series of blog posts written up by <a href="http://webjazz.blogspot.com/2007/07/erlang-and-neural-networks-article-on.html">this guy</a> a few years back. When I was following through doing it, I had a bit of an issue with continuity in the later parts of the tutorial and a few errors as well (derivative of sigmoid was wrong). But it was good overall and if anyone&#8217;s interested, I managed to put something together that executes <a href="http://pastie.org/1246340">here</a>. Still, there&#8217;s a lot of unused/useless/confusing code that should be killed but try to ignore it.</p>
<p>Here are a few notes that I gathered in a flash (and which you can gather by following the links above):</p>
<ul>
<li>Neurons are modeled by perceptrons</li>
<li>Perceptrons = summing junction + nonlinear element</li>
<li>Summing junction &#8211; dot the input vector with coefficients (state)</li>
<li>Nonlinear element &#8211; take that dot product, map it under the <a href="http://en.wikipedia.org/wiki/Sigmoid_function">sigmoid function</a> for your output</li>
<li>You hook up a bunch of these perceptrons into a DAG (basically a trellis without the one input node restriction) and call it a neural network</li>
<li>You train the neural network by putting in some input signals, compare the generated output with an expected output, and perform backpropagation to adjust the coefficients</li>
</ul>
<p>With that high-level review, I&#8217;m thinking that the tutorial just got through hooking up a small neural network with 1 input layer, 1 hidden layer, and 1 output layer, and training it. I&#8217;m not sure the code that I have has it correct because, well, where&#8217;s the expected output? -_- And how to use it once it&#8217;s trained, I&#8217;m not exactly sure. But I thought I&#8217;d put the code up so that I could look at some of the code again now that a significant amount of time has passed and I&#8217;ve learned some other related things that might help this make more sense. It sort of does, from a high-level point of view, but I couldn&#8217;t explain the details of how the neural network is actually adjusting a hyperplane to classify an input vector; I didn&#8217;t work any proofs, I just wrote some Erlang.</p>
<p>Just a thought: If the neural network is just doing high-dimensional gradient descent, why can&#8217;t we just solve the problem and implement gradient descent? I guess a solution in the form  of a neural network is somehow more general? Or maybe it&#8217;s simpler: you&#8217;re really just feeding some training data to the network and then using it to predict new data. I don&#8217;t know. It&#8217;s an interesting approach though.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/feralchicken.wordpress.com/173/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/feralchicken.wordpress.com/173/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/feralchicken.wordpress.com/173/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/feralchicken.wordpress.com/173/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/feralchicken.wordpress.com/173/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/feralchicken.wordpress.com/173/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/feralchicken.wordpress.com/173/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/feralchicken.wordpress.com/173/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/feralchicken.wordpress.com/173/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/feralchicken.wordpress.com/173/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/feralchicken.wordpress.com/173/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/feralchicken.wordpress.com/173/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/feralchicken.wordpress.com/173/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/feralchicken.wordpress.com/173/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=feralchicken.wordpress.com&amp;blog=5985195&amp;post=173&amp;subd=feralchicken&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://feralchicken.wordpress.com/2010/10/24/some-ann-code-in-erlang-recent-thoughts/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="" medium="image">
			<media:title type="html">alextsui05</media:title>
		</media:content>
	</item>
		<item>
		<title>I git it: the branch + merge</title>
		<link>http://feralchicken.wordpress.com/2010/07/20/i-git-it-the-branch-merge/</link>
		<comments>http://feralchicken.wordpress.com/2010/07/20/i-git-it-the-branch-merge/#comments</comments>
		<pubDate>Tue, 20 Jul 2010 17:32:48 +0000</pubDate>
		<dc:creator>alextsui05</dc:creator>
				<category><![CDATA[Figured Out]]></category>
		<category><![CDATA[git]]></category>

		<guid isPermaLink="false">http://feralchicken.wordpress.com/?p=165</guid>
		<description><![CDATA[It&#8217;s been almost a month since I first committed our project to version control under git, but up until now, I didn&#8217;t really know how to leverage git to support our two-person development effort. I&#8217;ll talk about the project setup that evolved from the past few weeks that&#8217;s really working out for me now. First, [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=feralchicken.wordpress.com&amp;blog=5985195&amp;post=165&amp;subd=feralchicken&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>It&#8217;s been almost a month since I first committed our project to version control under git, but up until now, I didn&#8217;t really know how to leverage git to support our two-person development effort. I&#8217;ll talk about the project setup that evolved from the past few weeks that&#8217;s really working out for me now.</p>
<p>First, a little bit about our setup: we have a server where we have our application deployed, but we also have active development going on right on that server. This is convenient and is a typical workflow for web projects: you&#8217;ll make and upload edits to see the changes on the server immediately. I have a local server set up on my laptop that I&#8217;ll work on, which saves me the hassle of the upload, and in this case turns out to be nice in that I&#8217;m not inadvertently clobbering work on the remote server.</p>
<p>Every once in a while, I&#8217;ll need to pull in the latest changes and also push out my work as well. For the longest time, I didn&#8217;t have a great way of doing this. Initially, I was just using FTP, at times to cherry-pick files and other times just batch downloading the whole project tree. Needless to say, this is a big waste of time and involved more point-and-click than I could stand. It also doesn&#8217;t give a good feeling about being in sync at all.</p>
<p>Sync? Great idea, we can use rsync! We do have shell access after all. The next step came when I wrote an rsync command to pull the files I care about from the remote server to my machine. Rsync is nice because it just transfers differences, so it&#8217;s nice and quick. The problem is that it clobbers old stuff, and for a while I was using a separate folder with rsync apart from my working folder and manually diff/patching. This also got annoying.</p>
<p>But wait a minute, I don&#8217;t have to worry about clobbering code, I could just create a branch in git and pull the changes into that branch. My own branch will be untouched and I can use git checkout to switch between branches. From there, I can merge that branch with my main working branch!</p>
<p>For example, the team meets at 5pm to continue work on the project. At that point, I will create a branch for myself do work on, and my partner will go about his work on the remote server. When we call it a night later on, I create another branch from the initial 5pm commit and pull in changes from the server using rsync.</p>
<p><a href="http://feralchicken.files.wordpress.com/2010/07/screenshot-1.png"><img class="alignnone size-full wp-image-166" title="Screenshot-1" src="http://feralchicken.files.wordpress.com/2010/07/screenshot-1.png" alt="" width="440" height="178" /></a></p>
<p>At this point, git recognizes the fork, and when you issue a git merge command, git will do its best to merge changes, presenting a list of conflicted files if it can&#8217;t resolve them itself.</p>
<pre>atsui@atsui-mmx:~/web/letswoosh$ git branch
* alex
  master
  parris
atsui@atsui-mmx:~/web/letswoosh$ git merge parris
Auto-merging app/plugins/woosh/controllers/events_controller.php
Auto-merging app/plugins/woosh/models/event.php
CONFLICT (content): Merge conflict in app/plugins/woosh/models/event.php
Auto-merging app/plugins/woosh/views/events/nearby_events.ctp
CONFLICT (content): Merge conflict in app/plugins/woosh/views/events/nearby_events.ctp
Auto-merging app/views/elements/tag_form.ctp
CONFLICT (content): Merge conflict in app/views/elements/tag_form.ctp
Automatic merge failed; fix conflicts and then commit the result.
</pre>
<p>I&#8217;ll go through the files, clean up the conflicts, add them back to git, and commit the changes, after which the two branches are successfully merged.</p>
<p><a href="http://feralchicken.files.wordpress.com/2010/07/screenshot-2.png"><img class="alignnone size-full wp-image-167" title="Screenshot-2" src="http://feralchicken.files.wordpress.com/2010/07/screenshot-2.png" alt="" width="440" height="177" /></a></p>
<p>The benefits are clear: no manual diff/patch business, the ability to check out any past commit later on, and a pretty graph to look at. After doing things a pretty hard way, I guess I learned a lesson about using git.</p>
<p>This was really helpful for understanding merge:<br />
<a href="http://github.com/guides/pull-requests" target="_self">http://github.com/guides/pull-requests</a></p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/feralchicken.wordpress.com/165/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/feralchicken.wordpress.com/165/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/feralchicken.wordpress.com/165/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/feralchicken.wordpress.com/165/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/feralchicken.wordpress.com/165/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/feralchicken.wordpress.com/165/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/feralchicken.wordpress.com/165/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/feralchicken.wordpress.com/165/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/feralchicken.wordpress.com/165/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/feralchicken.wordpress.com/165/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/feralchicken.wordpress.com/165/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/feralchicken.wordpress.com/165/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/feralchicken.wordpress.com/165/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/feralchicken.wordpress.com/165/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=feralchicken.wordpress.com&amp;blog=5985195&amp;post=165&amp;subd=feralchicken&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://feralchicken.wordpress.com/2010/07/20/i-git-it-the-branch-merge/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="" medium="image">
			<media:title type="html">alextsui05</media:title>
		</media:content>

		<media:content url="http://feralchicken.files.wordpress.com/2010/07/screenshot-1.png" medium="image">
			<media:title type="html">Screenshot-1</media:title>
		</media:content>

		<media:content url="http://feralchicken.files.wordpress.com/2010/07/screenshot-2.png" medium="image">
			<media:title type="html">Screenshot-2</media:title>
		</media:content>
	</item>
		<item>
		<title>A thought about BFS queue size</title>
		<link>http://feralchicken.wordpress.com/2010/07/17/a-thought-about-bfs-queue-size/</link>
		<comments>http://feralchicken.wordpress.com/2010/07/17/a-thought-about-bfs-queue-size/#comments</comments>
		<pubDate>Sat, 17 Jul 2010 21:33:31 +0000</pubDate>
		<dc:creator>alextsui05</dc:creator>
				<category><![CDATA[Graph Theory]]></category>
		<category><![CDATA[Problems]]></category>
		<category><![CDATA[algorithm]]></category>
		<category><![CDATA[graph theory]]></category>
		<category><![CDATA[topcoder]]></category>

		<guid isPermaLink="false">http://feralchicken.wordpress.com/?p=161</guid>
		<description><![CDATA[There was a Topcoder SRM this morning and one of the problems was essentially to compute the shortest distance between two points on a 2-dimensional grid.  I usually never stick around for the challenge round because I usually dwell on two or three programs, not really understanding them, before time runs out. But I&#8217;m going [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=feralchicken.wordpress.com&amp;blog=5985195&amp;post=161&amp;subd=feralchicken&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>There was a Topcoder SRM this morning and one of the problems was essentially to compute the shortest distance between two points on a 2-dimensional grid.  I usually never stick around for the challenge round because I usually dwell on two or three programs, not really understanding them, before time runs out. But I&#8217;m going to try reading code from now on because, well, it&#8217;s a weakness of mine, and also you get to see different approaches to problems you&#8217;d thought were pretty hard.</p>
<p>Back to the problem, another guy in my room took a different approach from mine and implemented breadth-first search. Basically, you expand outwards uniformly from the source node searching for a destination node. The advantage is that once you find the destination node, you have the shortest path and are done. Sadly, a mistake in the implementation ruined this good approach.</p>
<p>It took me a while to figure out that the guy had implemented his own queue for BFS, using a fixed-size array and pointers to the front and back.  The terminating condition in this case would be to check whether the front and back pointers were the same, ie. the queue is empty. It wasn&#8217;t until I could run the program in a debugger that I noticed the program was segfaulting due to the front pointer extending way beyond the upper bound of the array. However! I didn&#8217;t recognize this for what it was and decided to patch things up by turning the queue into a circular queue.</p>
<p>This fixed the problem for the grid-type graphs that the problem was giving out, but it left me wondering about a fixed queue size that could handle all cases. In the worst case, BFS will visit every node in a graph once, and in theory, it&#8217;s possible to queue up all of the nodes at the very first step. The program that I &#8220;fixed&#8221; with a circular queue was using a fixed size queue with a size that was an order of magnitude lower than the maximum number of nodes that could be dished out by the problem. I was definitely lucky that the number of nodes enqueued at any one time never exceeded the magic number being used to size the queue.</p>
<p>So it&#8217;s interesting to think about what that running number &#8211; the number of nodes enqueued at any given time during BFS &#8211; represents and whether we are able to give an upper bound for it. At any given moment, it gives the size of a &#8220;cross-section&#8221; of the graph. I guess without knowing about the structure of the graph, you can&#8217;t really assume much and so you have to bound the queue by the total nodes in the graph. The graphs in this problem were 4-regular, ie. every node has 4 adjacent nodes, and since the program was passing, this upper bound is definitely an overestimate.</p>
<p>I guess the moral of the story is to use the data structures provided by your local library, because thinking about upper bounds can be a deal breaker, and implementing your own data structure on the fly is error-prone and definitely cost this guy a hundred and some points.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/feralchicken.wordpress.com/161/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/feralchicken.wordpress.com/161/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/feralchicken.wordpress.com/161/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/feralchicken.wordpress.com/161/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/feralchicken.wordpress.com/161/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/feralchicken.wordpress.com/161/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/feralchicken.wordpress.com/161/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/feralchicken.wordpress.com/161/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/feralchicken.wordpress.com/161/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/feralchicken.wordpress.com/161/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/feralchicken.wordpress.com/161/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/feralchicken.wordpress.com/161/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/feralchicken.wordpress.com/161/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/feralchicken.wordpress.com/161/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=feralchicken.wordpress.com&amp;blog=5985195&amp;post=161&amp;subd=feralchicken&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://feralchicken.wordpress.com/2010/07/17/a-thought-about-bfs-queue-size/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="" medium="image">
			<media:title type="html">alextsui05</media:title>
		</media:content>
	</item>
		<item>
		<title>Server build notes</title>
		<link>http://feralchicken.wordpress.com/2010/07/08/server-build-notes/</link>
		<comments>http://feralchicken.wordpress.com/2010/07/08/server-build-notes/#comments</comments>
		<pubDate>Fri, 09 Jul 2010 03:00:04 +0000</pubDate>
		<dc:creator>alextsui05</dc:creator>
				<category><![CDATA[Logs]]></category>

		<guid isPermaLink="false">http://feralchicken.wordpress.com/?p=153</guid>
		<description><![CDATA[The past week&#8217;s been pretty fun, configuring the web server for optimized request handling and more maintainable source code files. I&#8217;ll talk about the latter, how we made the server go to work to help us maintain our stuff. Two tools that we got compiled on the server are Sass and XHP. Sass comes with [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=feralchicken.wordpress.com&amp;blog=5985195&amp;post=153&amp;subd=feralchicken&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>The past week&#8217;s been pretty fun, configuring the web server for optimized request handling and more maintainable source code files. I&#8217;ll talk about the latter, how we made the server go to work to help us maintain our stuff. Two tools that we got compiled on the server are Sass and XHP.</p>
<p><a title="Syntactically Awesome Stylesheets" href="http://sass-lang.com/">Sass</a> comes with the haml Rubygem, and it&#8217;s basically an extension to CSS, giving it things like variables, mixins &#8211; which are kinda like macros, and ability to generate nicely formatted CSS or compressed CSS for efficient use of bandwidth. Sass can then be set as a daemon to watch a project directory, compiling Sassy CSS files (as they call it) into standard CSS files whenever a change is made. Installation was as simple as <code>gem install haml</code>, assuming Ruby is set up on your server. It wasn&#8217;t on ours initially, but just clicking into Rubygems on the CPanel triggered the server to set it up automatically.</p>
<p><a title="XHP" href="http://wiki.github.com/facebook/xhp/" target="_self">XHP</a> took a little more work to get (and still doesn&#8217;t seem to work 100% &#8211; one post-build unit test failed&#8230; however, PHP was able to load the module and we&#8217;re making good use of it). First of all, the <a title="Building XHP" href="http://wiki.github.com/facebook/xhp/building-xhp" target="_self">site</a> specifies some prerequisite software &#8211; treat the versions as minimum requirements. re2c was one necessary package that wasn&#8217;t readily available in the required version (0.13.5 &#8211; we had 0.13.4 on the server but XHP accepts no less) as an RPM. So I had to hit up Sourceforge for the source RPM and compile it. This wasn&#8217;t too bad. The workflow is basically as follows:</p>
<ol>
<li><code>rpm -ivv &lt;name of source rpm&gt;</code>. This seems to stage the resources in an area for building and extracts a specfile, which is a Makefile of sorts. The -vv option will trigger verbose output, which should tell you where the specfile is.</li>
<li><code>rpmbuild -bb &lt;name of the specfile&gt;</code>. Run this after you cd to the directory where the specfile is. This will start the build process, which hopefully runs without a hitch and produces an RPM at a secondary location.</li>
<li><code>rpm -i &lt;name of compiled rpm&gt;</code>. The installed software should be available immediately.</li>
</ol>
<p>Compiling was easy, but the post-build unit test refused to run because PHP had safe mode enabled. Apparently, it was compiled into the PHP on the server, so a rebuild was necessary. CPanel has a nice point-and-click configuration for this as well, though Apache needs to be rebuilt as a part of this as well. After that, do a make install and add <code>extension=xhp.so</code> on a new line in your <code>php.ini</code>. Your site should be good to go. Also, one useful configuration option to have is <code>xhp.idx_expr=1</code>, which enables you to index arrays returned from function evaluations right away.</p>
<p>This stuff all took a while to figure out, but in the end, we added two awesome tools to our disposal, which keeps the spirits high and the developers developing!</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/feralchicken.wordpress.com/153/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/feralchicken.wordpress.com/153/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/feralchicken.wordpress.com/153/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/feralchicken.wordpress.com/153/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/feralchicken.wordpress.com/153/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/feralchicken.wordpress.com/153/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/feralchicken.wordpress.com/153/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/feralchicken.wordpress.com/153/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/feralchicken.wordpress.com/153/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/feralchicken.wordpress.com/153/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/feralchicken.wordpress.com/153/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/feralchicken.wordpress.com/153/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/feralchicken.wordpress.com/153/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/feralchicken.wordpress.com/153/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=feralchicken.wordpress.com&amp;blog=5985195&amp;post=153&amp;subd=feralchicken&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://feralchicken.wordpress.com/2010/07/08/server-build-notes/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
	
		<media:content url="" medium="image">
			<media:title type="html">alextsui05</media:title>
		</media:content>
	</item>
		<item>
		<title>File-specific vim configurations</title>
		<link>http://feralchicken.wordpress.com/2010/06/18/file-specific-vim-configurations/</link>
		<comments>http://feralchicken.wordpress.com/2010/06/18/file-specific-vim-configurations/#comments</comments>
		<pubDate>Fri, 18 Jun 2010 08:00:55 +0000</pubDate>
		<dc:creator>alextsui05</dc:creator>
				<category><![CDATA[Howto]]></category>
		<category><![CDATA[vim]]></category>

		<guid isPermaLink="false">http://feralchicken.wordpress.com/?p=148</guid>
		<description><![CDATA[vim amazes me with its ability to highlight the syntax of so many languages, but I&#8217;d been stuck with a single configuration for all file types for the longest time.  Actually, .vimrc can do much more for you. For example, I have a blanket configuration for inserting 4 spaces for tabs in any file I [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=feralchicken.wordpress.com&amp;blog=5985195&amp;post=148&amp;subd=feralchicken&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>vim amazes me with its ability to highlight the syntax of so many languages, but I&#8217;d been stuck with a single configuration for all file types for the longest time.  Actually, <code>.vimrc</code> can do much more for you.</p>
<p>For example, I have a blanket configuration for inserting 4 spaces for tabs in any file I type, because tabs are evil:</p>
<pre>set shiftwidth=4 softtabstop=4 expandtab</pre>
<p>But this is a pain when editing Makefiles, where tabs are a necessity for build rules.  You end up entering explicit tabs with &lt;CTRL+V&gt; &lt;TAB&gt;, which is tedious.  Instead, you can make vim know to use real tabs in Makefiles:</p>
<pre>autocmd BufEnter Makefile set sw=8 sts=0 noet</pre>
<p>Another example is for creating html files. It&#8217;d be nice to have a skeleton file that includes a strict doctype and the proper content type all ready to go.   Also, nesting can get real deep real quick so an adjusted shift width would be nice.  This does the trick:</p>
<pre>autocmd BufNewFile *.html 0r /path/to/your/template.html
autocmd BufEnter *.html set sw=2 sts=2 et</pre>
<p>Basically, creating new html files will source the template html file, and editing any html file will adjust the indent size to 2 spaces to save on horizontal space.</p>
<p>There are lots of different hooks where you can make use of autocmd. Type <code>:help Buf</code> and hit &lt;CTRL+D&gt; to see a lot more buffer-related hooks.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/feralchicken.wordpress.com/148/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/feralchicken.wordpress.com/148/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/feralchicken.wordpress.com/148/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/feralchicken.wordpress.com/148/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/feralchicken.wordpress.com/148/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/feralchicken.wordpress.com/148/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/feralchicken.wordpress.com/148/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/feralchicken.wordpress.com/148/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/feralchicken.wordpress.com/148/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/feralchicken.wordpress.com/148/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/feralchicken.wordpress.com/148/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/feralchicken.wordpress.com/148/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/feralchicken.wordpress.com/148/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/feralchicken.wordpress.com/148/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=feralchicken.wordpress.com&amp;blog=5985195&amp;post=148&amp;subd=feralchicken&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://feralchicken.wordpress.com/2010/06/18/file-specific-vim-configurations/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="" medium="image">
			<media:title type="html">alextsui05</media:title>
		</media:content>
	</item>
		<item>
		<title>Better Cygwin Terminal</title>
		<link>http://feralchicken.wordpress.com/2010/04/13/better-cygwin-terminal/</link>
		<comments>http://feralchicken.wordpress.com/2010/04/13/better-cygwin-terminal/#comments</comments>
		<pubDate>Wed, 14 Apr 2010 04:40:09 +0000</pubDate>
		<dc:creator>alextsui05</dc:creator>
				<category><![CDATA[Logs]]></category>
		<category><![CDATA[cygwin]]></category>
		<category><![CDATA[terminal]]></category>
		<category><![CDATA[windows]]></category>

		<guid isPermaLink="false">http://feralchicken.wordpress.com/?p=145</guid>
		<description><![CDATA[I recall at last week&#8217;s hackathon we were trying to push stuff using git on Cygwin.  It took a while to figure out ssh was missing, which is weird &#8211; you&#8217;d assume that&#8217;d be included in the default install.  After spending time at a decent terminal on a decent OS, the Cygwin shell definitely leaves [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=feralchicken.wordpress.com&amp;blog=5985195&amp;post=145&amp;subd=feralchicken&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>I recall at last week&#8217;s hackathon we were trying to push stuff using git on Cygwin.  It took a while to figure out ssh was missing, which is weird &#8211; you&#8217;d assume that&#8217;d be included in the default install.  After spending time at a decent terminal on a decent OS, the Cygwin shell definitely leaves something to be desired.</p>
<p>So I searched for &#8216;better cygwin terminal&#8217; and the <a href="http://c2.com/cgi/wiki?BetterCygwinTerminal">first result</a> tells you exactly how to do it.  Basically, you go into C:\cygwin\Cygwin.bat, replace the line that reads:</p>
<pre>bash --login -i</pre>
<p>With:</p>
<pre>start rxvt -sr -sl 10000 -fg white -bg black -fn fixedsys -fb fixedsys -tn cygwin -e /bin/bash --login -i</pre>
<p>Okay, I realize it&#8217;s kinda lame to re-blog top Google results, but more people should know about it &#8211; no one deserves to be squinting at a 80 by 25 window that you can&#8217;t even copy and paste from, nor can you scroll up and down on, nor can you resize.  The command line rocks, and people might never realize it experiencing it through Cygwin.</p>
<p>Also, I found that manpages were scrambled with special characters appearing as garbage in rxvt.  A fix for that is to add the following to .bashrc:</p>
<pre>export LANG=C.ASCII
</pre>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/feralchicken.wordpress.com/145/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/feralchicken.wordpress.com/145/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/feralchicken.wordpress.com/145/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/feralchicken.wordpress.com/145/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/feralchicken.wordpress.com/145/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/feralchicken.wordpress.com/145/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/feralchicken.wordpress.com/145/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/feralchicken.wordpress.com/145/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/feralchicken.wordpress.com/145/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/feralchicken.wordpress.com/145/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/feralchicken.wordpress.com/145/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/feralchicken.wordpress.com/145/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/feralchicken.wordpress.com/145/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/feralchicken.wordpress.com/145/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=feralchicken.wordpress.com&amp;blog=5985195&amp;post=145&amp;subd=feralchicken&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://feralchicken.wordpress.com/2010/04/13/better-cygwin-terminal/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
	
		<media:content url="" medium="image">
			<media:title type="html">alextsui05</media:title>
		</media:content>
	</item>
	</channel>
</rss>
