Dynamic Languages are Static August 20, 2014 | 04:06 pm

This article is a response to this blog post. The problem with this post is that it makes several mistakes around the behavior of sum types, which undrcut the argument the post is making. I want to explain why Bob Harper’s original (and admittedly some-what flaime-baity) post is correct.

But first, I need to actually state the argument Bob Harper was making. He was said that every dynamic language could be incoded as a sum type in a static language. As example of this, let me demonstrate exactly how to do this, by encoding lisp into a sum type in haskell:

    data Lisp =
        LInt Int
        | LString String
        | LSymbol String
        | LList [ Lisp ]

This says a Lisp value is either an Int (labelled with the tag LInt), a String (LString), a Symbol (LSymbol), or a list of Lisp values. You can, if you feel like, extend this with more data types- add floats, and doubles, and chars, and vectors, and maps, and sets, etc. I can then happily write functions that take and return my Lisp values.

At this point, the OP makes a critical error right about here- she assumes that the values 3 and LInt 3 are the same. They aren’t. No, you can’t add an integer and a string in Haskell- but you can write an add function (of type Lisp -> Lisp -> Lisp) which can add an LInt 3 to an LString "foo".

This is interesting because it demonstrates another point the OP missed. So let’s consider the add function, to add two lisp function together. As there are two arguments, and each argument can be one of four different types (variants), you might think I need to write 16 different case statements down. You’d be wrong. The code looks like:

    add :: Lisp -> Lisp -> Lisp
    add (LInt x) (LInt y) = Lint (x + y)
    add _ _ = error "add called with a non-integer argument"

The _ is a discard matcher- it matches anything. And since matching precedes in order, and the first pattern to fit is the one that is evaluated, if both arguments are ints, the first expression is evaluated, and we get an int. If any of the other 15 different situations occurs, then the second expression is evaluate, and we throw an error at run time. Just like Lisp. In this way, the _ acts as a sort of escape hatch from having to deal with all the different cases, which all get handled the same way anyways. Indeed, the whole Lisp type itself acts as a sort of escape hatch.

From one angle, all Bob Harper has done here is restate Greenspun’s tenth law. But here’s the difference, and the point Harper was making: we can choose not to use the Lisp type. By taking a value of type Lisp, we are expressly stating that this function takes any value that can be encoded as an s-expression. If that’s what we mean, all right. But we have the choice of using a more restrictive type, we express something of the assumptions the function is making.

This is what Bob Harper meant by more expressive. Everything we can express in language X was can also expression in language Y- but there are things we can express in language Y that we can not in language X. For example, that a given function doesn’t handle every possible case.

Repealing Godwin’s Law August 3, 2014 | 02:22 pm

Memetic drift has changed Godwin’s Law from a wry observation, to an indication that useful conversation is over, to a statement that discussing Fascism at all is verboten. Discussion of Fascism at all has been fraught for some time- most people seem to think the definition of “fascist” is “someone I don’t like”. Which is why Obama can be both a communist and a fascist (and if your proof that this makes sense is that the Nazi’s had the word “socialist” in their party name, then North Korea is a Democracy).

Which is unfortunate, because there are a lot of lessons from that era that need learning. One that has been weighing on my heart a lot lately is just this: The final solution was not the first solution tried. The history most people remember has the Nazis gaining power, and then one day going “Hey, I know: let’s kill all the jews!” There is no logic to the decision, no progressions, and certainly no parallels to any other situations- just the innate evilness of nazis.

But first, let me back up and ask a simple question: what was the problem to which the final solution was a (proposed) solution? In the most general terms, the problem was one of having an existing subculture you’ve decided is a problem. The very existence of this subculture is harming you (you think). By striping the problem of it’s specific cultural aspects, it becomes more obvious that the holocaust was not unique, that many other countries/cultures have faced the same problem. Two other examples I want to point at this juncture is the American (US) and apartheid South Africa’s behavior towards blacks, and our behavior to the Native Americans (especially in the 19th century).

Now the question is: if the final solution was not the initial solution tried, what where the previous (non-final) solutions tried? And why did they fail, and how does that lead to the final solutiom?

I count four steps on this express lane to hell. Step one is ghettoization. So, you have a subculture- jews, blacks, native Americans, doesn’t matter- who a problem, you quarantine them. They have their own parts of the city, or their own land over there, and you make sure they don’t come over here. It’s no coincidence that ‘ghetto’, a term which originally described the jewish sections of european cities also got applied to the black sections of US cities. If it walks like a duck and quacks like a duck…

