<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom"><title>pmallory.com</title><link href="http://www.pmallory.com/" rel="alternate"></link><link href="http://www.pmallory.com/feeds/all.atom.xml" rel="self"></link><id>http://www.pmallory.com/</id><updated>2021-01-08T00:00:00-08:00</updated><entry><title>Gray Ridge</title><link href="http://www.pmallory.com/gray-ridge.html" rel="alternate"></link><published>2021-01-08T00:00:00-08:00</published><updated>2021-01-08T00:00:00-08:00</updated><author><name>Philip Mallory</name></author><id>tag:www.pmallory.com,2021-01-08:/gray-ridge.html</id><summary type="html">&lt;p&gt;This is my first painting in a long while.
I used white and black paint only for this which made it easy to mix compatible colors but harder to distinguish different elements on the canvas.&lt;/p&gt;
&lt;p&gt;&lt;a href="/images/paintings/January_2021-Gray_Ridge.jpg"&gt;&lt;img src="/images/paintings/small-January_2021-Gray_Ridge.jpg" alt="Painting of a snowy ridge with a tree in the foreground" class="center" /&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;I also practiced a receding ridge line in this painting, as seen previously in &lt;a href="/northern-california-coast-at-night.html"&gt;Northern …&lt;/a&gt;&lt;/p&gt;</summary><content type="html">&lt;p&gt;This is my first painting in a long while.
I used white and black paint only for this which made it easy to mix compatible colors but harder to distinguish different elements on the canvas.&lt;/p&gt;
&lt;p&gt;&lt;a href="/images/paintings/January_2021-Gray_Ridge.jpg"&gt;&lt;img src="/images/paintings/small-January_2021-Gray_Ridge.jpg" alt="Painting of a snowy ridge with a tree in the foreground" class="center" /&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;I also practiced a receding ridge line in this painting, as seen previously in &lt;a href="/northern-california-coast-at-night.html"&gt;Northern California Coast at Night&lt;/a&gt;.
If you look at any Bob Ross painting you'll notice the hills and mountains are totally perpendicular to the viewer.
They never look along a valley or along a ridge or anything like that.
This makes them simple to paint but it's really limiting if you want to recreate real places.
To make the ridge recede into the distance I used light values in the distance and gradually darkened it coming forward, while also increasing the size and detail of the textures as I worked towards the foreground.&lt;/p&gt;
&lt;p&gt;The big tree was originally going to be some kind of evergreen which is why the trunk is so straight.&lt;/p&gt;</content><category term="Painting"></category></entry><entry><title>Autumn Barn with Road</title><link href="http://www.pmallory.com/autumn-barn-with-road.html" rel="alternate"></link><published>2019-07-04T00:00:00-07:00</published><updated>2019-07-04T00:00:00-07:00</updated><author><name>Philip Mallory</name></author><id>tag:www.pmallory.com,2019-07-04:/autumn-barn-with-road.html</id><summary type="html">&lt;p&gt;In my first painting in a long time, I revisit the barn with autumn colors theme.
I painted this over three days, unlike most of my paintings which I do in one day.
This is a bit tricky, since the paint dried between sessions I couldn't blend new details into …&lt;/p&gt;</summary><content type="html">&lt;p&gt;In my first painting in a long time, I revisit the barn with autumn colors theme.
I painted this over three days, unlike most of my paintings which I do in one day.
This is a bit tricky, since the paint dried between sessions I couldn't blend new details into the already dry paint.
I would up having to paint some things multiple times (the grassy hill on the right and the middle strip of the road).
I think multi-day painting makes more detailed paintings possible, but I need to be more deliberate about where I quit each day to avoid wasting time and paint.&lt;/p&gt;
&lt;p&gt;Click it for higher resolution.&lt;/p&gt;
&lt;p&gt;&lt;a href="/images/paintings/fall-barn-road-July_4_2019.jpg"&gt;&lt;img src="/images/paintings/small-fall-barn-road-July_4_2019.jpg" alt="An picture of an old barn on a hill, with a dirt road leading up to it, with a tree, in autumn colours." class="center" /&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;And this animation shows how the painting came together:&lt;/p&gt;
&lt;p&gt;&lt;img src="/images/paintings/fall-barn-road-July_4_2019.gif" alt="An animated series of pictures taken as the picture was painted." class="center" /&gt;&lt;/p&gt;</content><category term="Painting"></category></entry><entry><title>Mountain Pond</title><link href="http://www.pmallory.com/mountain-pond.html" rel="alternate"></link><published>2018-08-18T00:00:00-07:00</published><updated>2018-08-18T00:00:00-07:00</updated><author><name>Philip Mallory</name></author><id>tag:www.pmallory.com,2018-08-18:/mountain-pond.html</id><content type="html">&lt;p&gt;Here's a pond! I tried a new way of painting trees. Click it for higher resolution.&lt;/p&gt;
&lt;p&gt;&lt;a href="/images/paintings/August_18_2018-mountain_pond.jpg"&gt;&lt;img src="/images/paintings/small-August_18_2018-mountain_pond.jpg" alt="Painting of a pond in an alpine meadow, with a few trees" class="center" /&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;And this animation shows how the painting came together.&lt;/p&gt;
&lt;p&gt;&lt;img src="/images/paintings/mountain_pond.gif" alt="An animated series of pictures taken as the picture was painted." class="center" /&gt;&lt;/p&gt;</content><category term="Painting"></category></entry><entry><title>Northern California Coast at Night</title><link href="http://www.pmallory.com/northern-california-coast-at-night.html" rel="alternate"></link><published>2018-07-05T00:00:00-07:00</published><updated>2018-07-05T00:00:00-07:00</updated><author><name>Philip Mallory</name></author><id>tag:www.pmallory.com,2018-07-05:/northern-california-coast-at-night.html</id><summary type="html">&lt;p&gt;I used some new brushes in this one: a detail round, a small filbert, and a new blender.
Lots of new strokes in this one.&lt;/p&gt;
&lt;p&gt;The dark patch in the sky below the moon has a fun explanation.
I rested my pinkie on the canvas while highlighting the moon, and …&lt;/p&gt;</summary><content type="html">&lt;p&gt;I used some new brushes in this one: a detail round, a small filbert, and a new blender.
Lots of new strokes in this one.&lt;/p&gt;
&lt;p&gt;The dark patch in the sky below the moon has a fun explanation.
I rested my pinkie on the canvas while highlighting the moon, and that left a fingerprint in the sky.
I forgot to blend that out, and only remembered hours later when I was finished and had already cleaned my brushes.
The painting was already beginning to dry by then.
So I mixed up some more sky color and blended it into the already dry paint.&lt;/p&gt;
&lt;p&gt;Or maybe that's a gap in the clouds I put there on purpose.
There are no mistakes, just happy accidents.&lt;/p&gt;
&lt;p&gt;Click it for higher resolution.&lt;/p&gt;
&lt;p&gt;&lt;a href="/images/paintings/July_5_2018-California-Coast.jpg"&gt;&lt;img src="/images/paintings/small-July_5_2018-California-Coast.jpg" alt="Painting of a rocky, Northern California Coast, with evergreen tree, at night." class="center" /&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;And this animation shows how the painting came together.
Notice how the colors are different in each frame; I have no idea how to properly photograph a dark painting.
None of the photographs actually look like the painting, you'll just have to see it in person to know what it really looks like.&lt;/p&gt;
&lt;p&gt;&lt;img src="/images/paintings/CaliforniaCoast.gif" alt="An animated series of pictures taken as the picture was painted." class="center" /&gt;&lt;/p&gt;</content><category term="Painting"></category></entry><entry><title>Midtown Atlanta from Piedmont Park</title><link href="http://www.pmallory.com/midtown-atlanta-from-piedmont-park.html" rel="alternate"></link><published>2017-11-27T00:00:00-08:00</published><updated>2017-11-27T00:00:00-08:00</updated><author><name>Philip Mallory</name></author><id>tag:www.pmallory.com,2017-11-27:/midtown-atlanta-from-piedmont-park.html</id><summary type="html">&lt;p&gt;This is a view of the Midtown Atlanta skyline as viewed from Lake Clara Meer in Piedmont Park.&lt;/p&gt;
&lt;p&gt;&lt;a href="/images/paintings/November_27_2017-Midtown.jpg"&gt;&lt;img src="/images/paintings/small-November_27_2017-Midtown.jpg" alt="Painting of the Midtown Atlanta Skyline seen from Piedmont Park" class="center" /&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;And this animation shows how the painting came together.
I painted this in three sessions.
First was the background (sky and lake), then the skyline, then the bushes in the foreground.&lt;/p&gt;
&lt;p&gt;&lt;img src="/images/paintings/midtown.gif" alt="An animated series of pictures taken as the picture was painted." class="center" /&gt;&lt;/p&gt;
&lt;p&gt;This …&lt;/p&gt;</summary><content type="html">&lt;p&gt;This is a view of the Midtown Atlanta skyline as viewed from Lake Clara Meer in Piedmont Park.&lt;/p&gt;
&lt;p&gt;&lt;a href="/images/paintings/November_27_2017-Midtown.jpg"&gt;&lt;img src="/images/paintings/small-November_27_2017-Midtown.jpg" alt="Painting of the Midtown Atlanta Skyline seen from Piedmont Park" class="center" /&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;And this animation shows how the painting came together.
I painted this in three sessions.
First was the background (sky and lake), then the skyline, then the bushes in the foreground.&lt;/p&gt;
&lt;p&gt;&lt;img src="/images/paintings/midtown.gif" alt="An animated series of pictures taken as the picture was painted." class="center" /&gt;&lt;/p&gt;
&lt;p&gt;This is the third painting where I've used a photograph for inspiration.
Counterintuitively, I think it's harder to paint a real scene than it is to make one up.
If the details in a painting are a bit off from its real subject that's noticeable; paintings of imagined scenes however can't fall short of a real ideal.
Here's the photograph I worked from while painting this scene:&lt;/p&gt;
&lt;p&gt;&lt;a href="/images/paintings/midtown-inspiration.jpg"&gt;&lt;img src="/images/paintings/small-midtown-inspiration.jpg" alt="A photograph of a similar scene" class="center" /&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;I did a simpler version of this painting first to get a feel for painting the skyline.
One thing I found in doing this practice painting is that mixing up the colors for all the buildings was hard.
Each building has its own color scheme, and for each of those colors I would need to mix two or more values to represent the sunny and shady sides of each building.
Doing this well seemed too great a challenge, so for the final painting I opted for to paint the buildings at sunset when they're partially silhouetted.&lt;/p&gt;
&lt;p&gt;&lt;a href="/images/paintings/midtown-practice.jpg"&gt;&lt;img src="/images/paintings/small-midtown-practice.jpg" alt="A lousy painting" class="center" /&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;One thing that I've found is true in painting (and most other things) is that effort and planning seem to improve outcomes.
To that end I did a little sketch of the scene before painting the final version.
This helped me plan the positions and relative sizes of the buildings, the bushes, and the reflections.
I also found that the aspect ratio of a sheet of paper is not the same as that of a canvas.
This forced me to rethink where the bushes would go, so much for planning ahead!&lt;/p&gt;
&lt;p&gt;&lt;a href="/images/paintings/midtown-sketch.jpg"&gt;&lt;img src="/images/paintings/small-midtown-sketch.jpg" alt="A lousy painting" class="center" /&gt;&lt;/a&gt;&lt;/p&gt;</content><category term="Painting"></category></entry><entry><title>Reading Log II</title><link href="http://www.pmallory.com/reading-log-ii.html" rel="alternate"></link><published>2017-04-25T00:00:00-07:00</published><updated>2017-04-25T00:00:00-07:00</updated><author><name>Philip Mallory</name></author><id>tag:www.pmallory.com,2017-04-25:/reading-log-ii.html</id><summary type="html">&lt;p&gt;It's been awhile since my &lt;a href="reading-log.html"&gt;last reading log&lt;/a&gt;! Here's my thoughts on some of my more recent reading:&lt;/p&gt;
&lt;h3&gt;The Stranger - Albert Camus&lt;/h3&gt;
&lt;p&gt;A short artsy novel, I read Matthew Ward's 1989 translation.
The book is stylistically interesting; it consists of lots of short, descriptive sentences from a first person narrator …&lt;/p&gt;</summary><content type="html">&lt;p&gt;It's been awhile since my &lt;a href="reading-log.html"&gt;last reading log&lt;/a&gt;! Here's my thoughts on some of my more recent reading:&lt;/p&gt;
&lt;h3&gt;The Stranger - Albert Camus&lt;/h3&gt;
&lt;p&gt;A short artsy novel, I read Matthew Ward's 1989 translation.
The book is stylistically interesting; it consists of lots of short, descriptive sentences from a first person narrator who doesn't inspire sympathy.
It's well crafted, and provides fuel for thinking.&lt;/p&gt;
&lt;p&gt;The copy I read was littered with marginal notes from a past reader who was fixated on the narrator's use of color to describe things.
I don't think color itself is a significant theme of the novel, I think these descriptions were simply an example of the narrator's way of perceiving objects, people and events without imposing meaning on them.&lt;/p&gt;
&lt;p&gt;The quick read is worthwhile, and I might read this again one day.&lt;/p&gt;
&lt;h3&gt;The Wonderful Wizard of Oz - L. Frank Baum&lt;/h3&gt;
&lt;p&gt;A simple children's book published in 1900.
I think this book is more interesting for its historical context than its content.
In the brief preface the author explains that the story is like a fairy tale, but without any moralizing or scary stuff like witches who eat children.
His reasoning for omitting these is that modern children get moral education in other ways, and that the scary parts of traditional fairy tales serve only to enforce the moral message.
That's reasonable, and the novel is an excellent example of the evolution of children's literature, but to this contemporary, adult reader the story was pretty dull.&lt;/p&gt;
&lt;p&gt;The book is whimsical and provides imagination fuel but there isn't much else to it.
The primary conflict of the book is that Dorothy wants to go home to Kansas.
This conflict is the only one that isn't introduced and resolved in the span of a few pages.
Every other event and mishap of Dorothy's journey is introduced and then dismissed after a few minutes of reading.
If story does have a moral, it is that the fear of difficulties might be a bigger obstacle than the difficulties themselves.&lt;/p&gt;
&lt;p&gt;I had heard that sophisticated political commentary was embedded in The Wizard of Oz, a la Animal Farm.
This is not true.
The simple construction of the story makes it easy to impose some overarching meaning on the story but there is no intrinsic allegory, any such meaning comes from the commentator and not the  author.
And I think that this is the point of the story, it provides a jumping off point for the reader's own imaginings by having very little substance of its own.&lt;/p&gt;
&lt;p&gt;I don't expect to read this again myself, but I can imaging reading it to a child maybe.&lt;/p&gt;
&lt;h2&gt;Death of a Salesman - Arthur Miller&lt;/h2&gt;
&lt;p&gt;This is very good.
I don't read many plays which made this interesting, and maybe a bit confusing.
The action alternates between real time and the main character's emotional, and unreliable, reminisces.
I lost track of who was who and when was now a few times and had to reread some passages to get things straight.
I'm not sure if my confusion was caused by the complicated narrative structure or my unfamiliarity with reading plays.&lt;/p&gt;
&lt;p&gt;Like the Wizard of Oz, this story is interesting in part because it's a window into when it was written.
Specific details of the story reflect the time period, but I think many of the play's themes are timeless.
Self sabotage, self deception, unrealistic aspirations, and rosy self assessments will probably always be part of the human experience.&lt;/p&gt;
&lt;h2&gt;The Floating Opera - John Barth&lt;/h2&gt;
&lt;p&gt;This is John Barth's first novel, written in 1955 and first published when the author was 26 years old.
Like &lt;em&gt;The Stranger&lt;/em&gt;, this book is described as a philosophical novel.
I think that means that the book aims to be thought provoking while placing less emphasis on narrative.
The book made me anxious, which I think was the author's intent.&lt;/p&gt;
&lt;p&gt;I think this book is pretty good overall, but it does have rough edges.
A downplayed narrative is fine, but I felt that this story's narrative was almost vestigial.
The events and characters of the story were constructed to convey a kind of anxious nihilist feel.
This feeling was achieved, but the characters and events weren't consistently engaging when considered on their own.&lt;/p&gt;
&lt;p&gt;The author tried several experimental writing techniques to differing degrees of success.
For example the book's nonlinear structure was easy to understand and contributed nicely to the feel of the book.
A less successful experiment occurred in a later chapter, which consisted of two parallel columns of text meant to be read simultaneously.
The effect was carefully crafted, but I'm not sure it contributed anything to the book other than some weirdness.&lt;/p&gt;
&lt;p&gt;I don't think I'll read this again, but I would like to read Barth's later work to see how his talent developed.&lt;/p&gt;
&lt;p&gt;Thank you Debbie for recommending this to me :)&lt;/p&gt;
&lt;h2&gt;Reviving Ophelia - Mary Pipher&lt;/h2&gt;
&lt;p&gt;This is a nonfiction book published in 1994.
The author is a clinical psychologist who has a ton of experience counseling young women and their families.
The book is structured as a collection of case studies of individual clients sorted by theme (such as divorce, depression, sexual violence, and drugs).
The case studies are interspersed with the author's analysis of the themes exemplified by the case studies.
The analyses describe general trends, and suggestions for how negative influences from society can be addressed.
The author also discusses how trends have changed overtime, for example society has higher expectations of a father's role in parenting today than in the beginning and middle of the 20th century.
This trend, among countless others, make it hard for older people like the author to empathize with the experience of young women today.
This type of analysis relates to the book's only flaw, the analysis is contemporary to 1994.
While the themes are timeless, the specifics have drifted over time, and the book doesn't address topics like smart phones and the Internet.
I'm sure there tons of other, less obvious social trends, that have transpired since the book was written and deserve attention.&lt;/p&gt;
&lt;p&gt;This hardly detracts from the book though, it's real value to me is that it shines light on undiscussed facets of human experience that I'm mostly oblivious too.
The case studies are great for building empathy and understanding the enormous range of troubles that young women can run into, while the author's analysis concentrates and directs the empathy towards useful understanding.&lt;/p&gt;
&lt;p&gt;I read the book by reading from random sections, gradually absorbing the whole book over the course of a few months.
I think this was a good approach, reading it straight through is unnecessary and would be a bit depressing.&lt;/p&gt;
&lt;p&gt;I recommend this book to anyone.
I think it's potentially useful to adolescent men though, who struggle with their own issues and could be served by insight into the experiences of the women around them.
The book is exclusively focused on the United States.&lt;/p&gt;
&lt;p&gt;I will continue to peruse this book in the future, and I'm interested in similar books that are more contemporary and that discuss other demographics.&lt;/p&gt;
&lt;p&gt;Thanks Carson and Elana for turning me on to this book.&lt;/p&gt;</content><category term="misc"></category></entry><entry><title>Hattie's Hollow</title><link href="http://www.pmallory.com/hatties-hollow.html" rel="alternate"></link><published>2017-04-22T00:00:00-07:00</published><updated>2017-04-22T00:00:00-07:00</updated><author><name>Philip Mallory</name></author><id>tag:www.pmallory.com,2017-04-22:/hatties-hollow.html</id><summary type="html">&lt;p&gt;This painting is a departure from Bob Ross's wet on wet style.
I painted this in four sessions allowing the paint to dry between sessions.
This opens up more possibilities for detail, and it'll be fun to explore this further.&lt;/p&gt;
&lt;p&gt;The subject is Hattie's Hollow in Hanging Dog, North Carolina …&lt;/p&gt;</summary><content type="html">&lt;p&gt;This painting is a departure from Bob Ross's wet on wet style.
I painted this in four sessions allowing the paint to dry between sessions.
This opens up more possibilities for detail, and it'll be fun to explore this further.&lt;/p&gt;
&lt;p&gt;The subject is Hattie's Hollow in Hanging Dog, North Carolina which is where my grandparents lived when I was little.&lt;/p&gt;
&lt;p&gt;&lt;a href="/images/paintings/April_22_2017-Hatties_Hollow.jpg"&gt;&lt;img src="/images/paintings/small-April_22_2017-Hatties_Hollow.jpg" alt="Painting of valley with barn in the Smoky Mountains" class="center" /&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;And here's an animation of how it looked at the end of each painting session:&lt;/p&gt;
&lt;p&gt;&lt;img src="/images/paintings/Hatties_Hollow.gif" alt="An animated series of pictures taken as the picture was painted." class="center" /&gt;&lt;/p&gt;</content><category term="Painting"></category></entry><entry><title>Autumn Barn in the Woods</title><link href="http://www.pmallory.com/autumn-barn-in-the-woods.html" rel="alternate"></link><published>2017-03-15T00:00:00-07:00</published><updated>2017-03-15T00:00:00-07:00</updated><author><name>Philip Mallory</name></author><id>tag:www.pmallory.com,2017-03-15:/autumn-barn-in-the-woods.html</id><content type="html">&lt;p&gt;&lt;a href="/images/paintings/March_15_2017-Autumn_Barn.jpg"&gt;&lt;img src="/images/paintings/small-March_15_2017-Autumn_Barn.jpg" alt="Painting of barn in woods will autumn colors" class="center" /&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;And this is the &lt;a href="https://en.wikipedia.org/wiki/Underpainting"&gt;underpainting&lt;/a&gt; layer:&lt;/p&gt;
&lt;p&gt;&lt;a href="/images/paintings/March_15_2017-Autumn_Barn_Underpainting.jpg"&gt;&lt;img src="/images/paintings/small-March_15_2017-Autumn_Barn_Underpainting.jpg" alt="Painting of barn in woods will autumn colors" class="center" /&gt;&lt;/a&gt;&lt;/p&gt;</content><category term="Painting"></category></entry><entry><title>Updating a Program from Python 2 to Python 3</title><link href="http://www.pmallory.com/updating-a-program-from-python-2-to-python-3.html" rel="alternate"></link><published>2017-03-09T00:00:00-08:00</published><updated>2017-03-09T00:00:00-08:00</updated><author><name>Philip Mallory</name></author><id>tag:www.pmallory.com,2017-03-09:/updating-a-program-from-python-2-to-python-3.html</id><summary type="html">&lt;p&gt;I've been working with Python 2 and Python 3 codebases for a couple years now.
I write new code in Python 3 and maintain past work written in Python 2, but I've never ported a codebase from two to three.&lt;/p&gt;
&lt;p&gt;This topic is interesting to me because the 2/3 …&lt;/p&gt;</summary><content type="html">&lt;p&gt;I've been working with Python 2 and Python 3 codebases for a couple years now.
I write new code in Python 3 and maintain past work written in Python 2, but I've never ported a codebase from two to three.&lt;/p&gt;
&lt;p&gt;This topic is interesting to me because the 2/3 split is a big deal in every Python-related thread on Hacker News, but despite Python being my go-to language of seven years the split hasn't ever bothered me much.&lt;/p&gt;
&lt;p&gt;To explore the problem I decided to port a small program I wrote five years ago.
&lt;a href="https://github.com/pmallory/pylife"&gt;PyLife&lt;/a&gt; is an implementation of &lt;a href="https://en.wikipedia.org/wiki/Conway%27s_Game_of_Life"&gt;Conway's Game of Life&lt;/a&gt; that uses the terminal as its display.
I wrote the program to practice a few things:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Writing Python in a functional style. The program generates each generation as a function of the last.&lt;/li&gt;
&lt;li&gt;Using the &lt;a href="https://docs.python.org/3/library/itertools.html"&gt;itertools&lt;/a&gt; library to practice using iterators.&lt;/li&gt;
&lt;li&gt;Using the &lt;a href="https://en.wikipedia.org/wiki/Curses_%28programming_library%29"&gt;curses library&lt;/a&gt; to make text based interfaces.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;You can view the most recent, Python 2/3 compatible, &lt;a href="https://github.com/pmallory/pylife/blob/master/life.py"&gt;code at GitHub&lt;/a&gt;&lt;/p&gt;
&lt;h2&gt;The Porting Process&lt;/h2&gt;
&lt;p&gt;I started porting by running the program with the python3 interpreter to see what errors I got.
The first one was an &lt;code&gt;ImportError&lt;/code&gt; involving itertools.
I wasn't familiar with how the library had been changed and reorganized in Python 3 so I Googled for &lt;a href="http://www.diveintopython3.net/porting-code-to-python-3-with-2to3.html#itertools"&gt;an overview&lt;/a&gt;.
I found that Python 3's &lt;code&gt;filter&lt;/code&gt; function and related functions use iterators under the hood, making itertool's &lt;code&gt;filter&lt;/code&gt; function redundant.
I removed the bad import and replaced all calls to &lt;code&gt;itertools.ifilter&lt;/code&gt; with calls to &lt;code&gt;filter&lt;/code&gt;.&lt;/p&gt;
&lt;p&gt;The next error was similar.
Python 2 provides the &lt;code&gt;range&lt;/code&gt; and &lt;code&gt;xrange&lt;/code&gt; functions to create sequences of integers.
&lt;code&gt;range&lt;/code&gt; returns a list while &lt;code&gt;xrange&lt;/code&gt; returns a faster and more memory-efficient generator.
In Python 3 &lt;code&gt;range&lt;/code&gt; behaves like &lt;code&gt;xrange&lt;/code&gt; does in Python 2 and in the inefficient version of the function is removed.
Updating my program required a minute of find-and-replacing.&lt;/p&gt;
&lt;p&gt;And with that my program is Python 2/3 compatible!
The program no longer uses generator backed ranges when run as Python 2.
I could work around this, but the program performs fine so I don't think it's worth the trouble.&lt;/p&gt;
&lt;h2&gt;Conclusions&lt;/h2&gt;
&lt;p&gt;Small programs are trivial to port.
Larger programs that depend on libraries beyond the standard library could be harder.
Programs that explicitly handle text encoding are almost certainly harder to port.&lt;/p&gt;</content><category term="Tech"></category></entry><entry><title>High Falls of the Baptism River</title><link href="http://www.pmallory.com/high-falls-of-the-baptism-river.html" rel="alternate"></link><published>2017-01-29T00:00:00-08:00</published><updated>2017-01-29T00:00:00-08:00</updated><author><name>Philip Mallory</name></author><id>tag:www.pmallory.com,2017-01-29:/high-falls-of-the-baptism-river.html</id><content type="html">&lt;p&gt;This is the &lt;a href="http://www.gowaterfalling.com/waterfalls/baptismhigh.shtml"&gt;High Falls of the Baptism River&lt;/a&gt; in northeast Minnesota.&lt;/p&gt;
&lt;p&gt;&lt;a href="/images/paintings/January_29_2017-High_Falls.jpg"&gt;&lt;img src="/images/paintings/small-January_29_2017-High_Falls.jpg" alt="The High Falls of the Baptism River" class="center" /&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;This painting was sold for charity, yay!&lt;/p&gt;</content><category term="Painting"></category></entry><entry><title>Frosty Mountain Lake</title><link href="http://www.pmallory.com/frosty-mountain-lake.html" rel="alternate"></link><published>2016-12-24T00:00:00-08:00</published><updated>2016-12-24T00:00:00-08:00</updated><author><name>Philip Mallory</name></author><id>tag:www.pmallory.com,2016-12-24:/frosty-mountain-lake.html</id><content type="html">&lt;p&gt;This is the first time I've painted the sun.&lt;/p&gt;
&lt;p&gt;&lt;a href="/images/paintings/December_24_2016-Frosty_Mountain_Lake.jpg"&gt;&lt;img src="/images/paintings/small-December_24_2016-Frosty_Mountain_Lake.jpg" alt="Painting of snowy mountains and frosted shrubberies" class="center" /&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;And here's an animation of how it came together:&lt;/p&gt;
&lt;p&gt;&lt;img src="/images/paintings/Frosty_Mountain_Lake.gif" alt="An animated series of pictures taken as the picture was painted." class="center" /&gt;&lt;/p&gt;</content><category term="Painting"></category></entry><entry><title>Seacliff Sunset</title><link href="http://www.pmallory.com/seacliff-sunset.html" rel="alternate"></link><published>2016-11-05T00:00:00-07:00</published><updated>2016-11-05T00:00:00-07:00</updated><author><name>Philip Mallory</name></author><id>tag:www.pmallory.com,2016-11-05:/seacliff-sunset.html</id><content type="html">&lt;p&gt;&lt;a href="/images/paintings/Noveber_5_2016-Seacliff_Sunset.jpg"&gt;&lt;img src="/images/paintings/small-Noveber_5_2016-Seacliff_Sunset.jpg" alt="Painting of waves breaking by a seacliff at sunset." class="center" /&gt;&lt;/a&gt;&lt;/p&gt;</content><category term="Painting"></category></entry><entry><title>Forest Trail</title><link href="http://www.pmallory.com/forest-trail.html" rel="alternate"></link><published>2016-10-02T00:00:00-07:00</published><updated>2016-10-02T00:00:00-07:00</updated><author><name>Philip Mallory</name></author><id>tag:www.pmallory.com,2016-10-02:/forest-trail.html</id><content type="html">&lt;p&gt;These close-in paintings are trickier than the huge vistas.&lt;/p&gt;
&lt;p&gt;&lt;a href="/images/paintings/October_2_2016-Forest_Trail.jpg"&gt;&lt;img src="/images/paintings/small-October_2_2016-Forest_Trail.jpg" alt="A trail thorugh enormous trees." class="center" /&gt;&lt;/a&gt;&lt;/p&gt;</content><category term="Painting"></category></entry><entry><title>rsync and Android</title><link href="http://www.pmallory.com/rsync-and-android.html" rel="alternate"></link><published>2016-10-01T00:00:00-07:00</published><updated>2016-10-01T00:00:00-07:00</updated><author><name>Philip Mallory</name></author><id>tag:www.pmallory.com,2016-10-01:/rsync-and-android.html</id><summary type="html">&lt;p&gt;Here's what you need to transfer files to an Android phone over the network using rsync.&lt;/p&gt;
&lt;p&gt;sshd for Android: &lt;a href="http://arachnoid.com/android/SSHelper/"&gt;SSHelper&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;How to use rsync on a nonstandard port:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;rsync -rv -e &lt;span class="s2"&gt;&amp;quot;ssh -p 2222&amp;quot;&lt;/span&gt; ~/Music &lt;span class="m"&gt;192&lt;/span&gt;.168.0.100:/sdcard/Music
&lt;/pre&gt;&lt;/div&gt;


