Sunday, August 26, 2012

Mark Pilgrim vs the Android

Discovered completely by accident that the up-to-date version of the book I'm learning Python from is available, for free, from the Android appketplace.

Also, now that I have a handy reference for Python 3, I think it's time to upgrade my IDE too.

Wednesday, August 22, 2012

Lamb Of God: Resolution

Been listening to the new Lamb of God album "Resolution" this week. Not a record for the ages, and I don't have the time to give a detailed review in any case, but still two-and-a-half solid stars.

Punchline: forget the first single ("Ghost Walking"). Otherwise, the album begins strong with "Desolution", hits its groove hard in "Insurrection", and ends on an absolute high point with "King Me":

Look, LOG, as long as Randy ain't playing shows in Czecho, swing by Nashville and I'll be the first motherfucker in the pit. (Though after that last song, I have this odd urge to play checkers...)

Thursday, August 16, 2012

Turning coffee into...

In the mug: Starbucks Malawi coffee, brewed on the Clover.

In the earbuds: Nachtmystium, Black Meddle I.

On the page: slides for my qualifying talk (scheduled for Tuesday, 2 PM, SC 1206).

Student Paper showdown at the House of Dawg

The entire student editorial staff of the University of Georgia's student newspaper (which is independent of the university) has walked out. As a member in a past life of the editorial staff of a student newspaper, I applaud this move: the students cite massive interference in day-to-day operations by the paper's board of directors, hiring of ten(!) full-time staff (an impossible number to sustain for a paper which publishes in print only weekly) and demanding prior restraint on content. The excerpta from the draft memo to the student editors are both hilarious and chilling in their illiteracy.

However, to the journalists covering this story and the ed staff of the Red and Black, a word: your accounts so far are disjointed and not particularly coherent. As a reader, I need to know who the people are who are forcing these changes forward: the Poynter story linked above talks about the Board of Directors, but does not have any indication of who sits on that board, how they are appointed, or to whom they answer (except that they are not answerable to the University, at least nominally).

There is some kind of conflict of interests at play here, and as someone who values student journalism, I say we need to have it reported on.

Tuesday, August 14, 2012

Blogging learning Python: Equivalence Relations II

Part I

Last time we looked at the basic class methods of the eqrel class. Python knows these are class methods because their definition blocks are indented under the main class header. What this means in practice is that a method like union is called on an instance EQ of the equivalence relation class, modifies that instance, and doesn't return anything.

The methods we'll see this time are different: they don't belong to the class but to the overall module, and they return a new instance of the class.

As mentioned, the two main functions we want to be able to compute are the equivalence relation join and meet. Join doesn't require any new technology:

def eqjoin(EQa,EQb):
    """Returns an instance of eqrel coding the least equivalence relation
    containing both EQa and EQb.

    Both arguments must be of the same length."""
    if len(EQa) != len(EQb): raise IndexMismatchError()
    N = len(EQa)
    EQr = eqrel(N)

    for iter1 in range(N):
        for iter2 in [y for y in [EQa[iter1],EQb[iter1]] if y >= 0]:

    return EQr

I've included a custom error message in case __name__ passes stupid data to the method; I'm sure that there are other possible errors I could anticipate, but this is the only one I can remember accidentally tripping over in practice. Here's the custom exception definition:

class IndexMismatchError(Exception):
    def __init__(self):
        self.msg = "Index Mismatch!\n\nAll equivalence relations must have the same length!"

    def __str__(self):
        return repr(self.msg)

Notice that a Python exception is a class (which for obvious reasons inherits from Exception). Basically all I've written this one to do is print a message detailing why it got called; nothing fancy.

Now let's program equivalence relation meet. But to do this, we need a low-wattage implementation of breadth-first search. (Recall that we already have a class method EQ.alists(), shown in the last post, for creating an adjacency-list representation of the tree out of the original parent data.)