Of course, there turns out to be two problems with this. First, it’s hard to make sure they stay over on their land/neigborhoods. As the saying goes, a 10 foot wall just sells 12 foot ladders (“Mr. Perry, tear down this wall!”). But the bigger problem is just that land is expensive. Especially city property- gee, you have this neighborhood which is only a 45 minute commute from Wall Street? Guess what- Harlem gets gentrified. Even forcing the problem subculture into waste land that no one wants now only works until oil or uranium or something is found under the land, as the Native Americans can well attest.

So, as ghettoization fails, the solution number two presents itself: deportation. Pack up the problem subculture and send them somewhere else. Of course, this fails as well. As a general rule, everyone has more than enough problems of their own, and aren’t interested on taking on someone else’s problems.

So deportation fails, which leads to solution number three: incarceration. Round up the problem subculture and put them in jail. It’s a gray line between extreme ghettoization and actual incarceration- but the line gets crossed when the subculture gets packed so tight that some form of support from the majority culture is needed. Of course, now you’re responsible for feeding, clothing, and housing the entire subculture. You can try to make them productive by forcing them to work- but prison labor is never worth it (in terms of productivity, it’s generally worthwhile to simply have the guards do the work, and get rid of the prisoners). And as soon as things get tight (and they will always get tight, sooner or later), the cost of maintaining the subculture in the prisons will become unsustainable, and some way to reduce the cost of keeping them in jail.

At which point we reach the final solution: just kill them. And welcome to hell, and deservedly so. But hey, at least it really solves the problem of the subculture.

There is an inevitable logic to the situation, which is not at all specific to Germany in the 1930′s. With the US and Blacks, we’ve gone at least to step 2 (look up the history of Liberia), and arguably to step 3 (consider the War on Some Drugs). And the path is not always walked cleanly or discreetly- for example, during World War 2, the US skipped steps 1 and 2 and went right to step 3 with respect to Japanese Americans. And the US again skipped step 3 with the native Americans, and went directly to step 4 (small pox blankets? Really? You expect me to not see through that ploy?).

But the logic still applies. The only way off is to redefine the problem. Stop labelling the subculture as a problem, make the subculture no longer “them” but now just a part of “us”. This may require a redifinition of what your culture is. Germany, for example, would have had to give up it’s vision of being a Christian Aryan nation, and admitted it’s plurality. The US had (has) to give up it’s vision of itself as a european and christian nature, and admit it’s pluralistic nature- that Native Americans and Japanese Americans and African Americans are all, first and foremost Americans. Just like Irish Americans, German Americans, French Americans, Italian Americans, Polish Americans, Chinese Americans, Mexian Americans, etc., are.

The holocaust was not the result of unqiue circumstances in Germany in the 1930′s. It was the inevitable and logical result of bigotry. And anywhere where bigotry flurishes, against anyone, there is the possibility of a new holocaust. This is the true problem with Godwin’s law, the shouting down of anyone talking about Fascism, especially in relationship to anything else. The lesson not taught is the lesson learned the hard way. Not talking about the Fascists means the Fascists will rise again.

The fundamental conflict between Science and Religion July 10, 2014 | 05:29 pm

First off, an apology for my long silence on this blog. Life intervened (and I don’t even have the excuse Robert has, not having spawned a subprocess). But I’d like to take the opportunity to address a topic that’s been bothering me for a while.

There is a widespread belief, especially among the more liberal theists, that religion and science can somehow be reconciled. Simplifying to the point of near-insult, this belief holds that science only applies to sciency things, like gravity or sucrose consumption by the mitocrondria, or things like that. While religion only applies to religousy things, like the meaning of life or whose outies get to go in whose innies, and so on. Or, to use bigger words, that science and religion are non-overlapping magisteria, and thus are not in conflict (unless one or the other is stepping out of bounds).

Or, to put it another way, theologians are demanding rigidly defined areas of doubt and uncertainty.

The problem I have is just this: religion’s right to define what the meaning of life is, and whose outies go into whose innies, is predicated on having a communications to channel to the creator of all. And the existance of this communication channel is itself subject to scientific proof- or disproof. And the evidence says that the communication channel doesn’t exist.

Before I go on, two comments I’m going to need to make. First of all, there is no proof so strong, so irrefutable, that someone can’t go “nuh uh!” The existence of people who disbelieve in evolution, or global warming, or even the round earth, proves this. So simply because you refuse to accept the proof doesn’t mean the proof isn’t valid.

Second, yes, abscence of evidence doesn’t qualify as evidence of absence. But evidence of absence *does*. There is a difference between not having looked for something (absence of evidence), and having looked for it and not found it (evidence of absence). There are accepted scientific proofs tha something doesn’t exist. A classic example of this is the luninous ether. Basic logic said it had to exist- water waves don’t exist without water, and sound waves don’t exist without air, so if light was a wave, then it had to be a wave in something. Unfortunately, the Michaelson-Morley experiments (which were repeated multiple times in differing circumstances) failed to find any evidence for the ether. Conclusion: it didn’t exist. We had evidence of absence.