&lt;p&gt;I'm not using the compression flag (-z) because my …&lt;/p&gt;</summary><content type="html">&lt;p&gt;Here's what you need to transfer files to an Android phone over the network using rsync.&lt;/p&gt;
&lt;p&gt;sshd for Android: &lt;a href="http://arachnoid.com/android/SSHelper/"&gt;SSHelper&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;How to use rsync on a nonstandard port:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;rsync -rv -e &lt;span class="s2"&gt;&amp;quot;ssh -p 2222&amp;quot;&lt;/span&gt; ~/Music &lt;span class="m"&gt;192&lt;/span&gt;.168.0.100:/sdcard/Music
&lt;/pre&gt;&lt;/div&gt;


&lt;p&gt;I'm not using the compression flag (-z) because my music library consists of files that are already compressed.
Even if they weren't I'm not sure if compression would even be a time saver considering my phone's pitiful CPU and that this transfer is over the speedy local network.&lt;/p&gt;
&lt;p&gt;The &lt;code&gt;-e "ssh -p 2222"&lt;/code&gt; bit is how you get rsync to connect to sshd on a nonstandard port, SSHelper would need to run as root to get ssh on port 22.&lt;/p&gt;
&lt;p&gt;&lt;a href="http://arachnoid.com/android/SSHelper/"&gt;SSHelper&lt;/a&gt; is an open source app that supports several other Unixy file transfer protocols in addition to ssh.
They author is pretty cool too, browse his page for all kinds of interesting things.&lt;/p&gt;
&lt;p&gt;The syncing process is pretty slow, but it works.
iPods also just worked but the world seems to have moved on from people owning their own digital music libraries.
Oh well.&lt;/p&gt;</content><category term="tech"></category></entry><entry><title>Northern California/Oregon Motorcycle Trip</title><link href="http://www.pmallory.com/northern-californiaoregon-motorcycle-trip.html" rel="alternate"></link><published>2016-09-03T00:00:00-07:00</published><updated>2016-09-03T00:00:00-07:00</updated><author><name>Philip Mallory</name></author><id>tag:www.pmallory.com,2016-09-03:/northern-californiaoregon-motorcycle-trip.html</id><summary type="html">&lt;p&gt;I just got back from a motorcycle camping trip arund northern California and Oregon.
The route went from San Francisco, through Sacremento, towards Tahoe, and then north through the Sierreas and Cascades.&lt;/p&gt;
&lt;p&gt;Here are the photos, click them to view in full resolution.&lt;/p&gt;
&lt;p&gt;&lt;a href="/images/CA_OR_Motorcycle_Ride/Plumas_campsite.jpg"&gt;&lt;img src="/images/CA_OR_Motorcycle_Ride/small-Plumas_campsite.jpg" alt="Trees in Plumas National Forest" class="center" /&gt;&lt;/a&gt;
&lt;p&gt;I camped in the Plumas National Forest …&lt;/p&gt;&lt;/p&gt;</summary><content type="html">&lt;p&gt;I just got back from a motorcycle camping trip arund northern California and Oregon.
The route went from San Francisco, through Sacremento, towards Tahoe, and then north through the Sierreas and Cascades.&lt;/p&gt;
&lt;p&gt;Here are the photos, click them to view in full resolution.&lt;/p&gt;
&lt;p&gt;&lt;a href="/images/CA_OR_Motorcycle_Ride/Plumas_campsite.jpg"&gt;&lt;img src="/images/CA_OR_Motorcycle_Ride/small-Plumas_campsite.jpg" alt="Trees in Plumas National Forest" class="center" /&gt;&lt;/a&gt;
&lt;p&gt;I camped in the Plumas National Forest. This is off some forest road.&lt;/p&gt;&lt;/p&gt;
&lt;p&gt;&lt;a href="/images/CA_OR_Motorcycle_Ride/Lassen_snowfield.jpg"&gt;&lt;img src="/images/CA_OR_Motorcycle_Ride/small-Lassen_snowfield.jpg" alt="Snowfield on Lassen Peak" class="center" /&gt;&lt;/a&gt;
&lt;p&gt;This is a snowfield I hiked through near the summit of Lassen Peak in Lassen National Park.&lt;/p&gt;&lt;/p&gt;
&lt;p&gt;&lt;a href="/images/CA_OR_Motorcycle_Ride/Lassen_selfie.jpg"&gt;&lt;img src="/images/CA_OR_Motorcycle_Ride/small-Lassen_selfie.jpg" alt="Selfie on Lassen Peak" class="center" /&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;&lt;a href="/images/CA_OR_Motorcycle_Ride/Lassen_Peak_1.jpg"&gt;&lt;img src="/images/CA_OR_Motorcycle_Ride/small-Lassen_Peak_1.jpg" alt="The view from Lassen Peak" class="center" /&gt;&lt;/a&gt;
&lt;p&gt;The view from Lassen Peak. Mt Shasta is faint on the horizon 80 miles away.&lt;/p&gt;&lt;/p&gt;
&lt;p&gt;&lt;a href="/images/CA_OR_Motorcycle_Ride/Lassen_Peak_2.jpg"&gt;&lt;img src="/images/CA_OR_Motorcycle_Ride/small-Lassen_Peak_2.jpg" alt="The view from Lassen Peak" class="center" /&gt;&lt;/a&gt;
&lt;p&gt;The view from Lassen Peak&lt;/p&gt;&lt;/p&gt;
&lt;p&gt;&lt;a href="/images/CA_OR_Motorcycle_Ride/Lassen_Peak_3.jpg"&gt;&lt;img src="/images/CA_OR_Motorcycle_Ride/small-Lassen_Peak_3.jpg" alt="The view from Lassen Peak" class="center" /&gt;&lt;/a&gt;
&lt;p&gt;That lake is 2000 feet down.&lt;/p&gt;&lt;/p&gt;
&lt;p&gt;&lt;a href="/images/CA_OR_Motorcycle_Ride/Lassen_Peak_4.jpg"&gt;&lt;img src="/images/CA_OR_Motorcycle_Ride/small-Lassen_Peak_4.jpg" alt="The view from Lassen Peak" class="center" /&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;&lt;a href="/images/CA_OR_Motorcycle_Ride/Lassen_Peak_5.jpg"&gt;&lt;img src="/images/CA_OR_Motorcycle_Ride/small-Lassen_Peak_5.jpg" alt="The view from Lassen Peak" class="center" /&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;&lt;a href="/images/CA_OR_Motorcycle_Ride/forrest_road.jpg"&gt;&lt;img src="/images/CA_OR_Motorcycle_Ride/small-forrest_road.jpg" alt="Motorcycle parked by forest service sign and tall trees" class="center" /&gt;&lt;/a&gt;
&lt;p&gt;&lt;/p&gt;&lt;/p&gt;
&lt;p&gt;&lt;a href="/images/CA_OR_Motorcycle_Ride/Medicine_Lake_campsite.jpg"&gt;&lt;img src="/images/CA_OR_Motorcycle_Ride/small-Medicine_Lake_campsite.jpg" alt="Motorcycle among tall trees" class="center" /&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;&lt;a href="/images/CA_OR_Motorcycle_Ride/Medicine_Lake.jpg"&gt;&lt;img src="/images/CA_OR_Motorcycle_Ride/small-Medicine_Lake.jpg" alt="Motorcycle in front of lake with mountains" class="center" /&gt;&lt;/a&gt;
&lt;p&gt;Medicine Lake&lt;/p&gt;&lt;/p&gt;
&lt;p&gt;&lt;a href="/images/CA_OR_Motorcycle_Ride/Lava_Fields.jpg"&gt;&lt;img src="/images/CA_OR_Motorcycle_Ride/small-Lava_Fields.jpg" alt="Desolate scrubland" class="center" /&gt;&lt;/a&gt;
&lt;p&gt;Outside of Lava Fields National Monument&lt;p&gt;&lt;/p&gt;&lt;/p&gt;
&lt;p&gt;&lt;a href="/images/CA_OR_Motorcycle_Ride/Crater_Lake_pinnacles.jpg"&gt;&lt;img src="/images/CA_OR_Motorcycle_Ride/small-Crater_Lake_pinnacles.jpg" alt="Pinnacles in gorge" class="center" /&gt;&lt;/a&gt;
&lt;p&gt;Some Pinnacles in Crater Lake National Park.&lt;/p&gt;&lt;/p&gt;
&lt;p&gt;&lt;a href="/images/CA_OR_Motorcycle_Ride/Crater_Lake_sunset.jpg"&gt;&lt;img src="/images/CA_OR_Motorcycle_Ride/small-Crater_Lake_sunset.jpg" alt="Creter Lake" class="center" /&gt;&lt;/a&gt;
&lt;p&gt;Crater Lake&lt;/p&gt;&lt;/p&gt;
&lt;p&gt;&lt;a href="/images/CA_OR_Motorcycle_Ride/Crater_Lake_1.jpg"&gt;&lt;img src="/images/CA_OR_Motorcycle_Ride/small-Crater_Lake_1.jpg" alt="Creter Lake" class="center" /&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;&lt;a href="/images/CA_OR_Motorcycle_Ride/Crater_Lake_2.jpg"&gt;&lt;img src="/images/CA_OR_Motorcycle_Ride/small-Crater_Lake_2.jpg" alt="Crater Lake" class="center" /&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;&lt;a href="/images/CA_OR_Motorcycle_Ride/Crater_Lake_insect_repellent.jpg"&gt;&lt;img src="/images/CA_OR_Motorcycle_Ride/small-Crater_Lake_insect_repellent.jpg" alt="Packet stapled to tree" class="center" /&gt;&lt;/a&gt;
&lt;p&gt;The Park Service staples insect repellent to trees.&lt;/p&gt;&lt;/p&gt;
&lt;p&gt;&lt;a href="/images/CA_OR_Motorcycle_Ride/Cinnamon_Camp.jpg"&gt;&lt;img src="/images/CA_OR_Motorcycle_Ride/small-Cinnamon_Camp.jpg" alt="Tent on mountaintop" class="center" /&gt;&lt;/a&gt;
&lt;p&gt;Cinnamon Lookout&lt;/p&gt;&lt;/p&gt;
&lt;p&gt;&lt;a href="/images/CA_OR_Motorcycle_Ride/Cinnamon_firetower.jpg"&gt;&lt;img src="/images/CA_OR_Motorcycle_Ride/small-Cinnamon_firetower.jpg" alt="Fire watchtower" class="center" /&gt;&lt;/a&gt;
&lt;p&gt;Cinnamon Lookout&lt;/p&gt;&lt;/p&gt;
&lt;p&gt;&lt;a href="/images/CA_OR_Motorcycle_Ride/Cinnamon_scene.jpg"&gt;&lt;img src="/images/CA_OR_Motorcycle_Ride/small-Cinnamon_scene.jpg" alt="Distant Lake" class="center" /&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;&lt;a href="/images/CA_OR_Motorcycle_Ride/Cinnamon_sunset.jpg"&gt;&lt;img src="/images/CA_OR_Motorcycle_Ride/small-Cinnamon_sunset.jpg" alt="Sunset from the mountain top" class="center" /&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;&lt;a href="/images/CA_OR_Motorcycle_Ride/Cinnamon_sunset_2.jpg"&gt;&lt;img src="/images/CA_OR_Motorcycle_Ride/small-Cinnamon_sunset_2.jpg" alt="Sunset over the mountains" class="center" /&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;&lt;a href="/images/CA_OR_Motorcycle_Ride/Cinnamon_sunset_3.jpg"&gt;&lt;img src="/images/CA_OR_Motorcycle_Ride/small-Cinnamon_sunset_3.jpg" alt="Sunset over the mountains" class="center" /&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;&lt;a href="/images/CA_OR_Motorcycle_Ride/Cinnamon_sunset_4.jpg"&gt;&lt;img src="/images/CA_OR_Motorcycle_Ride/small-Cinnamon_sunset_4.jpg" alt="Sunset over the mountains" class="center" /&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;&lt;a href="/images/CA_OR_Motorcycle_Ride/Portland.jpg"&gt;&lt;img src="/images/CA_OR_Motorcycle_Ride/small-Portland.jpg" alt="Sunset and cool clouds with houses" class="center" /&gt;&lt;/a&gt;
&lt;p&gt;Portland&lt;/p&gt;&lt;/p&gt;</content><category term="Adventure"></category></entry><entry><title>Summer Alpine Lake</title><link href="http://www.pmallory.com/summer-alpine-lake.html" rel="alternate"></link><published>2016-08-20T00:00:00-07:00</published><updated>2016-08-20T00:00:00-07:00</updated><author><name>Philip Mallory</name></author><id>tag:www.pmallory.com,2016-08-20:/summer-alpine-lake.html</id><content type="html">&lt;p&gt;This is really big canvas!
It, along with some of my paintings and art supplies, were used as props in this &lt;a href="https://www.youtube.com/watch?v=H2Q4vJrxTwo"&gt;Udacity course about Heroku&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;&lt;a href="/images/paintings/August_20_2016-Summer_Alpine_Lake.jpg"&gt;&lt;img src="/images/paintings/small-August_20_2016-Summer_Alpine_Lake.jpg" alt="Painting of mountains and foothills and a lake and different kinds of trees" class="center" /&gt;&lt;/a&gt;&lt;/p&gt;</content><category term="Painting"></category></entry><entry><title>Iterative Tree Traversal, and Simulating Recursion</title><link href="http://www.pmallory.com/iterative-tree-traversal-and-simulating-recursion.html" rel="alternate"></link><published>2016-08-18T22:15:00-07:00</published><updated>2016-08-18T22:15:00-07:00</updated><author><name>Philip Mallory</name></author><id>tag:www.pmallory.com,2016-08-18:/iterative-tree-traversal-and-simulating-recursion.html</id><summary type="html">&lt;p&gt;Students sometimes ask, "what's the point of recursion?"
My stock answer is that some problems, like tree traversal, are much easier to solve recursively.&lt;sup&gt;&lt;a name="reference1"&gt;&lt;a href="#footnote1"&gt;1&lt;/a&gt;&lt;/a&gt;&lt;/sup&gt;
But what does an iterative tree traversal look like?
Let's find out!&lt;/p&gt;
&lt;p&gt;This is the tree-node I'll be working with (in Python):&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;span class="k"&gt;class&lt;/span&gt; &lt;span class="nc"&gt;Node&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
    &lt;span class="k"&gt;def …&lt;/span&gt;&lt;/pre&gt;&lt;/div&gt;</summary><content type="html">&lt;p&gt;Students sometimes ask, "what's the point of recursion?"