def bfs_component(alists,origin):
    """bfs_component(alists) returns a list, the connected component
    of the element origin in the graph coded by alists."""
    N = len(alists)
    is_searched = [False] * N
    queue = [origin]
    ret_component = []

    while len(queue) > 0:
        active_element = queue.pop()
        if is_searched[active_element]:
            is_searched[active_element] = True

            for iter1 in [x for x in alists[active_element] if not is_searched[x]]:

    return ret_component

All this implementation does is compute the connected component of whatever vertex number is passed as the origin argument. This will allow us to search downwards, where the array-of-parents data representation allows easy upward search but no downward search. (The tradeoff is that it is more difficult to tend a tree represented as adjacency lists, cut off and reattach elements, etc. Not an insurmountable problem, but annoying.)

Finally we can meet the meet:

def eqmeet(EQa,EQb):
    """eqmeet(EQa,EQb) returns an instance of eqrel coding the greatest
    equivalence relation contained in both EQa and EQb. Both arguments must
    have the same length."""
    if len(EQa) != len(EQb): raise IndexMismatchError()
    N = len(EQa)
    alistsa = EQa.alists()
    alistsb = EQb.alists()
    components_b = dict([[root,bfs_component(alistsb,root)] for root in range(N) if EQb[root] < 0])
    ## components_b is a dictionary with items root : root/EQb, where root
    ## takes on all root values in EQb and root/EQb is a list of the elements
    ## in root's tree.
    component_list_r = []
    is_handled = [False] * N

    ## Basic procedure: 1: pop an element from the main queue.
    ## 2: find its EQa component and its EQb component.
    ## 2a: the intersection of these two is a component of EQr.
    ## 3. exhaust the remaining elements of the EQa component,
    ## treating it as a queue.

    for x in range(N):
        if is_handled[x]:
            cmp_a = bfs_component(alistsa,x)

            while len(cmp_a) > 0:
                x1 = cmp_a[0]
                cmp_b = components_b[EQb.find(x1)]

                cmp_r = [y for y in cmp_a if y in cmp_b]
                ## cmp_r is the intersection of cmp_a and cmp_b
                for y in cmp_r:
                    is_handled[y] = True

                cmp_a = [y for y in cmp_a if y not in cmp_r]
                ## deletes all elements of cmp_r from cmp_a

    return eqrel(N,blocks = component_list_r)

Python's list comprehension scheme is right up my alley, as you've no doubt already seen. I do sometimes worry about construction like the assignment of cmp_r near the end; abstractly, that could be \( \mathcal{O}(n^2) \), but I think Python has ways of making comprehensions like that run faster than the naive algorithm. (If someone knows if that's true, I'd love to know details. Maybe use some kind of hash and only check clashing pairs?)

So that's it for the methods I planned to write when I sat down to program. But wandering around in the documentation, I found something really fun, which I couldn't resist including. But that's for next time.

Sunday, August 12, 2012

More Cain, Cain, and Abel

