Monday, April 1, 2019

Programming Doodle -- Enigma Emulator

I've revived this blog to track some general programming projects I've been playing with. This was inspired by watching Code Bullet's Youtube posting on creating an Enigma Machine emulator.

I decided to code my own in Python and looked around the web for further documentation on the structure of the Enigma machines. This is based on several online articles on the subject, though I'll admit that most of the code is heavily "inspired" (i.e. algorithms are pretty much copied) from the work of Harald Schmidl. While Code Bullet's implementation is impressive for its nice UI and rapid development, there are some discrepancies between it and other emulators out there.

I also found this emulator to be a good way to test my implementation, though I have no way to prove that anything I've coded is actually historically accurate to the original machine.

The code is here on github:
https://github.com/eric-lindberg/enigma-emulator

Tuesday, December 18, 2007

A Gladiator Dies Only Once and Saturnalia


I've been spending much of the last month and a half fighting off a flu I picked up while in Montréal. At least I've had a chance to catch up on some reading during that time, but I felt no desire to try to write about it while trying to clear my sinuses.

Mystery literature has been said to be one of the best forms of fiction to describe a particular place and time. The nature of the mystery requires the author to populate it with important details both to hide and reveal the clues. Characters need to have believable motivations for carrying out the crime, hiding it, or just appearing guilty even when they're not.

I have never seen a survey of the distribution in time and place of English-language mystery fiction. I guess that a large portion would be spread across 1920s Britain, with most of the American literature more evenly spread across the twentieth century, and perhaps a little overrepresenting the urban areas. Every once in a while, someone recommends a mystery writer to read when traveling. Sarah Paretsky's Warshaski stories for Chicago ... Tony Hillerman for the southwest. Even a remote place like Vermont is covered by the works of Archer Mayor, which my Vermont-based sister reads.

Then there are the historical mysteries. Some are truly dreadful, little better than the worst of the historical romances or formula fantasy novels set in a vaguely medieval setting. The good ones, however, are fun because they give an author with some knowledge of the period the challenge to describe a past society in a way that is simultaneously plausible and recognizable to the reader.

The two books here are Steven Saylor's A Gladiator Dies Only Once, and Lindsey Davis' Saturnalia. I brought both of these mysteries along for my travel reading, and finished both of them off quickly. Steven Saylor and Lindsey Davis are the two giants of the English language mysteries set in ancient Rome. You'd think that would be a pretty small subgenre of mystery literature, and yeah ... you'd be right.

Still, these are both interesting authors in different ways. Davis, a British writer, uses an obvious love for archeology to help flesh out her stories, set in Vespasian-era Imperial Rome. Saylor, working more from a love of ancient literature, creates a detective who hunts down details for Cicero, and later other historical figures of the later Republican era. Davis' characters barely age, comfortably moving from one comic drama to another. (Well, except for the one who was eaten by a lion.) Saylor's character starts as a young man in the time of Sulla, and has progressed to an elderly head of a family which he tries to keep together during the Civil War between Caesar and Pompey.

I have no strong preference. Davis is probably the better writer, stylistically, and has more interesting characters. Saylor is better at capturing a believable ancient world, but that said, his mysteries are just too easy to solve. But for either writer, I find I can forgive that. These days, solving the mystery story is less interesting than just seeing how the writer constructs the world that contains it.

Sunday, November 4, 2007

San Francisco Municipal Election Voter Information Pamphlet & Sample Ballot (Tuesday, November 6, 2007)


I'm not sure San Francisco necessarily has the most entertaining voter's guide of any municipality on earth (Hello, New Orleans?), but it's certainly somewhere in the top ten.

The list of Words You Need To Know (mostly phrases, actually) reads like a free-association riff on the election itself: Absentee Ballot, Annual Budget, Baseline, Car-Share Vehicle, Charter Amendment, Charter-Created City Boards and Commissions, Charter-Created Citizens Advisory Committees, Declaration of Policy, Downtown, Exempt, Fiscal Year, General Fund, General Obligation Bond, Hold-Over, Initiative, Low-Emission Vehicle, Municipal Transportation Agency (MTA), Ordinance, Planning Commission, Proposition, Qualified Write-In Candidate, Revenue Bonds, Service Hours, Set-Aside, Street Furniture, Super-Majority, Supervisorial District, Zoning Districts.

Alas, if only Phil Frank were still alive, I think he'd be able to rearrange that to something that could be set to music.

This year, the real fun is to be found among the twelve candidates for mayor. Our current mayor, Gavin Newsom, spent the year getting over his divorce, admitting he had an affair with his friend's wife, and getting treated for alcohol abuse. And he has trouble reading the news. All-in-all, the citizens aren't terribly concerned about having the reincarnation of New York's Gentleman Jimmy Walker as mayor. Tourists are showing up again, and South of Market construction is finishing what the Dot-Com boom started - driving anyone with an income under $100,000 out of the city.

So under those circumstances, nobody really wanted to run against the mayor. Well, that's not exactly true. Lots of people have signed up to run against Newsom. Nobody named Alioto, Gonzalez, or Ammiano are running. Just a list of the occupations is entertaining: Publisher and SF Bulldog, Writer/Nudist Activist, Juvenile Probation Manager, Florist/Coffee Farmer, Vegan Taxicab Driver, Program Director, Mayor of San Francisco, College Professor, Nightclub Owner, Showman, Physician, Journalist.