So, with those points in mind, I present my argument. Let’s engage in a thought experiment. Lets us assume I suddenly announce that I am in contact with an alien species. For long, irrelevent reasons, I can only communicate with this species, I’m not in physical contact (so I can’t pocket a alien artifact, as Neil deGrasse Tyson advises). And they won’t communicate with you, only with me. And let us furthr assume you’re willing to at least entertain the possibility that I’m telling the truth and not just a crank- it’s a thought experiment, work with me here.

Even under those constraints, it is still possible to determine, with a very high degree of certainity, whether I’m telling the truth or not- whether my aliens are real, or just a figure of my imagination. You could ask for an explanation of how to reconcile relativity and quantum mechanics, say, or a proof of the Goldbach conjecture, or whether P=NP (and a proof of whichever), and so on. These are things we humans are likely to figure out ourselves in the next century or two- any alien civilization advanced enough to be comunicating with other start systems is almost certainly will have the answer to those questions.

So, if you ask me to ask my alien friends these questions, and I come back later with pages of mathematics that cause the experts in those fields to get all exicited, that counts as pretty strong evidence that the aliens are real. On the other hand, if I come back with mealy-mouthed excuses (“those are problems humans are supposed to solve for themselves”), that’s pretty strong evidence that the aliens are simply figments of my imagination. I may still enthusiastically insist that my aliens are really real, but it’s hard for any rational person to take my claim seriously.

And something to note: my aliens are every bit as mortal, every bit as limited, every bit as physical, as humans are. They’re just in sixth grade while humans are still in first grade. They’re just a little bit more knowledgable, a little bit more technologically advanced, than we humans are. They don’t violate the fundamental laws of physics (well, except possibly relativity’s ban on information travelling faster than light, but even that I can get around by positing worm holes). They don’t cause logical paradoxes. Given the approximately 10,000,000,000,000,000,000,000
stars in the visible universe, even hardened skeptics would be surprised if aliens didn’t exist- the only surprising thing is my claim that I’m in contact with them. It is just insane to hold religions to a lower standad of evidence than we hold my aliens to.

This is, at the end, just a thought experiment (no, I’m not really in contact with aliens). But it demonstates the fundamental problem religion has, and why it runs into fundamental conflict with religion.

Science has shown us huge things. Provable things. Things the all-knowing creator of all *has* to know. Why didn’t God say something? “Dude- it’s *round*. I know it doesn’t look like it to you, but trust me! From up here, you can’t mistake it’s round. Yep. A sphere. OK, oblate spheroid, if you want to get technical. Anyways, here’s how you prevent smallpox, and save billions of lives over the next couple of millenia…” In fact, there’s no religious book I know of that contains demonstable information that wasn’t known to well read people at the time they are written.

Yes, I know that God doesn’t work that way. God requires faith for reasons. Just like my hypothetical aliens who didn’t provide a proof of Goldbach’s conjecture, God acts in ways that are mysteriously indistinguishable from being a fiction.

Note that this is a challenge that still holds. Next time God communicates with you, I’ve got some questions to ask him. This is the challenge that science poses for religion. Not (just) that we have figured things out since holy scripture was written, but that we are still, today, finding new things out. Things God could have communicated, but strangely didn’t.

And without this pipeline to he is who is, religion loses all claim to it’s magisteria. No, science can’t speak to whether gay marriage is moral or not- but neither can religion. Religion can not be used as a basis for morality- because it’s basis for morality (communication with the supreme being) doesn’t exist. Science may not be able to disprove god- but it can (and has) disproven your god, a god who communicates.

A religion which does not want to confront this dilemna has no basis to influence anything. They are not unlike Emperor Norton, who declared himself Emperor of United States and Protector of Mexico. Just because you claim dominion, doesn’t mean you have dominion.

If anything, the biblical literalists, the fundamentalists, are more honest in their faith. Their position is that God did tell the biblical writers the real truth, in plain language and with no mealy mouthed excuses about poetry and limited understanding, and it’s science who has it wrong. Of course, their problem is that the science refuses to go away (evolution isn’t science any more, it’s technology).

They’re wrong, but no more wrong than those who hold that science and religion are not in unavoidable conflict.

Dependency Injection with Guice and GuiceJumper May 10, 2014 | 10:14 pm

When a lot of people discussion static vs. dynamic typing, they are really discussing Java vs. Ruby typing: they simply don’t know any better than to think that Java is representative of static typing. In a similar way, when people hear “dependency injection”, they think Spring. I was one of these people: after getting caught on one too many angle brackets, I was generally put off Spring. The dynamic language features of Groovy made Spring a bit more tolerable within Grails, but I still found it more annoying and obscure than helpful.

