Some ground rules for debate

For some reason, you've gotten into a debate with me about philosophy, software, psychology, history, life, the universe, and everything. Awesome!

Before we go any further, let's lay down a few ground rules to help ensure that we don't waste each other's time.

Rule 1: cogito ergo sum

If we debate long enough, it's possible that we'll become unhinged from reality and start to question everything. Perhaps the world is not what it seems. Maybe our senses are lying to us. What if this is all a dream? What if you're a figment of my imagination or I'm a figment of yours?

If we get to this point, we need to stop immediately, and back up.

All arguments boil down to just a single truth:
I think, therefore I am. - RenĂ© Descartes
Unfortunately, this is not a particularly useful result. If we're going to have a debate, we need more than that.
I am, therefore I think
Even though I can't prove it, I'm going to assume that there is some sort of real world out there; that there isn't a robot deity keeping my brain trapped in a computer simulation; that my senses aren't lying to me all the time. I'm going to assume that the world is, more or less, what it seems, and our role is merely to do our best to adapt to it.

If we can't agree to these axioms, then we shouldn't waste any more time debating. If "I think, therefore I am" is the only thing you're willing to believe, then we won't make it very far anyway. After all, if everything is a lie, what could we possibly gain from a debate?

Rule 2: theories and models

Although I'll rely on some axioms as the basis for my reality, most of my claims will come from theories. I put this word in italics because it needs some explanation.

Outside of a scientific context, the word theory often means that something is uncertain or unproven. For example, people like to criticize the theory of evolution by saying "it's only a theory." 

This is an unfortunate mix-up because, in science, theory means something different. A theory is an explanation based on observation and experimentation that can be used to describe and predict something. 

In other words, a theory is a tool that you use. It is a model of reality that can be used to make predictions; whether or not the theory corresponds to some underlying truth about that reality is (almost) irrelevant.

In fact, I'll go one step further: 
All models are wrong, but some are useful. - George E.P. Box
Yep, all theories are wrong. And that's OK. For example, we know that the theory of gravity is wrong (see: general relativity); we know that Newton's laws of motion are wrong (see: special relativity); in fact, most of classical physics is wrong (see: quantum mechanics); there is a whole wiki page of superseded scientific theories. Nevertheless, all of these theories have been and continue to be incredibly useful, providing the essential tools for building airplanes, bridges, computers, spaceships, and understanding the universe.

The goal of a theory isn't to be right; after all, you can never really be right, as per rule 1. The goal of a theory is to be useful. The important question is not "is this theory correct" but rather, "does this theory let us make predictions about the world better than other theories"?

For example, the theory of evolution by natural selection lets us make some good predictions about how plant and animal species came to be and what will happen to them in the future. It may be only a theory, but it's a very useful one. On the other hand, intelligent design doesn't match our observations, isn't useful for making predictions, and therefore not a theory.

So, when you and I debate, it's not worth debating axioms, so all we can really do is debate theories. And we won't debate them based on the merit of whether they are true or not, but whether they are more useful than other theories.

Rule 3: the most important question

One final step before we can have a debate: you need to ask yourself a question. It's arguably the most important question in all of science, reason, and debate:
What would convince you that you're wrong?
Be honest. What facts, evidence, or events would convince you that your current stance in the debate is wrong? This question is the very basis of the scientific method.

If there is not a single thing in the world that could convince you that you're wrong, then your stance isn't a theory, but an article of faith. And faith cannot be debated.

What would convince an evolutionary scientist that the theory of evolution is totally wrong? That is, what would show that the theory of evolution is not a useful model? I can think of a few examples: discovering evidence that the earth was just a few thousand years old; observing a new species magically materialize with no connection to any other species; finding evidence that the entire fossil record is an elaborate hoax by the liberal media.

What would convince someone who believes in intelligent design that they are wrong? As far as I know, nothing. Apparently, numerous observations of natural selection in progress, mounds of data showing the earth is over 4 billion years old, an extensive fossil record, and countless examples of unintelligent design are not enough. This is yet another reason intelligent design is not a scientific theory and should not be taught as one in schools.


As long as a debate is about faith instead of theory, it is largely pointless, since there is nothing that can change either party's mind. This is why it's so painful to debate topics like abortion, conspiracy theories, politics, and religion.

Therefore, I propose that we only have a debate if both of us can identify, at least to ourselves, that there is at least one piece of evidence that could convince us that we're wrong.