Now, I admit that there's nothing inherently funny about the idea of a Physician, Journalist, Program Manager, or any of the others becoming mayor. Of course, I kind of question whether "vegan taxicab driver" is actually an occupation. Taxicab driver, yes. Vegan, not so much. And some of these people even have thoughtful and well-written platforms.

Then there's the stuff like this:

This is a One Issue campaign which is to Make Golden Gate Park Clothing Optional like the major urban parks in Europe. . .
[Uh, dude. Dejeuner sur l'herbe is not an accurate portrayal of "major urban parks in Europe".]

I am a 63 year old straight white man.
[Stop stealing Quentin Kopp's platform!]

My creation of the Power Exchange adult sexual liberation experience shows my capacity to embrace every kind of alternative lifestyle and manage multiple environments housed in one totally law-abiding and successful business. [Uh . . . no, I've got nothing to say to that one.]

Perhaps the most eloquent statement is by Showman "Chicken John," who says, Am I dumb enough to think I can win? Not really. But I do believe I can win the losing vote . . . . C'mon, it'll be fun. Vote for me.

No, I just can't bring myself to that. If only Sister Boom Boom would come out of retirement like a San Francisco Cincinnatus to show them all how it's done.

[Actually, now that I read this, I can't believe that I'm the first to mention either the Dejeuner sur l'herbe or the Quentin Kopp jokes. Did I just repeat them from some vague memory?]

Wednesday, October 24, 2007

CMMI for Development, Version 1.2


I'm at OOPSLA in Montréal this week. I've been reading the Capability Maturity Model Interface for Development spec on occasional breaks, which haven't been many.

I don't have much to say now. I'll have more when I get back to San Francisco.

Tuesday, October 16, 2007

Yangtze Skipper


I found this book in Powell's Books in Portland last year while at the OOPSLA Conferece. Published in the mid-1930's, it describes the experiences of a young gunboat captain in China in 1919. It had been filed in the history section, and I bought it, thinking it was a historical memoir.

It is, after a fashion. The writer, Thomas Woodrooffe, did apparently serve on a British gunboat just after the First World War. The book is a fictionalized version of his experiences. Woodrooffe really doesn't have any deep insights on the history of the period, but makes some wry, and sometimes amusing, comments about both the Chinese population and the colonial society he's forced to live with. The inscription described in this copy of the book sounds as though it is a fairly accurate portrayal of the author, based upon his style.

The picture here is of the type of gunboat Woodrooffe would have sailed in, and is taken from this website on the subject.

Now that I've finally got around to reading this book, I'll have to see what I pick up in Montréal while at this year's OOPSLA next week.

Sunday, October 14, 2007

Master and Margarita

OK, first off, I'm really not trying to be pretentious here, choosing Pushkin, Bulgakov, and a massive tome on Chinese history. I'm not continuously reading daunting stuff like this. Secondly, I'm not really in the midst of reading this particular book. I only pulled it down off the shelf because I rented the television version of Master and Margarita directed by Vladimir Bortko. I also promise not to attempt any deep analyses of he work, not because I'm demonstrating any restraint, but just because I don't think I'm up to it.

The story is about a visit by the Devil to Stalinist-era Moscow. While Master and Margarita is filled with enough allusions to Russian literature, Soviet history, Russian Orthodox theology, and other references to encourage extensive analysis, it is still an entertaining book without having to stop every page and ponder its deeper meaning. (Unless you want to.) It contains any number of memorable passages, and evocative descriptions of the Moscow of the twenties and thirties.

Which brings me to the subject of the Russian TV series. I pulled down the book just to compare my memories of it to what I saw on the DVD. The television scenes were extremely faithful to Bulgakov's words. In fact, I was pleased that I was able to notice a minor change, replacing the bicycle act in the Varieté scene with a balancing act. The same scene added a detail, putting a poster exhorting "Complete the Five Year Plan in Four Years" behind the stage, something I don't believe is anywhere in the book.

Inevitably, even in over eight hours, some things were missing. While the music was effective, I heard none of the musical references made by Bulgakov. Also missing was the scene with the little boy during Margarita's flight over Moscow. I'm sure those who have read the book more often could cite other missing parts.

Despite that, the DVD is worth a look. One note, based on the comments of one person I know who already complained: The subtitles on the DVD are only available through your DVD player controls, and not through the title menu. It would certainly be difficult to follow for someone who doesn't speak Russian, otherwise.

Monday, October 8, 2007

Imperial China 900-1800

This has been my evening reading since I returned from my first trip to China at the end of August. Actually, I've been reading it on and off for a while, but at 1,000 pages, it is taking a while. So far, I've reached the rise of Zhu Yuanzhang and the founding of the Ming Dynasty.

Reading through the reviews in the Amazon link above, one reviewer considers the book lacking narrative. I'm not sure that's fair unless you're expecting an overarching theme to the entire 900 year history covered.

The one simple thing I'm taking away from the book so far is that the focus on dynastic history often obscures study both long-term economic or social trends as well as local history. So much is written, both in China and in the West, that focuses chiefly on the establishment and maintenance of imperial authority.

I realize this is a comment more on popular perceptions, rather than on scholarly work, but I have yet to find the kinds of detailed studies of local social history that are popular in European historical study.