Monday, October 6, 2014

Living the Question

Happy Birthday

In about a month, it will be my 36th birthday. Normally, my birthday isn't a big deal to me. I get a few Happy Birthday e-mails, my girlfriend makes a chocolate cake; it's all low-key and nice.

This year is a little different. My driver's license expires, and I need to stop in at a Department of Motor Vehicles (DMV) in order to get a new license. So, you might ask, what's the big deal? Show up, fill out a form, pay the fee, and get a new license. Easy as cake, right? Not quite.


Religious Conviction

I am a Pastafarian. I am also an ordained minister of the Church of the Flying Spaghetti Monster. When it comes to getting a driver's license photo, the tradition is to wear a spaghetti strainer (colander) upon one's head for the photo.

Here are some other examples of Pastafarians who have done the same in the past two years:

This is the first time I've needed to update my driver's license photo since I became a Pastafarian. I don't know how much resistance to expect from the Wisconsin DMV. Aaron Williams was denied his right to wear a religious headware by the New Jersey DMV in Feb 2013. It seems other Pastafarians in other states have fared better since then. I remain hopeful.


Sincere Beliefs


My girlfriend of two years doesn't understand my desire to wear a colander on my head for my driver's license photo. Her objections are similar to objections that my friends have voiced before:
  • A driver's license photo is serious, why aren't you taking it seriously?
  • Why do Pastafarians make fun of religion and religious people?
Juxtaposed, the two objections make an odd paradox. Other religions are assumed to be sincerely held by the people who practice them, they are serious, and it is disrespectful to make fun of them. Yet, if I seek to practice my religion, I'm assumed to be insincere, making fun of religion, and not taking my driver's license photo seriously. It's really an odd kind of contradiction.

It occurs to me that my girlfriend (a non-Pastafarian) does not understand the nature and purpose of the Church of the Flying Spaghetti Monster. She does not understand that I am a Pastafarian and therefore, I am Living the Question.


Asking the Question


Before we get to Living the Question, it might first help to Ask the Question. Before we Ask the Question, we need to ponder something important. Here, I need to quote the Join Us page of the Church of the Flying Spaghetti Monster:
"FSM is a real, legitimate religion, as much as any other. The fact that many see this is as a satirical religion doesn’t change the fact that by any standard one can come up with, our religion is as legitimate as any other. And *that* is the point."
What I will ask you to ponder is this: The Pastafarian religion is a legitimate religion, but many see it as a satirical religion. If we want to be taken seriously, why go to all the trouble to make our religion appear satirical to so many? Is it important to Pastafarians that our religion be seen as satire?

The reason for this becomes clear after we Ask The Question. The Question, succinctly, is this:
What is the proper role of society with respect to religion?
That's a pretty big question, so let's rephrase that question another way. American society is an inclusive society with multiple religions. Our constitution guarantees Freedom of Religion for all. Most of us belong to one religion and regard the other religions as strange. So the question is:
How does society maximize the religious freedom of everyone, while preserving its own legitimate interest in the welfare of its citizens?

This turns out to be a very important question. For example:


There are almost too many questions to enumerate them all. Now we see why The Question is such a big and important question. So let's ask it again, so that we're clear on The Question...

What is the proper role of society with respect to religion?

Living the Question

Let's return to what we were pondering before:

The Pastafarian religion is a legitimate religion, but many see it as a satirical religion. If we want to be taken seriously, why go to all the trouble to make our religion appear satirical to so many? Is it important to Pastafarians that our religion be seen as satire?
Now in the context of The Question:
What is the proper role of society with respect to religion?
Let's consider this another way:
What is society to do when a very strange religion, with very strange beliefs shows up? What if some of those beliefs seem to be absolute nonsense and at odds with reality? What if some of those beliefs are based on logical fallacies and other faulty reasoning?
Now the pieces of the puzzle begin to click together. In asking The Question, we want to know how society should interact with religion. A religion that we are all familiar with is less useful here. Such a religion might be accepted because "Well, that's the way it's always been." which implies a bias against other religions, since they aren't "the way it's always been."

No, to explore The Question, we need a religion that is very odd. A religion whose practices are so far "out there" as to seem like satire. A religion that is so strange that people looking at it from the outside will say to themselves, "Only an idiot would believe that!" And that, is the point.

Our religion is as legitimate as any other, and "other" enough that society can reason about it without personal or cultural biases. Someone might think teaching Creation Science or Intelligent Design in public schools is a good idea. Yet, when asked if schools should teach Flying Spaghetti Monsterism, they don't have the pro-FSM bias. Suddenly, they are left in the awkward position of explaining how and why the government should be favoring one religion over another religion.

As a Pastafarian, I am Living the Question when I put a colander on my head for a driver's license photo. I am asking society at large to ask itself, "Should the state make headware exemptions for religious belief?" Is an identification photo with uncovered head important? Does the state have an compelling interest in regulating the appearance of the head in an identification photo? Is that compelling interest so strong as to override religious belief? Or can society tolerate that a strange person with a strange belief wears a strange thing on their (strange) head while having an identification photo taken?

I assert that this is a very important thing for all of us, as a society, as a whole, to consider. Yes, the colander, as part of the bigger picture; The Question:
What is the proper role of society with respect to religion?
I sincerely believe that this is a very important question to answer. And I believe that being a Pastafarian is a good (and fun!) way to help people answer that question.

Now, I just need to find a spaghetti strainer that doesn't make me look fat in the picture.

Sunday, October 5, 2014

Server Side WebSocket in Java



I recently wrote a high quality, low grade, server side WebSocket (RFC 6455) implementation. The intended use-case is as follows:
  • I want to create a service in Java that accepts connections from modern web browsers.
  • I want to use InputStream and OutputStream to get my bytes back and forth between my service and the browser.
  • I want my service code to do this with minimal setup.
  • I want to ignore all the protocol details; just give me the bytes.
  • I'm not sure, but I might like to support SSL/TLS security (i.e.: HTTPS) for none/some/all of my connections.

 

Need More?


If you need something else, like Java NIO support, non-blocking I/O, evented I/O, ability to provide custom handlers for web frames, etc.. then you'll probably need to find another implementation:
Note that JavaEE 7 includes WebSocket support. So if you've already got a web container (i.e.: Tomcat), then you've probably already got a solution at hand:


 

Just Enough


Since you're still reading this, I'll assume you want to know more about my WebSocket implementation. You can find the repository here:

https://github.com/blinkdog/websocket

How does it work? I'm glad you asked...


This is how you start listening for WebSocket connections:
ServerSocket serverSocket = new ServerSocket(PORT);
WebSocketServerSocket webSocketServerSocket = new WebSocketServerSocket(serverSocket);
WebSocket webSocket = webSocketServerSocket.accept();

And this is how you read data from the connecting client:
InputStream is = webSocket.getInputStream();
int data = is.read();

And this is how you communicate back to the connecting client:
WebSocketServerOutputStream os = webSocket.getOutputStream();
os.writeString("This is a UTF-8 string.");
os.writeBinary("Some binary data.".getBytes()); 


That's It

A high quality, low grade, server-side WebSocket component with no frills or nonsense. That's it, that's all. Enjoy!