My stock answer is that some problems, like tree traversal, are much easier to solve recursively.&lt;sup&gt;&lt;a name="reference1"&gt;&lt;a href="#footnote1"&gt;1&lt;/a&gt;&lt;/a&gt;&lt;/sup&gt;
But what does an iterative tree traversal look like?
Let's find out!&lt;/p&gt;
&lt;p&gt;This is the tree-node I'll be working with (in Python):&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;span class="k"&gt;class&lt;/span&gt; &lt;span class="nc"&gt;Node&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
    &lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="fm"&gt;__init__&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="bp"&gt;self&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;data&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;left&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;right&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt;
        &lt;span class="bp"&gt;self&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;data&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;data&lt;/span&gt;
        &lt;span class="bp"&gt;self&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;left&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;left&lt;/span&gt;
        &lt;span class="bp"&gt;self&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;right&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;right&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;


&lt;p&gt;&lt;code&gt;left&lt;/code&gt; and &lt;code&gt;right&lt;/code&gt; are a node's child nodes, or &lt;code&gt;None&lt;/code&gt; if the node doesn't have a left or right subtree.&lt;/p&gt;
&lt;p&gt;I figure that a recursive tree traversal implicitly uses the call stack as its key data structure, so my iterative tree traversal had better have a stack too.
After zero planning and a bit of hacking I got this solution working:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;iterative_traverse&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;t&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt;
    &lt;span class="n"&gt;stack&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="n"&gt;t&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;

    &lt;span class="k"&gt;while&lt;/span&gt; &lt;span class="n"&gt;stack&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
        &lt;span class="n"&gt;node&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;stack&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;pop&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;
        &lt;span class="nb"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;node&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;data&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

        &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="n"&gt;node&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;l&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
            &lt;span class="n"&gt;stack&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;append&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;node&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;l&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
        &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="n"&gt;node&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;r&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
            &lt;span class="n"&gt;stack&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;append&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;node&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;r&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;


&lt;p&gt;When I give it a test tree:&lt;/p&gt;
&lt;pre style="text-align: center"&gt;
    1 &lt;- root
  2   4      
3    5 6     
&lt;/pre&gt;

&lt;p&gt;All the nodes get printed and the loop terminates.
So far so good.
Given that sample tree the algorithm yields 1, 4, 6, 5, 2, 3, which looks like a backwards post-order traversal.
Replacing the stack with a queue seems to produce a level-order traversal.&lt;/p&gt;
&lt;p&gt;This is interesting, and it resembles a recursive algorithm because it uses a stack, but the similarities are superficial.
Consider this pre-order traversal for comparison:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;recursive_traverse&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;t&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt;
    &lt;span class="nb"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;t&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;data&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="n"&gt;t&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;l&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
        &lt;span class="n"&gt;recursive_traverse&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;t&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;l&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="n"&gt;t&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;r&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
        &lt;span class="n"&gt;recursive_traverse&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;t&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;r&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;


&lt;p&gt;This looks like my iterative solution; first we print a node's data, then we check to see if there are left and right subtrees to explore.
The recursive code is easy to modify, if I want an in-order traversal all I have to do is move the print statement in between the two recursive calls:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;recursive_traverse&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;t&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt;
    &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="n"&gt;t&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;l&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
        &lt;span class="n"&gt;recursive_traverse&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;t&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;l&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="nb"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;t&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;data&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="n"&gt;t&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;r&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
        &lt;span class="n"&gt;recursive_traverse&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;t&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;r&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;


&lt;p&gt;Rearranging the statements of my iterative traversal doesn't produce similar results though, if I want an in-order traversal I need entirely new code.&lt;sup&gt;&lt;a name="reference2"&gt;&lt;a href="#footnote2"&gt;2&lt;/a&gt;&lt;/a&gt;&lt;/sup&gt;&lt;/p&gt;
&lt;p&gt;Can I write an iterative algorithm that works more like the recursive algorithm?
Let's revisit that idea from earlier about the recursive algorithm implicitly using a call stack as its core data structure.
Here's what is stored on a call stack:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Function arguments: the values passed to a function.&lt;/li&gt;
&lt;li&gt;Stack variables: variables whose lifetime is defined by a particular function call.
See &lt;a href="https://en.wikipedia.org/wiki/Automatic_variable"&gt;automatic variable&lt;/a&gt; and &lt;a href="https://en.wikipedia.org/wiki/Local_variable"&gt;local variable&lt;/a&gt;, the terminology is fuzzy here because different languages use different words for similar concepts.&lt;/li&gt;
&lt;li&gt;Return Address: which code to return to executing when this function exits&lt;/li&gt;
&lt;li&gt;The calling function's register values: The called function saves the calling function's state so that the calling function's context can be restored when the called function returns.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;These components make up a stack frame, the information required to track a function call.
Every time any function is called a stack frame is pushed onto the call stack, and every time a function returns its frame is popped off the call stack.&lt;/p&gt;
&lt;p&gt;Let's take another look at a recursive traversal algorithm so we can see which elements of the stack frame we need to simulate in order to traverse a tree with iteration.&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;recursive_traverse&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;t&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt;
    &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="n"&gt;t&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;l&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
        &lt;span class="n"&gt;traverse&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;t&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;l&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="nb"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;t&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;data&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="n"&gt;t&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;r&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
        &lt;span class="n"&gt;traverse&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;t&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;r&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;


&lt;p&gt;This function has an argument, &lt;code&gt;t&lt;/code&gt;, which refers the (sub)tree to traverse.
My first iterative algorithm stored nodes in its stack and we'll still need to do that going forwards.&lt;/p&gt;
&lt;p&gt;There aren't any local variables other than &lt;code&gt;t&lt;/code&gt;, so I won't make any space for them in my simulated stack frame.&lt;/p&gt;
&lt;p&gt;The recursive &lt;code&gt;traverse&lt;/code&gt; function returns to a previous call of the &lt;code&gt;traverse&lt;/code&gt; function, or it simply stops executing once the traversal is complete.
This is simpler than what a real call stack has to manage, a real call stack stores a return address to resume execution at when a function call returns.
Since my case is simpler I can leave the return address out of the simulated stack frame.&lt;/p&gt;
&lt;p&gt;The last information in a real stack frame are the calling function's register values.
The registers are a computer's scratch space, as a function executes it can load values from memory into registers, do math, and write the results back to memory.
One particularly important register is the Program Counter which stores the line number of the code that should execute next.
This value is saved on the stack when one function calls another so that the original function knows where it left off before calling the other function.
When the subcall returns, the original function restores the program counter register using its stored value and resumes execution.&lt;/p&gt;
&lt;p&gt;The recursive traverse function does rely on this element of the stack frame.
The function includes two function calls, and when those calls return the &lt;code&gt;traverse&lt;/code&gt; needs to know where to resume.&lt;/p&gt;
&lt;p&gt;This is the "stack frame" I came up with to organize my new iterative tree traversal:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;span class="k"&gt;class&lt;/span&gt; &lt;span class="nc"&gt;stackframe&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
    &lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="fm"&gt;__init__&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="bp"&gt;self&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;node&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt;
        &lt;span class="bp"&gt;self&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;node&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;node&lt;/span&gt;
        &lt;span class="bp"&gt;self&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;execution_step&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;1&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;


&lt;p&gt;&lt;code&gt;node&lt;/code&gt; refers to a node to print or traverse, and the &lt;code&gt;execution_step&lt;/code&gt; attribute is my program counter analog.
The recursive traversal function has three execution steps: traverse the left subtree, print the node, and traverse the right subtree.
Each node's stack frame records which step it's on in the &lt;code&gt;execution_step&lt;/code&gt; attribute.&lt;/p&gt;
&lt;p&gt;Here is the recursive in-order traversal algorithm translated to use the simulated stack frame.&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;fancy_iterative_traverse&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;root&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt;
    &lt;span class="n"&gt;stack&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="n"&gt;stackframe&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;root&lt;/span&gt;&lt;span class="p"&gt;)]&lt;/span&gt;

    &lt;span class="k"&gt;while&lt;/span&gt; &lt;span class="n"&gt;stack&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
        &lt;span class="n"&gt;context&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;stack&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;

        &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="n"&gt;context&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;execution_step&lt;/span&gt; &lt;span class="o"&gt;&amp;gt;&lt;/span&gt; &lt;span class="mi"&gt;3&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
            &lt;span class="n"&gt;stack&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;pop&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;

        &lt;span class="c1"&gt;# Step 1: traverse left subtree&lt;/span&gt;
        &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="n"&gt;context&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;execution_step&lt;/span&gt; &lt;span class="o"&gt;==&lt;/span&gt; &lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
            &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="n"&gt;context&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;node&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;l&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
                &lt;span class="n"&gt;stack&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;append&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;stackframe&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;context&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;node&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;l&lt;/span&gt;&lt;span class="p"&gt;))&lt;/span&gt;

        &lt;span class="c1"&gt;# Step 2: process this node&lt;/span&gt;
        &lt;span class="k"&gt;elif&lt;/span&gt; &lt;span class="n"&gt;context&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;execution_step&lt;/span&gt; &lt;span class="o"&gt;==&lt;/span&gt; &lt;span class="mi"&gt;2&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
            &lt;span class="nb"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;context&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;node&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;data&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

        &lt;span class="c1"&gt;# Step 3: traverse right subtree&lt;/span&gt;
        &lt;span class="k"&gt;elif&lt;/span&gt; &lt;span class="n"&gt;context&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;execution_step&lt;/span&gt; &lt;span class="o"&gt;==&lt;/span&gt; &lt;span class="mi"&gt;3&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
            &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="n"&gt;context&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;node&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;r&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
                &lt;span class="n"&gt;stack&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;append&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;stackframe&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;context&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;node&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;r&lt;/span&gt;&lt;span class="p"&gt;))&lt;/span&gt;

        &lt;span class="n"&gt;context&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;execution_step&lt;/span&gt; &lt;span class="o"&gt;+=&lt;/span&gt; &lt;span class="mi"&gt;1&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;


&lt;p&gt;This is nice because it's easy to rearrange the code to perform pre-order or post-order traversals instead.
Adding steps would be a pain though, and translating more complex recursive functions would require a more sophisticated simulated call stack.&lt;/p&gt;
&lt;p&gt;I'm not aware of any practical applications of this technique, there's no reason to maintain your own specialized call stack instead of using the one provided by your compiler or runtime environment.
It is interesting to apply low-level programming concepts in a high level language though.&lt;/p&gt;
&lt;hr&gt;

