<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
     xmlns:content="http://purl.org/rss/1.0/modules/content/"
     xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
     xmlns:atom="http://www.w3.org/2005/Atom"
     xmlns:dc="http://purl.org/dc/elements/1.1/"
     xmlns:wfw="http://wellformedweb.org/CommentAPI/"
     >
  <channel>
    <title>Piece Of Py(thon)</title>
    <link>http://pieceofpy.com</link>
    <description>A static blog engine/compiler</description>
    <pubDate>Fri, 13 Jan 2012 15:29:42 GMT</pubDate>
    <generator>Blogofile</generator>
    <sy:updatePeriod>hourly</sy:updatePeriod>
    <sy:updateFrequency>1</sy:updateFrequency>
    <item>
      <title>Migrating to Blogofile</title>
      <link>http://pieceofpy.com/2010/12/16/migrating-to-blogofile/</link>
      <pubDate>Thu, 16 Dec 2010 15:23:02 EST</pubDate>
      <category><![CDATA[personal]]></category>
      <guid>http://pieceofpy.com/?p=375</guid>
      <description>Migrating to Blogofile</description>
      <content:encoded><![CDATA[
Because I am a lemming and everyone else is doing it, I too am going to migrate to blogofile! Then I'll blog about doing it!]]></content:encoded>
    </item>
    <item>
      <title>Moving by blog back!</title>
      <link>http://pieceofpy.com/2010/12/16/moving-by-blog-back/</link>
      <pubDate>Thu, 16 Dec 2010 15:22:24 EST</pubDate>
      <category><![CDATA[personal]]></category>
      <category><![CDATA[updates]]></category>
      <guid>http://pieceofpy.com/?p=373</guid>
      <description>Moving by blog back!</description>
      <content:encoded><![CDATA[
ok, combining personal blog and tech blog was a bad idea. I didn't realize there were some many people following each that were completely uninsterested in the other one. So after some thought, I will be bring back all my Tech posting to <a href="http://pieceofpy.com">pieceofpy.com</a>

My personal stuff will now be on <a href="http://riotousliving.com">Riotous Living</a>! which is a much better platform for all the crazy stuff I do that isn't tech related.

Thanks for putting up with all my shifting and moving around!]]></content:encoded>
    </item>
    <item>
      <title>What I Look For In A Job</title>
      <link>http://pieceofpy.com/2010/01/20/what-i-look-for-in-a-job/</link>
      <pubDate>Wed, 20 Jan 2010 05:13:55 EST</pubDate>
      <category><![CDATA[personal]]></category>
      <guid>http://pieceofpy.com/?p=322</guid>
      <description>What I Look For In A Job</description>
      <content:encoded><![CDATA[
So I'm currently looking for new work and I've defined my list of items that are high priority to me. I figured I'd list them here and then break each down in to a little detail. Mainly because I'm up late at a stopping point in some code and haven't updated my blog in forever.
<ul>
	<li>Refreshing</li>
	<li>Excitement</li>
	<li>Vision</li>
	<li>Caring</li>
</ul>
<strong>Refreshing</strong>

What do I mean by refreshing? I mean a company that isn't doing what everyone else. Something that isn't YAIC (Yet Another Internet Company). For me, this can really mean two things though. It could also mean a company that produces software for an industry I've never worked in before, but ideally it is a company doing something new, innovative, and refreshing. At the end of the day, writing software for them makes you go "Ahhhhhhhhhh".

<strong>Excitement</strong>

I want everyone in the company I am working for to be jacked about working there. I want people to be excited about the products. Even if they are boring everyday products. If everyone there is excited about them and cares about them it promotes a much better work environment and in my experience a higher quality product.

<strong>Vision</strong>

Here's where we are. Here's where we are going. Here is how WE are gonna do it. This seems as one of those things that is so easily over looked once you're out of lets keep this startup from dying working 100 hours a week mode, but even for established companies this is so important. Without a vision your company will eventually end up stuck in the mud.

<strong>Caring</strong>

This is more in the human respect. We are sometimes at work more than we are at home. This is especially the case with small companies and start-ups (and even some big ones). Companies that care, have employees that care. Treating employees like cattle will only result in employees treating the company like a feed station. Every place I've worked that did mandatory start / end times or mandatory OT always had issues getting coverage and had huge turn over rates compared to flex time locations with resources for employees to relax, take breaks, and feel cared about.
]]></content:encoded>
    </item>
    <item>
      <title>I Need a New Theme</title>
      <link>http://pieceofpy.com/2009/04/09/i-need-a-new-theme/</link>
      <pubDate>Thu, 09 Apr 2009 14:17:34 EDT</pubDate>
      <category><![CDATA[personal]]></category>
      <guid>http://pieceofpy.com/index.php/2009/04/09/i-need-a-new-theme/</guid>
      <description>I Need a New Theme</description>
      <content:encoded><![CDATA[
I want a new theme for my blog. This site runs Wordpress 2.7. So please link your recommendations in the comments. I'd like something simple and clean but a little more pleasing to the eye than this current theme.

I've been flipping through the different ones on the Wordpress site, but there is so many and I have no zero skills when it comes to what looks good and what doesn't; I like Christmas colors if that tells you anything.]]></content:encoded>
    </item>
    <item>
      <title>Jython 2.5 and snakefight for deploying Pylons w/ SQLAlchemy + Oracle.</title>
      <link>http://pieceofpy.com/2009/03/13/jython-25-and-snakefight-for-deploying-pylons-w-sqlalchemy-oracle/</link>
      <pubDate>Fri, 13 Mar 2009 17:42:34 EDT</pubDate>
      <category><![CDATA[test driven]]></category>
      <category><![CDATA[Jython]]></category>
      <category><![CDATA[sqlalchemy]]></category>
      <category><![CDATA[pylons]]></category>
      <category><![CDATA[python]]></category>
      <category><![CDATA[personal]]></category>
      <guid>http://pieceofpy.com/?p=254</guid>
      <description>Jython 2.5 and snakefight for deploying Pylons w/ SQLAlchemy + Oracle.</description>
      <content:encoded><![CDATA[
<strong>UPDATE / 13 March 2009: </strong><a href="http://pypi.python.org/pypi/snakefight">snakefight 0.3</a> now has a --include-jar option, prefer that to using my hack.

After reading <a href="http://dunderboss.blogspot.com/2009/03/deploying-pylons-apps-to-java-servlet.html">P. Jenvey's blog post about Deploying Pylons Apps to Java Servlet Containers</a> I immediately downloaded the Jython 2.5 beta and installed snakefight to give it a try. One of our services where I work is a Pylons based application. It is deployed using paster and Apache ProxyPass. Our main application is written in Java and is deployed as a war under Jetty. So if I can get my Pylons application built as a war and deployed that way, it would greatly simplify our deployment process.

[sourcecode language="bash"]
$ sudo /opt/jython25/bin/easy_install snakefight
$ /opt/jython25/bin/jython setup.py develop
$ /opt/jython25/bin/jython setup.py bdist_war --paster-config dev_r2.ini
... output of success and stuff ...
$ cp dist/project-0.6.8dev.war /opt/jetty/webapps
[/sourcecode]

Now I visit my local server and hit the project context. I get some database errors, kind of expected them. So for the time being, I'll be running this directly using Jython to speed up the debugging process. A quick googling of my DB issues turns up <a href="http://pylonshq.com/pasties/77c3184b14d6936d86d13e4e65df92d2">zxoracle for SQLalchemy</a> which uses Jython zxJDBC. I install that in to sqlalchemy/databases as zxoracle.py and give it another go. Changing the oracle:// lines in my .ini file to now read zxoracle:// Now it can't find the 3rd party Oracle libraries (ojdbc.jar).

[sourcecode]
$ cd ./dist
$ jar xf project-0.6.8dev.war
$ cd WEB-INF/lib
$ ls
# no ojdbc.jar as expected ...
$ cd ~/project
$ export CLASSPATH=/opt/jython25/jython.jar:/usr/lib/jvm/java/jre/lib/ext/ojdbc.jar
$ /opt/jython25/bin/jython /opt/jython25/bin/paster serve --reload dev_r2.ini
[/sourcecode]

Now it is looking a little better and it able to find the jar, but still a DB issue, now with SQLalchemy library. Not having a ton of time to investigate, I decide to try rolling back my SQAlachemy version for Jython. Turns out rolling back to 0.5.0 fixed the issue. I'll be investigating why it was breaking with 0.5.2 soon (tm). So now I rerun it, and get a new error.

[sourcecode lang="bash"]
AttributeError: 'ZXOracleDialect' object has no attribute 'optimize_limits'
[/sourcecode]

I decide I am just going to go in to the <a href="http://trac.pieceofpy.com/pieceofpy/browser/snakefight-java-libs">zxoracle.py and add optimize_limits = False to the ZXOracleDialect</a>. No idea what this breaks or harms, but I do it anyway and rerun the application. Success! Every thing is working now. No liking the idea of having to manually insert the Oracle jar in to the WEB-INF/lib and not really wanting to much around with environment variables, I also implemented a quick and dirty include-java-libs for snakefight, the diff for command.py is below. This allows me to pass in a : separated list of jars to include in the WEB-INF/lib. <strong>EDIT: </strong>The diff I posted isn't needed since I put it on my hg repo. <a href="http://trac.pieceofpy.com/pieceofpy/browser/snakefight-java-libs">You can grab it from here.</a>

So now I am back to building my war. Just as before.
[sourcecode lang="bash"]
$ /opt/jython25/bin/jython setup.py bdist_war --paste-config dev_r2.ini --include-java-libs /opt/jython25/extlibs/ojdbc.jar
running bdist_war
creating build/bdist.java1.6.0_12
creating build/bdist.java1.6.0_12/war
creating build/bdist.java1.6.0_12/war/WEB-INF
creating build/bdist.java1.6.0_12/war/WEB-INF/lib-python
running easy_install project
adding eggs (to WEB-INF/lib-python)
adding jars (to WEB-INF/lib)
adding WEB-INF/lib/jython.jar
adding Paste ini file (to dev_r2.ini)
adding Paste app loader (to WEB-INF/lib-python/____loadapp.py)
generating deployment descriptor
adding deployment descriptor (WEB-INF/web.xml)
created dist/project-0.6.8dev-py2.5.war
$ cp dist/project-0.6.8dev-py2.5.war /opt/jetty/webapps
$ sudo /sbin/service jetty restart
[/sourcecode]

And presto! I am in business. My pylons application is deployed under Jetty and all the <a href="http://seleniumhq.org/">selenium functional tests</a> are passing. I am sure there is probably a easier, neater, or cleaner way to do all this, but this was my first iteration through and also my first time ever deploying a WAR to a java servlet container so all in all I am happy with the results. Performance seems about the same as when running the application with paster serve, but Jetty does use a little more memory than before (expected I guess).]]></content:encoded>
    </item>
    <item>
      <title>I didn't want those changes anyway.</title>
      <link>http://pieceofpy.com/2009/03/12/i-didnt-want-those-changes-anyway/</link>
      <pubDate>Thu, 12 Mar 2009 14:48:21 EDT</pubDate>
      <category><![CDATA[personal]]></category>
      <category><![CDATA[sourcecontrol]]></category>
      <category><![CDATA[deploy]]></category>
      <guid>http://pieceofpy.com/?p=238</guid>
      <description>I didn't want those changes anyway.</description>
      <content:encoded><![CDATA[
I use hg (<a href="http://www.selenic.com/mercurial/wiki/">Mercurial</a>) for version control. Since switching to hg I have adopted the following process. I also do this for my Git projects at work.
<ul><li>I create a local branch to working.</li>
	<li>I setup my External Tools in Eclipse to run my test suite.</li>
	<li>The output of my test suite gets committed to my local branch.</li>
	<li>I squash the local branch messages when I merge in to master.</li>
	<li>I add some insightful commit message for my master commit. Like, I haz changes.</li>
</ul>
So yesterday, I roll up my sleeves and prepare to dive in to an older project that <a href="http://en.wikipedia.org/wiki/Code_smell">smells like rotten potatoes</a>. The plan of attack is to take this project and bring it up-to-date with Python 2.6, Pylons 0.9.7, and SQLalchemy 0.5.2 in the process of doing it, re-factor and extend where needed, of course letting the tests drive. I start my work and wand waving and 2-3 hours in I've removed about 200 lines of cruft and copy paste inheritance extended flexibility by further encapsulating some behavior using the Strategy pattern. I've got 47 tests (including functional doctests) passing and I'm green bar and happy with my time spent. So now time to merge this baby back in to master.

My test suite external tool performs the hg add . and I keep my .hgignore pretty up-to-date for Python projects, so I feel confident doing that. I open up the terminal to check out the change sets and start the merge and I notice I missed a binary format in my .hgignore. So I now have about 15 unwanted files staged for adding. Being lazy and knowing my last commit was when I just ran my test suite, I blindly run.

[sourcecode lang="bash"]
$ ^R hg revert <enter><enter> (Ctrl-R, hg revert - shell previous command search)
$ hg revert -a --no-backup
# ...my work being destroyed because I was lazy and not paying attention
# whimpering
[/sourcecode]

It is at this point my day goes from great to awful. I face palm as I watch the uncommitted changes I've been making over the last 3 hours get reverted. As I mentioned, this project was older, in fact, it was started before the migration to hg and I never updated the External Tools runnable for this project in Eclipse to do the new hg add / commits. So every time I thought I was committing when I was running the tests, I was in fact not. Fortunate for me, I did have some buffers open and was able to recover the end result in about 45 minutes of hacking, but I did lose all of my change history which was very very disappointing (not to mention scary).

So if I had any advice after this it would be ensure your older projects are up-to-date with how you do things now and they follow your current development process before you start refactoring. I guess the oneliner could be; When refactoring a project start with the tool set first.</enter></enter>]]></content:encoded>
    </item>
    <item>
      <title>Holidays and New Server</title>
      <link>http://pieceofpy.com/2008/12/28/holidays-and-new-server/</link>
      <pubDate>Sun, 28 Dec 2008 22:37:17 EST</pubDate>
      <category><![CDATA[project]]></category>
      <category><![CDATA[personal]]></category>
      <guid>http://pieceofpy.com/?p=222</guid>
      <description>Holidays and New Server</description>
      <content:encoded><![CDATA[
I've been a little behind on my posts what with the holidays here and me doing all sorts of traveling and migrating to the new server for pieceofpy.com I haven't really had time to make any new useful posts. So just taking the time to let everyone know I am not dead and wishing everyone happy holidays and a good winter.

Oh and the new server is lovely. The specs are below and so far I couldn't be happier.
<ul>
	<li>3.2GHz P4 Core Duo2</li>
	<li>2GB Memory</li>
	<li>36GB 15k SCSI (Mirrored)</li>
	<li>500GB monthly transfer</li>
</ul>]]></content:encoded>
    </item>
    <item>
      <title>Another try at a blog a day?</title>
      <link>http://pieceofpy.com/2008/12/03/another-try-at-a-blog-a-day/</link>
      <pubDate>Wed, 03 Dec 2008 20:21:15 EST</pubDate>
      <category><![CDATA[personal]]></category>
      <guid>http://pieceofpy.com/?p=213</guid>
      <description>Another try at a blog a day?</description>
      <content:encoded><![CDATA[
This month is a little calmer for me. No Iceland trip, no Thanksgiving trip, basically no nothing except work and side projects. So I figure I'll have another go at this blog a day thing, minus the 1st and 2nd of this month because I had food poisoning.

November I made it deep in to the first day before my blogging stopped. Hopefully December will be better for me.

Unrelated note, get the book <a href="http://www.amazon.com/American-Lion-Andrew-Jackson-White/dp/1400063256">American Lion</a>. Excellent book about Andrew Jackson.]]></content:encoded>
    </item>
    <item>
      <title>Exercise even a programmer can do.</title>
      <link>http://pieceofpy.com/2008/11/05/exercise-even-a-programmer-can-do/</link>
      <pubDate>Wed, 05 Nov 2008 16:51:32 EST</pubDate>
      <category><![CDATA[python]]></category>
      <category><![CDATA[personal]]></category>
      <guid>http://pieceofpy.com/?p=210</guid>
      <description>Exercise even a programmer can do.</description>
      <content:encoded><![CDATA[
So I've been exercising lately. The last visit to the Dr. was a wake up call. 300 lb .. WHAT?! So, taking an iterative approach to exercise, I've manged to work up to 6-day a week cardio routine and a 3-day a week strength training routine and have gone from just over 300 lb. to 270 lb. in a couple months. Couple friends asked how I started and what I do, so I figure I'd break it down here.

I started by walking. 3 times a week for a couple weeks. Then after reading a Lifehacker post about a morning routine and matabolism, I added my very fast morning routine and actually eating breakfast to my day. Made it a whole week Monday-Friday. Then I bumped up the walking to Monday through Saturday. Did the morning routine and the walking for another week, then I bumped up the walking to targeted cardio 3 out of the 6 days and did that for another week. Added strength training 1 out of the 6 days and did that for another week. Switched from walking to cardio on all 6 days and + 1 more week. Then strength training 3 days out of the week. And slowly over about 3 months, I built up to this routine.

<strong>Every morning</strong>
<i>I do this right after eating breakfast</i>
2 sets, push-ups, 30 sec OR failure
2 sets, scissor kicks, 1 minute OR failure

<strong>Monday through Saturday</strong>
2 minute warm up
20 minutes of cardio (140-160 heart rate, check with your Dr.)
2 minute cool down

<strong>Strength training</strong>
<i>This adds another 20 minutes to my workout, so schedule for that</i>
Monday - Push (chest, triceps)
Wednesday - Pull (bicep, shoulders)
Friday - Legs (legs and stomach)

Now, it is just habit. Also, I am sure there is some study somewhere to prove or disprove this, but I find it makes my mind much sharper. I am more alert through out the day and I sleep much better at night. Not to mention clothes fitting better and just feeling better. My personal goal is 250.

<strong>Python tip</strong>
Prefer xrange to range when you need an arbitrary number of iterations as range actually generates a list for you, this will consume memory and be more costly than xrange.
]]></content:encoded>
    </item>
    <item>
      <title>Voting and the land of ice and snow.</title>
      <link>http://pieceofpy.com/2008/11/04/voting-and-the-land-of-ice-and-snow/</link>
      <pubDate>Tue, 04 Nov 2008 20:20:13 EST</pubDate>
      <category><![CDATA[python]]></category>
      <category><![CDATA[personal]]></category>
      <guid>http://pieceofpy.com/?p=206</guid>
      <description>Voting and the land of ice and snow.</description>
      <content:encoded><![CDATA[
Today is election day in the states. Lots of free coffee and donut offers floating around for those few people wearing their I voted sticker.

Tomorrow I head out for my trip to Iceland. From Florida to Iceland in the Fall, makes perfect sense right? It was an excuse for me to purchase some new warm wear and jogging shoes, have to keep up with the exercise routine even on vacation. I should be able to maintain the blog from there keeping the spirit of blog every day in November.

<strong>Snippet of Python</strong>
In an effort to always have something a little Python related in all my posts, here is how to use list comprehension to filter out no value items from a list.
[sourcecode language="python"]
foo = ["A", "", "C", None, "E"]
bar = [i for i in foo if i]
print bar
['A', 'C', 'E']
[/sourcecode]

]]></content:encoded>
    </item>
  </channel>
</rss>