For a while, I considered dependency injection to be an informative failure, but something kept nagging at me: the magical variables in Rails are effectively involuntary dependency injection—this pattern is half-jokingly called “dependency ejection” or “dependency secretion”. So there’s something to dependency injection, even if Spring got it wrong.

Then, at JavaOne, I bumped into some of the Google devs, and they pitched me Guice. Some of the pitch points hit home: compile-time type checking; actionable error messages; configured through code; works with immutable classes. However, it still used annotations (which I was busy hating on), and dependency injection was not a popular point with me, so it took me a while to get around to checking Guice out.

I wish I hadn’t waited so long.

Guice does dependency injection as right as I’ve seen, and it makes working within Java and Groovy much nicer. Its simplicity sometimes leads people to underestimate it, however. Recently, I released GuiceJumper, which is my extension to the Guice core library. The code in there demonstrates some of the power of Guice.

For instance, there’s the ExecutorModule. Its primary purpose is to enable classes to ask for an ExecutorService—the core class for concurrency—by specifying the kind of tasks that will be passed to it. The context will provide an appropriately-configured implementation of the ExecutorService, which (if appropriate) is shared throughout the system.

// Groovy code so it's short enough to read
class Busy {
   @Inject @Background ExecutorService executor
def injector = Guice.createInjector(new ConcurrentModule())
def busy = injector.getInstance(Busy)
busy.executor.submit {-> ... }

The @Background annotation means the ExecutorService will be appropriate for background task processing. The other options are @Process (CPU-limited processing); @Read (work production and I/O input); and @Write (work consumption and I/O output).

But that’s no big deal: that’s basically a step above rudimentary dependency injection. Slightly cooler: load your application configuration up into your favorite properties file (through, say, Properties.load(Reader)), provide it to the PropertiesModule, and then those properties will be available throughout your system. You can convert them to any primitive type, BigInteger, BigDecimal, Charset, File, URL, URI, or any enum…with actionable errors if the conversion fails. So all those magic constants can now be stored up front in a single configuration step, loaded later, and you will get an early error if they are badly formatted or otherwise bogus. It’s a beautiful thing.

class Configured {
   @Inject @Named("my.config.prop") int value
   @Inject @Named("my.awesome.blog") URL blogUrl
def injector = Guice.createInjector(new PropertiesModule(["my.config.prop":"42", "my.awesome.blog": "http://enfranchisedmind.com"]))
def confed = injector.getInstance(Configured)
assert confed.value == 42
assert "$confed.blogUrl" == "http://enfranchisedmind.com"

The I18nModule pulls a similar stunt, but uses annotations that look like @Localized("i18n.key") and loads localized values from the ResourceBundle, enabling super-simpler localization of the application and centralization of the messaging.

I’ve got another module to be released which provides all the wiring necessary for the AWS Java SDK objects, but that’s not released to the public yet.

Guice gives you the ability to have a distinct configuration phase to your application, which is entirely under the control of your application, and which need not be at the very beginning. In fact, I have systems that have multiple configuration phases, generating child injectors with new modules as more information becomes available: for instance, my hybrid of Groovy/Guice/Restlet (working title: Restling) creates a new injector for each request. The request injector can provide the request itself, the response, the user, and other request-scoped information.[1] It is worth emphasizing that all of this is configured and controlled by code, which means that you can have precise control over what is going on when, and in the unlikely situation that there is a problem, you can apply your standard debugging tactics. It’s great.

It’s dependency injection without the pain. I love it.

[1] Yes, I am aware that there is a request scope using the servlet plugin for Guice. I find that plugin more magical than helpful, especially given that I can accomplish the same things with nested injectors.

Two Months and Counting February 22, 2014 | 04:10 pm

It’s been two months since my baby was born, three since I posted “Congratulations! She's Pregnant! You're Screwed!“. I thought it might be time for a bit of retrospection.

There are a few things that I want to say right away.

First of all, I was hugely helped by idea that becoming a father is a crucible (see the comment by Avdi on the previous post), and that you have to fight for whatever time you need. Anything that is fat in your schedule needs to be eliminated. It’s just that simple. Once the baby comes, your schedule is cutthroat, and it’s all about just pushing through.

Second, I have become an idiot. And, by all reports, this is never going to get better. I cannot remember things as well as I did before the baby, and I’m making stupid mistakes that I wouldn’t have made before. Creativity is harder to come by.

Third, I’ve gotten fat. Deprived of sleep, my body is looking to calories for energy, and my willpower to keep myself from eating is way down. Of course, I could work on adjusting my diet and improving my exercise, but other things are getting my willpower and attention right now.

That aside, let’s begin the retrospective.

I still believe everything that I said in the original post, and dads-to-be are coming out of the woodwork to tell me they feel the same way. Aside from spreading on Avdi’s advice, my only other advice is to keep repeating this mantra: “It gets better.” The first two weeks were exhilarating: between the constant demands from the baby and the excitement of learning how to manage a baby (Protip: look up Harvey Carp’s “Happiest Baby on the Block” video), it was satisfying in that too-busy-to-be-bored kind of way. After that, things got much more routine, and it became a slog. Each week is better than the last, though, in the sense that the baby is easier to deal with. My baby girl is just starting to smile for reasons other than gas, mostly as a muscle reflex from tapping her nose. She’s also sleeping through the night, although that’s apparently uncommon.

At eight weeks, being a father doesn’t seem terribly enjoyable. But this doesn’t surprise me: this part of having a kid wasn’t what I was looking forward to. I’m looking forward to having a kid a few years from now, and then having an adult offspring. A few parents with older kids tell me that they want to be back at this phase, and I don’t get it. My running theory is that they have suffered brain damage, suppressed the trauma, or otherwise forgot just how much this time sucks.

And this time does suck. Breastfeeding is extremely hard, and the mother will need a lot of support. This is especially true in the beginning, when breastfeeding took four hands to really work. Now that we are past that stage, my job has become entertaining my wife for the six hours or so that she is stuck in the chair doing the breastfeeding. That’s a lot easier and more fun than the previous job, so it’s getting better.

Outside of breastfeeding, there’s the ever-popular game of “Why the Hell is the baby crying this time?” Initially, there was just one setting to the crying: “END OF THE WORLD”. Now, she’s just now starting to have distinct cries for “END OF THE WORLD”, “pain”, and “anything else”, which at least offers a clue. But since “pain” could be anything from being scratched to an arm being stuck in an awkward position to gas, it’s hard to debug. And “anything else” requires running through the whole list, which is roughly this (in order): diaper, hungry, uncomfortable, bored, tired, WTF?

Meanwhile, people keep encouraging me to spend time with the baby, but I don’t know what to do. She screams at me most of the time when I tried to do babywearing: the one notable exception was when I wore her to Durham Friends Meeting (the Quaker Meeting that I attend). I consider her staying quiet for forty-five minutes while being worn to be a miracle on par with Hanukkah. Outside of that, she mostly just sits there, which doesn’t give me a whole lot to work with. I was going to read to her every night, but she doesn’t tolerate that well with me. (Other people seem to have better luck for some reason, which is disheartening to say the least.) Occasionally, I’ve got enough energy and excitement to be able to entertain myself with her, but that’s just for extremely limited windows.

I tried to have some things that were my schtick: some ways that I was going to be special for her. At first, it was the fact that I could quiet her down better than anyone else. I thought that I had some special knack, but it turned out that I was simply less stressed than Mom and more familiar than everyone else. So that didn’t last long, and pride went before the fall. I was the diaper guy and handled all of them (my wife literally did not a change a single diaper for the first six days), but other people were simply going to have to change her diapers sooner or later. Baths were just her screaming at me in a room with reverb, which is hardly the special experience people sold me. So I’ve mostly just given up and I’m biding my time until she’s more engaging.

While all this struggling is going in within the context of the nuclear family, I’ve found the treatment outside the nuclear family is largely continued dismissal. Dads are very much second-class citizens when it comes to childrearing and any kind of parenting consideration, which basically disengages me right away. The stuff that is dad-centric seems poseur-ish and hyper-macho. I don’t want something for dads or moms: I want something for parents. All of this has at least given me appreciation form the Women’s Liberation movement: if I was treated like this in all aspects of my life, I’d be rebelling, too.

The one thing that has changed since the birth of the child is that I am getting a lot more positive feedback from my wife, so at least I’ve got that going for me. I’m not sure if this is something a guy can just expect from his wife, or if it’s a consequence of her reading the previous post. Just to be sure, if you’re a guy, I’d happen to leave the previous post up on your laptop and sitting out for your wife to find. Having your wife be supportive is huge, because you’re not going to get much support from anywhere else.

Being who I am, I tried for book reading. Every book I’ve read on being a father has made me feel worse, so I’ve just stopped doing that. First of all, all the books contradict each other, which is worse than useless. Second, the books make a big deal about how meaningful fatherhood is and how warm and fuzzy you feel and how that can be spiritual, and I’m feeling little of that, which is leaving me feeling like a broken sociopath again. One of the books said, “Lay with your daughter on your chest. This is when the world begins to make sense.” I did that, and didn’t feel anything more than a weight on my chest and anxiety about whether she was about to burst out crying. Another book I read spent the first half the book talking about “Mindful Parenting” and how great it was and how it would transform everything without actually ever defining what it was or talking about how to accomplish it. So, yeah, forget books.

When I reached out to others, I quickly also discovered that “Mommy Wars” (because it’s not Parent Wars, right?) are vicious. I will take blogging flamewars any day over these kinds if issues. Anyone who thinks that women are somehow innately more cooperative or friendly or whatever haven’t had a conversation with new moms about vaccines or breastfeeding. And everyone is freaking offended by everything, and it’s all hugely important OR YOU WILL SCREW UP YOUR CHILD FOREVER YOU BASTARD. I have literally been told that I am abusing my child (their terminology) by having her get vaccines and using formula to supplement breastfeeding. In return for putting up with this kind of vitriol, I still get conflicting and largely unhelpful advice. This has put me off soliciting advice from anyone beyond my family and some very select friends. This has mostly worked, although I do feel pretty isolated.

Now, to be fair, we’ve had an incredible amount of support. My parents, my cousin, and a friend of mine all came and spent the night, which was huge for allowing my wife and I to catch up on sleep (and each other). People have regularly come and spent a lot of time just holding the baby and being all excited about her, which takes a lot of pressure off my wife and me. So that sense of isolation isn’t from a lack of attention from family and friends: it’s more from a fact that I feel like my wife and I are having to figure this all out (mostly) on our own, and I’ve still got a kind of distance from the baby that she doesn’t.

Between that sense of isolation, the day-to-day demands, and the way it has wrecked my mind, body, and soul, I just wouldn’t do this again. Doing it once has been really good for me, but I don’t have any interest in repeating the experience. From where I’m sitting at this moment, I just can’t understand people who are onto babies three, four, or five. Having a second kid in order to give your child a sibling makes some sense to me, but doing it over and over again seems bizarre. That makes as much sense to me as running your car into a streetlight three, four, or five times. But ask me again in a year or two.

Congratulations! She’s Pregnant! You’re Screwed! November 23, 2013 | 04:41 pm

Moms: This post isn’t for you. Please don’t read it. If you decide to read it and you get pissed off, please don’t tell me about it. This isn’t a conversation for you. When I’ve got something out of it which is valuable to bring outsiders into, then I’ll let you know. But I don’t right now, so I’m just talking to the guys, and you really don’t want to hear this. If you have a critique that you’d like to make, please talk to your partner about it and have him bring it in, because your partner is welcome into this conversation.

Dads: There is a small subset of you out there who are way excited about having a baby and who get all gushy about onesies and cribs and the like. If that’s you, then this post isn’t applicable to you. If your lady asks if you agree with this post, you have my permission to go ahead and claim to be one of those guys, even if you aren’t and you agree with the whole post. I get it, and I’m just a random dude on the Internet. Throw me under the bus if it helps your relationship with your baby’s mama.

LGBTQWXYZWFTBBQ Folks: Yes, my note to the moms was downright exclusivist and heteronormative. The rest of this post will be, too. If your relationship isn’t heteronormative compliant, then I have no idea if anything in this blog post has any relevance to you or not. Take what’s applicable, and file the rest under “Breeder Problems”, right beside anything starting with the prefix “Bro–”.

It is astounding to me to experience the utter neglect of dads as human beings during the whole pregnancy cycle. We’re complete accessories: we’re talked past when we’re not outright ignored, and those things which do address us are basically just the same thing women get but with more hair and a few infantile jokes about beer and sex. Oh, and lots of great tips about how to keep her comfortable and happy and to be sensitive to her needs.

But these books are worthless. When I get together with other fathers-to-be and newly minted dads, nobody is concerned about how to make their wife comfortable or how to be sensitive to her needs. We’re the generation that grew up in the world of the “Sensitive 90s Guy”. One of the books that I read called it the “Pussification Period of America”, which is blunt and crude but fitting. As Tyler Durden puts it, “We’re a generation of men raised by women.” Sensitivity, we’ve got.

Fight Club – A generation of men raised by… by the_MGTOW_database

The issue that I have—and which I keep encountering—is that I have no idea how to relate to this newborn baby stuff. I’ve got the technical aspects down, and I know that a bunch of it is going to be on-the-job-learning, but I’m talking about something deeper than that.

The reality is that I don’t care for newborns. I don’t get excited about onesies. I don’t make “Awwwww” noises when a baby burps. I could not care less about the colors for the nursery or whether we have stars or animals. The part of having a kid that I’m excited about isn’t for a few years down the line yet. This whole baby and pregnancy thing just sucks, and my happiest times during this process are when I can ignore the fact that my beautiful wife has this parasite growing in her, and ignore the fact that it’s about to rip its way through some of my favorite parts of her body and enter the world as a sleep-depriving life-vampire for somewhere between three months and a year.

And I’m not the only one. When I talk to other dads in confidence, I hear a whole lot of agreement, usually appended with some statement like, “Yeah, but we can’t let our wives know we feel this way!” (Sorry, guys. Feel free to disown me and act like you have no idea what I’m talking about. I get it.) The most messed up part of the whole situation is that the guys who feel this way often feel like they’re the only ones, and there’s something shameful and broken about us in particular, whereas all the other guys must be coping better with being new dads.

But they’re not coping better. Sure, there are a few guys out there who are super excited to be dads and to be Mama’s Little Helper the whole time. (For some reason, these guys tend to be with women who are loathe to be doing this whole “pregnancy” thing. There’s a balance in the Force.) The reality, however, is that feeling like I do is extremely common, and it won’t take a much asking around among dads-to-be for you to find that out for yourself.

Yet, despite how common it is, there’s just nobody who addresses this problem.

I’m yet to encounter a daddy book which addresses these feelings and tells you how to deal with them. Classes that aren’t explicitly for new dads will regularly refer to the class saying “You”, but they’re only ever talking to your wife: you-as-partner basically do not exist except insofar as you’re a spare and mobile pair of hands to get things for mom, and you-as-partner-as-human-being is a totally foreign concept. (When you do get some attention, it’s usually to tell you how you’re going to fail: you’re going to faint when you see blood, you won’t be able to handle your wife in pain, you’re going to be an idiot about diapers, etc., etc.)

Since books and generic classes failed, I signed up for all the classes in the area specifically for new dads (that’s two classes, BTW). In one class, I mentioned I felt this way and we had a conversation about it, but didn’t come to much of a resolution: the best we got was “Well, it’s not as bad as you think it will be once the baby comes.” In the other class, I mentioned I felt this way, there were some comments of agreement, and the instructor proceeded to acknowledge and then ignore it. (Oh, and also BTW, the good class which did address these issues is getting cancelled due to lack of funding.)

With books and classes and dad classes out, I looked on for more support. As far as I can tell, there is no such thing as a “New Dads Meet-Up”. So it’s the personal network only at this point.

Your wife, of course, will not be able to comprehend the problem at all, because she’s in an entirely different place, both in terms of the support she’s getting and the embodied experience of being pregnant. And it’s not her fault that she can’t understand, and she’s not a bad person for it: it’s just the reality of your different circumstances. But it sucks, because if you’ve got a wife who is normally a key part of your support system, she’s suddenly off the table.

So, then there’s family and friends. While family and friends are busy throwing your wife a parade for getting knocked up and gushing over her growing belly and asking her how she’s feeling to the point she’s sick of hearing the question, you’re going to be shunted entirely to the side. Those that actually listen to your concerns will genuinely say something like, “Yup. That’s how it is. Just gotta man up and get through it.” Guys who used to be wonderfully supportive will suddenly become sadistic older siblings, tormenting you with horror stories about how horrible their babies were, how they got no sleep, how they lived covered in vomit and shit, and how their relationship tanked, the sex dried up, and all their dreams and hobbies had to die.

Oh, yeah, did I not mention that? It may not seem like it when you’re planning pregnant life before conception, but you’re going to have to fight tooth and nail for any kind of free time. If you have time-consuming hobbies or big dreams, you’re going to have to take them out back behind the shed and just put them down, because there is simply not enough free time. Personally, I’ve got one thing that I’m clinging to, and it’s a struggle, but I am just barely making time for it. And, of course, my friends and family are more than happy to tell me how even that little time will be gone once the baby arrives. To hear them tell it, that baby is the Sword of Damocles for my one last side project. So, at that point, I guess I’ll just be a diaper changing service and a paycheck until the baby grows up enough to be less demanding. (Which, of course, friends and family tell you is “Never.” Sadists.)

It doesn’t help any that partners have a pretty thankless job throughout the labor and the first few months. When mothers tell birth stories, partners during labor almost never get mentioned except when A) a mother is asked directly about them, or B) the partner is being blamed for something the mother didn’t like during labor. The same is true when you hear moms talk about breastfeeding or the fourth trimester. So as much as all the books tell you as the partner that you’re vital and important and just as much a part of it as mom, clearly moms don’t see it that way…unless you’re screwing up. And the reality is that it’s legit for you to be neglected, because you’re entirely a luxury. The baby is going to be born whether you are there or not. Your wife would be able to breastfeed and raise the child even if you split. So it makes total sense for you to be left out of the story. It just makes the role especially unrewarding.