Not ready to jump into the more complicated scenarios (spoiler that everyone already guessed: they'll feature both Cains and Abel on the island simultaneously), but the discussion in comments has prompted me to add one hypothetical before we even get to that point.
Scenario 3: Imagine instead of an environmentally conscious vegetarian pair of Cains, the human population of the island is a pair, let's call them Mr and Mrs Raton, who are even more rapacious and consuming than Abel is. However, unlike Abel, they do plan to bear children and perpetuate their lineage. They are completely unconcerned for the sustainability of their lifestyle, and all the food sources they live off will be depleted before any of their children possibly reach adulthood.
(The pair's name is a nod to the way ships' rats, in the days of European sea exploration, would come ashore onto islands with populations evolved to meet local/specialized pressures and wipe them out completely. These populations of rats would grow exponentially as long as the prey was easy; but as it was soon obliterated, the rats themselves died off when what they could eat was no longer available.)

So we naturally ask ourselves, is this behavior by the Ratons moral? Do they have the right to pass on a blighted and arid landscape to their own offspring?

I contend that their behavior is immoral, and moreover that they do not have such a right. To have full responsibility for and (some measure of) full control over a person's life and well-being (as parents do over their children) includes the obligation to not willfully deprive that person of the means of life. Additionally, it makes no difference whether these children are only as-yet-hypothetical or whether already alive: I'm viewing their whole planned path as a unit, one where (in this case) the order certain pieces occur in is irrelevant to the general cruelty and depraved indifference of the whole.

Naturally, the difference between Scenarios 2 and 3 is not a binary, on-off matter. I've written Scenario 2 so that the Cains' offspring will enjoy all the resources they do, but I don't mean to argue that all usage of nonrenewable resources is immoral. Leaving the world to the next generation in as good condition as you found it is, of course, exemplary, but the welfare of the future generations is not the only criterion on which morality is to be judged. (That way lies infinite regress, as well as any number of paradoxes involving nonconvergent integrals.) However, ones own wanted and freely chosen children have a claim upon one's labor so long as they are too young to take care of themselves -- this is a principle I have never heard a libertarian argue against -- and as a corollary one wrongs one's children if one depletes the resources they will need to survive and thrive.

In the context of the actual modern world, this principle is what justifies removing children from abusive parents: saying that parents have no right to abuse their children is equivalent, under the definition I'm working under, to saying that it is not wrong for others (in this case, the state) to prevent a parent from abusing a child.

Saturday, August 11, 2012

You got your BBQ sauce in my store-brand cola

What in the Flying Spaghetti Monster's name?

Zombie Eyes

At time T = minus 12 hours, Mitt Romney's campaign announced that they would be unveiling their running mate ... at 9 AM eastern on a Saturday, a time when the ranks of the awake comprise only those too young to vote, those too old to not vote, those too amped to quit coding, and bus drivers.

At time T = minus 11 hours and 59 minutes, the lovely Ms Heel-Filcher and I wondered what on earth Mitt is thinking, playing his last high card while the Olympics are still on, when the Republican convention is still (a couple of) weeks away, and while most nice conservative families' kids still haven't gone back to school and given their parents a moment to breathe have sexytimes catch up with the news.

At time T = minus 11 hours, 57 minutes, 57 seconds, NBC announced on the basis of three corroborating but anonymous sources, that this pick will be Paul Ryan.

At time T = minus 11 hours, 57 minutes, and 56 seconds, we were wondering if Mitt has forgotten that the U.S. electorate features a large bloc of voters too old to not vote, or possibly forgotten that Paul Ryan has devoted the last couple years of his life to cutting "entitlements", meaning in plain English the Federal programs ensuring that those old folks get to indulge what Malcolm Reynolds refers to as the powerful need to eat sometime this month.

The Obama campaign doesn't need my assistance scripting great commercials, but here's one I'd love:


Paul Ryan has spent every minute of his Congressional career
working to destroy Medicare.


Mitt Romney wants Paul Ryan to be his Vice President.


What will happen to Medicare in a Mitt Romney presidency?
You do the math.

Wednesday, August 8, 2012

Brewer's night: UnPale Ale

Two beer-related items tonight. First, I brought a few bottles of Sweet English Bitter to choir rehearsal tonight for the after-singing snacks, and they were well-received. The only problem is that they're way too carbonated; I realized when I got home and reviewed the log, that I doubled the poor yeasties' priming sugar ration when I bottled.

Second: Fired up the new 5 gallon beer rig tonight for the first time. Decided to basically completely freestyle a recipe, possibly something in the porter family, but with aspects of pale ale too. Will update with observations and notes as they come in.

UnPale Ale

3.3 lb (1 can) Briess Traditional Dark LME
3 lb Briess Golden Light DME

This gives a calculated gravity of 1.050 in a 5-gallon brew, which is a nice middling; but also, it means that the boil gravity is really high. If I could have brought the boil volume up to 3.5 gallons, it would have meant a boil at 1.072 gravity intstead of the <2 .5=".5" and="and">1.100 that I actually had to work with; and apparently hops just don't want to give up the alpha when the sugar content is that high. (The limiting factor was the largest cookpot in the house... This strikes me as likely to be a recurring problem.)

This was also my first brew doing my own bittering (ie only using unhopped extract), so I secured

1 oz. Columbus (14% alpha), pellets
1 oz Liberty (4% alpha), pellets

I boiled the Columbus for 60 minutes, half the Liberty for 15 minutes, and the other half for 10 minutes. The boil wasn't all that vigorous; the burner was only just keeping up with the wort. (I wasn't using the biggest burner for most of the boil, because I had an early boilover and didn't want to cook very dark sugars onto Ms Heelfilcher's stovetop. Ugh. (See likelihood of recurring problem.)

After cooling the wort in the sink-turned-ice-bath, I poured it and pitched a tube of

White Labs Cry Havoc

which is supposed to be an odd little beast (it will ferment at both ale and lager temperatures) but is known for producing a clean flavor profile with a little fruity sweetness.

No gravity measurements, I don't currently bother with them (or even own a hydrometer).

Tuesday, August 7, 2012

The Ballad of Cain, Cain, and Abel, part I

So, this will be attempt 2 at a thought-experiment about rights.

The question, we recall, is to what extent we can think intelligently about rights by reducing to an extremal case, in this instance the case of there being only one person in the world. I argue that this last-person-on-earth scenario is missing crucial features of what makes rights, in the real world, problematic to decide. Joe, on the other hand, thinks that the last-person-on-earth scenario is paradigmatic for rights.

After thinking about this a bit more, I want to amend what I said in the last post. One can have a right to do a morally wrong thing, I realized, and the amendment is that "A has the right to do X" should mean that it is immoral for others to prevent A from doing X. There's already a problem on this horizon, in that there's a generally accepted distinction between random other people preventing you from doing something, and the state, or the church, or your employer, etc. doing so; but while that problem is interesting, I think it's not too relevant for this discussion, since the hypotheticals here have so few other people, no state, etc.

Anyway, all of what I'm about to say is toward an argument that rights are inseparable from their context. In particular, I'm not prepared to concede the validity of any argument of the form
(0) Imagine a hypothetical world where the effects of person X doing action A are very different from the effects of that action in the real world.
(1) In the hypothetical world, it is moral for X to do A, and/or immoral for anyone else to prevent X from doing A.
(2) Therefore, in the real world, it is moral for X to do A, and/or immoral for anyone else to prevent X from doing A.

This is at least partially due to my consequentialist leanings in moral philosophy, an early point of divergence between Ms Rand and myself. (More precisely, I think that any attempt at a moral philosophy which does not factor predictable, anticipable effects of actions into the calculation of their moral status automatically fails.) Two actions which look identical "up close", but which will have different effects, can have different moral status, so long as the agents can predict or anticipate those effects (or at least anticipate how probable various possible effects are).

TL/DR: Context and consequences have moral weight!

Anyway: we begin our parable on a small island. To keep this post a manageable length, I'll lay out the first three sets of circumstances today, in which the moral claims are (I think) pretty unproblematic -- but I'd love to see disagreement if my readers have any.
0th scenario: there are no people on the island. The island's soil and natural features could probably support a civilization of a few hundred people, if they had the right crops to plant and the right animal species to raise in captivity; but none of that goes on in this hypothetical. The island features (obviously undomesticated) edible plant species, herbivorous and carnivorous animals, and freshwater fish in the island's lake and streams. (These don't tend to be very large, since there's not a whole lot of room for them to bump up against each other.)
OK, so there's really nothing, at all, to be said about rights here, since no moral agents live in this hypothetical. (As usual, I assume that nonhuman animals on Earth are neither moral agents nor persons. Also, no aliens.) So let's move on to the
1st scenario:We introduce one human into the hypothetical, a guy we'll call Abel. The details of his background are, I think, irrelevant; let's just assume he shows up at some point on the island with no expectation of ever leaving. He has skills ample to the task of surviving; he can hunt, and can make tools. Not only that: Abel knows how to work metals, and has the skill to find the ores of useful metals and smelt and forge metal implements. (Useful metals, I said, not gold.)

Abel does no cultivation of plants or animals, but as said, he does hunt, for food (and I'm sure for enjoyment too). In fact, he hunts faster than his targets can replenish their numbers: several of the tastier species on the island will be extinct, at his current rate, in twenty years or less. At the same time, Abel's smithing is using up the trees on the island too, on about the same timescale. He also fishes, but not at such a high rate; the fish species are safe.

The question is, of course, is Abel doing anything wrong in this scenario? Does he have a right to do the things he does?

The most obvious candidate for a "no" answer would be his practice of hunting animals to extinction; but while there's definitely an argument to be made that it's always baseline immoral for a species of moral agents to drive another species extinct (i.e. yeah, there are self-defense situations and smallpox, that's not what we're talking about here), I think for this discussion I'll posit that Abel has the right to consume the island's resources for his own benefit under this scenario. Disagreement is welcome below. (In particular, since this hypothetical arose in discussion as the last-person-on-earth scenario, we can omit the argument from "science needs to categorize and know about these species!')

 OK, so far so good.
Scenario 2: Same island, same plants and animals, no Abel. Instead, a similarly immaculately arrived adult human couple, Mr. and Mrs. Cain. Their skills lie in the direction of agriculture; they are vegetarians (though like many, they inexplicably see no problem with eating fish... maybe they used to be Catholic?). Hence, they are not in the business of driving any species to extinction.

After spending time eating fish (and ok, maybe a little rabbit when they couldn't get hobbit fish), the Cains can determine some plant species they can live off. The staple of their diet soon becomes the products of a pair of vines which climb on and live symbiotically with the tall trees of the island. One produces squash, and the other beans, which together provide complete protein. The Cains have tried, but with only limited success, to transplant these vines to trellises: the vines grow, but the beans are all husk and the squash taste like vinegar. They speculate that this may be a matter of too much light and not enough shade, but probably also related to the symbiosis between vines and trees, some invisible nutrient being passed on that they haven't figured out how to substitute in their own gardens.

The Cains prioritize the sustainability of their lifestyle. They plant and tend the vines and other vegetable species they eat, monitor the soil for depletion, and rotate their cultivation accordingly. Their focus on sustainability is not merely feel-good: they are planning to raise a family and generate a lasting society on the island, so that while they may be the only people on Earth at the moment, they are determined not to be the last.
Once again, I submit that in this scenario it is hard to claim that anything the Cains are doing is wrong, is anything that they do not have a right to do. Of course, in on sense this is trivial: since there are no other people, there is no one who could prevent either Abel or the Cains from doing anything they liked; but regardless of that, what they're doing in the scenarios seems well within their rights, no matter how we define that term precisely. (There aren't even any borderline cases in the second scenario, unless you count the fact that their kids will have no choices for mates outside their own siblings; let's hope the Cains have strong genes.)

OK, so are we good with these initial scenarios? Are there any matters of rights that show up as problematic here, but that I've skipped or not noticed?

****ing Pandora

I haven't had this problem, but a friend is reporting that her Pandora is giving her bleeped songs. I thought I remembered Pandora having some kind of very strongly worded policy against bleeping back when I created my account, but I may be confusing them with someone else.

Does/did this policy exist? I've looked, but for me, the googles, they do nothing. Also, if there's any option to set which will prevent bleeped songs, that's something I'd want set.

Sunday, August 5, 2012

Blogging learning Python: equivalence relations I

 (Continuation here)

So I've finally broken down and started climbing up the learning curve for Python, just like everyone has been telling me to do for a couple of years now. Last summer's debacles with Octave should have been the last straw, but it's amazing what one can't get oneself to do when one actually got the result (despite the algorithm's taking a week to finally fail to compute what I asked for) and can move over to writing a paper instead of laboriously constructing examples.