Thursday, November 27, 2014

Essie Mae Washington-Williams

From Wikipedia (with edits):

Essie Mae Washington-Williams (October 12, 1925 – February 4, 2013) was an American teacher and writer. She is best known as the oldest natural child of Strom Thurmond, Governor of South Carolina and longtime United States Senator, known for his pro-racial segregation policies. Of mixed race, she was born to Carrie Butler, a 16-year-old black girl who worked as a household servant for Thurmond's parents, and Thurmond, then 22 and unmarried. Washington-Williams grew up in the family of one of her mother's sisters, not learning of her biological parents until 1938 when her mother came for a visit and informed Essie Mae she was her mother. She graduated from college, earned a master's degree, married and had a family, and had a 30-year professional career in education.

Washington-Williams did not reveal her biological father's identity until she was 78 years old, after Thurmond's death in 2003. He had paid for her college education, and took an interest in her and her family all his life. In 2004 she joined the Daughters of the American Revolution and United Daughters of the Confederacy through Thurmond's ancestral lines. She encouraged other African Americans to join such lineage societies, to enlarge the histories they represent. In 2005, she published her autobiography, which was nominated for the National Book Award and a Pulitzer Prize.

It's not so easy, I think, to not be acknowledged as your father's offspring for years. I'm rather impressed by Mrs. Washington-Williams take on the historical importance of her heritage and the importance for blacks to join in our nation's complex and sometimes unsavory history.


Wednesday, November 19, 2014

I just discovered this site Haven't explored it, but it looks nice at least.


Tuesday, November 18, 2014

Python3 or Bust

I decided to transition my library, Yarom (Yet another rdf-object mapper), to Python3. I've resisted using Python3 at all to avoid dealing with the transition/rewrite tools (six, 2to3) and the still un-ported packages. What made me reconsider is the unicode support. Although I don't code in a language that requires special characters, I understand that other people do. Making it more comfortable for them to write code is worth the trouble, I think. Besides that, new core Python development should be happening in Python 3, making it more secure to go with the latest version

In the future, I might post about how the Python 2/3 issues, as well as Ubuntu release cycles and the current Haiku OS discussion on a non-alpha release, have affected my thoughts on software versions.

Sunday, November 16, 2014

I just remembered that I once chatted regularly (maybe once a week) with a guy from China. It was early in college. He was a pretty cool dude. He even introduced me to his friend once.

I don't remember his name though :(

Saturday, November 8, 2014

Night Witches

Here's an article about the "night witches", Soviet bomber pilots from WWII, and a blogpost with links to a little more.

Tuesday, November 4, 2014

Sort and replace identifiers in a sentence

I found this post on LinuxQuestions that interested me, so I decided to try my hand at it. What I wrote is slightly more general in that it sorts any identifiers matching a pattern rather than just identifiers with numbers. The program does 3 passes over the sentence: The second substitutes all of the matching identifiers with "{}", a string which can be replaced using Python's string formating function. The first pass extracts the identifiers and sorts them. The third pass is the actual substitution using the string formatter.
import re

word_split_regex = re.compile(r"[\W\s]*")
id_regex = re.compile(r"id\d+")
natsort_regex = re.compile('([0-9]+)')

# from
#  does-python-have-a-built-in-function-for-string-natural-sort#18415320
def natural_sort_key(s):
    return [int(text) if text.isdigit() else text.lower()
            for text in re.split(natsort_regex, s)]
def main(s):
    b = sorted(id_regex.findall(s), key=natural_sort_key)
    x = id_regex.sub("{}", s)
    print x.format(*b)

if __name__ == "__main__":
    import sys
    if len(sys.argv) > 1:


Sunday, November 2, 2014

Disable Checked Exceptions?

I recently was frustrated by the necessity of annotating every function in the call chain in order to not handle an exception at the entry point to my code. The module I am working on accepts many different signatures for essentially the same method:

public static void doTransformation(Transformer t, Source in, Result out)
public static void doTransformation(Transformer t, InputStream in, Result out)
public static void doTransformation(Transformer t, InputStream in, OutputStream out)
public static void doTransformation(String t, InputStream in, OutputStream out)
public static void doTransformation(String xslt, String in, Writer out)
public static void doTransformation(String xslt, String in, OutputStream out)

Only the first actually does the transformation, but this can throw an exception from an external library, and all of the others call it directly or indirectly. I didn't want to annotate all of these with a throws declaration because I didn't know if I would have to switch out Transformer for something else or add more such methods in the future.

My first reaction was to leave off and go read a book; so I did that and then went to sleep. This morning I was looking at the code again and I was reminded of the first tool (or maybe second after abstraction) in the programmer's toolbox: indirection. Although a checked exception, if unhandled, can introduce a lot of unnecessary annotations into your code, you aren't obligated to use that exception throughout. All it took was wrapping that exception in my own derived from java's RuntimeException, and now it passes through to a place where I can deal with the exception appropriately.

I should have thought of such a simple solution right away — maybe I'll remember not to be writing code when I'm so tired in the future!

I happened upon this excellent blog post on exceptions in Java. Really, I can only vouch for the headings and the comments, but it's a very good summary.