Alright, let's do this

Made it this far?

Good.

Because I'm ready to put on a clinic.



What my grandfather taught me about happiness

Boris K.
1919-2013
This is the eulogy I gave for my grandfather on March 14, 2013. He was 93 years old. 

I want to share with you something I learned from my grandfather. It may sound a bit odd at a time like this, but I want to tell you guys what I learned from him about happiness.

Here’s the thing: my grandfather had a tough life. He went through war, communism, poverty, emigration, and somehow, he came out the other end happy, kind, and loving.

His happiness showed through in every conversation.

For example, he spent over 20 years in the Red Army, and not by choice; his original plan had been to study history in college, but when WWII broke out, he was drafted. But if you asked him about it, the story he would tell would not be about the misery of military life, but rather about the life-long friends he made in the army and the discipline and strength he learned.



He fought in some of the biggest battles of World War II, including Stalingrad and Kursk, and was wounded several times. But if you ask him about that, he’d mostly smile as he told you about the pretty nurses he met while recovering from his wounds. He’d also tell you that he was wounded in the leg... though the photographs clearly show a bandage on his head... He’d just laugh about that too.


After fighting the Nazis for years across all of Europe, he ended up being part of the offensive that took Berlin. There is even a photo of him in front of the fallen Reichstag. Ask him about that and he'd tell you how much he enjoyed living in Berlin. With a German family. And how hospitable and friendly they were.


He lived through some of the toughest years of Communism in the Soviet Union, sometimes at near poverty levels in horrible communal apartments. But if you ask him about that, he'd tell you about his circle of friends, he’d go on about how Riga was beautiful, and he’d tell you about going to theater every night. 


I found his attitude astonishing, but wonderful. Life was never easy for my grandfather, but he never complained. Whereas I freak out when my iPhone loses signal for a minute and I can't check my email; and then freak out again because I can't use twitter to complain about the signal loss.

So what was his secret?  

I think my grandpa realized, perhaps subconsciously, that you can’t just be happy. You can be tall or you can be fat or you can be strong, but happiness is different.

Happiness is not something you have, it’s something you do.

My grandfather was happy because he always focused on the things he loved. That’s what he did. And when you do what you love, you do it well, and you’ll be happy.

For example, in the army, he was a medic. I cannot imagine the daily horrors and stress of a job like that. But my grandpa was able to focus on the parts he loved: learning medicine, helping people, and working with a team of doctors he admired. My grandpa became an excellent medic. 



Later in life, in his 40’s, he went to law school and began studying law. That’s not an easy career change at that age, and not an easy job at any age. But he never complained; in fact, he’d always light up when talking about being an attorney, about the amazing people he got to work with, and the perks of the job - you could tell he loved it. It’s no surprise he spent the next 30 years as a successful attorney.

Now, this isn’t just blind optimism; there is science behind it. There is research that indicates that if you just change your body language - force a smile on your face, assume an open, comfortable posture - after a few minutes, your cortisol levels drop, testosterone levels go up, and you feel better. You feel happier.

It’s also possible that how you react to events - in fact, the very words you use to think about those events - has a dramatic affect on your mood. When something bad happens, some people react by starting to curse, yell, frown, shake their hands, complain... Other people just look around, nod, and say “that’s... mildly inconvenient”. And just like that, the entire problem doesn’t seem so bad.

It’s counter-intuitive, but the way you think about things and your verbal and body language are not just a reflection of your emotions, but an active cause of those emotions. It’s a two way street.

By choosing to focus on the things you love, you aren’t just pretending to be happy, you really are happy. My grandpa’s happy memories of living in communist Riga or even post-war Berlin weren’t delusions: they were genuine happiness.


Happiness is not something you have, it’s something you do.

This doesn’t mean my grandfather totally blocked out all the bad memories. He wasn’t in denial. Years ago, I was watching Saving Private Ryan, a violent WWII movie, and my grandfather, who never watched any American movies, happened to walk by the room and watched for a minute. After a drawn out battle scene, he said “I’ve seen this before... it’s not that great”, shrugged, and moved on.

He remembered the war, both the good and the bad. But his reaction was of the “that’s... mildly inconvenient” variety, which made the bad, even the awful, tolerable. And then, of course, he’d be able to focus on the good. In fact, he was proud of what he did in the war - we all were. V day was one of the most important days of the year for him and always called for a celebration.