All this is true, and people wonder why I’m not more excited about having a baby, and why I seem so down through so much of this process. I have no inner motivation, no outer encouragement, and no way of relating to it as a full person. I’m just trying to get through this time and the by-all-accounts-miserable time to come.

At this point in the blog post, I’d love to make the turn to the solution. I’d love to explain how I had that experience, and then I found something that worked, and now I’m much better off. But I didn’t, and I’m not. I’ve got nothing.

I do know that burying yourself in your job is a horrible plan. If you do, being at work becomes more rewarding than being at home, which means that you will come to love being at work and loathe being at home. I tried this for a very short time as a coping mechanism and rapidly discovered how workaholics are born, because I was beginning to hate getting into the car to come home from the office, even though I love my wife like crazy and normally can’t wait to get home to see her. Hanging out with the guys or any other activities outside the home without your wife has the same kind of problem.

The best advice I’ve gotten is to try to find some, any place where you can have a sense of agency. This has reportedly worked for some guys (I’ve gotten “I had this friend who…” kinds of stories), but I haven’t gotten it to work for me. Some guys get into photographing and taping and documenting everything, living vicariously through their wife via their records, but my hands shake and I generally hate pictures and videos, so that’s no good. Some guys get into making a crib or furniture or the like, but that just wasn’t going to fly in my situation, and that’s fine, because I’ve got negative interest in craftiness: if you have any inkling that way, go for it. I picked out books that I was going to read to my baby girl (bathtime and reading and bed are going to be my schtick once we get there), but thanks to my decisive nature, I just picked the books, called it good, and was done. I tried getting into vaccines and the rest of the medical side of things, and then discovered that the “v”-word is a hugely contentious issue, right up there with religion and politics. (Thanks for wrecking that for me, Jenny McCarthy.)