&lt;p&gt;&lt;a name="footnote1" href="#reference1"&gt;1&lt;/a&gt;: This is a contrast to the familiar Fibonacci sequence example that is often used to teach recursion.
Calculating Fibonacci numbers recursively is straightforward, but you can do it iteratively just as easily.
Fibonacci is an okay example to begin with but more motivating examples are also required to demonstrate that recursion can be simpler than iteration.&lt;/p&gt;
&lt;p&gt;&lt;a name="footnote2" href="#reference2"&gt;2&lt;/a&gt;: Refer to &lt;a href="https://en.wikipedia.org/wiki/Tree_traversal#Implementations"&gt;Wikipedia's article on tree traversal&lt;/a&gt; for examples of other iterative tree traversals.&lt;/p&gt;</content><category term="Tech"></category></entry><entry><title>Rocky Shore</title><link href="http://www.pmallory.com/rocky-shore.html" rel="alternate"></link><published>2016-04-16T00:00:00-07:00</published><updated>2016-04-16T00:00:00-07:00</updated><author><name>Philip Mallory</name></author><id>tag:www.pmallory.com,2016-04-16:/rocky-shore.html</id><content type="html">&lt;p&gt;It's an ocean!&lt;/p&gt;
&lt;p&gt;&lt;a href="/images/paintings/April_16_2016-Rocky_Shore.jpg"&gt;&lt;img src="/images/paintings/small-April_16_2016-Rocky_Shore.jpg" alt="Painting of waves breaking against a rock" class="center" /&gt;&lt;/a&gt;&lt;/p&gt;</content><category term="Painting"></category></entry><entry><title>Cloudy Moonrise</title><link href="http://www.pmallory.com/cloudy-moonrise.html" rel="alternate"></link><published>2016-04-02T00:00:00-07:00</published><updated>2016-04-02T00:00:00-07:00</updated><author><name>Philip Mallory</name></author><id>tag:www.pmallory.com,2016-04-02:/cloudy-moonrise.html</id><content type="html">&lt;p&gt;I found an unusually proportioned canvas at the art supply store and made this.&lt;/p&gt;
&lt;p&gt;&lt;a href="/images/paintings/April_2_2016-Cloudy_Moon.jpg"&gt;&lt;img src="/images/paintings/small-April_2_2016-Cloudy_Moon.jpg" alt="Painting of moonrise on a cloudy night" class="center" /&gt;&lt;/a&gt;&lt;/p&gt;</content><category term="Painting"></category></entry><entry><title>Muddy Mountain</title><link href="http://www.pmallory.com/muddy-mountain.html" rel="alternate"></link><published>2016-02-28T00:00:00-08:00</published><updated>2016-02-28T00:00:00-08:00</updated><author><name>Philip Mallory</name></author><id>tag:www.pmallory.com,2016-02-28:/muddy-mountain.html</id><content type="html">&lt;p&gt;&lt;a href="/images/paintings/February_28_2016-Muddy_Mountain.jpg"&gt;&lt;img src="/images/paintings/small-February_28_2016-Muddy_Mountain.jpg" alt="Painting of brown mountain with lake and barn in foreground." class="center" /&gt;&lt;/a&gt;&lt;/p&gt;</content><category term="Painting"></category></entry><entry><title>Spanish Moss</title><link href="http://www.pmallory.com/spanish-moss.html" rel="alternate"></link><published>2016-02-06T00:00:00-08:00</published><updated>2016-02-06T00:00:00-08:00</updated><author><name>Philip Mallory</name></author><id>tag:www.pmallory.com,2016-02-06:/spanish-moss.html</id><content type="html">&lt;p&gt;I like the subdued colors of this one.
Also the Spanish moss.&lt;/p&gt;
&lt;p&gt;&lt;a href="/images/paintings/February_6_2016-Spanish_Moss.jpg"&gt;&lt;img src="/images/paintings/small-February_6_2016-Spanish_Moss.jpg" alt="Painting of swamp with Spanish moss." class="center" /&gt;&lt;/a&gt;&lt;/p&gt;</content><category term="Painting"></category></entry><entry><title>Wonky Creek</title><link href="http://www.pmallory.com/wonky-creek.html" rel="alternate"></link><published>2016-01-18T00:00:00-08:00</published><updated>2016-01-18T00:00:00-08:00</updated><author><name>Philip Mallory</name></author><id>tag:www.pmallory.com,2016-01-18:/wonky-creek.html</id><content type="html">&lt;p&gt;I didn't get the colors right in this one.
The goal was to have sunlight peeking around a bend in the creek, but I didn't gradually change the lighting so it didn't work out.
Oh well, every painting is practice :&amp;#41;&lt;/p&gt;
&lt;p&gt;&lt;a href="/images/paintings/January_18_2016-Wonky_Creek.jpg"&gt;&lt;img src="/images/paintings/small-January_18_2016-Wonky_Creek.jpg" alt="Painting of rushing creek in a forest." class="center" /&gt;&lt;/a&gt;&lt;/p&gt;</content><category term="Painting"></category></entry><entry><title>Pasture at Sunset</title><link href="http://www.pmallory.com/pasture-at-sunset.html" rel="alternate"></link><published>2015-11-21T00:00:00-08:00</published><updated>2015-11-21T00:00:00-08:00</updated><author><name>Philip Mallory</name></author><id>tag:www.pmallory.com,2015-11-21:/pasture-at-sunset.html</id><content type="html">&lt;p&gt;The details in the grass were fun to paint.&lt;/p&gt;
&lt;p&gt;&lt;a href="/images/paintings/November_21_2015-Pasture_at_Sunset.jpg"&gt;&lt;img src="/images/paintings/small-November_21_2015-Pasture_at_Sunset.jpg" alt="Painting of field before foothills, with rustic house and fence, at sunset." class="center" /&gt;&lt;/a&gt;&lt;/p&gt;</content><category term="Painting"></category></entry><entry><title>Spiky Lump Mountains II</title><link href="http://www.pmallory.com/spiky-lump-mountains-ii.html" rel="alternate"></link><published>2015-11-11T00:00:00-08:00</published><updated>2015-11-11T00:00:00-08:00</updated><author><name>Philip Mallory</name></author><id>tag:www.pmallory.com,2015-11-11:/spiky-lump-mountains-ii.html</id><content type="html">&lt;p&gt;&lt;a href="/images/paintings/November_11_2015-Spiky_Lump_Mountains_II.jpg"&gt;&lt;img src="/images/paintings/small-November_11_2015-Spiky_Lump_Mountains_II.jpg" alt="Painting of mountain and pond with trees." class="center" /&gt;&lt;/a&gt;&lt;/p&gt;</content><category term="Painting"></category></entry><entry><title>High Creek</title><link href="http://www.pmallory.com/high-creek.html" rel="alternate"></link><published>2015-11-01T00:00:00-07:00</published><updated>2015-11-01T00:00:00-07:00</updated><author><name>Philip Mallory</name></author><id>tag:www.pmallory.com,2015-11-01:/high-creek.html</id><content type="html">&lt;p&gt;&lt;a href="/images/paintings/November_1_2015-High_Creek.jpg"&gt;&lt;img src="/images/paintings/small-November_1_2015-High_Creek.jpg" alt="Painting of a rushing creek with a waterfall, and a shed." class="center" /&gt;&lt;/a&gt;&lt;/p&gt;</content><category term="Painting"></category></entry><entry><title>Pond and Barn</title><link href="http://www.pmallory.com/pond-and-barn.html" rel="alternate"></link><published>2015-09-27T00:00:00-07:00</published><updated>2015-09-27T00:00:00-07:00</updated><author><name>Philip Mallory</name></author><id>tag:www.pmallory.com,2015-09-27:/pond-and-barn.html</id><content type="html">&lt;p&gt;The reflection of the red roof in the pond is nice :&amp;#41;&lt;/p&gt;
&lt;p&gt;&lt;a href="/images/paintings/September_27_2015-Pond_and_Barn.jpg"&gt;&lt;img src="/images/paintings/small-September_27_2015-Pond_and_Barn.jpg" alt="A painting of a barn by a pond." class="center" /&gt;&lt;/a&gt;&lt;/p&gt;</content><category term="Painting"></category></entry><entry><title>Purple Sunset</title><link href="http://www.pmallory.com/purple-sunset.html" rel="alternate"></link><published>2015-08-16T00:00:00-07:00</published><updated>2015-08-16T00:00:00-07:00</updated><author><name>Philip Mallory</name></author><id>tag:www.pmallory.com,2015-08-16:/purple-sunset.html</id><content type="html">&lt;p&gt;&lt;a href="/images/paintings/August_16_2015-Purple_Sunset.jpg"&gt;&lt;img src="/images/paintings/small-August_16_2015-Purple_Sunset.jpg" alt="Painting of mountain and scraggly trees at sunset" class="center" /&gt;&lt;/a&gt;&lt;/p&gt;</content><category term="Painting"></category></entry><entry><title>Mountain Lake</title><link href="http://www.pmallory.com/mountain-lake.html" rel="alternate"></link><published>2015-08-09T00:00:00-07:00</published><updated>2015-08-09T00:00:00-07:00</updated><author><name>Philip Mallory</name></author><id>tag:www.pmallory.com,2015-08-09:/mountain-lake.html</id><content type="html">&lt;p&gt;&lt;a href="/images/paintings/August_9_2015-Mountain_Lake.jpg"&gt;&lt;img src="/images/paintings/small-August_9_2015-Mountain_Lake.jpg" alt="Painting of mountain lake surrounded by brush" class="center" /&gt;&lt;/a&gt;&lt;/p&gt;</content><category term="Painting"></category></entry><entry><title>Spiky Lump Mountains</title><link href="http://www.pmallory.com/spiky-lump-mountains.html" rel="alternate"></link><published>2015-08-01T00:00:00-07:00</published><updated>2015-08-01T00:00:00-07:00</updated><author><name>Philip Mallory</name></author><id>tag:www.pmallory.com,2015-08-01:/spiky-lump-mountains.html</id><content type="html">&lt;p&gt;Spiky Lump Mountains, my first painting.&lt;/p&gt;
&lt;p&gt;&lt;a href="/images/paintings/August_1_2015-Spiky_Lump_Mountains.jpg"&gt;&lt;img src="/images/paintings/small-August_1_2015-Spiky_Lump_Mountains.jpg" alt="Painting of mountain with lake" class="center" /&gt;&lt;/a&gt;&lt;/p&gt;</content><category term="Painting"></category></entry><entry><title>Reading Log</title><link href="http://www.pmallory.com/reading-log.html" rel="alternate"></link><published>2015-06-07T00:00:00-07:00</published><updated>2015-06-07T00:00:00-07:00</updated><author><name>Philip Mallory</name></author><id>tag:www.pmallory.com,2015-06-07:/reading-log.html</id><summary type="html">&lt;p&gt;I've decided to start logging the books I read and to write brief book reports about them.
I think maintaining a log will confer a lot of the same benefits of maintaining a personal library (reflecting on previous reads, showing off) except without the trouble of buying, storing and organizing …&lt;/p&gt;</summary><content type="html">&lt;p&gt;I've decided to start logging the books I read and to write brief book reports about them.
I think maintaining a log will confer a lot of the same benefits of maintaining a personal library (reflecting on previous reads, showing off) except without the trouble of buying, storing and organizing tons of books.
Public libraries can take care of that for me!&lt;/p&gt;
&lt;p&gt;Without further ado here's the book's I've read recently:&lt;/p&gt;
&lt;h3&gt;Brief Interviews with Hideous Men - David Foster Wallace&lt;/h3&gt;
&lt;p&gt;This is a collection of short stories (each story is a fictional interview).
The stories are generally depressing and cynical but some of them are humorous too.
The writing is very good and this is a very good introduction to David Foster Wallace's fiction, these stories convey his style well without being thousands of pages long.&lt;/p&gt;
&lt;p&gt;This is worth rereading.&lt;/p&gt;
&lt;p&gt;&lt;a href="http://www.theparisreview.org/fiction/1225/brief-interviews-with-hideous-men-david-foster-wallace"&gt;One of the interviews&lt;/a&gt; is available to read online. Warning! This story contains scary rape stuff.&lt;/p&gt;
&lt;h3&gt;Consider the Lobster and other Essay - David Foster Wallaces&lt;/h3&gt;
&lt;p&gt;This collection of essays features articles originally published in long form magazines like Rolling Stone.
The essays are nonfiction and are about interesting topics.
The titular essay, Consider the Lobster, is fun and worth reading.
You can find it online too.
The rest of the essays are worth reading if you like DFW's writing style, it's fun to see how he varies his style to be more approachable to readers who wouldn't read his novels, and it's also fun to compare his fiction to his nonfiction.&lt;/p&gt;
&lt;p&gt;Thank you Jesse for recommending this to me :)&lt;/p&gt;
&lt;h3&gt;Infinite Jest - David Foster Wallace&lt;/h3&gt;
&lt;p&gt;This is an enormously huge novel (1079 pages) consisting of very dense prose.
Many pages have footnotes, some of the footnotes are many pages long, some of the footnotes have their own footnotes, and one of the footnotes is over 30 pages long.
Also the footnotes are printed in tiny type so the 1079 page figure underrepresents the true length of the book.&lt;/p&gt;
&lt;p&gt;If you can tolerate that though the book is pretty neat.
You can (and people do) argue that the book could accomplish the same narrative and artistic objectives without being so long, but I think the length is justified.
One of the emotional themes of the book is a sense of crushing, pervasive, futility that exists in an enormously complex society composed of myriad participants who are individually and collectively insignificant.
An enormous, sprawling novel is a pretty good way to express that.
I'm sure the book could have been a bit shorter (one chapter in particular seemed pointless to me) but it's great the way it is.&lt;/p&gt;
&lt;p&gt;Wallace did bunches of research and planning when writing the novel and that contributes a lot to the story but there are some rough edges that made me question his credibility.
In particular some of his descriptions of psychedelic drugs were a bit ridiculous; it felt like he was piecing together knowledge gleaned from stories related to him by acquaintances and stories from bluelight.ru
This doesn't undermine the narrative or the themes of the book, but it did force me to question Wallace's knowledge of the other plot elements.
Maybe the parts about tennis, Canada, and rape would also seem dubious if I were more familiar with those topics.&lt;/p&gt;
&lt;p&gt;If you enjoy angst and don't plan on reading anything else for the next few months this a great book for you.&lt;/p&gt;
&lt;h3&gt;Life on the Mississippi - Mark Twain&lt;/h3&gt;
&lt;p&gt;I really liked this.
The book is a memoir (with some of Twain's signature exaggeration) about Mark Twain's experiences on the Mississippi River.
The topics covered include:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;America's westward expansion (when "the west" referred to things west of the Mississippi).&lt;/li&gt;
&lt;li&gt;The ins and outs of steamboat commerce. This includes piloting, the effect of geography on commerce, the effects of commerce on society, etc.&lt;/li&gt;
&lt;li&gt;What New Orleans was like.&lt;/li&gt;
&lt;li&gt;What life was like during the Civil War (this includes one battle, but the parts about the effects on society and commerce were more interesting to me).&lt;/li&gt;
&lt;li&gt;Many other fascinating things&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;I feel like I have a much better understanding of the United States in the middle of the 19th century after reading the book.
It isn't a history book, and it wasn't intended as one, but it is very informative while also being a fun and easy read.&lt;/p&gt;
&lt;p&gt;I recommend the book, but I'm not likely not read it again.&lt;/p&gt;
&lt;h3&gt;Huckleberry Finn - Mark Twain&lt;/h3&gt;
&lt;p&gt;A lot has been written about this book and I don't have much to add.
It's very good and if you're a literate American you should probably read it.&lt;/p&gt;
&lt;h3&gt;Puddn' Head Wilson - Mark Twain&lt;/h3&gt;
&lt;p&gt;This book is less well known so I'll spend more time describing it.
It's one of Twain's later novels and it isn't as timeless as The Adventures of Tom Sawyer and Huckleberry Finn.
It was a fun read though, it's a murder mystery set in a small town on the Mississippi River.
The book is very clever and tidy but there are two facets that stand out.
First: I think Twain got increasingly cynical over his career and he didn't really try to filter that.
The book is as humorous and witty as anything else he wrote, but it's kind of depressing too.
That's not a flaw, but it is very noticeable.
The book does have an actual flaw though, it's obvious from very early on how the mystery will be resolved.
I don't know if this is intentional or if I as a modern reader am more familiar with crime tropes than readers in the late 19th century were.&lt;/p&gt;
&lt;p&gt;Also, if you've ever read your Unix fortune file and wondered what Puddn' Head Wilson's Calendar is, this book has the answer!&lt;/p&gt;
&lt;p&gt;Altogether the book was worth reading, but is not worth a reread.&lt;/p&gt;
&lt;h3&gt;Cannery Row - John Steinbeck&lt;/h3&gt;
&lt;p&gt;This book is fantastic.
It's a short novel/novella set in Monterey California sometime between world wars one and two.
The book has a plot but that's not really the point, it's like an extended prose poem.
It's just page after page of beautiful imagery and euphony.
If you like the English language and the craft of writing this is a great book to read.&lt;/p&gt;
&lt;p&gt;The book also conveys a very nice, and particularly Californian, sense of freedom.
I could describe the plot further (there's a marine biologist, a truck and a puppy for instance) but since that's all ancillary to what the book is about I won't bother.&lt;/p&gt;
&lt;p&gt;Highly recommended, and worth rereading.&lt;/p&gt;
&lt;h3&gt;Heretics of Dune - Frank Herbert&lt;/h3&gt;
&lt;p&gt;This book was fun but also ridiculous and somewhat stupid.
If you haven't read Dune read it.
If you're still reading the sequels by the time you get to Heretics of Dune you may as well keep reading.&lt;/p&gt;
&lt;p&gt;Weakly recommended, not worth rereading.&lt;/p&gt;
&lt;h3&gt;The Intelligent Asset Allocator - William J. Bernstein&lt;/h3&gt;
&lt;p&gt;This is an overview of index investing, asset allocation, and diversification.
It isn't a how-to book but it isn't a textbook either; maybe it's like an readable, somewhat opinionated text book.
Anyways the book does a very good job of explaining what it means to optimize an asset allocation, how you can measure that sort of thing, and the choices you make when allocating assets.
As I said this isn't a how-to book, but now that I've read it I can confidently handle my own asset allocation in a confident and informed sort of way.&lt;/p&gt;
&lt;p&gt;Highly recommended, maybe worth rereading.&lt;/p&gt;
&lt;h3&gt;A Random Walk Down Wall Street - Burton Malkiel&lt;/h3&gt;
&lt;p&gt;An introduction to how stock markets move and the efficient market hypothesis.
This book is helpful for becoming an unemotional investor and for understanding why diversification and indexing are worthwhile.
The book is still completely applicable 42 years after it was written which is pretty impressive considering that most personal finance books are garbage from the day they're published.&lt;/p&gt;
&lt;p&gt;Highly recommended&lt;/p&gt;
&lt;h3&gt;Your Money or Your Life - Vicki Robin, Joe Dominguez&lt;/h3&gt;
&lt;p&gt;This is book is much more emotional and much less technical than the previous two.
It explains the mindset necessary to have functional personal finances.
I thought it was pretty boring and basic so I skimmed through it.
The book did have a nice, happy, wholesome, environmentally conscious, hippy, self actualization vibe to it which I liked.&lt;/p&gt;
&lt;p&gt;Recommended if you're new to personal finance, if you have no idea what you're doing, or if you're still figuring out how to be an adult.
If you're already good at saving money and have long term financial goals you should pass.&lt;/p&gt;
&lt;h3&gt;One Flew Over the Cuckoos Nest - Ken Kesey&lt;/h3&gt;
&lt;p&gt;A lot has been written about this book and I don't have much to add.
One particular thing I liked about this book is that it was written nearby to where I live (I read the book shortly after moving to the SF peninsula) and that made learning about Kesey more fun and relatable.
The book is very good and if you're a literate American you should probably read it.&lt;/p&gt;
&lt;p&gt;Here's a good interview of &lt;a href="http://www.theparisreview.org/interviews/1830/the-art-of-fiction-no-136-ken-kesey"&gt;Ken Kesey&lt;/a&gt;.
It is fascinating.&lt;/p&gt;
&lt;p&gt;Thank you Carson for recommending this to me :)&lt;/p&gt;
&lt;p&gt;Highly recommended&lt;/p&gt;
&lt;h3&gt;The Fractal Geometry of Nature - Benoit Mandelbrot&lt;/h3&gt;
&lt;p&gt;This is basically a coffee table book, leave it laying out to impress your friends!
The pictures are pretty but the text is pretty worthless in my opinion.
Mandelbrot explained that the book wasn't meant to be read straight through, but I think that's just an excuse for writing a badly organized book with no clearly defined audience.
Fractals are awesome but there are better ways to learn about them.&lt;/p&gt;
&lt;p&gt;Not recommended.&lt;/p&gt;</content><category term="misc"></category></entry><entry><title>Crag Bars</title><link href="http://www.pmallory.com/crag-bars.html" rel="alternate"></link><published>2014-09-28T00:00:00-07:00</published><updated>2014-09-28T00:00:00-07:00</updated><author><name>Philip Mallory</name></author><id>tag:www.pmallory.com,2014-09-28:/crag-bars.html</id><summary type="html">&lt;p&gt;This is my recipe for chewy, calorie dense, high protein food bars (they're like concentrated Clif Bars).
These are good for camping or for refueling on really long bike rides.
This recipe yields 8-10 bars that have about 500 Calories and 23 g of protein each.
The ingredients for one …&lt;/p&gt;</summary><content type="html">&lt;p&gt;This is my recipe for chewy, calorie dense, high protein food bars (they're like concentrated Clif Bars).
These are good for camping or for refueling on really long bike rides.
This recipe yields 8-10 bars that have about 500 Calories and 23 g of protein each.
The ingredients for one batch cost less than $10, about half as much as an equivalent amount of Clif Bars.&lt;/p&gt;
&lt;h2&gt;Ingredients&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;2 cups oatmeal&lt;/li&gt;
&lt;li&gt;1 cup ground flax seed&lt;/li&gt;
&lt;li&gt;1 cup protein powder (I use unflavored whey extract. Flavored powder works too)&lt;/li&gt;
&lt;li&gt;1 cup crunchy peanut butter&lt;/li&gt;
&lt;li&gt;1 cup honey&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&lt;a href="/images/cragbars/ingredients.jpg"&gt;&lt;img src="/images/cragbars/small-ingredients.jpg" alt="Ingredients" class="center" /&gt;&lt;/a&gt;&lt;/p&gt;
&lt;h2&gt;Instructions&lt;/h2&gt;
&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;Put everything in a mixing bowl.
&lt;a href="/images/cragbars/bowl.jpg"&gt;&lt;img src="/images/cragbars/small-bowl.jpg" alt="Mixng bowl" class="center" /&gt;&lt;/a&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Mix everything by hand. I guess you could use a mixer instead but that'd be way harder to clean.
&lt;a href="/images/cragbars/mixing.jpg"&gt;&lt;img src="/images/cragbars/small-mixing.jpg" alt="Mixing bowl" class="center" /&gt;&lt;/a&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Mix thoroughly, you don't want any dry powdery patches.
&lt;a href="/images/cragbars/mixed.jpg"&gt;&lt;img src="/images/cragbars/small-mixed.jpg" alt="Mixed ingredients" class="center" /&gt;&lt;/a&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Wash your hands and then make the bars.
At this point the bars are remarkably unsticky; the dry ingredients have mostly absorbed the sticky ingredients.
Make 8-12 bars, it's really easy to accidentally make the bars way too big.
You can make smaller bars if you'd prefer snack sized portions.
Smoosh the bars together well, the bars will break apart if they have seams in them.
&lt;a href="/images/cragbars/done.jpg"&gt;&lt;img src="/images/cragbars/small-done.jpg" alt="Crag Bars" class="center" /&gt;&lt;/a&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Let the bars air out overnight so that the oatmeal soaks up the stickiness and the excess moisture evaporates.&lt;/p&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;h2&gt;Adjustments&lt;/h2&gt;
&lt;p&gt;This recipe is adaptable, you can add fruit or nuts or anything else you want.
When you experiment try to maintain the ratio of sticky and absorbent ingredients so that the bars aren't crumbly or gooey.
Also if you add too many chunky ingredients the bars will fall apart.&lt;/p&gt;
&lt;h2&gt;Approximate Nutrition Facts&lt;/h2&gt;
&lt;p&gt;This is highly variable depending on your ingredients and how big your bars are.
I made nine bars and used salt-free peanut butter for instance.&lt;/p&gt;
&lt;p&gt;&lt;img src="/images/cragbars/small-NutritionLabel.png" alt="Nutritional facts" class="center" /&gt;&lt;/p&gt;</content><category term="Useful Info"></category></entry><entry><title>Square Taper Bottom Bracket Replacement</title><link href="http://www.pmallory.com/square-taper-bottom-bracket-replacement.html" rel="alternate"></link><published>2014-07-02T00:00:00-07:00</published><updated>2014-07-02T00:00:00-07:00</updated><author><name>Philip Mallory</name></author><id>tag:www.pmallory.com,2014-07-02:/square-taper-bottom-bracket-replacement.html</id><summary type="html">&lt;p&gt;&lt;a href="/images/bottom_bracket/beforeAfter.JPG"&gt;&lt;img src="/images/bottom_bracket/small-beforeAfter.JPG" alt="Old and new bottom brackets" class="center" /&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;I've noticed that most bicycle repair guides on the Internet are written by people who know what they're doing.
This is probably a good thing, but these resources also tend to assume their readers have some level of background knowledge and basic competence.
Since I'm not handicapped by basic competence …&lt;/p&gt;</summary><content type="html">&lt;p&gt;&lt;a href="/images/bottom_bracket/beforeAfter.JPG"&gt;&lt;img src="/images/bottom_bracket/small-beforeAfter.JPG" alt="Old and new bottom brackets" class="center" /&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;I've noticed that most bicycle repair guides on the Internet are written by people who know what they're doing.
This is probably a good thing, but these resources also tend to assume their readers have some level of background knowledge and basic competence.
Since I'm not handicapped by basic competence I'm uniquely qualified to write a more approachable take on bicycle repair.
My bike is a mid-nineties mountain bike, but the similar principles apply to most bikes built since the mid 1980s.&lt;/p&gt;
&lt;p&gt;This article is intended to supplement articles written by competent people.
If you haven't already read &lt;a href="http://www.parktool.com/blog/repair-help/cartridge-bearing-type-bottom-bracket-service-bbt"&gt;Park Tool's guide&lt;/a&gt; go do that.&lt;/p&gt;
&lt;h2&gt;What's a bottom bracket?&lt;/h2&gt;
&lt;p&gt;The bottom bracket is the axle doohickey that the pedals spin around.
This particular article is about square taper bottom brackets.&lt;/p&gt;
&lt;h2&gt;Why should I replace my bottom bracket?&lt;/h2&gt;
&lt;p&gt;I replaced mine because my pedals had so much side-to-side play that I couldn't adjust my front derailer properly.
The chain could move all over the place and spent most of its time rubbing the derailer cage.
Dead and dying bottom brackets can apparently also make awful grinding noises, though mine never did.&lt;/p&gt;
&lt;h2&gt;How do I buy the right replacement?&lt;/h2&gt;
&lt;p&gt;The easiest way is to ask a bike shop, but you'll never learn self reliance if you go around asking people for help all the time!&lt;/p&gt;
&lt;p&gt;You can figure it out yourself by looking up your bike on &lt;a href="http://www.bikepedia.com/"&gt;Bikepedia&lt;/a&gt;.
The two important numbers are the spindle width and the bottom bracket shell width.
The spindle width is how wide the unit is
Spindle width affects how far from the frame your pedals and cranks will be, if you get the wrong spindle width your chainline will be off.
The shell width is the diameter of the assembly that you install into the frame.&lt;/p&gt;
&lt;p&gt;Googling around is also a good idea.&lt;/p&gt;
&lt;p&gt;If your research reveals that you have a splined bottom bracket (Octalink or ISIS) then congratulations, you have a fancy bike!
Unfortunately this guide is about square taper bottom brackets (read on if you'd like though, the process is pretty similar).&lt;/p&gt;
&lt;h2&gt;What tools do I need?&lt;/h2&gt;
&lt;p&gt;The first two tools can be found in basic bike tool kits like &lt;a href="https://www.nashbar.com/bikes/Product_10053_10052_524452_-1___204676"&gt;this one&lt;/a&gt;:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;A crank extractor&lt;/li&gt;
&lt;li&gt;Cartridge bottom bracket tool&lt;/li&gt;
&lt;li&gt;A bike stand.
Doing this with the bike on the ground or balanced upside down would be no fun.&lt;/li&gt;
&lt;li&gt;Grease.
Fancy expensive bicycle grease exists, I used automotive chassis lube&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;You might also need allen wrenches and a screw driver.
Having a socket set handy is also a good idea.&lt;/p&gt;
&lt;h2&gt;What do?&lt;/h2&gt;
&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;The first step is to remove the cranks, if there are dust covers over the crank nuts remove them.
I pried mine off with a flathead screwdriver, some require an allen wrench.
You should see something like this:
&lt;a href="/images/bottom_bracket/dustCapRemoved.JPG"&gt;&lt;img src="/images/bottom_bracket/small-dustCapRemoved.JPG" alt="The crank nut" class="center" /&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;Remove the nut from the spindle (there might also be a washer).
Don't lose them!&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Now it's time to pull the cranks arms off the spindles, this is what the crank puller is for.
    If you're using a compact crank puller like mine it should look like this before you screw it onto the crank:&lt;/p&gt;
&lt;p&gt;&lt;a href="/images/bottom_bracket/extractor2.JPG"&gt;&lt;img src="/images/bottom_bracket/small-extractor2.JPG" alt="crank extractor" class="center" /&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;If you've ever used a pulley puller this thing operates in about the same way; by screwing the bolt part in you force the crank off of the spindle.
Play around with until it makes sense, then attach the extractor to the crank arm.
Screw the extractor's base onto the crank arm being careful not to cross the threads.
&lt;a href="/images/bottom_bracket/extracorInUse.JPG"&gt;&lt;img src="/images/bottom_bracket/small-extracorInUse.JPG" alt="crank extractor mounted on crank" class="center" /&gt;&lt;/a&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Turn the extractors bolt clockwise to force the crank arm off of the spindle.
If you have to resort to drastic measures like this:
&lt;a href="/images/bottom_bracket/doingItWrong.JPG"&gt;&lt;img src="/images/bottom_bracket/small-doingItWrong.JPG" alt="Don't do this" class="center" /&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;¡STOP YOU'RE DOING IT WRONG!&lt;/p&gt;
&lt;p&gt;The crank arm will be on there tight, but not 100 ft/lbs tight.
If you can't get the extractor to turn take it off the crank arm and make sure the tip is actually touching the spindle.
I had to take the tip off of my extractor to get it to fit my cranks:
&lt;a href="/images/bottom_bracket/extractorMod.JPG"&gt;&lt;img src="/images/bottom_bracket/small-extractorMod.JPG" alt="Modified crank extractor" class="center" /&gt;&lt;/a&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Remove the other crank.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Now it's time to remove the bottom bracket using the bottom bracket wrench:
&lt;a href="/images/bottom_bracket/BBWrench.JPG"&gt;&lt;img src="/images/bottom_bracket/small-BBWrench.JPG" alt="Bottom bracket wrench" class="center" /&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;Put the splines of the bottom bracket tool into the slots of the bottom bracket cups, and wrench away.&lt;/p&gt;
&lt;p&gt;¡VERY IMPORTANT OMG!
The cup on the drive side of the bottom bracket (the side closer to the chain) is reverse threaded.
Turn it clockwise to loosen it.&lt;/p&gt;
&lt;p&gt;The cups might be really stuck on there.
If they won't budge (and you've double checked to make sure you're turning the wrench the right way) feel free to resort to drastic measures.
Breaker bars, cheater pipes, and liberal use of WD-40 are all options here.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Time to install the new bottom bracket.
    Grease the threads of the new cups (unless they're plastic).
    I used automotive grease:
&lt;a href="/images/bottom_bracket/grease.JPG"&gt;&lt;img src="/images/bottom_bracket/small-grease.JPG" alt="Bottom bracket wrench" class="center" /&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;A lifetime supply of this stuff costs about $3.
Some people recomend heavy duty or marine rated grease, I really don't think that's necessary for bicycles though.&lt;/p&gt;
&lt;p&gt;If you have a torque wrench use it, otherwise just get the cups good 'n tight.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;From here all that's left is to put the cranks back on (make sure they point in opposite directions).
    Tightening the crank nut will force the crank onto the spindle.
    Again, if you have a torque wrench use it (30ish ft-lbs).&lt;/p&gt;
&lt;/li&gt;
&lt;/ol&gt;</content><category term="Useful Info"></category></entry><entry><title>Color Cycling</title><link href="http://www.pmallory.com/color-cycling.html" rel="alternate"></link><published>2014-03-28T00:00:00-07:00</published><updated>2014-03-28T00:00:00-07:00</updated><author><name>Philip Mallory</name></author><id>tag:www.pmallory.com,2014-03-28:/color-cycling.html</id><summary type="html">&lt;iframe width="420" height="315" src="//www.youtube.com/embed/8YNk2UNqWzo" frameborder="0" allowfullscreen&gt;&lt;/iframe&gt;

&lt;p&gt;Color cycling is a nifty technique from the days of yore for creating animations.
The key idea of color cycling is to modify the color palette an image uses rather than the image itself.
Since each pixel on the screen is refers to some color in the palette, it's possible …&lt;/p&gt;</summary><content type="html">&lt;iframe width="420" height="315" src="//www.youtube.com/embed/8YNk2UNqWzo" frameborder="0" allowfullscreen&gt;&lt;/iframe&gt;

&lt;p&gt;Color cycling is a nifty technique from the days of yore for creating animations.
The key idea of color cycling is to modify the color palette an image uses rather than the image itself.
Since each pixel on the screen is refers to some color in the palette, it's possible to change many pixels at once by modifying the palette.
This takes much less time than redrawing the screen because the palette is significantly smaller than the video buffer itself.&lt;/p&gt;
&lt;p&gt;In this demo the palette is rotated every screen refresh:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;span class="n"&gt;palette[1]&lt;/span&gt; &lt;span class="o"&gt;&amp;lt;-&lt;/span&gt; &lt;span class="n"&gt;palette[2]&lt;/span&gt; &lt;span class="kc"&gt;...&lt;/span&gt; &lt;span class="o"&gt;&amp;lt;-&lt;/span&gt; &lt;span class="n"&gt;palette[255]&lt;/span&gt;
    &lt;span class="n"&gt;\_______________________________^&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;


&lt;p&gt;The source of this demo is on &lt;a href="https://github.com/pmallory/gba_ColorCycling/"&gt;GitHub&lt;/a&gt;.
The repo includes both the Game Boy code and a small Python program for generating palettes that cycle well.&lt;/p&gt;
&lt;p&gt;More complicated color cycling is possible too.
Sim City 2000 used color cycling to drive almost all of its animations (road traffic, water flowing through pipes, even the screen on the drive in movie theaters).
More intricate examples can be found &lt;a href="http://www.effectgames.com/demos/canvascycle/?sound=0"&gt;here&lt;/a&gt;.&lt;/p&gt;</content><category term="Tech"></category></entry><entry><title>Bitmap Graphics on the Nintendo DS - Part 2: Mode 3</title><link href="http://www.pmallory.com/bitmap-graphics-on-the-nintendo-ds-part-2-mode-3.html" rel="alternate"></link><published>2014-02-27T00:00:00-08:00</published><updated>2014-02-27T00:00:00-08:00</updated><author><name>Philip Mallory</name></author><id>tag:www.pmallory.com,2014-02-27:/bitmap-graphics-on-the-nintendo-ds-part-2-mode-3.html</id><summary type="html">&lt;p&gt;This is the second post in a two post series on drawing and animating bitmap graphics on the Nintendo DS.
The first part is &lt;a href="bitmap-graphics-on-the-nintendo-ds-part-1-framebuffer-mode.html"&gt;here&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;The biggest problem with frame buffer mode is that it could only draw on the DS's primary display.
To solve that issue we'll need to …&lt;/p&gt;</summary><content type="html">&lt;p&gt;This is the second post in a two post series on drawing and animating bitmap graphics on the Nintendo DS.
The first part is &lt;a href="bitmap-graphics-on-the-nintendo-ds-part-1-framebuffer-mode.html"&gt;here&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;The biggest problem with frame buffer mode is that it could only draw on the DS's primary display.
To solve that issue we'll need to dig deeper into graphics hardware.&lt;/p&gt;
&lt;p&gt;The Nintendo DS has a graphics engine for each display, and each engine can be run in one of several modes.
These engines can be set to drive tile maps, 3d layers and the simplest option: bitmap backgrounds.
The engine mode that lets us draw bitmaps on both screens is Mode 3.&lt;/p&gt;
&lt;p&gt;Writing for Mode 3 starts off about the same as writing for frame buffer mode.
First we set the display control registers appropriately:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;span class="n"&gt;REG_DISPCNT_MAIN&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;MODE3&lt;/span&gt; &lt;span class="o"&gt;|&lt;/span&gt; &lt;span class="n"&gt;BG3_ENABLE&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="n"&gt;REG_DISPCNT_SUB&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;MODE3&lt;/span&gt; &lt;span class="o"&gt;|&lt;/span&gt; &lt;span class="n"&gt;BG3_ENABLE&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;


&lt;p&gt;The engines driving both screens are now in Mode 3, and we've enabled background 3 on each.
Background 3 is an arbitrary choice, we could have enabled other backgrounds too if we were interested in using some sort of layering techniques.&lt;/p&gt;
&lt;p&gt;Now we have to configure the background on each display.
This step wasn't necessary in frame buffer mode.&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;span class="n"&gt;REG_BG3CNT&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt;  &lt;span class="n"&gt;BG_256x256&lt;/span&gt; &lt;span class="o"&gt;|&lt;/span&gt; &lt;span class="n"&gt;BG_15BITCOLOR&lt;/span&gt; &lt;span class="o"&gt;|&lt;/span&gt; &lt;span class="n"&gt;BG_CBB1&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="n"&gt;REG_BG3CNT_SUB&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;BG_256x256&lt;/span&gt; &lt;span class="o"&gt;|&lt;/span&gt; &lt;span class="n"&gt;BG_15BITCOLOR&lt;/span&gt; &lt;span class="o"&gt;|&lt;/span&gt; &lt;span class="n"&gt;BG_CBB1&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;


&lt;p&gt;Both backgrounds are now large enough to fill their screens, in fact they're larger than necessary!
It's possible to scroll these around (for example if the background is displaying  a map).
It's also worth noting that you could have a background that's smaller than the screen if for instance you wanted to display a small UI element like a health indicator.&lt;/p&gt;
&lt;p&gt;Now things get tricky.
Backgrounds on the DS have associated affine transformation matrices which let you scale, stretch and skew the background.
If you want to learn more you can read all about affine transformations in &lt;a href="http://www.coranac.com/tonc/text/affine.htm"&gt;TONC&lt;/a&gt;, an excellent resource on Nintendo programming.&lt;/p&gt;
&lt;p&gt;That's beyond this article though, we just want to draw plain, undistorted images to the screen.
This implies that we want our transformation matrix to be an identity matrix (that is when we apply the matrix to our graphics they come through unmodified).
Here's what a 2d identity matrix looks like:&lt;/p&gt;
&lt;p&gt;&lt;img alt="Identity matrix" src="/images/identity_matrix.png"&gt;&lt;/p&gt;
&lt;p&gt;So how do we get that into the DS?&lt;/p&gt;
&lt;p&gt;First we need to know about &lt;a href="https://instruct1.cit.cornell.edu/Courses/ee476/Math/index.html"&gt;fixed point numbers&lt;/a&gt;.
Fixed point numbers are a way to represent numbers with fractional parts.
In our case a fixed point number is stored as a 16 bit unsigned value where the first eight bits store the integer part of the number and the last eight store the fractional part.
This scheme of splitting a 16 bit number into two parts is called 8:8 fixed point.&lt;/p&gt;
&lt;p&gt;So how do we store 1.0 in fixed point?
The integer part is 1, so we put a 1 in the left byte.
The fractional part is 0, so we don't have to do anything with the right byte.&lt;/p&gt;
&lt;p&gt;Let's put some 1.0s and 0.0s into the affine matrices:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;span class="n"&gt;REG_BG3PA&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;1&lt;/span&gt; &lt;span class="o"&gt;&amp;lt;&amp;lt;&lt;/span&gt; &lt;span class="mi"&gt;8&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="n"&gt;REG_BG3PD&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;1&lt;/span&gt; &lt;span class="o"&gt;&amp;lt;&amp;lt;&lt;/span&gt; &lt;span class="mi"&gt;8&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="n"&gt;REG_BG3PA_SUB&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;1&lt;/span&gt; &lt;span class="o"&gt;&amp;lt;&amp;lt;&lt;/span&gt; &lt;span class="mi"&gt;8&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="n"&gt;REG_BG3PD_SUB&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;1&lt;/span&gt; &lt;span class="o"&gt;&amp;lt;&amp;lt;&lt;/span&gt; &lt;span class="mi"&gt;8&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;


&lt;p&gt;The letters A and D in those register names refer to which spot in the matrix that register is for:&lt;/p&gt;
&lt;p&gt;&lt;img alt="Affine matrix" src="/images/affinematrix.png"&gt;&lt;/p&gt;
&lt;p&gt;Our code puts 1.0s into A and D of the affine matrices of both backgrounds.
The other spots are set to 0.0 when the Game Boy turns on so we can leave them as is.&lt;/p&gt;
&lt;p&gt;Phew, now that we've got that settled we can finally draw things to the screen.
Fortunately this works almost the same way as it was in frame buffer mode:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;span class="kt"&gt;void&lt;/span&gt; &lt;span class="nf"&gt;setPixel3_main&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="kt"&gt;int&lt;/span&gt; &lt;span class="n"&gt;row&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="kt"&gt;int&lt;/span&gt; &lt;span class="n"&gt;col&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;u16&lt;/span&gt; &lt;span class="n"&gt;color&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="n"&gt;VIDEO_BUFFER_MAIN&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="n"&gt;OFFSET&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;row&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;col&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;SCREENWIDTH&lt;/span&gt;&lt;span class="p"&gt;)]&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;color&lt;/span&gt; &lt;span class="o"&gt;|&lt;/span&gt; &lt;span class="n"&gt;PIXEL_ENABLE&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;


&lt;span class="kt"&gt;void&lt;/span&gt; &lt;span class="nf"&gt;setPixel3_sub&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="kt"&gt;int&lt;/span&gt; &lt;span class="n"&gt;row&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="kt"&gt;int&lt;/span&gt; &lt;span class="n"&gt;col&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;u16&lt;/span&gt; &lt;span class="n"&gt;color&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="n"&gt;VIDEO_BUFFER_SUB&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="n"&gt;OFFSET&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;row&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;col&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;SCREENWIDTH&lt;/span&gt;&lt;span class="p"&gt;)]&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;color&lt;/span&gt; &lt;span class="o"&gt;|&lt;/span&gt; &lt;span class="n"&gt;PIXEL_ENABLE&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;


&lt;p&gt;If this is unfamiliar head back to &lt;a href="bitmap-graphics-on-the-nintendo-ds-part-1-framebuffer-mode.html"&gt;the previous article&lt;/a&gt; which covered OFFSET and color representation.
The only new thing here is PIXEL_ENABLE.&lt;/p&gt;
&lt;p&gt;Last time we learned that colors are represented by 16 bit numbers with 5 bits for each component, red, green and blue.
In frame buffer mode that remaining bit was simply ignored.
Here in Mode 3 it isn't ignored, if that bit isn't set the pixel isn't drawn.
This can be used for transparency if you're layering backgrounds.&lt;/p&gt;
&lt;p&gt;setPixel() can be used as the basis for all sort of drawing functions:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;span class="kt"&gt;void&lt;/span&gt; &lt;span class="nf"&gt;drawRect3_main&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="kt"&gt;int&lt;/span&gt; &lt;span class="n"&gt;row&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="kt"&gt;int&lt;/span&gt; &lt;span class="n"&gt;col&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="kt"&gt;int&lt;/span&gt; &lt;span class="n"&gt;width&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="kt"&gt;int&lt;/span&gt; &lt;span class="n"&gt;height&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;u16&lt;/span&gt; &lt;span class="n"&gt;color&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="kt"&gt;int&lt;/span&gt; &lt;span class="n"&gt;r&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;c&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="k"&gt;for&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;c&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="n"&gt;col&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="n"&gt;c&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="n"&gt;col&lt;/span&gt;&lt;span class="o"&gt;+&lt;/span&gt;&lt;span class="n"&gt;width&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="n"&gt;c&lt;/span&gt;&lt;span class="o"&gt;++&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="k"&gt;for&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;r&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="n"&gt;row&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="n"&gt;r&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="n"&gt;row&lt;/span&gt;&lt;span class="o"&gt;+&lt;/span&gt;&lt;span class="n"&gt;height&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="n"&gt;r&lt;/span&gt;&lt;span class="o"&gt;++&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
            &lt;span class="n"&gt;setPixel3_main&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;r&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;c&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;color&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
        &lt;span class="p"&gt;}&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;


