<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Matt O' Rama &#187; Code</title>
	<atom:link href="http://mattorama.net/blog/index.php/category/code/feed/" rel="self" type="application/rss+xml" />
	<link>http://mattorama.net/blog</link>
	<description>Much profound brain things inside my head</description>
	<lastBuildDate>Tue, 17 Apr 2012 01:56:13 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.1.3</generator>
		<item>
		<title>Starting An Experiment</title>
		<link>http://mattorama.net/blog/index.php/2012/04/16/starting-an-experiment-startup/</link>
		<comments>http://mattorama.net/blog/index.php/2012/04/16/starting-an-experiment-startup/#comments</comments>
		<pubDate>Tue, 17 Apr 2012 01:43:09 +0000</pubDate>
		<dc:creator>matt</dc:creator>
				<category><![CDATA[Business]]></category>
		<category><![CDATA[Code]]></category>

		<guid isPermaLink="false">http://mattorama.net/blog/?p=1092</guid>
		<description><![CDATA[I&#8217;ve been neglecting my little blog here for quite awhile partly because I&#8217;ve been working on a side project that I didn&#8217;t know how to write about. I&#8217;m not quite ready to pull the covers off it and talk directly about it yet (soon!) but I didn&#8217;t want to let the private nature of the [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve been neglecting my little blog here for quite awhile partly because I&#8217;ve been working on a side project that I didn&#8217;t know how to write about. I&#8217;m not quite ready to pull the covers off it and talk directly about it yet (soon!) but I didn&#8217;t want to let the private nature of the site prevent me from writing any longer. In the spirit of just getting something written, this is probably going to be more rambling that usual.</p>
<p>So, I&#8217;m building a website. It&#8217;s a tool for programmers, which I think is pretty useful. Is it a <strong>&#8220;startup&#8221;</strong>? I don&#8217;t know. I don&#8217;t even really know if it&#8217;s a good idea yet. The way I work probably isn&#8217;t the way others work so who knows if anybody else will find this thing useful. Programmers are very picky about tools, and rightly so. When talking about my somewhat expensive keyboard I bought for myself to have at work, I said <strong>&#8220;Don&#8217;t bring a knife to a gun fight&#8221;</strong> which is of course a famous quote but also fits how I feel about tools. Programmers need guns. Metaphorically.</p>
<p>But anyway, I don&#8217;t know if it&#8217;s a startup. It&#8217;s an idea. <strong>It&#8217;s an experiment.</strong> I would love more than anything for this thing to take off so I can hire some of my friends to come work with me. I would love it if this experiment took off enough just to support me working on it. But right now I&#8217;m not really interested in the typical TechCrunch / VC / Valley / Bubble / blahblah startup. I&#8217;m building this thing myself since I&#8217;m doing it for no money. I&#8217;m going to bootstrap it, which is startup-speak for actually making money like a real business. At some point if it makes sense to let somebody give me money, I&#8217;ll consider it of course. <strong>&#8220;A foolish consistency is the hobgoblin of little minds,&#8221;</strong> and all that. Money isn&#8217;t evil, it&#8217;s a tool. </p>
<p>I think it&#8217;s a shame we&#8217;ve lost some of the &#8220;2 people in a garage&#8221; excitement from the early 2000s. Yeah, there&#8217;s a lot to making a modern website. So what? That&#8217;s part of being a programmer, learning new stuff. That&#8217;s part of why I call this thing an experiment, if it was a business I wouldn&#8217;t be able to play around as much. I&#8217;m learning about Heroku instead of using a server which is something I already know how to do. I&#8217;m using Grails and Groovy instead of Java which I already know. I&#8217;m using Mongodb instead of Mysql which, you guessed it, I already know. Even stuff like wildcard ssl certificates is new to me since they didn&#8217;t used to have those when I was an admin. Is some of this new stuff going to bite me in the ass since I don&#8217;t know it? Probably. But I&#8217;ll do what I&#8217;ve always done which is learn on the job. And in the end I&#8217;ll have built something cool, learned a ton of new stuff, and had fun. And maybe made some money.</p>
<p>We&#8217;ll see where this thing goes. More later.</p>
]]></content:encoded>
			<wfw:commentRss>http://mattorama.net/blog/index.php/2012/04/16/starting-an-experiment-startup/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>My Minecraft Home Base Tour Video</title>
		<link>http://mattorama.net/blog/index.php/2011/12/24/my-minecraft-home-base-tour-video/</link>
		<comments>http://mattorama.net/blog/index.php/2011/12/24/my-minecraft-home-base-tour-video/#comments</comments>
		<pubDate>Sat, 24 Dec 2011 17:32:49 +0000</pubDate>
		<dc:creator>matt</dc:creator>
				<category><![CDATA[Code]]></category>

		<guid isPermaLink="false">http://mattorama.net/blog/?p=1081</guid>
		<description><![CDATA[My Minecraft Home Base This is the first of hopefully many videos I&#8217;m going to make about my adventures in the land of Minecraft. I hope you enjoy, it&#8217;s my first time making any videos like this.]]></description>
			<content:encoded><![CDATA[<p><iframe width="560" height="315" src="http://www.youtube.com/embed/Weywu7mqpWE" frameborder="0" allowfullscreen></iframe></p>
<p><a href="http://www.youtube.com/watch?v=Weywu7mqpWE">My Minecraft Home Base</a></p>
<p>This is the first of hopefully many videos I&#8217;m going to make about my adventures in the land of Minecraft. I hope you enjoy, it&#8217;s my first time making any videos like this.</p>
]]></content:encoded>
			<wfw:commentRss>http://mattorama.net/blog/index.php/2011/12/24/my-minecraft-home-base-tour-video/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Job Title</title>
		<link>http://mattorama.net/blog/index.php/2011/03/29/job-title/</link>
		<comments>http://mattorama.net/blog/index.php/2011/03/29/job-title/#comments</comments>
		<pubDate>Tue, 29 Mar 2011 16:51:34 +0000</pubDate>
		<dc:creator>matt</dc:creator>
				<category><![CDATA[Code]]></category>

		<guid isPermaLink="false">http://mattorama.net/blog/?p=1072</guid>
		<description><![CDATA[&#160; &#160; hehe]]></description>
			<content:encoded><![CDATA[<p><a href="http://1.bp.blogspot.com/-YhwtjjSfRf4/TZBOYuLTNVI/AAAAAAAAAP0/0P7KUdJ1RBI/s1600/James.png">&nbsp;</p>
<p style="text-align: center;"><a href="http://1.bp.blogspot.com/-YhwtjjSfRf4/TZBOYuLTNVI/AAAAAAAAAP0/0P7KUdJ1RBI/s1600/James.png"><img src='http://mattorama.net/blog/wp-content/uploads/2011/03/James.png' alt='Job Title' /></a></p>
<p>&nbsp;</p>
<p></a></p>
<p>hehe</p>
]]></content:encoded>
			<wfw:commentRss>http://mattorama.net/blog/index.php/2011/03/29/job-title/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>File uploads with CXF Multipart form posts</title>
		<link>http://mattorama.net/blog/index.php/2011/02/19/file-uploads-with-cxf-multipart-form-posts/</link>
		<comments>http://mattorama.net/blog/index.php/2011/02/19/file-uploads-with-cxf-multipart-form-posts/#comments</comments>
		<pubDate>Sun, 20 Feb 2011 05:10:32 +0000</pubDate>
		<dc:creator>matt</dc:creator>
				<category><![CDATA[Code]]></category>

		<guid isPermaLink="false">http://mattorama.net/blog/?p=1056</guid>
		<description><![CDATA[Now that the title of this post has scared off all non-technical readers of my blog (sorry Mom! :)) I wanted to come back to hopefully regular posting with a bang. I&#8217;ve been working a side project that involves a REST web service. I needed to upload a file along with some identifying data and [...]]]></description>
			<content:encoded><![CDATA[<p>Now that the title of this post has scared off all non-technical readers of my blog (sorry Mom! :)) I wanted to come back to hopefully regular posting with a bang.</p>
<p>I&#8217;ve been working a side project that involves a REST web service. I needed to upload a file along with some identifying data and for the life of me I couldn&#8217;t figure it out. I could get files to upload with a PUT or send the data with a POST, but couldn&#8217;t do both in one call. I finally got it and I want to keep it here since finding full examples for CXF stuff isn&#8217;t easy.</p>
<p>First, here&#8217;s the interface for the method:</p>

<div class="wp_syntax"><div class="code"><pre class="java" style="font-family:monospace;">@POST
@Path<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;/stuff&quot;</span><span style="color: #009900;">&#41;</span>
@Produces<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;application/json&quot;</span><span style="color: #009900;">&#41;</span>
@Consumes<span style="color: #009900;">&#40;</span>MediaType.<span style="color: #006633;">MULTIPART_FORM_DATA</span><span style="color: #009900;">&#41;</span>
<span style="color: #000000; font-weight: bold;">public</span> <span style="color: #003399;">String</span> doStuff<span style="color: #009900;">&#40;</span>@Multipart<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;id&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #003399;">Integer</span> id, @Multipart<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;data&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #003399;">String</span> foo, @Multipart<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;image&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #000066; font-weight: bold;">byte</span><span style="color: #009900;">&#91;</span><span style="color: #009900;">&#93;</span> image<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div>

<p>The @Consumes annotation with the @Multipart annotations on the parameters is the vital bit. These allows you to just grab the parameters in the implementation and not mess around with getting the Multipart Attachments and all that.</p>

<div class="wp_syntax"><div class="code"><pre class="java" style="font-family:monospace;">@Override
<span style="color: #000000; font-weight: bold;">public</span> <span style="color: #003399;">String</span> doStuff<span style="color: #009900;">&#40;</span><span style="color: #003399;">Integer</span> id, <span style="color: #003399;">String</span> foo, <span style="color: #000066; font-weight: bold;">byte</span><span style="color: #009900;">&#91;</span><span style="color: #009900;">&#93;</span> image<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
<span style="color: #009900;">&#125;</span></pre></div></div>

<p>I&#8217;m sending the file with Android, using the <a href="http://hc.apache.org/">HttpClient</a> api.</p>

<div class="wp_syntax"><div class="code"><pre class="java" style="font-family:monospace;">HttpPost request <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> HttpPost<span style="color: #009900;">&#40;</span>url<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
MultipartEntity mentity <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> MultipartEntity<span style="color: #009900;">&#40;</span>HttpMultipartMode.<span style="color: #006633;">BROWSER_COMPATIBLE</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
ByteArrayBody imgBody <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> ByteArrayBody<span style="color: #009900;">&#40;</span>imageBytes, <span style="color: #0000ff;">&quot;image/jpeg&quot;</span>, <span style="color: #0000ff;">&quot;image&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
mentity.<span style="color: #006633;">addPart</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;image&quot;</span>, imgBody<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #666666; font-style: italic;">//add headers</span>
<span style="color: #000000; font-weight: bold;">for</span><span style="color: #009900;">&#40;</span><span style="color: #003399;">NameValuePair</span> h <span style="color: #339933;">:</span> headers<span style="color: #009900;">&#41;</span>
<span style="color: #009900;">&#123;</span>
    request.<span style="color: #006633;">addHeader</span><span style="color: #009900;">&#40;</span>h.<span style="color: #006633;">getName</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>, h.<span style="color: #006633;">getValue</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span>
&nbsp;
<span style="color: #000000; font-weight: bold;">for</span><span style="color: #009900;">&#40;</span><span style="color: #003399;">NameValuePair</span> p <span style="color: #339933;">:</span> params<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
    mentity.<span style="color: #006633;">addPart</span><span style="color: #009900;">&#40;</span>p.<span style="color: #006633;">getName</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>, <span style="color: #000000; font-weight: bold;">new</span> StringBody<span style="color: #009900;">&#40;</span>p.<span style="color: #006633;">getValue</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>, <span style="color: #0000ff;">&quot;text/plain&quot;</span>, Charset.<span style="color: #006633;">forName</span><span style="color: #009900;">&#40;</span> <span style="color: #0000ff;">&quot;UTF-8&quot;</span> <span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span>
&nbsp;
request.<span style="color: #006633;">setEntity</span><span style="color: #009900;">&#40;</span>mentity<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
executeRequest<span style="color: #009900;">&#40;</span>request, url<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div>

<p>This is nice and simple, and it works fine for me. Hopefully this will be helpful to you too if you&#8217;re like me and Google this issue a hundred times. :)</p>
]]></content:encoded>
			<wfw:commentRss>http://mattorama.net/blog/index.php/2011/02/19/file-uploads-with-cxf-multipart-form-posts/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>How I Got My New Job</title>
		<link>http://mattorama.net/blog/index.php/2010/10/10/how-i-got-my-new-job/</link>
		<comments>http://mattorama.net/blog/index.php/2010/10/10/how-i-got-my-new-job/#comments</comments>
		<pubDate>Sun, 10 Oct 2010 16:19:53 +0000</pubDate>
		<dc:creator>matt</dc:creator>
				<category><![CDATA[Code]]></category>

		<guid isPermaLink="false">http://mattorama.net/blog/?p=1048</guid>
		<description><![CDATA[As the title of this post suggests, I&#8217;ve landed myself a new job. If I may say: whoohoo! The road to this job has been the hardest I&#8217;ve ever gone on and I wanted to lay it out because it&#8217;s not just the typical &#8220;Who you know&#8221; story like some of my other jobs have [...]]]></description>
			<content:encoded><![CDATA[<p>As the title of this post suggests, I&#8217;ve landed myself a new job. If I may say: whoohoo! The road to this job has been the hardest I&#8217;ve ever gone on and I wanted to lay it out because it&#8217;s not just the typical &#8220;Who you know&#8221; story like some of my other jobs have been.</p>
<p>When I finally decided to look for another job, I aimed high. My brother-in-law put my resume in for Google, even though without a degree I figured I&#8217;d never get in there. I did it mostly for the interviewing experience, which is a very good thing to do. Interviews (phone or in-person) are tough and the more experience you have, the more relaxed you&#8217;ll be. I put my resume in to LinkedIn, Yahoo, Netflix, Zynga, Salesforce; a bunch of places I knew had strong engineering groups where they use Java and where I would learn a lot. <strong>Not having a degree hurt more than I thought it would.</strong> I thought in 2010 we were past everybody having to have a degree but I didn&#8217;t even get a call back from a lot of places, even with a number of years of experience. I ended up having phone interviews with a couple of places and moved on to 2nd level interviews with 1 or 2 I think.</p>
<p>My main problem I think was lack of breadth of experience. I have 10+ years programming, mostly in Perl. I&#8217;ve spent the last 3 or 4 years doing Java but at an insurance company doing internal applications and integration work. Most of it is various flavors of &#8220;Take data from System X or File Y, put the data in System A or write it to File B&#8221;. It&#8217;s been fun and I&#8217;ve certainly learned a lot, but not about a ton of different things. A lot of people wanted specific experience with Spring or Hibernate or whatnot and learning on the job doesn&#8217;t really fit the bill. Learning on the job is mostly how I&#8217;ve learned and while I think I&#8217;ve been very successful doing that, it does leave gaps in your knowledge where you haven&#8217;t had to use some specific technology and it does take time. I set out to fill in the gaps as much as I could, going through videos on algorithms from ArsDigita University (highly recommended) to reading more books. But in the end, I knew I just wasn&#8217;t up to the Senior level most companies seem to be looking for. That&#8217;s another question I had, how can companies only hire senior people? Don&#8217;t most places need or want people at the middle level? People who can get the job done but just don&#8217;t have the experience aren&#8217;t given much opportunity at big tech companies it seems.</p>
<p>During the early stages of my search, I had applied to a company in San Diego called Awarepoint who were doing very cool things with wireless networks and Java. I grew up in San Diego so this seemed perfect. When I actually got my resume together for them, the position was closed. I was disappointed for sure. A few months went by and I looked through a Who&#8217;s Hiring? post on <a href="http://news.ycombinator.com/">Hacker News</a> where people just posted positions they were looking to fill. I searched for Java and lo-and-behold there was a post by Awarepoint! I was prepared this time and sent my resume immediately. The poster was a member of the engineering team. We talked on the phone and he set me up with more phone interviews with various people. A little while later, they actually flew me out to San Diego for a day of in-person interviews. This would be a pretty big move so I interviewed them as much as they did me. I got a really great feeling from the team and pretty much knew this would be a great fit for me. They were looking for a mid-level person and with my limited experience, I know I&#8217;m a strong mid-level guy at this point. Being honest with myself about that really helped me understand that I wasn&#8217;t going to get some of those Senior positions and take some of the sting out of those rejections.</p>
<p>I knew I wanted to work there and I got the feeling they wanted me to come on board. I got very excited about the possibility of moving back to San Diego and working for this great company. For various reasons, my position in limbo where they kept saying they wanted to hire me but couldn&#8217;t actually make it happen lasted awhile. I knew I&#8217;d be moving if they made an offer but couldn&#8217;t tell my current boss in case it didn&#8217;t go through. This was a pretty stressful time. I got further word from Awarepoint that they wouldn&#8217;t be able to give me a firm answer for maybe a couple of months. I felt strongly enough about them that I was fine with waiting. Plus I was supposed to be running a huge project at the current job and felt better about getting that going before leaving since I was given the chance.</p>
<p>In the end, they were able to make me an offer after a month or so and I accepted immediately. I&#8217;m incredibly excited to be able to join such a great company (they were just named #1 Best Place To Work in Healthcare) who is doing really cutting edge stuff. The product also makes a real difference in hospitals and could very easily save lives, literally.</p>
<p>So in the end, the road to this job included the Java Posse Roundup where I first started thinking about a new job, the <a href="http://news.ycombinator.com/">Hacker News</a> community, this blog, and my writing on <a href="http://agilesoftwaredevelopment.com/blog/mattgrommes">AgileSoftwareDevelopment.com</a> (which I got because of this blog and Twitter).</p>
<p>I haven&#8217;t been writing here for awhile because the stuff I wanted to write about was my job hunting experiences but while I still had my old job I couldn&#8217;t exactly do that. Now that I&#8217;m moving on, I&#8217;ll be writing more.</p>
]]></content:encoded>
			<wfw:commentRss>http://mattorama.net/blog/index.php/2010/10/10/how-i-got-my-new-job/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Career Thinking</title>
		<link>http://mattorama.net/blog/index.php/2010/04/12/career-thinking/</link>
		<comments>http://mattorama.net/blog/index.php/2010/04/12/career-thinking/#comments</comments>
		<pubDate>Mon, 12 Apr 2010 17:21:33 +0000</pubDate>
		<dc:creator>matt</dc:creator>
				<category><![CDATA[Code]]></category>
		<category><![CDATA[Personal]]></category>
		<category><![CDATA[Work]]></category>

		<guid isPermaLink="false">http://mattorama.net/blog/?p=1040</guid>
		<description><![CDATA[Both of the Java Posse Roundups I&#8217;ve been to, I&#8217;ve made some fairly big decisions about my career. Now, I didn&#8217;t even really consider my career until fairly recently. I&#8217;d had some great jobs, a couple of not-so-great jobs, and I was finally working as a professional programmer. A couple of years ago though I [...]]]></description>
			<content:encoded><![CDATA[<p>Both of the Java Posse Roundups I&#8217;ve been to, I&#8217;ve made some fairly big decisions about my career. Now, I didn&#8217;t even really consider my career until fairly recently. I&#8217;d had some great jobs, a couple of not-so-great jobs, and I was finally working as a professional programmer. A couple of years ago though I started thinking about what I&#8217;d like to be doing as a programmer in the future, whether I&#8217;d want to be a manager at some point, all of that stuff. At the 2009 Roundup, I&#8217;d just been reading about managers and finally figuring out that all programmer managers aren&#8217;t just wastes of space with the help of some people who had been good managers or had good managers. I realized there that I shouldn&#8217;t just sit around and put up with the bad manager I had at the time, that it was time to move on and try to find a good manager who could actually help me grow. I got a couple of good job offers but for various reasons decided it would be worthwhile to stay put.</p>
<p>At the 2010 Roundup, I was once again faced with seeing people doing things with their career that I want to do. I want to be learning and growing as a programmer the way a lot of Roundup attendees are. I decided that once again I would reevaluate my job and try to figure out what the best thing would be. The difference is, <strong>this time I want to figure out what to do not to escape a bad situation but to go towards something good</strong>. I haven&#8217;t decided what to do yet but I have refocused my efforts toward learning and getting better rather than just sitting comfortably. </p>
<p>I&#8217;ve always learned on the job and I&#8217;ve found I&#8217;m very good at that. The problem with that kind of learning is it tends to leave gaps in your knowledge since you don&#8217;t learn as much that you don&#8217;t need right then. I&#8217;m rectifying that with a renewed course of study in the areas I feel I&#8217;m missing. I&#8217;m also focusing on the quality of the work I do and the code I write even more. I don&#8217;t work for a software company so I&#8217;m a little limited in the efforts I can put forth here but now that our boss has decided we&#8217;re to run our own projects I&#8217;m definitely pushing more quality into my work and I&#8217;m prouder than I&#8217;ve ever been with my code.</p>
<p>Like I say, I haven&#8217;t decided exactly what to do so this blog post doesn&#8217;t have some big conclusion. My new focus is a big deal to me though so I wanted to write it here and not forget. More to come!</p>
]]></content:encoded>
			<wfw:commentRss>http://mattorama.net/blog/index.php/2010/04/12/career-thinking/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Roundup Thoughts</title>
		<link>http://mattorama.net/blog/index.php/2010/04/09/roundup-thoughts/</link>
		<comments>http://mattorama.net/blog/index.php/2010/04/09/roundup-thoughts/#comments</comments>
		<pubDate>Fri, 09 Apr 2010 18:20:37 +0000</pubDate>
		<dc:creator>matt</dc:creator>
				<category><![CDATA[Code]]></category>
		<category><![CDATA[Geekery]]></category>
		<category><![CDATA[Personal]]></category>

		<guid isPermaLink="false">http://mattorama.net/blog/?p=1037</guid>
		<description><![CDATA[This is a roundup of my thoughts about the Roundup, the Java Posse Roundup 2010 that is. If you don&#8217;t know, the Roundup is the yearly conference put on by the guys who do the Java Posse podcast and tech writer/speaker Bruce Eckel. If you&#8217;re a Java person, you should be listening to their podcast, [...]]]></description>
			<content:encoded><![CDATA[<p>This is a roundup of my thoughts about the Roundup, the Java Posse Roundup 2010 that is. If you don&#8217;t know, the Roundup is the yearly conference put on by the guys who do the <a href="http://javaposse.com/">Java Posse</a> podcast and tech writer/speaker Bruce Eckel. If you&#8217;re a Java person, you should be listening to their podcast, no question. The conference is an unconference/open space conference/camp/etc. where it&#8217;s not about getting lectured to or watching slides but discussing topics with a group. There&#8217;s no speaker, just a bunch of smart people talking. This was my second Roundup and I very much hope it won&#8217;t be my last.</p>
<p>One of the best parts of the Roundup is seeing people I met and made friends with in person again. We drove up on Sunday and Bruce had a get-together for early attendees at his house that ended up being mostly returning folks catching up. It was great to see people again, even though I felt like I hadn&#8217;t spent any time away from some people thanks to Twitter.</p>
<p>The next day was Day 0 of the Roundup, the language dojo day. I had left last year&#8217;s Roundup with a great feeling about JavaFX and had done a little coding in it since then so I went to the JavaFX day Dick Wall of the Posse proposed. We spent the day writing a JavaFX version of OmmWriter (called ZenWriterFX) and fighting with git/github. If we hadn&#8217;t had so much trouble with git, we would have made it a lot farther but even so we made good progress. I helped a little generally and ended up doing the little bit that played the background sound for the app. Dick has since moved the project to Bitbucket so we can use Mercurial and I&#8217;m going to be participating in further development for sure. I already have some cool ideas I want to try out and I really like JavaFX.</p>
<p>I&#8217;ll go into the individual sessions at some later point when I can go over my notes but overall, the sessions were great again this year. I learned a lot, as always, and actually had something to say in more than a few. I do find that I like the sessions where I don&#8217;t talk as much more though. :) The Roundup attendees are all super smart people and it&#8217;s great to get everybody&#8217;s perspective and uses of things.</p>
<p>One of the best parts of the Roundup is the Lightning Talks. These are 5 minute talks people give on any subject that interests them, technical or not. This year there were talks about car engines, shaving, donating bone marrow, open mapping technology, and much more. The talks are recorded and will be on YouTube at some point. <strong>I even gave a talk this year!</strong> I did a short demo of the note taking system I use in my notebooks. Despite some technical difficulties (turns out Ubuntu does not like to be plugged into a projector while it&#8217;s coming back from sleep mode), I think my talk went well. I was super nervous so I rushed and forgot a couple things but people seemed to like it. I&#8217;ll have the video here when it&#8217;s up.</p>
<p>The Roundup is a very unique experience. If you&#8217;re expecting a regular conference or want to just blend in with a crowd it&#8217;s not for you. We don&#8217;t do technical stuff all the time (though of course if you want to, it&#8217;s up to you) and this year I did much less programming than last year. I spent my afternoons snow-shoeing and shooting a shotgun, watching the movie Vertigo, shopping, watching an impromptu demo of Scala, and lots else. It&#8217;s kind of a Geek Summer Camp, but in the blowing snow of Crested Butte, Colorado.</p>
<p>Like I said, I love going to the Roundup and hope to do it every year. I have a bunch of new friends because of it, I learned a lot, made some decisions about my career, and recharged my batteries to better attack the year to come.</p>
]]></content:encoded>
			<wfw:commentRss>http://mattorama.net/blog/index.php/2010/04/09/roundup-thoughts/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>The hacker, the architect and the superhero</title>
		<link>http://mattorama.net/blog/index.php/2010/03/22/the-hacker-the-architect-and-the-superhero/</link>
		<comments>http://mattorama.net/blog/index.php/2010/03/22/the-hacker-the-architect-and-the-superhero/#comments</comments>
		<pubDate>Mon, 22 Mar 2010 21:16:46 +0000</pubDate>
		<dc:creator>matt</dc:creator>
				<category><![CDATA[Code]]></category>

		<guid isPermaLink="false">http://mattorama.net/blog/?p=1035</guid>
		<description><![CDATA[The hacker, the architect and the superhero: three completely different ways to be an excellent programmer « The Reinvigorated Programmer.]]></description>
			<content:encoded><![CDATA[<p><a href='http://reprog.wordpress.com/2010/03/21/the-hacker-the-architect-and-the-superhero-three-completely-different-ways-to-be-an-excellent-programmer/'>The hacker, the architect and the superhero: three completely different ways to be an excellent programmer « The Reinvigorated Programmer</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://mattorama.net/blog/index.php/2010/03/22/the-hacker-the-architect-and-the-superhero/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Text File parsing with Flatworm and Substring Hacks</title>
		<link>http://mattorama.net/blog/index.php/2010/02/23/text-file-parsing-with-flatworm-and-substr-hacks/</link>
		<comments>http://mattorama.net/blog/index.php/2010/02/23/text-file-parsing-with-flatworm-and-substr-hacks/#comments</comments>
		<pubDate>Tue, 23 Feb 2010 17:45:33 +0000</pubDate>
		<dc:creator>matt</dc:creator>
				<category><![CDATA[Code]]></category>

		<guid isPermaLink="false">http://mattorama.net/blog/?p=1015</guid>
		<description><![CDATA[I&#8217;m going to start posting more code here, finally. I don&#8217;t consider myself a rockstar programmer or anybody to be telling others how to program but when I do something I found interesting, hopefully it&#8217;ll also be interesting to others. I&#8217;m always looking for better ways of doing things so if you have suggestions, I&#8217;m [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;m going to start posting more code here, finally. I don&#8217;t consider myself a rockstar programmer or anybody to be telling others how to program but when I do something I found interesting, hopefully it&#8217;ll also be interesting to others. I&#8217;m always looking for better ways of doing things so if you have suggestions, I&#8217;m all ears.</p>
<p>Recently I was implementing a new project at work where I had to read and write a bunch of fixed-width files for communicating with a new vendor. My first thought was that I would have to use Java&#8217;s String.substring() method to pull out the individual fields. This is ugly because you end up with stuff like</p>

<div class="wp_syntax"><div class="code"><pre class="java" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">final</span> <span style="color: #003399;">String</span> FIELD1_START_POS <span style="color: #339933;">=</span> <span style="color: #cc66cc;">10</span><span style="color: #339933;">;</span>
<span style="color: #000000; font-weight: bold;">final</span> <span style="color: #003399;">String</span> FIELD1_END_POS <span style="color: #339933;">=</span> <span style="color: #cc66cc;">20</span><span style="color: #339933;">;</span></pre></div></div>

<p>When you have a few hundred fields, this is exceptionally ugly. Luckily for code and my sanity, <a href="http://stackoverflow.com/questions/1609807/whats-the-best-way-of-parsing-a-fixed-width-formatted-file-in-java">I asked how best to do this on StackOverflow</a> and was pointed to the great little library <a href="http://flatworm.sourceforge.net/">Flatworm</a>. Flatworm allows you to create an XML descriptor for the file you need to parse, then it reads it into a plain Java bean for you. It also takes care of parsing the data if needed, casting into the correct type, stripping unwanted characters, etc. Very, very useful indeed.</p>
<p><strong>Aside:</strong> Of course you could also use regular expressions to pull out the data but I don&#8217;t see where that would give any advantage. You still have to encode what the field looks like, where it starts, something of that nature. It just feels even more brittle to me. There&#8217;s also the more complete route of using lexers, parsers, etc. I don&#8217;t know enough about that process to see how that would be benefit me in this particular case. Maybe it would, I don&#8217;t know for sure. But from what I do know, it seems like overkill and not a big benefit.</p>
<p>Fast forward to now, I have another project where I need to read and write text files. &#8220;Ah ha!&#8221; I say. &#8220;I&#8217;ll use Flatworm again.&#8221; &#8220;Nope,&#8221; says the universe. Unfortunately the file I need to read runs into a limitation of Flatworm. The file has lines where the data starts on column 10, but then it&#8217;s a name that could be any length. Instead of padding out the line to the end of the file, the line ends after the name. Flatworm has no way of handling this. I considered hacking Flatworm to handle this condition (and I still might do this as I think it&#8217;s useful) but I wanted to try something else first. What I ended up with was better than my first example I think but not quite as cool as Flatworm.</p>
<p>Here&#8217;s a mockup of the file I&#8217;m working with for reference (. is a blank space)</p>
<pre>.....12345......................................02/01/2010.....$123.45.....
.....One hundred twenty-three and forty-five cents
..........Matt Grommes
..........98765..........1 Test St..............123.45</pre>
<p>Here&#8217;s the first version of the parser code I had</p>

<div class="wp_syntax"><div class="code"><pre class="java5" style="font-family:monospace;">check.<span style="color: #006633;">setCheckDate</span><span style="color: #009900;">&#40;</span> <span style="color: #000000; font-weight: bold;">new</span> <span style="color: #003399; font-weight: bold;">Date</span><span style="color: #009900;">&#40;</span>checkLines<span style="color: #009900;">&#91;</span><span style="color: #cc66cc;">0</span><span style="color: #009900;">&#93;</span>.<span style="color: #006633;">substring</span><span style="color: #009900;">&#40;</span><span style="color: #cc66cc;">91</span>, checkLines<span style="color: #009900;">&#91;</span><span style="color: #cc66cc;">0</span><span style="color: #009900;">&#93;</span>.<span style="color: #006633;">indexOf</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;$&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
check.<span style="color: #006633;">setCheckTotal</span><span style="color: #009900;">&#40;</span> checkLines<span style="color: #009900;">&#91;</span><span style="color: #cc66cc;">0</span><span style="color: #009900;">&#93;</span>.<span style="color: #006633;">substring</span><span style="color: #009900;">&#40;</span> checkLines<span style="color: #009900;">&#91;</span><span style="color: #cc66cc;">0</span><span style="color: #009900;">&#93;</span>.<span style="color: #006633;">indexOf</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;$&quot;</span><span style="color: #009900;">&#41;</span>+<span style="color: #cc66cc;">1</span>, checkLines<span style="color: #009900;">&#91;</span><span style="color: #cc66cc;">0</span><span style="color: #009900;">&#93;</span>.<span style="color: #006633;">length</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
check.<span style="color: #006633;">setAmountWords</span><span style="color: #009900;">&#40;</span> checkLines<span style="color: #009900;">&#91;</span><span style="color: #cc66cc;">1</span><span style="color: #009900;">&#93;</span>.<span style="color: #006633;">substring</span><span style="color: #009900;">&#40;</span><span style="color: #cc66cc;">10</span>, checkLines<span style="color: #009900;">&#91;</span><span style="color: #cc66cc;">1</span><span style="color: #009900;">&#93;</span>.<span style="color: #006633;">length</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
check.<span style="color: #006633;">setPayee</span><span style="color: #009900;">&#40;</span> checkLines<span style="color: #009900;">&#91;</span><span style="color: #cc66cc;">3</span><span style="color: #009900;">&#93;</span>.<span style="color: #006633;">substring</span><span style="color: #009900;">&#40;</span> <span style="color: #cc66cc;">10</span>, checkLines<span style="color: #009900;">&#91;</span><span style="color: #cc66cc;">3</span><span style="color: #009900;">&#93;</span>.<span style="color: #006633;">length</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div>

<p>This isn&#8217;t optimal because there is a ton of duplicated code, plus there are problems with the same lines that tripped up Flatworm. I ended up making a new function called getLineValue()</p>

<div class="wp_syntax"><div class="code"><pre class="java5" style="font-family:monospace;">    <span style="color: #000000; font-weight: bold;">private</span> <span style="color: #000000; font-weight: bold;">static</span> <span style="color: #003399; font-weight: bold;">String</span> getLineValue<span style="color: #009900;">&#40;</span><span style="color: #003399; font-weight: bold;">String</span> line, <span style="color: #006600; font-weight: bold;">int</span> beginIndex, <span style="color: #006600; font-weight: bold;">int</span> endIndex<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
&nbsp;
        <span style="color: #003399; font-weight: bold;">String</span> value = <span style="color: #0000ff;">&quot;&quot;</span><span style="color: #339933;">;</span>
&nbsp;
        <span style="color: #666666; font-style: italic;">// endIndex 0 is just a shortcut to EndOfLine</span>
        <span style="color: #000000;  font-weight: bold;">if</span><span style="color: #009900;">&#40;</span>endIndex == <span style="color: #cc66cc;">0</span><span style="color: #009900;">&#41;</span>
            endIndex = line.<span style="color: #006633;">length</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
        <span style="color: #000000;  font-weight: bold;">if</span><span style="color: #009900;">&#40;</span>line.<span style="color: #006633;">length</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">!</span>= <span style="color: #cc66cc;">0</span> <span style="color: #339933;">&amp;</span>amp<span style="color: #339933;">;&amp;</span>amp<span style="color: #339933;">;</span> line.<span style="color: #006633;">length</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">&amp;</span>gt<span style="color: #339933;">;</span>= endIndex<span style="color: #009900;">&#41;</span>
            value = line.<span style="color: #006633;">substring</span><span style="color: #009900;">&#40;</span>beginIndex, endIndex<span style="color: #009900;">&#41;</span>.<span style="color: #006633;">trim</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
        <span style="color: #000000; font-weight: bold;">return</span> value<span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span></pre></div></div>

<p>This is of course just a wrapper around String.substring() but it lets me do some extra checks and have extra logic like using 0 for endIndex to indicate &#8220;go to end of line&#8221;.</p>
<p>Here&#8217;s the modified version, using the new function.</p>

<div class="wp_syntax"><div class="code"><pre class="java5" style="font-family:monospace;">check.<span style="color: #006633;">setCheckDate</span><span style="color: #009900;">&#40;</span> <span style="color: #000000; font-weight: bold;">new</span> <span style="color: #003399; font-weight: bold;">Date</span><span style="color: #009900;">&#40;</span>getLineValue<span style="color: #009900;">&#40;</span>checkLines<span style="color: #009900;">&#91;</span><span style="color: #cc66cc;">0</span><span style="color: #009900;">&#93;</span>, <span style="color: #cc66cc;">91</span>, checkLines<span style="color: #009900;">&#91;</span><span style="color: #cc66cc;">0</span><span style="color: #009900;">&#93;</span>.<span style="color: #006633;">indexOf</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;$&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
check.<span style="color: #006633;">setCheckTotal</span><span style="color: #009900;">&#40;</span> getLineValue<span style="color: #009900;">&#40;</span>checkLines<span style="color: #009900;">&#91;</span><span style="color: #cc66cc;">0</span><span style="color: #009900;">&#93;</span>, checkLines<span style="color: #009900;">&#91;</span><span style="color: #cc66cc;">0</span><span style="color: #009900;">&#93;</span>.<span style="color: #006633;">indexOf</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;$&quot;</span><span style="color: #009900;">&#41;</span>+<span style="color: #cc66cc;">1</span>, <span style="color: #cc66cc;">0</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
check.<span style="color: #006633;">setAmountWords</span><span style="color: #009900;">&#40;</span> getLineValue<span style="color: #009900;">&#40;</span>checkLines<span style="color: #009900;">&#91;</span><span style="color: #cc66cc;">1</span><span style="color: #009900;">&#93;</span>, <span style="color: #cc66cc;">10</span>, <span style="color: #cc66cc;">0</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
check.<span style="color: #006633;">setPayee</span><span style="color: #009900;">&#40;</span> getLineValue<span style="color: #009900;">&#40;</span>checkLines<span style="color: #009900;">&#91;</span><span style="color: #cc66cc;">3</span><span style="color: #009900;">&#93;</span>, <span style="color: #cc66cc;">10</span>, <span style="color: #cc66cc;">0</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div>

<p>This is a lot better to my eye, not as much extra code cluttering things up. It&#8217;s a lot clearer what I&#8217;m doing since you don&#8217;t have to pay attention to a bunch of substring() and length() calls. This is only about 1/5 of the total lines of parsing code so hopefully you can see how much better this looks over the course of the whole method. See the <strong>Aside</strong> above for thoughts on some other ways of doing this.</p>
<p>This wasn&#8217;t a big project and there may be better ways of going about it but I was pretty happy how this ended up. I like seeing less code so when there are ways of cutting extra things out, it&#8217;s a win.</p>
<p>Thanks to the couple of redditors that made comments about this post. I&#8217;m always looking to get better at this so constructive criticism is welcome.</p>
]]></content:encoded>
			<wfw:commentRss>http://mattorama.net/blog/index.php/2010/02/23/text-file-parsing-with-flatworm-and-substr-hacks/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Frequently Forgotten Fundamental Facts about Software Engineering</title>
		<link>http://mattorama.net/blog/index.php/2009/12/03/frequently-forgotten-fundamental-facts-about-software-engineering/</link>
		<comments>http://mattorama.net/blog/index.php/2009/12/03/frequently-forgotten-fundamental-facts-about-software-engineering/#comments</comments>
		<pubDate>Thu, 03 Dec 2009 20:10:37 +0000</pubDate>
		<dc:creator>matt</dc:creator>
				<category><![CDATA[Code]]></category>

		<guid isPermaLink="false">http://mattorama.net/blog/?p=991</guid>
		<description><![CDATA[Here are the most frequently forgotten fundamental facts about software engineering. Some are of vital importance—we forget them at considerable risk. via Frequently Forgotten Fundamental Facts about Software Engineering. Very interesting list of easily forgotten ideas. I hesitate to outright call them &#8220;facts&#8221; since there&#8217;s so little real research in programming (and even the author [...]]]></description>
			<content:encoded><![CDATA[<blockquote><p>Here are the most frequently forgotten fundamental facts about software engineering. Some are of vital importance—we forget them at considerable risk.</p></blockquote>
<p>via <a href="http://www.computer.org/portal/web/buildyourcareer/fa035?utm_source=bronto&amp;utm_medium=email&amp;utm_term=Forgotten+Facts+About+Software+Engineering&amp;utm_content=andrew%40badera.us&amp;utm_campaign=BYC-Issue+38-December+3">Frequently Forgotten Fundamental Facts about Software Engineering</a>.</p>
<p>Very interesting list of easily forgotten ideas. I hesitate to outright call them &#8220;facts&#8221; since there&#8217;s so little real research in programming (and even the author says they might be figments of his imagination. One of the most annoying things about the computer field is how much we reinvent things and forget old lessons so lists like this and discussions on the topics are always valuable if they keep things from being forgotten.</p>
]]></content:encoded>
			<wfw:commentRss>http://mattorama.net/blog/index.php/2009/12/03/frequently-forgotten-fundamental-facts-about-software-engineering/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
	</channel>
</rss>

