<?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/"
	>

<channel>
	<title>Ambitious Apathy</title>
	<atom:link href="http://www.ambitiousapathy.com/?feed=rss2" rel="self" type="application/rss+xml" />
	<link>http://www.ambitiousapathy.com</link>
	<description>...Programming....And Everything Else....</description>
	<pubDate>Sun, 18 Apr 2010 20:52:37 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.7.1</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>RawkX - version 0.2.0!</title>
		<link>http://www.ambitiousapathy.com/?p=83</link>
		<comments>http://www.ambitiousapathy.com/?p=83#comments</comments>
		<pubDate>Sun, 18 Apr 2010 20:11:33 +0000</pubDate>
		<dc:creator>Pete</dc:creator>
		
		<category><![CDATA[RawkX]]></category>

		<guid isPermaLink="false">http://www.ambitiousapathy.com/?p=83</guid>
		<description><![CDATA[So, in my last post I discussed my new gem, RawkX. If you remember, to use it, I told you to open up the RawkX class and over-write a method called &#8216;parse_line&#8217;. This was because that was the method which was called on each line of your log and you could then tell it how [...]]]></description>
			<content:encoded><![CDATA[<p>So, in my<a href="http://www.ambitiousapathy.com/?p=70"> last post</a> I discussed my new gem, RawkX. If you remember, to use it, I told you to open up the RawkX class and over-write a method called &#8216;parse_line&#8217;. This was because that was the method which was called on each line of your log and you could then tell it how to parse your special format.</p>
<p>But lets be honest, that&#8217;s little awkward.</p>
<p>Why? because I&#8217;m forcing you to see a bit more about how RawkX works then you really need to know. you shouldn&#8217;t care what the method for parsing a line is called. You shouldn&#8217;t need to know what class it&#8217;s in. What if I change the method name? That would cause your parsing to break if you updated versions.  It wouldn&#8217;t be your fault, it would just be the result of me exposing too much to the user.</p>
<p>The good news is version 0.2.0 is an attempt to fix, or at least improve, that issue.</p>
<p>Now to specify how to parse your logs you can simply pass a block to RawkX which specifies the logic to handle your log. Lets just take a look at an example. Below is the same parsing logic from my previous example, made to work as version 0.2.0 intends:</p>
<pre>
require "rubygems"
require "rawkx"

RawkX.new do |line|
  fields = line.split
  [fields[1], fields[0]]
end
</pre>
<p>To me, this feels cleaner and safer. This block will be used in the same manner as the parse_line method was. it will get called for each line of the log, and it expects a key/value pair to be returned (or nil if the line is to be ignored). As with the previous version, if you do not pass a block or over-write the method, it will fall back to standard Rails log parsing.</p>
<p>Version 0.2.0 has been released to <a href="http://rubygems.org/gems/rawkx">rubygems.org</a> and, again, the source code for RawkX can be found <a href="http://github.com/pzimbelman/rawkx">here</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.ambitiousapathy.com/?feed=rss2&amp;p=83</wfw:commentRss>
		</item>
		<item>
		<title>RawkX - An Extendable Rawk!</title>
		<link>http://www.ambitiousapathy.com/?p=70</link>
		<comments>http://www.ambitiousapathy.com/?p=70#comments</comments>
		<pubDate>Fri, 16 Apr 2010 01:27:50 +0000</pubDate>
		<dc:creator>Pete</dc:creator>
		
		<category><![CDATA[RawkX]]></category>

		<guid isPermaLink="false">http://www.ambitiousapathy.com/?p=70</guid>
		<description><![CDATA[If you&#8217;re familiar with Rails then there is a good chance you&#8217;ve heard of or used Rawk. Rawk is a log analyzer that will generate statistics about your application&#8217;s different controller actions. I won&#8217;t go in to details here, but it can be a useful bit of feed back to see a listing of some [...]]]></description>
			<content:encoded><![CDATA[<p>If you&#8217;re familiar with Rails then there is a good chance you&#8217;ve heard of or used <a href="http://rubyforge.org/projects/rawk-the-logs/">Rawk</a>. Rawk is a log analyzer that will generate statistics about your application&#8217;s different controller actions. I won&#8217;t go in to details here, but it can be a useful bit of feed back to see a listing of some of your worst requests and the amount of time its taking them to complete as compared to others.</p>
<p>Recently when I was at work we decided we wanted a Rawk-like report for another service our application was using, which was written in house, so we could observe its performance.  I was mildly familiar with Rawk, so I brought up the Rawk source code and started looking through to see what pieces we could reuse. Without much thought I began pulling pieces over, starting with the most obvious pieces and working my way down. It didn&#8217;t take very long for me to get what I wanted, but when all was said and done it started to sink in that I had ended up using almost all of Rawk&#8217;s original behavior, and simply changed how it parsed log lines. As any developer should, I realized I had created a significant amount of unnecessary duplication and felt compelled to find a way to prevent me from having to do it again.</p>
<p>Hence, the idea for RawkX was born and a couple nights later a first version has been published.</p>
<p>RawkX is simple. It is a slight refactoring of Rawk to allow it to be easily extended with different parsing logic. In short, the goal is to give you an easy way to generate Rawk reports for any log format without needing to think about anything besides how to parse your log.</p>
<p>For me, RawkX is also somewhat of an exercise and was a reason to play around with building and creating a gem for something I have actually had some use for. So maybe some of you will find it useful too!</p>
<p>Enough of that though, how do I get it and how does it work!</p>
<p>There&#8217;s no surprises or secrets getting the gem installed: <em>gem install rawkx</em></p>
<p>Next, Lets say you have a log of actions that looks something like this:</p>
<pre>3.24 Read user1
5.0 Write user1
2.245 Read user2
3.4 Read user3</pre>
<p>Not complicated, but perhaps you had a large number of these actions and you wanted to generate a report to see the performance of them. With RawkX, that&#8217;s pretty simple. Just create a ruby file which does the following:</p>
<pre>require "rubygems"
require "rawkx"

class RawkX
  def parse_line(line)
    fields = line.split
    return fields[1], fields[0]
  end
end
RawkX.new</pre>
<p>Lets look at this for a second. We are reopening the RawkX class, and redefining the parse_line method. This method recieves a line from the log and is expected to return a key/value pair. The key is the action or item you want to measure, and the value is the time it took to complete. Nothing impressive, but a few things to note:</p>
<ul>
<li>The values returned must be in the order used above: key first, then the value/time</li>
<li>Only two values are expected to be returned currently.</li>
<li>If you want a particular line, or some type of line, to be ignored simply return nil and RawkX will move on to the next line without doing anything further.</li>
<li>The parse_line method is called for each line of the log. If you want to save values between lines, you can do so using something like instance variables to remember things from previous lines (see how the default implementation of parse_line is done).</li>
<li>If you use RawkX without over-writing this method, it will use the default Rails log parsing.</li>
</ul>
<p>You can now run this file and pass in your log information (either  through stdin or using the -f parameter to specify a file):</p>
<p>ruby [filename] -f mylog.log</p>
<p>ruby [filename] &lt; mylog.log  mylog2.log   &#8230;..</p>
<p>Doing this should show a Rawk report for your log. I&#8217;m not going to go into details about the report. it should be fairly obvious and familiar if you&#8217;ve ever used Rawk.</p>
<p>Other options available when running RawkX reports are:</p>
<p>-w &lt;count&gt;</p>
<p>This is how many results you want displayed in the final &#8220;Worst Requests&#8221; list</p>
<p>-s &lt;count&gt;</p>
<p>This is how many results you want displayed in the results for the other report areas.</p>
<p>And, for the time being, that&#8217;s pretty much it. version 0.1.0 has been pushed out and available to download at rubygems.org. I have some stuff I want to try with this tool, but this seemed like the minimal amount required to be useful. As such, I wanted to get it released so I would feel like I accomplished something!</p>
<p>Also, the source code is posted on github <a href="http://github.com/pzimbelman/rawkx">here</a>.</p>
<p>As always any feedback is welcome and if you ever end up using it, tell me and let me know what you think!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.ambitiousapathy.com/?feed=rss2&amp;p=70</wfw:commentRss>
		</item>
		<item>
		<title>Learning Ruby</title>
		<link>http://www.ambitiousapathy.com/?p=64</link>
		<comments>http://www.ambitiousapathy.com/?p=64#comments</comments>
		<pubDate>Sun, 19 Jul 2009 05:07:16 +0000</pubDate>
		<dc:creator>Pete</dc:creator>
		
		<category><![CDATA[programming]]></category>

		<guid isPermaLink="false">http://www.ambitiousapathy.com/?p=64</guid>
		<description><![CDATA[So, It&#8217;s been a while since my last post. I recently graduated from college and accepted a job working for Cyrus Innovation. The first project I will be joining is a Ruby on Rails project, so I&#8217;ve spent some time lately learning a bit more about Ruby. To help with this, I&#8217;ve started making attempts [...]]]></description>
			<content:encoded><![CDATA[<p>So, It&#8217;s been a while since my last post. I recently graduated from college and accepted a job working for <a href="http://cyrusinnovation.com">Cyrus Innovation</a>. The first project I will be joining is a Ruby on Rails project, so I&#8217;ve spent some time lately learning a bit more about Ruby. To help with this, I&#8217;ve started making attempts at solving some <a href="http://rubyquiz.com">Ruby Quiz</a> problems, amongst other things. I decided to make a new page where I can start posting some of my solutions, and maybe other Ruby stuff, as I continue to learn. I&#8217;m very excited about everything thats going on in my life right now, so hopefully I can start posting more frequently as I get settled. In the meantime, check out my solutions and tell me all the things I did wrong!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.ambitiousapathy.com/?feed=rss2&amp;p=64</wfw:commentRss>
		</item>
		<item>
		<title>More Javascript Fun</title>
		<link>http://www.ambitiousapathy.com/?p=52</link>
		<comments>http://www.ambitiousapathy.com/?p=52#comments</comments>
		<pubDate>Mon, 27 Apr 2009 08:49:57 +0000</pubDate>
		<dc:creator>Pete</dc:creator>
		
		<category><![CDATA[programming]]></category>

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

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

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

		<guid isPermaLink="false">http://www.ambitiousapathy.com/?p=52</guid>
		<description><![CDATA[So, I&#8217;ve seen a variety of web pages with components which can be freely dragged around the page. Things like when Facebook used to let you freely drag and rearrange some of your profile boxes. Last night I somewhat randomly decided to find an easy way to do this component dragging using Javascript. Sure enough, [...]]]></description>
			<content:encoded><![CDATA[<p>So, I&#8217;ve seen a variety of web pages with components which can be freely dragged around the page. Things like when Facebook used to let you freely drag and rearrange some of your profile boxes. Last night I somewhat randomly decided to find an easy way to do this component dragging using Javascript. Sure enough, I immediately came across a very simple Jquery plugin called <a href="http://fromvega.com/wordpress/2007/07/14/easydrag-jquery-plugin/">EasyDrag</a>. After finding it, I suddenly decided I wanted to make something using it. All I wanted to do tonight was create something simple enough that I could finish at least a very basic example in one quick sitting. So I decided to create a trivially simple puzzle. The puzzle itself is pretty self explanatory. There are 4 colored triangles which start on the left side of the screen. The goal is to drag them onto their matching grey triangle  in the middle of the screen. Once a triangle is correctly placed, it cannot be moved any more until the page is refreshed. Yes, this is about on par with puzzles for your average 1 year-old. Oh well, I&#8217;ll create something more interesting once I get a bit more time.</p>
<p>The puzzle itself can be found <a href="http://www.ambitiousapathy.com/Puzzle.html">here</a>. My javascript code can be found <a href="http://www.ambitiousapathy.com/code/puzzleScripts.js">here</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.ambitiousapathy.com/?feed=rss2&amp;p=52</wfw:commentRss>
		</item>
		<item>
		<title>The Muffinman!</title>
		<link>http://www.ambitiousapathy.com/?p=48</link>
		<comments>http://www.ambitiousapathy.com/?p=48#comments</comments>
		<pubDate>Fri, 24 Apr 2009 03:09:31 +0000</pubDate>
		<dc:creator>Pete</dc:creator>
		
		<category><![CDATA[Muffinman]]></category>

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

		<guid isPermaLink="false">http://www.ambitiousapathy.com/?p=48</guid>
		<description><![CDATA[Muffinman is a project I&#8217;ve been working on for a while now. Me and one partner, Dale Sample, have been building this tool as our senior design project.
What is it? It is an automated testing tool for Java Swing applications. There are lots of things I want to say/write about this project, but I think [...]]]></description>
			<content:encoded><![CDATA[<p>Muffinman is a project I&#8217;ve been working on for a while now. Me and one partner, Dale Sample, have been building this tool as our senior design project.</p>
<p>What is it? It is an automated testing tool for Java Swing applications. There are lots of things I want to say/write about this project, but I think I&#8217;m going to hold off on all of those ideas for now since I feel they would do more good as a series of seperate posts instead of one disorganized post.</p>
<p>I took a little time a couple days ago to start setting up a simple website for the project though. Please note: The site in its current state of writing this does not have all the content, features, and design I&#8217;d like. However, I wanted to at least get something simple online quickly to create some sort of public presence about the project. As time continues in the weeks ahead, I will be adding and changing the site around as well as writing about the project and its development.</p>
<p>For now, check out <a href="http://muffinman.ambitiousapathy.com">Muffinman</a> and keep an eye out for more information in the weeks ahead!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.ambitiousapathy.com/?feed=rss2&amp;p=48</wfw:commentRss>
		</item>
		<item>
		<title>This Just In: I Like Jquery</title>
		<link>http://www.ambitiousapathy.com/?p=38</link>
		<comments>http://www.ambitiousapathy.com/?p=38#comments</comments>
		<pubDate>Thu, 23 Apr 2009 07:34:43 +0000</pubDate>
		<dc:creator>Pete</dc:creator>
		
		<category><![CDATA[General Thoughts]]></category>

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

		<guid isPermaLink="false">http://www.ambitiousapathy.com/?p=38</guid>
		<description><![CDATA[I know I&#8217;m not the first person to point it out, but Jquery is pretty damn cool. I had read about it a little while back, but I never really bothered to look into it in much detail. Recently, I took another look at it and started playing around with the basics and found it [...]]]></description>
			<content:encoded><![CDATA[<p>I know I&#8217;m not the first person to point it out, but <a href="http://jquery.com">Jquery</a> is pretty damn cool. I had read about it a little while back, but I never really bothered to look into it in much detail. Recently, I took another look at it and started playing around with the basics and found it to be a lot of fun. I&#8217;ve always liked Javascript in the times that I&#8217;ve used it, and Jquery makes so many of those little cool features in web pages trivially simple. I&#8217;ll probably start trying to integrate more and more little snippets of Javascript in any of the websites I post here (I&#8217;m planning on posting about another one of my projects soon) just to get a little more experience using it since I&#8217;m still a newbie.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.ambitiousapathy.com/?feed=rss2&amp;p=38</wfw:commentRss>
		</item>
		<item>
		<title>A Simple Interpreter in C++</title>
		<link>http://www.ambitiousapathy.com/?p=30</link>
		<comments>http://www.ambitiousapathy.com/?p=30#comments</comments>
		<pubDate>Wed, 22 Apr 2009 07:30:37 +0000</pubDate>
		<dc:creator>Pete</dc:creator>
		
		<category><![CDATA[programming]]></category>

		<guid isPermaLink="false">http://www.ambitiousapathy.com/?p=30</guid>
		<description><![CDATA[A little while ago I made my first post here and put up a link to a simple interactive shell I had made. Now, If you went out of your way to play with the shell it might not take very long for you to find some issues with it. If you are bold enough [...]]]></description>
			<content:encoded><![CDATA[<p>A little while ago I made my first post here and put up a link to a simple <a href="http://ambitiousapathy.com/shell">interactive shell</a> I had made. Now, If you went out of your way to play with the shell it might not take very long for you to find some issues with it. If you are bold enough to actually open up the source code for it, you might find the overall implementation to be fairly poor. Maybe it isn&#8217;t a good idea for me to post code that is not as good as it can be since it could reflect poorly on me as a programmer. However, to me, the goal of building things like this is to learn.  I am perfectly fine with the idea that the code I write is not perfect and I don&#8217;t think that should say anything bad about me as a programmer up front. In general, I would hope the ambition to continuously learn and improve with everything I create outweighs the fact that these creations may not end up being brilliant or flawless pieces of software.</p>
<p><em>So what was the problem with the interactive shell? </em><br />
Well, for starters, there was no solid organization for how I tried to parse or interpret the commands entered by the user.<br />
<em>What do you mean by that?</em><br />
At the time of starting the project, I had absolutely no experience or knowledge of compiler theory or the general organization of a compiler/interpreter. In other words: I didn&#8217;t know that a compiler is usually broken up into a <a href="http://en.wikipedia.org/wiki/Lexical_analysis">lexer</a> and <a href="http://en.wikipedia.org/wiki/Parsing">parser</a>. As a result, no formal tokenization really ever takes place, which doesn&#8217;t make the process of parsing and evaluating expressions any easier.</p>
<p>I don&#8217;t want to spend too much time talking about what I didn&#8217;t do correctly, I just want to mention some points which inspired me to take another stab at a similar problem in a more intelligent way. As I mentioned, the interactive shell was primarily motivated by my desire to build something in Javascript and it was just something to keep me coding at the time.  It was not about trying to learn intelligent methods of parsing. Recently however, I decided to try to build a basic interpreter in C++ and I wanted to go about it in a more organized fashion.</p>
<p>All I wanted was the ability to, once again, evaluate arithmetic expressions and to allow the creation and use of variables in these expressions. Instead of being an interactive shell, it would simply read in a full script from a text file and evaluate the expressions line by line and print any results out to the console. I admit, this is not terribly useful, but I wanted to try and do things more intelligently.</p>
<p>What do I mean by &#8216;more intelligently&#8217;? I mean that I wanted to have a formal lexer which performed tokenization first, and then these tokens would be used by the parser to evaluate the expressions based off of a well defined grammer. So what all is needed?</p>
<p>First, I defined the valid set of tokens which are allowed:</p>
<p>NUMBER (an integer number. no decimal places)</p>
<p>IDENTIFIER (basically a variable name. can start with upper or lower case letter. can contain letters, digits, and underscores)</p>
<p>LINECOMMENTS(the usual &#8216;//&#8217; for line comments is allowed. these arent actually technically a token since they are ignored by the lexer)</p>
<p>PLUS(+), MINUS(-), DIVIDE (/), MULTIPLY (*), EQUALS (=), SEMI(;), LPAREN( &#8216;(&#8217; ), and RPAREN ( &#8216;)&#8217; ).</p>
<p>Given these tokens, I define a very basic grammer for the different types of statements which are valid. Basically we only have 2 types of statements: a straight forward expression to be evaluated, or an assignment statement where the value of an expression is placed into a variable.</p>
<p>An assignment statement is defined as: <em>IDENTIFIER EQUALS expression SEMI<br />
</em></p>
<p>where <em>expression </em>is defined as one of: <em>NUMBER </em><strong>or </strong><em>IDENTIFIER </em><strong>or </strong><em>LPAREN expression op expression RPAREN SEMI</em></p>
<p>and <em>op</em> is defined as: <em>PLUS </em><strong>or </strong><em>MINUS </em><strong>or </strong><em>DIVIDE </em><strong>or </strong><em>MULTIPLY</em></p>
<p>Furthermore, the value of a straightforward expression is printed to the console while nothing is printed in an assignment statement. So, an example script could end up looking like:</p>
<blockquote><p>//This is just a simple script&#8230;</p>
<p>(3+4);<br />
(12 - (3*7));<br />
((10-5) * (3+5));<br />
(((5-2) + (3*2)) + 10);<br />
A = (3+4);<br />
A = (A + 4);<br />
B = A;<br />
B;</p></blockquote>
<p>The syntax is far from elegant, but that&#8217;s not really the point. The parsing is my attempt at something resembling recursive descent parsing, which you can read a bit more about <a href="http://en.wikipedia.org/wiki/Recursive_descent_parser">here</a>.  My actual code is heavily influenced in style from that in the article. However, I did do some things a bit differently, especially because I also wanted to actually evaluate the expressions as I was parsing them.</p>
<p>It&#8217;s still nothing amazing, but I feel like my code is more easily understood and organized for now. speaking of the code, you can get it <a href="http://ambitiousapathy.com/code/Interpreter.zip">here</a>. I wrote it in Microsoft Visual C++ Express Edition and I simply zipped up the Visual Studio project to post. Take a look at it if you&#8217;re interested and feel free to share any comments or critisism. Its getting late, and I&#8217;m off to bed. Goodnight&#8230;.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.ambitiousapathy.com/?feed=rss2&amp;p=30</wfw:commentRss>
		</item>
		<item>
		<title>Why, Hello There&#8230;</title>
		<link>http://www.ambitiousapathy.com/?p=3</link>
		<comments>http://www.ambitiousapathy.com/?p=3#comments</comments>
		<pubDate>Sat, 11 Apr 2009 21:23:53 +0000</pubDate>
		<dc:creator>Pete</dc:creator>
		
		<category><![CDATA[programming]]></category>

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

		<guid isPermaLink="false">http://www.ambitiousapathy.com/?p=3</guid>
		<description><![CDATA[Yeah, I made a blog.
As I approach graduation I&#8217;ve become more and more torn as to how I ought to spend my time.  I have more &#8216;free&#8217; time than I have had in years, and plenty of ideas and projects to use it for. However, over the last few weeks I have spent most of [...]]]></description>
			<content:encoded><![CDATA[<p>Yeah, I made a blog.</p>
<p>As I approach graduation I&#8217;ve become more and more torn as to how I ought to spend my time.  I have more &#8216;free&#8217; time than I have had in years, and plenty of ideas and projects to use it for. However, over the last few weeks I have spent most of my time thinking about what I could be doing, instead of doing much of anything. I decided to create this blog in order to help stop this. In an attempt to no longer think or worry too much about jobs, moving, classes, or anything else. I have decided to focus on doing one thing: <strong>coding</strong>.</p>
<p>This blog might be used for all sorts of things. Perhaps sharing thoughts about programming and software development in general and anything else that is on my mind.  But most of all, it is a place for me to write about and share the projects I want to build in my spare time. This blog is a place for me to start seeing some sort of  organized results for the things I create.</p>
<p>And, obviously, it&#8217;s a place for you to see it all as well&#8230;</p>
<p>On the right side is a link to where I plan to post some info about projects as I work on them. I&#8217;ll probably write more about projects of interest in separate posts as well. For now, I&#8217;ve added a link and a little description about a simple interactive shell I wrote a while back. Check it out. More will be coming. </p>
]]></content:encoded>
			<wfw:commentRss>http://www.ambitiousapathy.com/?feed=rss2&amp;p=3</wfw:commentRss>
		</item>
	</channel>
</rss>