&lt;p&gt;A corresponding function can be written for the secondary display.&lt;/p&gt;
&lt;p&gt;Here's a screen shot of all this in action:&lt;/p&gt;
&lt;p&gt;&lt;img alt="Mode 3 demo" src="/images/mode3.png"&gt;&lt;/p&gt;
&lt;p&gt;We've got the same bouncing ball from last time on the main display, and a rectangle and line hanging out on the secondary display.&lt;/p&gt;
&lt;p&gt;If you'd like to browse the source of this demo or download the code head on over to &lt;a href="https://github.com/pmallory/nds_mode3_bitmaps"&gt;GitHub&lt;/a&gt;.
You can also &lt;a href="/bin/nds_mode3_bitmaps.nds"&gt;download the ROM&lt;/a&gt; to run in an emulator.&lt;/p&gt;
&lt;h2&gt;Further Reading&lt;/h2&gt;
&lt;p&gt;There really aren't many good written resources on programming the Nintendo DS.&lt;/p&gt;
&lt;p&gt;A very thorough &lt;a href="http://nocash.emubase.de/gbatek.htm"&gt;spec sheet&lt;/a&gt; exists which explains the memory layout, control registers and other low level details.&lt;/p&gt;
&lt;p&gt;There's also &lt;a href="http://libnds.devkitpro.org/"&gt;libNDS&lt;/a&gt;, a community developed API for programming the DS.
An API reference exists and there's lots of example code.&lt;/p&gt;
&lt;p&gt;For a conceptual overview of Game Boy Advanced programming you can check out &lt;a href="http://www.coranac.com/tonc"&gt;TONC&lt;/a&gt;.
While it isn't directly applicable to the DS is it very very close.
Many topics (buttons, affine transformations, DMA, etc ) are identical or nearly identical on the GBA and DS.&lt;/p&gt;</content><category term="Tech"></category></entry><entry><title>Bitmap Graphics on the Nintendo DS - Part 1: Framebuffer mode</title><link href="http://www.pmallory.com/bitmap-graphics-on-the-nintendo-ds-part-1-framebuffer-mode.html" rel="alternate"></link><published>2014-02-01T00:00:00-08:00</published><updated>2014-02-01T00:00:00-08:00</updated><author><name>Philip Mallory</name></author><id>tag:www.pmallory.com,2014-02-01:/bitmap-graphics-on-the-nintendo-ds-part-1-framebuffer-mode.html</id><summary type="html">&lt;p&gt;This is the first post in a two part series on drawing and animating bitmap graphics on the Nintendo DS.
The second part is &lt;a href="bitmap-graphics-on-the-nintendo-ds-part-2-mode-3.html"&gt;here&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;The simplest way to draw graphics on the DS is frame buffer mode.
Frame buffer most is the closest analogue to the Game Boy Advance's …&lt;/p&gt;</summary><content type="html">&lt;p&gt;This is the first post in a two part series on drawing and animating bitmap graphics on the Nintendo DS.
The second part is &lt;a href="bitmap-graphics-on-the-nintendo-ds-part-2-mode-3.html"&gt;here&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;The simplest way to draw graphics on the DS is frame buffer mode.
Frame buffer most is the closest analogue to the Game Boy Advance's bitmap modes.
In frame buffer mode one of the video memory blocks is designated as the frame buffer.
Each short in that block represents one pixel and the format of that short is XBBBBBGGGGGRRRRR.
The least significant five bits are the pixel's red intensity, the next five are green and the last are blue.
This means that each color component can take a value from 0 to 31.
The most significant bit, denoted by an 'X', is ignored.&lt;/p&gt;
&lt;p&gt;Putting the DS in frame buffer mode is a two step process.
First the main screen's display control register is set to frame buffer mode:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;span class="n"&gt;REG_DISPCNT_MAIN&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;MODE_FB0&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;


