<?xml version="1.0" encoding="UTF-8"?>
<!-- generator="wordpress/2.1.3" -->
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	>

<channel>
	<title>xnot</title>
	<link>http://blog.xnot.org</link>
	<description>Where it all started</description>
	<pubDate>Thu, 05 Jun 2008 22:51:32 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.1.3</generator>
	<language>en</language>
			<item>
		<title>PoolParty! An Open Source tool for managing EC2 clusters</title>
		<link>http://blog.xnot.org/2008/06/05/poolparty-an-open-source-tool-for-managing-ec2-clusters-2/</link>
		<comments>http://blog.xnot.org/2008/06/05/poolparty-an-open-source-tool-for-managing-ec2-clusters-2/#comments</comments>
		<pubDate>Thu, 05 Jun 2008 22:51:32 +0000</pubDate>
		<dc:creator>ari</dc:creator>
		
		<category><![CDATA[ruby]]></category>

		<guid isPermaLink="false">http://blog.xnot.org/2008/06/05/poolparty-an-open-source-tool-for-managing-ec2-clusters-2/</guid>
		<description><![CDATA[Easily run an autoscaling, load-balanced, monitored failover-safe cloud computing cluster on Amazon&#8217;s EC2 cluster on open-source software! read more &#124; digg story
]]></description>
			<content:encoded><![CDATA[<p>Easily run an autoscaling, load-balanced, monitored failover-safe cloud computing cluster on Amazon&#8217;s EC2 cluster on open-source software! <br/><br/><a href="http://blog.citrusbyte.com/2008/6/5/announcing-pool-party">read more</a> | <a href="http://digg.com/programming/PoolParty_An_Open_Source_tool_for_managing_EC2_clusters">digg story</a></p>
]]></content:encoded>
			<wfw:commentRss>http://blog.xnot.org/2008/06/05/poolparty-an-open-source-tool-for-managing-ec2-clusters-2/feed/</wfw:commentRss>
		</item>
		<item>
		<title>PoolParty! An Open Source tool for managing EC2 clusters</title>
		<link>http://blog.xnot.org/2008/06/05/poolparty-an-open-source-tool-for-managing-ec2-clusters/</link>
		<comments>http://blog.xnot.org/2008/06/05/poolparty-an-open-source-tool-for-managing-ec2-clusters/#comments</comments>
		<pubDate>Thu, 05 Jun 2008 22:48:50 +0000</pubDate>
		<dc:creator>ari</dc:creator>
		
		<category><![CDATA[ruby]]></category>

		<guid isPermaLink="false">http://blog.xnot.org/2008/06/05/poolparty-an-open-source-tool-for-managing-ec2-clusters/</guid>
		<description><![CDATA[Easily run an autoscaling, load-balanced, monitored failover-safe cloud computing cluster on Amazon&#8217;s EC2 cluster on open-source software! read more &#124; digg story
]]></description>
			<content:encoded><![CDATA[<p>Easily run an autoscaling, load-balanced, monitored failover-safe cloud computing cluster on Amazon&#8217;s EC2 cluster on open-source software! <br/><br/><a href="http://blog.citrusbyte.com/2008/6/5/announcing-pool-party">read more</a> | <a href="http://digg.com/programming/PoolParty_An_Open_Source_tool_for_managing_EC2_clusters">digg story</a></p>
]]></content:encoded>
			<wfw:commentRss>http://blog.xnot.org/2008/06/05/poolparty-an-open-source-tool-for-managing-ec2-clusters/feed/</wfw:commentRss>
		</item>
		<item>
		<title>iPhone SDK, with IB</title>
		<link>http://blog.xnot.org/2008/03/28/iphone-sdk-with-ib/</link>
		<comments>http://blog.xnot.org/2008/03/28/iphone-sdk-with-ib/#comments</comments>
		<pubDate>Fri, 28 Mar 2008 10:32:24 +0000</pubDate>
		<dc:creator>ari</dc:creator>
		
		<category><![CDATA[ruby]]></category>

		<guid isPermaLink="false">http://blog.xnot.org/2008/03/28/iphone-sdk-with-ib/</guid>
		<description><![CDATA[Shortly after the initial release of the first iPhone SDK, Apple quickly followed it up with a second release just one week later that includes the interface builder. 
Seriously:
http://developer.apple.com/
]]></description>
			<content:encoded><![CDATA[<p>Shortly after the initial release of the first iPhone SDK, Apple quickly followed it up with a second release just one week later that includes the interface builder. </p>
<p>Seriously:</p>
<p>http://developer.apple.com/</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.xnot.org/2008/03/28/iphone-sdk-with-ib/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Hurray!</title>
		<link>http://blog.xnot.org/2008/03/12/hurray/</link>
		<comments>http://blog.xnot.org/2008/03/12/hurray/#comments</comments>
		<pubDate>Thu, 13 Mar 2008 06:00:22 +0000</pubDate>
		<dc:creator>ari</dc:creator>
		
		<category><![CDATA[ruby]]></category>

		<guid isPermaLink="false">http://blog.xnot.org/2008/03/12/hurray/</guid>
		<description><![CDATA[I&#8217;ve moved to LA, finally! Hurray
Check out my recent works either at:
http://blog.xnot.org
http://guerillaimprov.com
http://iowest.com
http://sohotandsexyionlyneedoneshoweraweek.com
Oh yeah, and the iPhone SDK is OUT!
]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve moved to LA, finally! Hurray</p>
<p>Check out my recent works either at:</p>
<p>http://blog.xnot.org<br />
http://guerillaimprov.com<br />
http://iowest.com<br />
http://sohotandsexyionlyneedoneshoweraweek.com</p>
<p>Oh yeah, and the iPhone SDK is OUT!</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.xnot.org/2008/03/12/hurray/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Effortlessly farm work to an EC2 instance without batting an eye!</title>
		<link>http://blog.xnot.org/2008/02/20/effortlessly-farm-work-to-an-ec2-instance-without-batting-an-eye/</link>
		<comments>http://blog.xnot.org/2008/02/20/effortlessly-farm-work-to-an-ec2-instance-without-batting-an-eye/#comments</comments>
		<pubDate>Wed, 20 Feb 2008 20:06:10 +0000</pubDate>
		<dc:creator>ari</dc:creator>
		
		<category><![CDATA[code]]></category>

		<category><![CDATA[ruby]]></category>

		<category><![CDATA[rails]]></category>

		<category><![CDATA[tutorial]]></category>

		<guid isPermaLink="false">http://blog.xnot.org/2008/02/20/effortlessly-farm-work-to-an-ec2-instance-without-batting-an-eye/</guid>
		<description><![CDATA[We&#8217;ve (Ron Evans and myself) have been working hard to release a new gem called ProcessorPool that uses EC2 and S3 to run your processor heavy-lifting!
Check it out at Blog @ CitrusByte 
]]></description>
			<content:encoded><![CDATA[<p>We&#8217;ve (Ron Evans and myself) have been working hard to release a new gem called ProcessorPool that uses EC2 and S3 to run your processor heavy-lifting!</p>
<p>Check it out at <a href="http://blog.citrusbyte.com/2008/2/20/effortlessly-farm-work-to-an-ec2-instance-without-batting-an-eye">Blog @ CitrusByte </a></p>
]]></content:encoded>
			<wfw:commentRss>http://blog.xnot.org/2008/02/20/effortlessly-farm-work-to-an-ec2-instance-without-batting-an-eye/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Gem runner bug on slicehost installation</title>
		<link>http://blog.xnot.org/2008/01/02/gem-runner-bug-on-slicehost-installation/</link>
		<comments>http://blog.xnot.org/2008/01/02/gem-runner-bug-on-slicehost-installation/#comments</comments>
		<pubDate>Thu, 03 Jan 2008 06:46:01 +0000</pubDate>
		<dc:creator>ari</dc:creator>
		
		<category><![CDATA[code]]></category>

		<category><![CDATA[rails]]></category>

		<guid isPermaLink="false">http://blog.xnot.org/2008/01/02/gem-runner-bug-on-slicehost-installation/</guid>
		<description><![CDATA[So, I got and interesting error when I installed and updated my rubygems on my slicehost account
sudo gem update --system
caused
uninitialized constant Gem::GemRunner (NameError)
The solution:
Add require &#8220;rubygems/gem_runner&#8221; on line 23
Change it from:

require 'rubygems'
Gem.manage_gems

To:

require 'rubygems'
require 'rubygems/gem_runner'
Gem.manage_gems

]]></description>
			<content:encoded><![CDATA[<p>So, I got and interesting error when I installed and updated my rubygems on my slicehost account</p>
<p><code>sudo gem update --system</code></p>
<p>caused<br />
<code>uninitialized constant Gem::GemRunner (NameError)</code></p>
<p>The solution:<br />
Add require &#8220;rubygems/gem_runner&#8221; on line 23</p>
<p>Change it from:<br />
<code><br />
require 'rubygems'<br />
Gem.manage_gems<br />
</code></p>
<p>To:<br />
<code><br />
require 'rubygems'<br />
require 'rubygems/gem_runner'<br />
Gem.manage_gems<br />
</code></p>
]]></content:encoded>
			<wfw:commentRss>http://blog.xnot.org/2008/01/02/gem-runner-bug-on-slicehost-installation/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Rails without a database</title>
		<link>http://blog.xnot.org/2007/12/29/rails-without-a-database/</link>
		<comments>http://blog.xnot.org/2007/12/29/rails-without-a-database/#comments</comments>
		<pubDate>Sun, 30 Dec 2007 02:35:09 +0000</pubDate>
		<dc:creator>ari</dc:creator>
		
		<category><![CDATA[code]]></category>

		<category><![CDATA[ruby]]></category>

		<category><![CDATA[rails]]></category>

		<guid isPermaLink="false">http://blog.xnot.org/2007/12/29/rails-without-a-database/</guid>
		<description><![CDATA[Despite all other options, I decided to write a small project in Rails. But, this project is so small, there is really no need to store any information in a database!
Now, with Rails 2.0, it&#8217;s easy to accomplish!
The only real thing you have to do is add this line to your config/environment.rb:
config.frameworks -= [ :active_record [...]]]></description>
			<content:encoded><![CDATA[<p>Despite all other options, I decided to write a small project in Rails. But, this project is so small, there is really no need to store any information in a database!</p>
<p>Now, with Rails 2.0, it&#8217;s easy to accomplish!</p>
<p>The only real thing you have to do is add this line to your config/environment.rb:<br />
<code>config.frameworks -= [ :active_record ]</code></p>
<p>Cake!</p>
<p>I tend to remove the database.yml file, just to remind myself I&#8217;m not using a database!</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.xnot.org/2007/12/29/rails-without-a-database/feed/</wfw:commentRss>
		</item>
		<item>
		<title>See code, C code!</title>
		<link>http://blog.xnot.org/2007/11/14/see-code-c-code/</link>
		<comments>http://blog.xnot.org/2007/11/14/see-code-c-code/#comments</comments>
		<pubDate>Wed, 14 Nov 2007 16:40:05 +0000</pubDate>
		<dc:creator>ari</dc:creator>
		
		<category><![CDATA[Blogroll]]></category>

		<category><![CDATA[code]]></category>

		<category><![CDATA[tutorial]]></category>

		<guid isPermaLink="false">http://blog.xnot.org/2007/11/14/see-code-c-code/</guid>
		<description><![CDATA[In writing a compiler, I&#8217;ve come across a sleek part of the standard c library that I just can&#8217;t help and a take a few minutes to write a blog post about it!
You can send any number of arguments to a method / macro that you want. It&#8217;s called Variadic methods and they have a [...]]]></description>
			<content:encoded><![CDATA[<p>In writing a compiler, I&#8217;ve come across a sleek part of the standard c library that I just can&#8217;t help and a take a few minutes to write a blog post about it!</p>
<p>You can send any number of arguments to a method / macro that you want. It&#8217;s called <b>Variadic</b> methods and they have a crazy syntax. Here is a piece of code that I am using in the compiler. It&#8217;s super similar to the printf method (the printf method itself is a variadic method, if you&#8217;ve ever wondered&#8230;)</p>
<pre><code>
char *stringerize(const char *fmt, ...) {
	char *buf = safe_malloc(sizeof(char)*BUFSIZE);
	va_list args;

	va_start(args, fmt);
	if (args &#038;&#038; strlen(args) > 0)
	  (void) vsnprintf(buf, BUFSIZE, fmt, args);
	va_end(args);

	return (buf);
}
</code></pre>
<p>Kind uninteresting, huh? I&#8217;ll show you a much more interesting one at the end of the post thatallows you to <b>safely</b> concatenate any number of strings.</p>
<p>The basic idea is that you define a method with the &#8230; syntax, such as</p>
<pre><code>
char *stringerize(const char *fmt, ...)
...
</code></pre>
<p>There are two two ways to access those variables. </p>
<p><b>One by one</b><br />
First, you declare all your variables that you are going to use in the method. That has to be before accessing the list. Then, you start the list with </p>
<pre><code>
va_list args;
</code></pre>
<p>Make sure you don&#8217;t forget to declare the args as a list otherwise C will throw a fit.</p>
<p>Then, when you are ready to get the variables, call </p>
<pre><code>
va_start(args, fmt);
</code></pre>
<p>The second parameter is the last required argument in the command. You do need at least one required argument in a function. The same requirement does not hold true for macros, though.</p>
<p>Then, to get to the variable you call </p>
<pre><code>
va_arg(args, const char *);
</code></pre>
<p>The second parameter is the type you are expecting to come back. This gives C a heads up as to what to expect.</p>
<p>Then, when you are done and want to move on to the next one in the list, simply call:</p>
<pre><code>
va_end(args);
</code></pre>
<p>That&#8217;s it!</p>
<p><b>Accessing the variables all at once</b></p>
<p>You can either do this in a macro that would look something like (untested):</p>
<pre><code>
#define VARGS(...) fprintf(stderr, __VA_ARGS__)
// or
#define VARGS(fmt, args...) fprintf(stderr, fmt, args)
</code></pre>
<p>There are other ways as well, but those are the ones that stood out to me. In a method, you can do this as I had done in the example above. Just call list and all the arguments are accessible to you, right there in your shirt pocket!</p>
<p>And now, finally for the more important snippet that:</p>
<pre><code>
char *concat_commands(const char* str,...) {
	va_list args; char *s; size_t held_memory = 100;
	char *res = safe_malloc(sizeof(char)*held_memory);
	if (res != NULL) {
		char *new_pointer, *word_pointer;
		va_start(args, str);
		word_pointer = res;
		for (s=str;s!=NULL;s=va_arg(args, const char *)) {
			size_t len = strlen(s);
			if (word_pointer + len + 1 > res + held_memory) {
				held_memory = (held_memory + len) * 2;
				new_pointer = (char *) realloc (res, held_memory);
				if (new_pointer == NULL) { free(res); return NULL; }
				word_pointer = new_pointer + (word_pointer - res);
				res = new_pointer;
			}
			word_pointer = memcpy(word_pointer,s,len);
			word_pointer = word_pointer + len;
		}
		*word_pointer++ = ' ';
		new_pointer = (char *) realloc(res, word_pointer-res);
		if (new_pointer != NULL) {res = new_pointer;}
		va_end(args);
	}
	return res;
}
</code></pre>
<p>I hope this helps someone out there save a few hours and remember how cool C even in the midst of the ruby we all love so much. On that note, I urge you to look at the ruby interpreter source code. It&#8217;s a tad jumbled up, my guess is because there are a few people working on it, but it is sure damn sexy code. Thanks once again matz!</p>
<p>I&#8217;ll be back more in a week or so for more fervent posts after my compiler is done. </p>
<p><a href="http://www-ccs.ucsd.edu/c/stdarg.html">More information here</a></p>
]]></content:encoded>
			<wfw:commentRss>http://blog.xnot.org/2007/11/14/see-code-c-code/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Where have I been?</title>
		<link>http://blog.xnot.org/2007/11/12/where-have-i-been/</link>
		<comments>http://blog.xnot.org/2007/11/12/where-have-i-been/#comments</comments>
		<pubDate>Tue, 13 Nov 2007 04:51:23 +0000</pubDate>
		<dc:creator>ari</dc:creator>
		
		<category><![CDATA[code]]></category>

		<category><![CDATA[random]]></category>

		<category><![CDATA[life]]></category>

		<category><![CDATA[events]]></category>

		<guid isPermaLink="false">http://blog.xnot.org/2007/11/12/where-have-i-been/</guid>
		<description><![CDATA[I&#8217;ve gotten a few emails about the lack of posts, so rather than reply to everyone, I figure I&#8217;ll set it straight:
I&#8217;ve been working on a compiler for class. Boom!
Something kinda cool though: 
I can take code that looks like this:


extern void print_int(int x);
extern void print_string(char x[]);

int two[2];
int five[5], one;

void love_me(void) {
	print_string("You love me, don't [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve gotten a few emails about the lack of posts, so rather than reply to everyone, I figure I&#8217;ll set it straight:</p>
<p>I&#8217;ve been working on a compiler for class. Boom!</p>
<p>Something kinda cool though: </p>
<p>I can take code that looks like this:</p>
<pre>
<code>
extern void print_int(int x);
extern void print_string(char x[]);

int two[2];
int five[5], one;

void love_me(void) {
	print_string("You love me, don't you?n");
}

void main( void ) {
	two = 4;
	love_me();
}
</code>
</pre>
<p>And turn it into code that looks like this:</p>
<pre>
<code>
.data
	two: .space 8
	five: .space 20
	one: .space 4
_string_0:	.asciiz "You love me, dont you?n"

.text

jal love_me
la $sp, 4($sp)
love_me:
 	# Function prologue
 	sw $fp, -4($sp)						# save old $fp
	sw $ra, -8($sp)						# save return address
	la $fp, 0($sp)						# set up frame pointer
	la $sp, -12($sp)					# Update stack pointer and allocate stack frame

# Load variables on to the stack
la $t9, _string_0
sw $t9, -4($sp)
la $sp, -4($sp)
# Call the method
jal print_string
la $sp, 4($sp)

 	# Function epilogue
	la $sp, 0($fp)						# Restore stack pointer
	lw $ra, -8($sp)						# Restore return address
	lw $fp, -4($sp)						# Restore frame pointer
	jr $ra							# Return

jal main
la $sp, 4($sp)
main:
 	# Function prologue
 	sw $fp, -4($sp)						# save old $fp
	sw $ra, -8($sp)						# save return address
	la $fp, 0($sp)						# set up frame pointer
	la $sp, -12($sp)					# Update stack pointer and allocate stack frame

li $4, 4	# Load _tmp_0
sw $4, -16($fp)	

lw $4, -16($fp)	# Load two
sw $4, two

# Load variables on to the stack
# Call the method
jal love_me
la $sp, 4($sp)

 	# Function epilogue
	la $sp, 0($fp)						# Restore stack pointer
	lw $ra, -8($sp)						# Restore return address
	lw $fp, -4($sp)						# Restore frame pointer
	jr $ra							# Return

print_int:
	li $v0, 1
	lw $a0, 0($sp)
	syscall
	jr $ra

print_string:
	li $v0, 4
	lw $a0, 0($sp)
	syscall
	jr $ra

</code>
</pre>
<p>When I get it done, I&#8217;ll open-source it and be back for more ruby joy! So stay tuned amigos!</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.xnot.org/2007/11/12/where-have-i-been/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Quick update</title>
		<link>http://blog.xnot.org/2007/11/02/quick-update/</link>
		<comments>http://blog.xnot.org/2007/11/02/quick-update/#comments</comments>
		<pubDate>Sat, 03 Nov 2007 03:22:24 +0000</pubDate>
		<dc:creator>ari</dc:creator>
		
		<category><![CDATA[life]]></category>

		<guid isPermaLink="false">http://blog.xnot.org/2007/11/02/quick-update/</guid>
		<description><![CDATA[For those of you who don't know, I have been working in Japan for the last two weeks....  Look for more content in the next few days and you shall find it!For now...]]></description>
			<content:encoded><![CDATA[<p>For those of you who don&#8217;t know, I have been working in Japan for the last two weeks. This is why the blog has not been updated in a while. Look for more content in the next few days and you shall find it!</p>
<p>For now&#8230; enjoy:</p>
<p><a href="http://blog.xnot.org/wp-content/uploads/2007/11/img-0006.jpg" onclick="window.open('http://blog.xnot.org/wp-content/uploads/2007/11/img-0006.jpg','popup','width=1600,height=1200,scrollbars=no,resizable=yes,toolbar=no,directories=no,location=no,menubar=no,status=yes,left=0,top=0');return false"><img src="http://blog.xnot.org/wp-content/uploads/2007/11/img-0006-tm.jpg" height="100" width="133" border="1" hspace="4" vspace="4" alt="Img 0006" /></a></p>
]]></content:encoded>
			<wfw:commentRss>http://blog.xnot.org/2007/11/02/quick-update/feed/</wfw:commentRss>
		</item>
	</channel>
</rss>