So, that’s where I am at. I can take some solace that I’m not alone here—lots of guys seem to feel this way—but I’m at a loss for what we can do to make this situation suck less. So, in an act of utter desperation, I’m putting it out to the Internet. What do I do?

Executing a MySQL Script through JDBC July 30, 2013 | 03:26 pm

There’s no way to execute a MySQL script through JDBC, and most of the tools (including SimpleJdbcTestUtils) have weird requirements for the script and/or a bunch of overhead to do what you want to do. The big trick is that DELIMITER isn’t actually a SQL command: it’s a pre-processing instruction (at least conceptually). And that makes feeding the script into MySQL a pain.

Groovy and Commons-Lang StringUtils to the rescue. Here’s the short script that will break up a SQL script into a Collection of String objects, which can then be fed to your favorite SQL execution tool.

	static Collection<String> breakUpSqlScript(String loadSql) {
		List<String> statements = []
		String delimiter = ";"
		String currentStatement = ""
		loadSql.eachLine { String line ->
			line = line.trim()
			if(StringUtils.startsWithIgnoreCase(line, "--")) {
				// Comment: IGNORE
			} else if(line.endsWith(delimiter)) {
				line = StringUtils.removeEnd(line, delimiter)
				currentStatement = "$currentStatement \n $line".trim()
				statements << currentStatement
				currentStatement = ""
			} else if(StringUtils.startsWithIgnoreCase(line, "DELIMITER")) {
				delimiter = StringUtils.removeStartIgnoreCase(line, "DELIMITER").trim()
			} else {
				currentStatement = "$currentStatement \n $line"
		if(!StringUtils.isBlank(currentStatement)) statements << currentStatement
		return statements

PS: If you want to get the contents of a file as a string, use File#getText().

Open Source Announcement: CleanSweep March 26, 2013 | 10:22 am

I just knocked out a generic implementation of a sweeper that leverages Java’s concurrency structures to provide a very pluggable background replacement for finalize(), which we all know is evil. It also works well for caching. You can find it over on GitHub under the name RobertFischer/CleanSweep. Instructions on its use are there, but it basically looks like this:

import com.smokejumperit.cleanSweep.Sweeper;
/* [...] */
    final Sweeper sweeper = new Sweeper();
/* [...] */
    Object it = new Object();
    sweeper.onGC(it, new Runnable() {
      public void run() {
        System.out.println("onGC action run!");

Happy Armistice Day from Smedley Butler! November 11, 2012 | 10:38 am

War is a racket. It always has been. It is possibly the oldest, easily the most profitable, surely the most vicious. It is the only one international in scope. It is the only one in which the profits are reckoned in dollars and the losses in lives. A racket is best described, I believe, as something that is not what it seems to the majority of the people. Only a small ‘inside’ group knows what it is about. It is conducted for the benefit of the very few, at the expense of the very many. Out of war a few people make huge fortunes.

—Major General Smedley Butler, USMC (Ret), War is a Racket

“The devil has always quoted scriptures.” — Gandhi October 10, 2012 | 08:02 pm

Untouchability is not a sanction of religion, it is a device of Satan. The devil has always quoted scriptures. But scriptures cannot transcend reason and truth. They are intended to purify reason and illuminate truth.

From Young India, Jan 19th, 1921, as cited in Hindu Dharma.