&lt;p&gt;Then we enable the video memory bank that corresponds to the specific frame buffer mode we're in:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;span class="n"&gt;VRAM_A_CR&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;VRAM_ENABLE&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;


&lt;p&gt;In this case we enable VRAM bank A since we're in frame buffer mode 0, if we'd chosen MODE_FB1 we would enable VRAM_B.
MODE_FB2 and FB3 likewise correspond with VRAM banks C and D.&lt;/p&gt;
&lt;p&gt;With frame buffer mode enabled we can draw to the main screen by writing to the video bank.&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;span class="kt"&gt;void&lt;/span&gt; &lt;span class="nf"&gt;setPixel&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="kt"&gt;int&lt;/span&gt; &lt;span class="n"&gt;row&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="kt"&gt;int&lt;/span&gt; &lt;span class="n"&gt;col&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;u16&lt;/span&gt; &lt;span class="n"&gt;color&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="n"&gt;VRAM_A&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="n"&gt;OFFSET&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;row&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;col&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;SCREENWIDTH&lt;/span&gt;&lt;span class="p"&gt;)]&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;color&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;


&lt;p&gt;It's pretty simple, the only complication is calculating the index of a particular pixel.
The video memory is just a contiguous chunk of memory, it doesn't know anything about rows or columns.
Directly after row one (pixels 0 through 255) comes row two (pixels 256 through 511), and so on all the way down the screen.
This index can be calculated with a quick macro:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;span class="cp"&gt;#define OFFSET(r,c,w) ((r)*(w)+(c))&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;


&lt;p&gt;That's everything you need to draw an image, but there's one more piece need to enable animation.
In order to move an object on the screen you need to draw an image, wait a bit, then redraw it in a new position.
We know how to do the drawing parts, but what about waiting?&lt;/p&gt;
&lt;p&gt;The best approach is to wait until the display is in vertical blank to redraw the screen.
Vertical blank is the time in which the display isn't updating.
After the last row of pixels is drawn the video hardware waits a bit before returning to the top of the screen to begin redrawing.
This vertical blank period occurs about 60 times a second.
If we only update the framebuffer during these vertical blanks our game will animate at a reasonable 60 fps.
Another benefit of drawing during vblank is that the video memory isn't being modified as it's being drawn to the screen which would lead to glitchy graphical tearing.&lt;/p&gt;
&lt;p&gt;So how do we use this vblank time?
The DS provides a register that keeps track of which scanline is currently being drawn.
If we wait until the value in the scanline register ticks past the last row of the display we know we're in vblank.&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;span class="cp"&gt;#define SCANLINECOUNTER   *(vu16 *)0x4000006&lt;/span&gt;
&lt;span class="cp"&gt;#define SCREENHEIGHT (192)&lt;/span&gt;
&lt;span class="kt"&gt;void&lt;/span&gt; &lt;span class="nf"&gt;waitForVblank&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="k"&gt;while&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;SCANLINECOUNTER&lt;/span&gt; &lt;span class="o"&gt;&amp;gt;&lt;/span&gt; &lt;span class="n"&gt;SCREENHEIGHT&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
    &lt;span class="k"&gt;while&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;SCANLINECOUNTER&lt;/span&gt; &lt;span class="o"&gt;&amp;lt;&lt;/span&gt; &lt;span class="n"&gt;SCREENHEIGHT&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;


&lt;p&gt;So that's frame buffer mode.
I've made a demo that puts it all together:
&lt;video width="480" height="476" controls&gt;
    &lt;source src="/bin/ndsfb.mp4" type="video/mp4"&gt;
    Your browser does not support HTML5 video.
&lt;/video&gt;&lt;/p&gt;
&lt;p&gt;You can browse the source of this demo on &lt;a href="https://github.com/pmallory/nds_framebuffer_bitmaps"&gt;GitHub&lt;/a&gt;.
If you'd like to run the demo in an emulator you can &lt;a href="/bin/nds_framebuffer_bitmaps.nds"&gt;download the ROM&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;So what are the downsides of frame buffer mode?
The most obvious limitation is that it only lets you draw to one of the DS's screens.
Frame buffer mode is also less featureful than the other modes and doesn't really demonstrate how configurable the DS's graphics hardware is.&lt;/p&gt;
&lt;p&gt;These problems are addressed by Mode 3, which is covered in &lt;a href="bitmap-graphics-on-the-nintendo-ds-part-2-mode-3.html"&gt;the next post in this series&lt;/a&gt;.&lt;/p&gt;</content><category term="Tech"></category></entry><entry><title>Meandering Momentum AI</title><link href="http://www.pmallory.com/meandering-momentum-ai.html" rel="alternate"></link><published>2013-10-04T17:08:00-07:00</published><updated>2013-10-04T17:08:00-07:00</updated><author><name>Philip Mallory</name></author><id>tag:www.pmallory.com,2013-10-04:/meandering-momentum-ai.html</id><summary type="html">&lt;p&gt;I wrote an example of basic NPC movement AI for a class I TA.&lt;/p&gt;
&lt;p&gt;The NPCs chase or flee from the player based on their race (Giant or Pygmy) and their proximity to the player. When they aren't chasing or fleeing they meander about with some sense of purpose/momentum …&lt;/p&gt;</summary><content type="html">&lt;p&gt;I wrote an example of basic NPC movement AI for a class I TA.&lt;/p&gt;
&lt;p&gt;The NPCs chase or flee from the player based on their race (Giant or Pygmy) and their proximity to the player. When they aren't chasing or fleeing they meander about with some sense of purpose/momentum.&lt;/p&gt;
&lt;p&gt;You can &lt;a href="https://github.com/pmallory/MeanderingMomentumAI"&gt;check it out on GitHub&lt;/a&gt;, or &lt;a href="/bin/MeanderingMomentumAI.gba"&gt;download the game rom&lt;/a&gt; to play with.&lt;/p&gt;</content><category term="Tech"></category></entry><entry><title>Urban Exploration</title><link href="http://www.pmallory.com/urban-exploration.html" rel="alternate"></link><published>2013-03-09T00:00:00-08:00</published><updated>2013-03-09T00:00:00-08:00</updated><author><name>Philip Mallory</name></author><id>tag:www.pmallory.com,2013-03-09:/urban-exploration.html</id><summary type="html">&lt;p&gt;Here's some cool stuff I found.
Click the pictures to view the full sized versions.&lt;/p&gt;
&lt;p&gt;&lt;a href="/images/quarry/quarry.jpg"&gt;&lt;img src="images/quarry/small-quarry.jpg" alt="face" class="center" /&gt;&lt;/a&gt;
A quarry&lt;/p&gt;
&lt;p&gt;&lt;a href="/images/quarry/skyline.jpg"&gt;&lt;img src="images/quarry/small-skyline.jpg" alt="face" class="center" /&gt;&lt;/a&gt;
The downtown skyline and the quarry&lt;/p&gt;
&lt;p&gt;&lt;a href="/images/quarry/rosemary.jpg"&gt;&lt;img src="images/quarry/small-rosemary.jpg" alt="face" class="center" /&gt;&lt;/a&gt;
Big rosemarry bush&lt;/p&gt;
&lt;p&gt;&lt;a href="/images/quarry/warehouse.jpg"&gt;&lt;img src="images/quarry/small-warehouse.jpg" alt="face" class="center" /&gt;&lt;/a&gt;
Some sort of abandoned warehouse/loading bay thing&lt;/p&gt;
&lt;p&gt;Inside the abandoned warehouse:&lt;/p&gt;
&lt;p&gt;&lt;a href="/images/quarry/diamond_yell.jpg"&gt;&lt;img src="images/quarry/small-diamond_yell.jpg" alt="face" class="center" /&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;&lt;a href="/images/quarry/digital_dude.jpg"&gt;&lt;img src="images/quarry/small-digital_dude.jpg" alt="face" class="center" /&gt;&lt;/a&gt;
"The bigital Duder making making Magic Magic Just Because"&lt;/p&gt;
&lt;p&gt;&lt;a href="/images/quarry/flower_lady.jpg"&gt;&lt;img src="images/quarry/small-flower_lady.jpg" alt="face" class="center" /&gt;&lt;/a&gt;
This mural spans …&lt;/p&gt;</summary><content type="html">&lt;p&gt;Here's some cool stuff I found.
Click the pictures to view the full sized versions.&lt;/p&gt;
&lt;p&gt;&lt;a href="/images/quarry/quarry.jpg"&gt;&lt;img src="images/quarry/small-quarry.jpg" alt="face" class="center" /&gt;&lt;/a&gt;
A quarry&lt;/p&gt;
&lt;p&gt;&lt;a href="/images/quarry/skyline.jpg"&gt;&lt;img src="images/quarry/small-skyline.jpg" alt="face" class="center" /&gt;&lt;/a&gt;
The downtown skyline and the quarry&lt;/p&gt;
&lt;p&gt;&lt;a href="/images/quarry/rosemary.jpg"&gt;&lt;img src="images/quarry/small-rosemary.jpg" alt="face" class="center" /&gt;&lt;/a&gt;
Big rosemarry bush&lt;/p&gt;
&lt;p&gt;&lt;a href="/images/quarry/warehouse.jpg"&gt;&lt;img src="images/quarry/small-warehouse.jpg" alt="face" class="center" /&gt;&lt;/a&gt;
Some sort of abandoned warehouse/loading bay thing&lt;/p&gt;
&lt;p&gt;Inside the abandoned warehouse:&lt;/p&gt;
&lt;p&gt;&lt;a href="/images/quarry/diamond_yell.jpg"&gt;&lt;img src="images/quarry/small-diamond_yell.jpg" alt="face" class="center" /&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;&lt;a href="/images/quarry/digital_dude.jpg"&gt;&lt;img src="images/quarry/small-digital_dude.jpg" alt="face" class="center" /&gt;&lt;/a&gt;
"The bigital Duder making making Magic Magic Just Because"&lt;/p&gt;
&lt;p&gt;&lt;a href="/images/quarry/flower_lady.jpg"&gt;&lt;img src="images/quarry/small-flower_lady.jpg" alt="face" class="center" /&gt;&lt;/a&gt;
This mural spans two walls. Part 1&lt;/p&gt;
&lt;p&gt;&lt;a href="/images/quarry/eye_flower.jpg"&gt;&lt;img src="images/quarry/small-eye_flower.jpg" alt="face" class="center" /&gt;&lt;/a&gt;
This mural spans two walls. Part 2&lt;/p&gt;
&lt;p&gt;&lt;a href="/images/quarry/for_the_hood.jpg"&gt;&lt;img src="images/quarry/small-for_the_hood.jpg" alt="face" class="center" /&gt;&lt;/a&gt;
For the hood&lt;/p&gt;
&lt;p&gt;&lt;a href="/images/quarry/hand_prism.jpg"&gt;&lt;img src="images/quarry/small-hand_prism.jpg" alt="face" class="center" /&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;&lt;a href="/images/quarry/wizard_dude.jpg"&gt;&lt;img src="images/quarry/small-wizard_dude.jpg" alt="face" class="center" /&gt;&lt;/a&gt;
Baddass wizard&lt;/p&gt;</content><category term="Adventure"></category></entry><entry><title>Linear Recurrence Generator</title><link href="http://www.pmallory.com/linear-recurrence-generator.html" rel="alternate"></link><published>2013-02-20T15:24:00-08:00</published><updated>2013-02-20T15:24:00-08:00</updated><author><name>Philip Mallory</name></author><id>tag:www.pmallory.com,2013-02-20:/linear-recurrence-generator.html</id><summary type="html">&lt;p&gt;A sequence whose elements are calculated from earlier elements in the series is a linear recurrence.
The Fibonacci sequence (0, 1, 1, 2, 3, 5, &amp;hellip;) is an example:
&lt;img alt="a_n = a_{n-1}+a_{n-2}" src="/images/fibonacci.png"&gt;&lt;/p&gt;
&lt;p&gt;With the equation and the first two numbers in the sequence, you can calculate the rest.&lt;/p&gt;
&lt;p&gt;There are more complicated sequences that …&lt;/p&gt;</summary><content type="html">&lt;p&gt;A sequence whose elements are calculated from earlier elements in the series is a linear recurrence.
The Fibonacci sequence (0, 1, 1, 2, 3, 5, &amp;hellip;) is an example:
&lt;img alt="a_n = a_{n-1}+a_{n-2}" src="/images/fibonacci.png"&gt;&lt;/p&gt;
&lt;p&gt;With the equation and the first two numbers in the sequence, you can calculate the rest.&lt;/p&gt;
&lt;p&gt;There are more complicated sequences that are also linear recurrences:
&lt;img alt="a_n = a_{n-1}-2a_n-3}" src="/images/linearrecurrence1.png"&gt;&lt;/p&gt;
&lt;p&gt;You can multiply each term by a constant and still have a linear equation.
Here the coefficients are 1, 0 and -2.&lt;/p&gt;
&lt;p&gt;You can also multiply terms by things that aren't constant:
&lt;img alt="a_n = na_n-1}" src="/images/linearrecurrence2.png"&gt;&lt;/p&gt;
&lt;p&gt;This is called a nonhomogeneous linear recurrence equation.
The previous examples were homogeneous linear recurrence equations.&lt;/p&gt;
&lt;p&gt;Calculating one of these sequences can obviously be pretty tedious, so let's do it with Python.&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;recurrentSequence&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;fn&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;k&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;sequence&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt;
&lt;span class="sd"&gt;&amp;quot;&amp;quot;&amp;quot; A generator for linear recurrence equations&lt;/span&gt;