My grandpa had other passions that made him happy. He loved to go on walks. Every day, even multiple times per day, rain or shine, he’d go out on a walk. Walks made him happy, or maybe being happy made him walk, but either way, he got good at it. He even walked the dogs of family friends, partially because he loved dogs and partially because dogs were the only ones that could keep up with him on a walk.

He also loved a good conversation and became quite good at that too. Every family dinner would start with the a toast from my grandfather: he’d stand up, raise his glass, and inspire everyone with a few well thought out sentences. Sometimes he’d throw in a joke or even a poem. And he could talk to anyone. Language barriers didn’t matter: Russian, Ukranian, German, Yiddish, even learning a little English at an old age. The language of kindness and a smile is universal.

And of course, he loved his family. I think my mom turned out pretty well, as did the grandkids, so I guess he did a good job there too. I like to think we made him happy.


So, that’s the secret. Happiness is not something you have, it’s something you do. No matter what is happening in your life, actively focus on what you love and you’ll be happy. I think on a day like today, this is more important than ever.

So, as you remember my grandpa, do what he would have: remember the things that are good. Remember the stories he told you, the laughs you shared, and the amazing life he led. Better yet, share those stories with someone you love, while out on a nice, long walk.



Goldensunsky 1000/1600/2000 dpi High Speed Wireless Gaming Optical Mouse with USB Mini Receiver, Plug and Play 2.4ghz





Best Wireless Gaming Mouse - Goldensunsky 1000/1600/2000 dpi High Speed Wireless Gaming Optical Mouse with USB Mini Receiver, Plug and Play 2.4ghz is great for the price. There is anything to bad about it, it fits into your hand perfectly. I have been using it to play guild wars 2 and it has been working great after 5 hours of straight use.The mouse itself is not huge, and  fits comfortably

MySQL error: last packet sent to the server was XXX ms ago

I just spent a few weeks battling a strange, infrequent, hard-to-reproduce error when using JDBC to talk to MySQL. After about a dozen experiments, I think I've finally found a solution and I've decided to capture the details here, since my online searches didn't turn up this particular answer anywhere else.

tldr: If you see a "last packet sent to the server was XXX ms ago" error, you may want to upgrade your version of the mysql-connector-java library.

The Symptoms

I had a simple Java app in production that was using JDBC to talk to a MySQL DB. Everything was running great: DB calls were taking 2 ms on average and 8 ms in the 99th percentile. However, once every 4-8 hours, a strange error would pop up that looked something like this:


I can understand the occasionally slow query, but 28800126 ms? EOFException? What's going on here?

Lots of ineffective options

As usual, I turned to a programmer's two best friends: Google and StackOverflow. I quickly found my way to the MySQL docs and found out that MySQL has two timeout settings that will close a connection if it is idle for too long: interactive_timeout and wait_timeout. The default value for these two settings is 28800000 ms or 8 hours.

The general advice online was to make sure that your connection management library was sending periodic "keep-alive" queries to prevent connections from going idle. I was using BoneCP, so I tried everything I could to make it behave properly, including a few configuration tweaks as well as workarounds for a connection leak bug and a releaseHelperThreads bug. Nothing worked.

Eventually, I swapped out BoneCP entirely for a different connection management library. Nevertheless, after a few hours, the dreaded "last packet sent to the server was XXX ms ago" error would pop up on the production box.

The solution at last

For a while, I was at a loss. I couldn't see how two entirely different DB connection management libraries could have the same bug. I began digging for what the two had in common and realized that, under the hood, both would be using the same JDBC driver. For MySQL, this is Connector/J.

It's at this point that I noticed that I was, for some reason, using Connector/J version 3.1.12, which is quite old. In fact, it is officially obsolete and only compatible with MySQL 5.0 and below. This is unfortunate, as I was using MySQL 5.5 in production.

I figured it was a long shot that this was the cause of the errors I was seeing, but I figured that using the "recommended" connector version was a good idea anyway. I updated from mysql-connector-java version 3.1.12 to version 5.1.22.

And just like that, all the errors were gone.

The final word

So, there you have it.  If you see a "last packet sent to the server was XXX ms ago", it's likely one of two things:
  1. Your DB connection management library is leaving idle connections open too long
  2. You're hitting an incompatibility bug between the Connector/J version and the MySQL DB version