&lt;span class="sd"&gt;fn: a function to calculat a_n from sequence&lt;/span&gt;
&lt;span class="sd"&gt;k: how many terms fn uses to calculate a_n&lt;/span&gt;
&lt;span class="sd"&gt;sequence: The first k elements of the sequence&lt;/span&gt;
&lt;span class="sd"&gt;&amp;quot;&amp;quot;&amp;quot;&lt;/span&gt;

&lt;span class="c1"&gt;# n indexes the sequence&lt;/span&gt;
&lt;span class="n"&gt;n&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;k&lt;/span&gt;

&lt;span class="k"&gt;while&lt;/span&gt; &lt;span class="kc"&gt;True&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
    &lt;span class="k"&gt;try&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
        &lt;span class="n"&gt;Sn&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;fn&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;sequence&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;n&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="k"&gt;except&lt;/span&gt; &lt;span class="ne"&gt;IndexError&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
        &lt;span class="c1"&gt;# if fn requires more terms than we have that&amp;#39;s bad&lt;/span&gt;
        &lt;span class="nb"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s1"&gt;&amp;#39;fn needs more terms than were provided&amp;#39;&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
        &lt;span class="k"&gt;break&lt;/span&gt;

    &lt;span class="n"&gt;sequence&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;append&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;Sn&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="n"&gt;sequence&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;sequence&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="n"&gt;k&lt;/span&gt;&lt;span class="p"&gt;:]&lt;/span&gt;

    &lt;span class="k"&gt;yield&lt;/span&gt; &lt;span class="n"&gt;Sn&lt;/span&gt;

    &lt;span class="n"&gt;n&lt;/span&gt; &lt;span class="o"&gt;+=&lt;/span&gt; &lt;span class="mi"&gt;1&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;


&lt;p&gt;Given a function, the number of terms are in the function, and the first elements of the sequence the generator calculates the subsequent elements.
This is an example of a &lt;a href="http://docs.python.org/2/tutorial/classes.html#generators"&gt;generator&lt;/a&gt;.
Precomputing an infinite sequence isn't very practical, instead recurrentSequence() generates elements as they're requested.
recurrentSequence() saves the elements it calculates so that they don't have to be recalculated when in order to get the next element in the sequence, but it only saves the k elements needed to calculate the next element.&lt;/p&gt;
&lt;p&gt;Here's a Fibonacci example:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;span class="n"&gt;In&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;]:&lt;/span&gt; &lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;fib&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;s&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;n&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt;
            &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="n"&gt;s&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="o"&gt;+&lt;/span&gt;&lt;span class="n"&gt;s&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;

&lt;span class="n"&gt;In&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="mi"&gt;2&lt;/span&gt;&lt;span class="p"&gt;]:&lt;/span&gt; &lt;span class="n"&gt;g&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;recurrentSequence&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;fib&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;2&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;])&lt;/span&gt;

&lt;span class="n"&gt;In&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="mi"&gt;3&lt;/span&gt;&lt;span class="p"&gt;]:&lt;/span&gt; &lt;span class="n"&gt;g&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;next&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;
&lt;span class="n"&gt;Out&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="mi"&gt;3&lt;/span&gt;&lt;span class="p"&gt;]:&lt;/span&gt; &lt;span class="mi"&gt;2&lt;/span&gt;

&lt;span class="n"&gt;In&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="mi"&gt;4&lt;/span&gt;&lt;span class="p"&gt;]:&lt;/span&gt; &lt;span class="n"&gt;g&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;next&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;
&lt;span class="n"&gt;Out&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="mi"&gt;4&lt;/span&gt;&lt;span class="p"&gt;]:&lt;/span&gt; &lt;span class="mi"&gt;3&lt;/span&gt;

&lt;span class="n"&gt;In&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="mi"&gt;5&lt;/span&gt;&lt;span class="p"&gt;]:&lt;/span&gt; &lt;span class="n"&gt;g&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;next&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;
&lt;span class="n"&gt;Out&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="mi"&gt;5&lt;/span&gt;&lt;span class="p"&gt;]:&lt;/span&gt; &lt;span class="mi"&gt;5&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;


&lt;p&gt;And an example of a nonhomogeneous equation:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;span class="n"&gt;In&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="mi"&gt;6&lt;/span&gt;&lt;span class="p"&gt;]:&lt;/span&gt; &lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;lines&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;seq&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;n&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt;
             &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="n"&gt;seq&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="o"&gt;+&lt;/span&gt;&lt;span class="n"&gt;n&lt;/span&gt;

&lt;span class="n"&gt;In&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="mi"&gt;7&lt;/span&gt;&lt;span class="p"&gt;]:&lt;/span&gt; &lt;span class="n"&gt;g&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;recurrentSequence&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;lines&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;])&lt;/span&gt;

&lt;span class="n"&gt;In&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="mi"&gt;8&lt;/span&gt;&lt;span class="p"&gt;]:&lt;/span&gt; &lt;span class="n"&gt;g&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;next&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;
&lt;span class="n"&gt;Out&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="mi"&gt;8&lt;/span&gt;&lt;span class="p"&gt;]:&lt;/span&gt; &lt;span class="mi"&gt;2&lt;/span&gt;

&lt;span class="n"&gt;In&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="mi"&gt;9&lt;/span&gt;&lt;span class="p"&gt;]:&lt;/span&gt; &lt;span class="n"&gt;g&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;next&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;
&lt;span class="n"&gt;Out&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="mi"&gt;9&lt;/span&gt;&lt;span class="p"&gt;]:&lt;/span&gt; &lt;span class="mi"&gt;4&lt;/span&gt;

&lt;span class="n"&gt;In&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="mi"&gt;10&lt;/span&gt;&lt;span class="p"&gt;]:&lt;/span&gt; &lt;span class="n"&gt;g&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;next&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;
&lt;span class="n"&gt;Out&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="mi"&gt;10&lt;/span&gt;&lt;span class="p"&gt;]:&lt;/span&gt; &lt;span class="mi"&gt;7&lt;/span&gt;

&lt;span class="n"&gt;In&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="mi"&gt;11&lt;/span&gt;&lt;span class="p"&gt;]:&lt;/span&gt; &lt;span class="n"&gt;g&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;next&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;
&lt;span class="n"&gt;Out&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="mi"&gt;11&lt;/span&gt;&lt;span class="p"&gt;]:&lt;/span&gt; &lt;span class="mi"&gt;11&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;


&lt;p&gt;&lt;a href="https://github.com/pmallory/LRE"&gt;Fork it on GitHub&lt;/a&gt;&lt;/p&gt;</content><category term="Tech"></category></entry><entry><title>TourStarter 0.5</title><link href="http://www.pmallory.com/tourstarter-05.html" rel="alternate"></link><published>2013-01-27T20:51:00-08:00</published><updated>2013-01-27T20:51:00-08:00</updated><author><name>Philip Mallory</name></author><id>tag:www.pmallory.com,2013-01-27:/tourstarter-05.html</id><summary type="html">&lt;p&gt;My most recent project, &lt;a href="http://tourstarter.pmallory.com/"&gt;TourStarter&lt;/a&gt; is feature complete!&lt;/p&gt;
&lt;p&gt;The &lt;a href="http://www.adventurecycling.org/routes/network.cfm"&gt;Adventure Cycling Route Network&lt;/a&gt; is a system of scenic and bicycle friendly routes that criss-cross North America.
Their maps are great for planning a tour, but how do you get on a route in the first place?&lt;/p&gt;
&lt;p&gt;That's where TourStarter comes …&lt;/p&gt;</summary><content type="html">&lt;p&gt;My most recent project, &lt;a href="http://tourstarter.pmallory.com/"&gt;TourStarter&lt;/a&gt; is feature complete!&lt;/p&gt;
&lt;p&gt;The &lt;a href="http://www.adventurecycling.org/routes/network.cfm"&gt;Adventure Cycling Route Network&lt;/a&gt; is a system of scenic and bicycle friendly routes that criss-cross North America.
Their maps are great for planning a tour, but how do you get on a route in the first place?&lt;/p&gt;
&lt;p&gt;That's where TourStarter comes in.
Enter your location and TourStarter will find the nearest point on any of Adventure Cycling's 22 routes
Then it suggests a way to get there using Google Maps' cycling layer.&lt;/p&gt;
&lt;p&gt;I have several UI and feature enhancements &lt;a href="https://github.com/pmallory/TourStarter/issues?state=open"&gt;planned&lt;/a&gt;, but they're on the back burner for now.
&lt;a href="http://tourstarter.pmallory.com/"&gt;Try it out&lt;/a&gt; or fork it on &lt;a href="https://github.com/pmallory/TourStarter"&gt;GitHub&lt;/a&gt;.&lt;/p&gt;</content><category term="Tech"></category></entry><entry><title>Silver Comet Tour</title><link href="http://www.pmallory.com/silver-comet-tour.html" rel="alternate"></link><published>2012-08-05T00:00:00-07:00</published><updated>2012-08-05T00:00:00-07:00</updated><author><name>Philip Mallory</name></author><id>tag:www.pmallory.com,2012-08-05:/silver-comet-tour.html</id><summary type="html">&lt;p&gt;Yesterday I finished a three day bicycle tour of the &lt;a href="http://en.wikipedia.org/wiki/Silver_Comet_Trail"&gt;Silver Comet&lt;/a&gt; and &lt;a href="http://en.wikipedia.org/wiki/Chief_Ladiga_Trail"&gt;Chief Ladiga&lt;/a&gt; rail trails. The combined trails are a 95 mile paved route between Smyrna, Georgia and Anniston, Alabama. The entire round trip (starting at Georgia Tech in Midtown Atlanta rather than the actual trailhead) was about …&lt;/p&gt;</summary><content type="html">&lt;p&gt;Yesterday I finished a three day bicycle tour of the &lt;a href="http://en.wikipedia.org/wiki/Silver_Comet_Trail"&gt;Silver Comet&lt;/a&gt; and &lt;a href="http://en.wikipedia.org/wiki/Chief_Ladiga_Trail"&gt;Chief Ladiga&lt;/a&gt; rail trails. The combined trails are a 95 mile paved route between Smyrna, Georgia and Anniston, Alabama. The entire round trip (starting at Georgia Tech in Midtown Atlanta rather than the actual trailhead) was about 215 miles.&lt;/p&gt;
&lt;p&gt;There's a bunch of stuff I didn't photograph because I didn't feel like stopping. This includes lots of scenic vistas, farmland, parks and the entire town of Rockmart. That last one is unfortunate because Rockmart is the prettiest town along the route. A little river runs through the town and the trail goes along it, the entire strecth leading into and through the town is a riverfront park.&lt;/p&gt;
&lt;p&gt;Here are the photos, click them to view in full resolution.&lt;/p&gt;
&lt;p&gt;&lt;a href="/images/metamorphic_rock.jpg"&gt;&lt;img src="/images/metamorphic_rock_small.jpg" alt="rock face" class="center" /&gt;&lt;/a&gt;
&lt;p&gt;The path of the Silver Comet Railroad was roadcut (ravines were carved through the hills) to minimize elevation changes. These areas of the trail are pleasantly shady.&lt;/p&gt;&lt;/p&gt;
&lt;p&gt;&lt;a href="/images/Brushy_Mountain_Tunnel.jpg"&gt;&lt;img src="/images/Brushy_Mountain_Tunnel_small.jpg" alt="Brushy Mountain Tunnel" class="center"/&gt;&lt;/a&gt;
&lt;p&gt;The Brushy Mountain Tunnel is big and echoey. Lots of riders use this as the halfway point of their rides. A round trip from the trailhead to here and back is almost exactly 100 kilometers. People who have more carbon fiber on their bicycles than I do call that a metric century.&lt;/p&gt;&lt;/p&gt;
&lt;p&gt;&lt;a href="/images/pasture.jpg"&gt;&lt;img src="/images/pasture_small.jpg" alt="pasture" class="center"/&gt;&lt;/a&gt;
&lt;p&gt;A pasture several miles west of Cedartown Georgia&lt;/p&gt;&lt;/p&gt;
&lt;p&gt;&lt;a href="/images/horsies.jpg"&gt;&lt;img src="/images/horsies_small.jpg" alt="horsies" class="center"/&gt;&lt;/a&gt;
&lt;p&gt;Horsies!&lt;/p&gt;&lt;/p&gt;
&lt;p&gt;&lt;a href="/images/duck_and_geese.jpg"&gt;&lt;img src="/images/duck_and_geese_small.jpg" alt="Duck and Geese" class="center"/&gt;&lt;/a&gt;
&lt;p&gt;This big old oak tree is a short ways west of Cedartown. There were about 100 geese and one duck hanging out under it.&lt;/p&gt;&lt;/p&gt;
&lt;p&gt;&lt;a href="/images/bones.jpg"&gt;&lt;img src="/images/bones_small.jpg" alt="bones" class="center"/&gt;&lt;/a&gt;
&lt;p&gt;I found these bones near to where I camped the first night.&lt;/p&gt;&lt;/p&gt;
&lt;p&gt;&lt;a href="/images/sunrise_over_landfill.jpg"&gt;&lt;img src="/images/sunrise_over_landfill_small.jpg" alt="sunrise" class="center"/&gt;&lt;/a&gt;
&lt;p&gt;Sunrise over a landfill. There was only one proper hill on the trail and it went right by this landfill. &lt;/p&gt;&lt;/p&gt;
&lt;p&gt;&lt;a href="/images/camp_comet.jpg"&gt;&lt;img src="/images/camp_comet_small.jpg" alt="Camp Comet" class="center"/&gt;&lt;/a&gt;
&lt;p&gt;Camp Comet is between Cedartown, GA and Rockmart, GA about 15 miles east of the Georgia-Alabama border.&lt;/p&gt;&lt;/p&gt;
&lt;p&gt;&lt;a href="/images/green_tunnel.jpg"&gt;&lt;img src="/images/green_tunnel_small.jpg" alt="green tunnel" class="center"/&gt;&lt;/a&gt;
&lt;p&gt;There were several stretches like this where the path was straight for a mile or more. My cell phone camera doesn't really do it justice. This particular view is looking west from a bridge about five miles east of the Georgia-Alabama border.&lt;/p&gt;&lt;/p&gt;
&lt;p&gt;&lt;a href="/images/arch2.jpg"&gt;&lt;img src="/images/arch2_small.jpg" alt="Gateway Arch" class="center"/&gt;&lt;/a&gt;
&lt;a href="/images/arch1.jpg"&gt;&lt;img src="/images/arch1_small.jpg" alt="Gateway Arch" class="center"/&gt;&lt;/a&gt;
&lt;p&gt;There's a gateway arch on the Goergia-Alabama border where the Silver Comet ends and Chief Ladiga begins. The two trails were joined in August 2008.&lt;/p&gt;&lt;/p&gt;
&lt;p&gt;&lt;a href="/images/arch_AL.jpg"&gt;&lt;img src="/images/arch_AL_small.jpg" alt="Gateway Arch" class="center"/&gt;&lt;/a&gt;
&lt;a href="/images/arch_GA.jpg"&gt;&lt;img src="/images/arch_GA_small.jpg" alt="Gateway Arch" class="center"/&gt;&lt;/a&gt;
&lt;p&gt;These nifty hunks of granite are under the arch.&lt;/p&gt;&lt;/p&gt;
&lt;p&gt;&lt;a href="/images/talladega_mountains.jpg"&gt;&lt;img src="/images/talladega_mountains_small.jpg" alt="Talladega Mountains" class="center"/&gt;&lt;/a&gt;
&lt;p&gt;A view of the distant Talladega Mountains taken from a bridge somewhere east of Piedmont, AL. The 335 mile Pinhoti hiking trail joins the Chief Ladiga for a short bit near here. The Pinhoti trail continues into Georgia (by a more northerly route than the Silver Comet) until it reaches the Benton MacKaye Trail west of Springer Mountain (the southern end of the Appalachian Trail).&lt;/p&gt;&lt;/p&gt;
&lt;p&gt;&lt;a href="/images/Piedmont_Welcome_Center.jpg"&gt;&lt;img src="/images/Piedmont_Welcome_Center_small.jpg" alt="pasture" class="center"/&gt;&lt;/a&gt;
&lt;p&gt;Piedmont Alabama is the first town in from the Georgia-Alabama border.&lt;/p&gt;&lt;/p&gt;
&lt;p&gt;&lt;a href="/images/Gazebo.jpg"&gt;&lt;img src="/images/Gazebo_small.jpg" alt="Gazebo" class="center"/&gt;&lt;/a&gt;
&lt;p&gt;The town of Piedmont had a very nice welcome center and this very nice gazebo.&lt;/p&gt;&lt;/p&gt;
&lt;p&gt;&lt;a href="/images/half_pipe.jpg"&gt;&lt;img src="/images/half_pipe_small.jpg" alt="half pipe" class="center"/&gt;&lt;/a&gt;
&lt;p&gt;Piedmont has a little skate park by the trail. If I had brought a photographer along you would be seeing a picture of me landing a gnarly flip trick. Oh well.&lt;/p&gt;&lt;/p&gt;
&lt;p&gt;&lt;a href="/images/disc_golf.jpg"&gt;&lt;img src="/images/disc_golf_small.jpg" alt="disc golf" class="center"/&gt;&lt;/a&gt;
&lt;p&gt;Jacksonville State University has a disc golf course on campus. Can you spot the target in this picture?&lt;/p&gt;&lt;/p&gt;
&lt;p&gt;&lt;a href="/images/pi_kappa_theta.jpg"&gt;&lt;img src="/images/pi_kappa_theta_small.jpg" alt="Pi Kappa Theta" class="center"/&gt;&lt;/a&gt;
&lt;p&gt;My next door neighbors have a JSU chapter.&lt;/p&gt;&lt;/p&gt;
&lt;p&gt;&lt;a href="/images/Sig_Ep.jpg"&gt;&lt;img src="/images/Sig_Ep_small.jpg" alt="Sigma Phi Epsilon" class="center"/&gt;&lt;/a&gt;
&lt;p&gt;My across the street neighbors are also represented.&lt;/p&gt;&lt;/p&gt;
&lt;p&gt;&lt;a href="images/cactus.jpg"&gt;&lt;img src="/images/cactus_small.jpg" alt="cactus" class="center"/&gt;&lt;/a&gt;
&lt;p&gt;This cactus (and the garden it lives in) is on the edge of the Jacksonville State University campus. Maintained by the Jacksonville Garden Club.&lt;/p&gt;&lt;/p&gt;
&lt;p&gt;&lt;a href="/images/jacksonville_depot.jpg"&gt;&lt;img src="/images/jacksonville_depot_small.jpg" alt="Jacksonville Depot" class="center"/&gt;&lt;/a&gt;
&lt;p&gt;Jacksonville coverted this train depot into an information station. I think it was closed when I went by.&lt;/p&gt;&lt;/p&gt;
&lt;p&gt;&lt;a href="/images/invisible_turkey.jpg"&gt;&lt;img src="/images/invisible_turkey_small.jpg" alt="turkey" class="center"/&gt;&lt;/a&gt;
&lt;p&gt;There's a big marshy area south of Jacksonville. I saw a wild turkey by the trail both times I went by here but each time she ran off before I could take a picture. I also saw deer, turtles, rabbits, and a hawk along the trail (all unphotographed).&lt;/p&gt;&lt;/p&gt;
&lt;p&gt;&lt;a href="/images/geodesic_house.jpg"&gt;&lt;img src="/images/geodesic_house_small.jpg" alt="geodesic structure" class="center"/&gt;&lt;/a&gt;
&lt;p&gt;The red geodesic structure (house? barn?) in the background of this picture is just off the trail to the south of Jacksonville, AL.&lt;/p&gt;&lt;/p&gt;
&lt;p&gt;&lt;a href="/images/footings.jpg"&gt;&lt;img src="/images/footings_small.jpg" alt="footings" class="center"/&gt;&lt;/a&gt;
&lt;p&gt;Maybe there used to be a bridge on these concrete footings.&lt;/p&gt;&lt;/p&gt;
&lt;p&gt;&lt;a href="/images/bumpy_bridges.jpg"&gt;&lt;img src="/images/bumpy_bridges_small.jpg" alt="bumpy bridges" class="center"/&gt;&lt;/a&gt;
&lt;p&gt;The land between Jacksonville and Anniston is very swampy and had a bunch of these boardwalk style bridges. Very bumpy.&lt;/p&gt;&lt;/p&gt;
&lt;p&gt;&lt;a href="/images/leaves.jpg"&gt;&lt;img src="/images/leaves_small.jpg" alt="Leaves" class="center"/&gt;&lt;/a&gt;
&lt;p&gt;The best part of the trip was crunching leaves. You can pretend it's a precision handling exercise (hit a leaf with only the front or back wheel, hit a series of leaves with both wheels, etc) to avoid feeling silly.&lt;/p&gt;&lt;/p&gt;
&lt;p&gt;&lt;a href="/images/off_road_excursion.jpg"&gt;&lt;img src="/images/off_road_excursion_small.jpg" alt="trail" class="center"/&gt;&lt;/a&gt;
&lt;p&gt;Experiments indicate that a loaded mountain bike with slick tires no longer function as a mountain bike. I wound up doing a really slick backwards wheelie when I tried to go over this berm. This particular side trail is between Jacksonville, AL and Anniston, AL.&lt;/p&gt;&lt;/p&gt;
&lt;p&gt;&lt;a href="/images/terminus.jpg"&gt;&lt;img src="/images/terminus_small.jpg" alt="terminus" class="center"/&gt;&lt;/a&gt;
&lt;p&gt;The end of the Chief Ladiga Trail at the north edge of Anniston Alabama. The trail runs to this point to the border and is about 33 miles long.&lt;/p&gt;&lt;/p&gt;
&lt;p&gt;&lt;a href="/images/under_the_bridge.jpg"&gt;&lt;img src="/images/under_the_bridge_small.jpg" alt="Under a brigde" class="center"/&gt;&lt;/a&gt;
&lt;p&gt;I got caught in a big thunderstorm ten miles from the Silver Comet trailhead on the return trip. Me and a bunch of other people took shelter under this bridge. There was a big spontaneously formed waterfall inundating the path about a quarter mile before the bridge. I got bored waiting for the rain to stop so I didn't stay here for very long. I'd been without a shower for two days and 190 miles at this point so I rather appreciated the rain.&lt;/p&gt;&lt;/p&gt;</content><category term="Adventure"></category></entry><entry><title>Now Featuring Syndication</title><link href="http://www.pmallory.com/now-featuring-syndication.html" rel="alternate"></link><published>2012-05-16T00:00:00-07:00</published><updated>2012-05-16T00:00:00-07:00</updated><author><name>Philip Mallory</name></author><id>tag:www.pmallory.com,2012-05-16:/now-featuring-syndication.html</id><content type="html">&lt;p&gt;This site now has an &lt;a href="http://www.pmallory.com/feed.xml"&gt;atom feed&lt;/a&gt;. Click the nifty icon to subscribe!&lt;/p&gt;</content><category term="Tech"></category></entry><entry><title>GitHub Drinkup - Atlanta 5/9/2012</title><link href="http://www.pmallory.com/github-drinkup-atlanta-592012.html" rel="alternate"></link><published>2012-05-10T00:00:00-07:00</published><updated>2012-05-10T00:00:00-07:00</updated><author><name>Philip Mallory</name></author><id>tag:www.pmallory.com,2012-05-10:/github-drinkup-atlanta-592012.html</id><summary type="html">&lt;p&gt;GitHub hosted a drinkup in midtown last night and it was pretty great. Here's the executive summary:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Ruby seemed like the most popular language among attendees. The combined forces of the Atlanta Ruby Users Group (who had a meeting a couple blocks down the street just prior to the drinkup …&lt;/li&gt;&lt;/ul&gt;</summary><content type="html">&lt;p&gt;GitHub hosted a drinkup in midtown last night and it was pretty great. Here's the executive summary:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Ruby seemed like the most popular language among attendees. The combined forces of the Atlanta Ruby Users Group (who had a meeting a couple blocks down the street just prior to the drinkup) and &lt;a href="http://www.highgroove.com"&gt;Highgroove&lt;/a&gt; contributed a lot to that. Objective-C, Java and Python were also represented. There was also a designer who uses git to keep track of graphics.&lt;/li&gt;
&lt;li&gt;Interviewing practices were a common topic of conversation. What I drew from the discussion was that the most important part of a developer interview is determining how well the candidate would fit in culturally. Confirming competence through pair programming is also good. Interview questions involving technical minutiae (eg asking about pointer arithmetic for a job that doesn't use C) and tedious take-home quizes are bad.&lt;/li&gt;
&lt;li&gt;A significant portion of GitHub's booze allotment was left over (allegedly).It wasn't for lack of trying though, and I think having the event on a Wednesday probably didn't help turnout.&lt;/li&gt;
&lt;li&gt;Atlanta GitHubers are a pretty homogeneous group. Twenty something, white, male, beer loving, bicycle aficionados is how a demographer would describe us.&lt;/li&gt;
&lt;/ul&gt;</content><category term="Tech"></category></entry><entry><title>New Site!</title><link href="http://www.pmallory.com/new-site.html" rel="alternate"></link><published>2012-05-10T00:00:00-07:00</published><updated>2012-05-10T00:00:00-07:00</updated><author><name>Philip Mallory</name></author><id>tag:www.pmallory.com,2012-05-10:/new-site.html</id><summary type="html">&lt;p&gt;I've been wanting to replace my old WordPress blog for awhile, so for the past
couple of months I've been writing a &lt;a href="https://github.com/pmallory/StaticSite"&gt;static site
generator&lt;/a&gt; in my spare time. Since
perfect is the enemy of good enough I've decided to switch the site over to my
generator now even though …&lt;/p&gt;</summary><content type="html">&lt;p&gt;I've been wanting to replace my old WordPress blog for awhile, so for the past
couple of months I've been writing a &lt;a href="https://github.com/pmallory/StaticSite"&gt;static site
generator&lt;/a&gt; in my spare time. Since
perfect is the enemy of good enough I've decided to switch the site over to my
generator now even though the code isn't as clean as I'd like and there are
still some features I want to add (an atom feed in particular).&lt;/p&gt;
&lt;p&gt;There were a few useful tools I used in the process of making this site:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;SimpleHTTPServer:
  &lt;pre&gt;python -m SimpleHTTPServer&lt;/pre&gt;
  Run this in any directory and you've got an instant web server for testing. It
  prints requests to stdout, serves  simple index pages for directories without
  an index file, serves useful error pages, and is convenient as can be.&lt;/li&gt;
&lt;li&gt;&lt;a href="https://developer.mozilla.org/en/CSS"&gt;Mozilla Developer Network&lt;/a&gt; 
  CSS has gotten way better since I first used it in my GeoCities days, and so
  have the resources that explain how to use it well.&lt;/li&gt;
&lt;li&gt;&lt;a href="http://border-radius.com/"&gt;border-radius.com/&lt;/a&gt;
  Originally this site looked like butt. Then I added rounded corners and 
  suddenly it looked hip and modern!&lt;/li&gt;
&lt;/ul&gt;</content><category term="misc"></category></entry><entry><title>Nerd Herder</title><link href="http://www.pmallory.com/nerd-herder.html" rel="alternate"></link><published>2011-10-10T00:00:00-07:00</published><updated>2011-10-10T00:00:00-07:00</updated><author><name>Philip Mallory</name></author><id>tag:www.pmallory.com,2011-10-10:/nerd-herder.html</id><summary type="html">&lt;p&gt;Nerd Herder is an arcade style game for the Gameboy Advance.&lt;/p&gt;
&lt;p&gt;&lt;img alt="splash screen" src="/images/NerdSplash.png"&gt;&lt;/p&gt;
&lt;p&gt;Your goal as head TA is to guide your students to their academic destinies. You
do this by chasing the best and brightest students to the dorm to study, while
driving the less capable to the M-Train¹. At your …&lt;/p&gt;</summary><content type="html">&lt;p&gt;Nerd Herder is an arcade style game for the Gameboy Advance.&lt;/p&gt;
&lt;p&gt;&lt;img alt="splash screen" src="/images/NerdSplash.png"&gt;&lt;/p&gt;
&lt;p&gt;Your goal as head TA is to guide your students to their academic destinies. You
do this by chasing the best and brightest students to the dorm to study, while
driving the less capable to the M-Train¹. At your disposal are your passion
for quality education and two power ups. A readme is included with the ROM with
a more complete description of gameplay.&lt;/p&gt;
&lt;p&gt;&lt;img alt="action shot" src="/images/NerdGameplay.png"&gt;&lt;/p&gt;
&lt;p&gt;The game is written in C. The nifty technical features include:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Direct Memory Access (DMA) to load the tiles/tile map, sprites, color palette, and to keep the sound buffer full&lt;/li&gt;
&lt;li&gt;Animated sprites with transparency&lt;/li&gt;
&lt;li&gt;Scrolling background&lt;/li&gt;
&lt;li&gt;Music (pcm encoded, not beeps and boops)&lt;/li&gt;
&lt;li&gt;Inline assembly to access BIOS functionality&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Download ROM and Readme: &lt;a href="/bin/NerdHerder.zip"&gt;NerdHerder&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;Browse Source: &lt;a href="https://github.com/pmallory/NerdHerder"&gt;GitHub repo&lt;/a&gt;&lt;/p&gt;
&lt;hr&gt;
&lt;p&gt;¹At Georgia Tech, to “board the M-Train” is to transfer from a science or engineering major to management. Refer to &lt;a href="http://www.urbandictionary.com/define.php?term=m-train"&gt;Urban Dictionary&lt;/a&gt; or this &lt;a href="http://www.youtube.com/watch?v=0NzNKKrYHqY"&gt;informational music video&lt;/a&gt;.&lt;/p&gt;</content><category term="Tech"></category></entry><entry><title>Music Histogram</title><link href="http://www.pmallory.com/music-histogram.html" rel="alternate"></link><published>2011-06-19T00:00:00-07:00</published><updated>2011-06-19T00:00:00-07:00</updated><author><name>Philip Mallory</name></author><id>tag:www.pmallory.com,2011-06-19:/music-histogram.html</id><summary type="html">&lt;p&gt;This graph shows the count of songs in my music library by year. The graph was
produced from a CSV generated by a Python script that pulls data from iTunes
using Apple’s &lt;a href="http://developer.apple.com/library/mac/#documentation/Cocoa/Conceptual/ScriptingBridgeConcepts/AboutScriptingBridge/AboutScriptingBridge.html"&gt;Scripting Bridge&lt;/a&gt;
technology. Eventually I want to go back and redo the script  so that it draws …&lt;/p&gt;</summary><content type="html">&lt;p&gt;This graph shows the count of songs in my music library by year. The graph was
produced from a CSV generated by a Python script that pulls data from iTunes
using Apple’s &lt;a href="http://developer.apple.com/library/mac/#documentation/Cocoa/Conceptual/ScriptingBridgeConcepts/AboutScriptingBridge/AboutScriptingBridge.html"&gt;Scripting Bridge&lt;/a&gt;
technology. Eventually I want to go back and redo the script  so that it draws 
the graph itself (matplotlib would work well).&lt;/p&gt;
&lt;p&gt;&lt;img alt="histogram" src="/images/histogram.png"&gt;&lt;/p&gt;
&lt;p&gt;Notes:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;The graph was generated in June 2011 so the song count for 2011 doesn’t include music acquired after that date.&lt;/li&gt;
&lt;li&gt;The graph starts at 1944 because everything in my library older than that is classical. There isn’t a consistent method for splitting classical music into tracks; one record might be divided into 20 tracks while another of the same length might be one continuous track. Track count just isn’t a useful metric.&lt;/li&gt;
&lt;li&gt;Songs with an empty year tag aren’t counted.&lt;/li&gt;
&lt;li&gt;The 1980s were a musical dark age.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;This is the script to generate the csv. Note that it iterates over “iTunes.currentPlaylist().tracks()” meaning that it will collect data from whichever playlist is highlighted in iTunes’ Library pane.&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;span class="kn"&gt;from&lt;/span&gt; &lt;span class="nn"&gt;Foundation&lt;/span&gt; &lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt;
&lt;span class="kn"&gt;from&lt;/span&gt; &lt;span class="nn"&gt;ScriptingBridge&lt;/span&gt; &lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt;

&lt;span class="n"&gt;iTunes&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;SBApplication&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;applicationWithBundleIdentifier_&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
            &lt;span class="s2"&gt;&amp;quot;com.apple.iTunes&amp;quot;&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

&lt;span class="n"&gt;years&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;{}&lt;/span&gt;

&lt;span class="k"&gt;for&lt;/span&gt; &lt;span class="n"&gt;track&lt;/span&gt; &lt;span class="ow"&gt;in&lt;/span&gt; &lt;span class="n"&gt;iTunes&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;currentPlaylist&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;tracks&lt;/span&gt;&lt;span class="p"&gt;():&lt;/span&gt;
    &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="ow"&gt;not&lt;/span&gt; &lt;span class="n"&gt;track&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;year&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="ow"&gt;in&lt;/span&gt; &lt;span class="n"&gt;years&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
        &lt;span class="n"&gt;years&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="n"&gt;track&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;year&lt;/span&gt;&lt;span class="p"&gt;()]&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;1&lt;/span&gt;
    &lt;span class="k"&gt;else&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
        &lt;span class="n"&gt;years&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="n"&gt;track&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;year&lt;/span&gt;&lt;span class="p"&gt;()]&lt;/span&gt; &lt;span class="o"&gt;+=&lt;/span&gt; &lt;span class="mi"&gt;1&lt;/span&gt;

&lt;span class="n"&gt;f&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nb"&gt;open&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s1"&gt;&amp;#39;./out.csv&amp;#39;&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s1"&gt;&amp;#39;w&amp;#39;&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

&lt;span class="k"&gt;for&lt;/span&gt; &lt;span class="n"&gt;key&lt;/span&gt; &lt;span class="ow"&gt;in&lt;/span&gt; &lt;span class="nb"&gt;sorted&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;years&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;keys&lt;/span&gt;&lt;span class="p"&gt;()):&lt;/span&gt;
    &lt;span class="n"&gt;f&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;write&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nb"&gt;str&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;key&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="o"&gt;+&lt;/span&gt;&lt;span class="s1"&gt;&amp;#39;, &amp;#39;&lt;/span&gt;&lt;span class="o"&gt;+&lt;/span&gt;&lt;span class="nb"&gt;str&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;years&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="n"&gt;key&lt;/span&gt;&lt;span class="p"&gt;])&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt;&lt;span class="s1"&gt;&amp;#39;&lt;/span&gt;&lt;span class="se"&gt;\n&lt;/span&gt;&lt;span class="s1"&gt;&amp;#39;&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

&lt;span class="n"&gt;f&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;close&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;</content><category term="Tech"></category></entry><entry><title>Hero's Quest</title><link href="http://www.pmallory.com/heros-quest.html" rel="alternate"></link><published>2010-10-10T00:00:00-07:00</published><updated>2010-10-10T00:00:00-07:00</updated><author><name>Philip Mallory</name></author><id>tag:www.pmallory.com,2010-10-10:/heros-quest.html</id><summary type="html">&lt;p&gt;&lt;img alt="spash screen" src="/images/HeroSplash.png"&gt;&lt;/p&gt;
&lt;p&gt;Hero’s Quest is a proof of concept RPG for the Game Boy Advance. It features 
animated sprites, scrolling backgrounds, music, sound effects, menus, and other
functionality. The game is implemented in C.&lt;/p&gt;
&lt;p&gt;&lt;img alt="overworld" src="/images/HeroOverworld.png"&gt;&lt;/p&gt;
&lt;p&gt;To play the game download the ROM and open it in with a Game Boy Advance 
emulator …&lt;/p&gt;</summary><content type="html">&lt;p&gt;&lt;img alt="spash screen" src="/images/HeroSplash.png"&gt;&lt;/p&gt;
&lt;p&gt;Hero’s Quest is a proof of concept RPG for the Game Boy Advance. It features 
animated sprites, scrolling backgrounds, music, sound effects, menus, and other
functionality. The game is implemented in C.&lt;/p&gt;
&lt;p&gt;&lt;img alt="overworld" src="/images/HeroOverworld.png"&gt;&lt;/p&gt;
&lt;p&gt;To play the game download the ROM and open it in with a Game Boy Advance 
emulator. &lt;a href="http://vba.ngemu.com/"&gt;VisualBoyAdvance (VBA)&lt;/a&gt; is a free emulator 
available for Linux, Mac and Windows. Instructions
and controls are in the in-game menu.&lt;/p&gt;
&lt;p&gt;&lt;img alt="battle" src="/images/HeroBattle.png"&gt;&lt;/p&gt;
&lt;p&gt;You can &lt;a href="https://github.com/pmallory/Heros-Quest"&gt;browse the source&lt;/a&gt; on GitHub or &lt;a href="/bin/HerosQuest.gba"&gt;download the rom&lt;/a&gt;.&lt;/p&gt;</content><category term="Tech"></category></entry><entry><title>Music Info Avatar Generator</title><link href="http://www.pmallory.com/music-info-avatar-generator.html" rel="alternate"></link><published>2010-05-01T00:00:00-07:00</published><updated>2010-05-01T00:00:00-07:00</updated><author><name>Philip Mallory</name></author><id>tag:www.pmallory.com,2010-05-01:/music-info-avatar-generator.html</id><summary type="html">&lt;p&gt;This script reads information about my most recently played song from iTunes, draws it on an image, and uploads it so it can be used online. The script is written in AppleScript and uses iMagine Photo, a lightweight and scriptable image editor, to draw the avatar. The script runs invisibly …&lt;/p&gt;</summary><content type="html">&lt;p&gt;This script reads information about my most recently played song from iTunes, draws it on an image, and uploads it so it can be used online. The script is written in AppleScript and uses iMagine Photo, a lightweight and scriptable image editor, to draw the avatar. The script runs invisibly, redrawing and reuploading the avatar whenever a new song is played.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Update:&lt;/strong&gt; I have moved away from iTunes and OS X so this image no longer updates. The script ran trouble free for seven years. RIP&lt;/p&gt;
&lt;p&gt;&lt;img alt="avatar image" src="/images/songAvy.jpeg"&gt;&lt;/p&gt;
&lt;p&gt;If you’re interested in using the script yourself configuration instructions are included in the download.&lt;/p&gt;
&lt;p&gt;&lt;a href="/bin/avatarGenerator.zip"&gt;Download&lt;/a&gt;&lt;/p&gt;</content><category term="Tech"></category></entry></feed>