Anathem by Neal Stephenson is the best book I have ever read.
|
|
A brief review of Anathem by Neal Stephenson |
|
Written by on Wednesday, July 8, 2009 at 12:22 am (EDT) Tagged as: literature praises reviews |
|
|
A Turing Test |
|
Written by on Thursday, July 2, 2009 at 11:21 pm (EDT) Tagged as: awesome funny geekiness |
I think I just participated in a Turing test. I had a problem ordering a new cell phone from Sprint, so I did an online chat with a customer service representative. They said they would e-mail me a transcript, but they haven’t yet. Since the chat was in a Flash object, I couldn’t select the text to copy and paste it, so I just combined two screenshots, and added some annotations.1

|
|
ImageSizer |
|
Written by on Friday, June 19, 2009 at 12:10 am (EDT) Tagged as: brags programming |
I wrote a program last week for resizing images so that they can fit onto a two-monitor desktop, and I figured I’d share with the world before heading to the beach. This program does more than just resize an image, though. It accounts for the gap between the two monitors, so that it looks much more like you are looking through the monitors. Most of this post will consist of an explanation of what exactly that means and why you’d want to do it.
Okay, for starters let’s say you have two monitors sitting side-by-side. In our example, these monitors each have a resolution of 304×228 pixels, giving a resolution of 608×228 for the entire desktop. Here is what that looks like:1
Now, let’s say you want to use this photo of the Gizah pyramids by Ricardo Liberato, the #21 finalist for Wikimedia Commons Picture of the Year 2007, as your wallpaper. Here is what the photo looks like initially:
There is a problem here, because that’s not the right proportion, so you’d want to crop out a portion of the image that is the right proportion. Here is a cropped portion that is the proper ratio and size (608×228):
Now, let’s use that image as our desktop wallpaper on our dual-monitor setup:
I don’t know about you, but I find this very aesthetically displeasing. Suddenly the pyramid is not shaped like a pyramid anymore! Your mind expects the image to continue through the space between the monitors, but it actually just picks up where it left off on the edge of the other screen. In fact, it kinda makes it look like there is a fourth, smaller pyramid, between the first and second one.
So here’s where my app comes in. We need to figure out how wide that gap is, in pixels. If you knew the dpi of your monitor, you could measure the gap in inches and calculate the number of pixels. But if you don’t know that, here’s how I measure it. Open up any kind of image editing app (Paint will do just fine). Place the window so that it straddles the gap between monitors. Draw a 45-degree line that spans the monitors. It is very important that the line be exactly 45 degrees (you can hold control or shift or something to fix the line to 45 degrees in most image editing apps). Now, hold something with a straight edge (say, a piece of paper) so that it lines up with the line on one monitor. Holding the straight edge there, click somewhere on the other monitor, where the line would be if it was accounting for the gap, and draw another 45-degree line starting from there. Now measure the vertical distance, in pixels, between the two lines. This will be equivalent to the horizontal distance, in pixels, between the two monitors. For our example, here is what that might look like:
You can see the solid black line is “straight” if the gap is not accounted for. However, the dashed line shows how the line would behave if the gap was considered to have a width. The distance between the dashed line and the solid line on the right-hand monitor is 50 pixels, so that is the width of our gap. So now, let’s use my app:
1
java -jar ImageSizer.jar pyramids.jpg -monitorWidth 304 -height 228 -gap 50
This will generate pyramids.resized.png, which looks like this:
When we use this image as our desktop wallpaper, we get an image that looks correct:
If you’d like the program, you can download it right here. But before you use it, here are a few things you should know:
You may get OutOfMemory exceptions on very large images. If this happens (thanks Peter), you can increase the Java heap size from the command line like this:
java -Xmx256m -jar ImageSizer.jar ....
If that still doesn’t work, increase the 256 to a bigger number. It is important that the -Xmx parameter comes before the -jar parameter, so that Java knows it is a parameter to the JVM and not to the ImageSizer.When the image is not the proper proportion (which will be nearly all the time), it will crop from the middle of the image. In many cases, this will be a less-than-ideal cropping. If that happens, you should crop the image the way you want it cropped first. (The tool will still help you out because removing the middle of an image is much more tedious.)
Your monitors must be of equal resolution.
Supported file types are .jpg, .png, and (I think) .bmp and .gif. (I’ve only tested jpg and png myself though.)
Output file will always be .png format, even if a different extension is used on output file. This is important because a lossy compression can cause some pixels to “bleed” between the monitors.
There is only support for two-monitor setups.
If you want to modify the code, feel free to do so. You can even redistribute if you want, just be sure to leave my name and URL in the comments and help info. The source is included in the jar file (open it as a zip file). There are only two Java files.
There is a good chance there are some bugs, as this was written in two evenings, with a fourteen-month-old competing with the computer for my attention. The vast majority of that time was spent trying to figure out how to use the Java image libraries. I probably could have written this in PHP in an hour, but I didn’t want to use PHP from the command line, and I didn’t want to have to upload large images.
|
|
Shadow of the Colossus |
|
Written by on Thursday, June 18, 2009 at 9:10 am (EDT) Tagged as: praises reviews video-games |
A few weeks ago I finished playing Shadow of the Colossus. Since the game is three and a half years old, I’m not going to talk about it too much. The game consists solely of 16 boss battles, in which you defeat colossi that are often hundreds of feet tall. But the interesting thing about the game is that you start to sympathize with the colossi. The only reason you are killing these things is because some god told you he would bring your dead girlfriend back to life if you would do it. But no justification beyond that is ever given. The colossi are not terrorizing villagers or anything like that. In fact, they keep to themselves in a land devoid of human life, and they’ve certainly never done anything to you. And, with the exception of the final colossus, none of them even appear to be attacking you for any reason other than self defense. In one case, you must even shoot a colossus with an arrow in order to make it wake up! As I was playing the game, I had the thought that this must be similar to bullfighting. I mean, the bull has never done anything to the matador, yet the matador provokes him and stabs him with swords, ultimately delivering a final blow in a weak spot (between the shoulder blades, I think). This is quite similar to what happens in Shadow of the Colossus. And the game has a satisfying ending which I won’t spoil.
If you follow games at all, you’ve probably heard the praises of this game over and over. So I’m not going to continue repeating things that have probably already been said in much better words by much better writers than myself.
|
|
An unusual business model |
|
Written by on Friday, June 12, 2009 at 11:52 pm (EDT) Tagged as: economics my-psyche thoughts |
Once upon a time, approximately two days ago, just as I finished mowing the sixth of an acre of grass within which my house resides, an unfamiliar man in a wifebeater pulled over in front of my driveway in a dirty 1992 Ford pickup truck. “This is unusual, even for North Carolina,” I thought to myself as he exited his vehicle and approached me.
“Would you be interested,” he proceeded to ask, “in good deals on meat?”
Is this a metaphor? a euphemism? What plans might this stranger have? A classic fight or flight response ensues: if he means no harm (which is almost certainly the case) but I run, I look like a fool and possibly, depending upon his race, a bigot; on the other hand, if I hold my ground, I save face, but I could possibly be abducted and (let’s say) fed into a wood chipper. He’s approaching, time is running out, what am I going to do?? Ultimately I decide to risk the wood chipper.
“I’m sorry?” I respond, as if I didn’t understand him (which is at least partially true).
“I have good deals on steaks, chicken, and beef.” A strange wording, considering that “steak” is a subset of “beef.” I make a mental note to ponder this at a later time. After all, “steak” is a particular type of beef which (I presume) has high demand elasticity at low prices, so it is worth mentioning. I mean, it’s not like he’s going to have every type of beef, so specifying up front that steak is one of the types of beef he carries will efficiently answer a nearly-inevitable follow-up question.
It’s been half a minute already; etiquette dictates that I supply some form of response.
“No thanks.” There, I’ve responded. My manners are so awesome.
He barely gets a quick “you have a nice day” out before he walks back to his truck. Which I now notice has a freezer in the truck bed. Secured into place with a single bungee. As he drives away, I am filled with questions. Where does this meat come from? How did he come to acquire it? Is this a side job, or his primary source of income. For that matter, is it a source of income at all? I’d like to think he just sells meat as a hobby. After all, even the most rudimentary efforts at the appearance of legitimacy are lacking. Maybe a logo on the side of the truck. Or a dress code consisting of pretty much anything other than a wife beater. I think such things would more than pay for themselves after a relatively short time. How significant are the savings, compared to a grocery store? How many other people are willing to buy meat from the back of some guy’s pickup truck? Regulated food markets have produced enough contamination scares of late, how many people are willing to risk meat from some guy’s truck?
Or maybe I’m overthinking this. I have a tendency to do that. I wonder why that is. Do I find comfort ruminating upon things which are ultimately meaningless? Is it a way of escaping thoughts about deeper topics? Or does everyone do this and just not write blog posts about it? Or maybe I actually do think about things more than other people. Some form of scientific modesty principle prevents me from leaping to that conclusion, anymore than I would leap to the conclusion that somehow the sun actually revolves around me.
Oh wait, I’m doing it again.
|
|
Why you shouldn’t put new columns in the middle of a table |
|
Written by on Tuesday, June 9, 2009 at 9:30 am (EDT) Tagged as: programming the-more-you-know |
I learned something new about databases this week. Perhaps I should have already known this, but it surprised me, so I have decided to share with the small segment of the world that reads this blog. In the past, I’ve always done database table management (i.e. creating/dropping tables or columns) through a GUI (like Management Studio for SQL Server, or phpMyAdmin for MySQL). In these tools, it is very easy to insert a new column in the middle of a table, and it never occurred to me that this was a big operation. This week, I had to write a script that would perform my changes to a table on a customer database. It turns out that the only way to put add a new column to the middle of a table1 is to:
Create a temporary table, with the columns in the order you want.
Insert everything from your original table into the new table.
Drop the original table.
Rename the temporary table to the name of the original table.
Recreate any indexes and constraints that existed on the original table.
On a very large table, this is quite a lengthy operation! But if you just add the new column to the end of the table, you can do that in a single SQL statement, and it runs quite quickly. And the fact is that if your code relies on the columns being in a particular order, you are doing something wrong. (Fortunately, I knew enough that I got that part right.)
|
|
Emma’s second first birthday and our trip to the beach |
|
Written by on Tuesday, May 26, 2009 at 11:51 pm (EDT) Tagged as: emma photos vacation videos |
It’s time again for some new pictures and videos of Emma. I added two new albums to the photos page. First, Emma’s second first-birthday party. That’s right, Emma got to celebrate her first birthday twice—once with family and then again with friends. And second, we have a set of photos from our recent trip to Myrtle Beach, which we took in the last week before I started my new job.
Beyond that, I have four new videos for you. Here is a video from a month and a half ago, showing Emma climbing the stairs. We happened to catch her descending the stairs properly for the first time while we were recording this video. Nowadays she can go all the way down the stairs with no problem.
Next, we have a series of scenes in which Stephanie and I try to get Emma to play the drums in Guitar Hero. We had some success, but I think Stephanie and me end up playing the drums more than Emma does!
Now we get to the afore-mentioned beach trip. Nothing particularly special about this video, it’s just Emma wandering around on the beach for fifty-nine seconds. Enjoy!
And to finish this off, we have another demonstration of Emma’s musical inclinations. We never taught her to dance, but we found that whenever fast music would come on during TV shows or video games, Emma would start dancing. So I tried to capture it on video, and I was mostly successful.
|
|
CharlotteGigs.net |
|
Written by on Friday, May 15, 2009 at 8:30 am (EDT) Tagged as: annoyances protip |
CharlotteGigs.net is a mostly worthless spam machine that masquerades as a local job board. I signed up for their site when I was looking for a job, and now I can’t seem to get their junk mail to stop coming. I have clicked the “unsubscribe” link at the bottom of their spam several times. I continue to get this message upon doing so:
Your request to update your email options has been received and is being processed. Please note that it may take up to 10 days for the changes to take effect as there may be email messages already in progress.
Protip: If you have to show a message like this to your users, you are doing something wrong. Come on guys, ten days?? What are you doing, writing the request on a notarized letter and mailing it to Nigeria?
|
|
Tonight’s Lost was great |
|
Written by on Thursday, May 14, 2009 at 12:37 am (EDT) Tagged as: awesome lost tv |
I don’t know about you guys, but I thought tonight’s Lost was excellent.
In the interest of those of you who haven’t seen it yet or are waiting for DVDs... that is all.
|
|
Does anyone else do this or is it just me? |
|
Written by on Wednesday, May 13, 2009 at 12:02 am (EDT) Tagged as: lazyweb my-psyche thoughts weird |
I have a way of remembering to do things that might be idiosyncratic, or it may be completely normal. So I thought I would reach out to the dozen or so people who read this little blog to see if you do the same thing. So here’s the scenario:
Let’s say I want to remember to take a CD to the office with me tomorrow morning. I will pick out some very specific action that I know I will take tomorrow—like picking up my keys off the bedside table—and I’ll visualize myself doing that while thinking to myself “don’t forget that CD.” I only need to spend a minute or two concentrating very hard on picturing myself picking up the keys while thinking “don’t forget that CD.” Then in the morning, when I’m picking up my keys, the thought “don’t forget that CD” will magically appear in my head.
I believe this is technically a form of self-hypnosis, or something like it. It works most of the time, but only recently did I start to wonder if other people use this little trick. When the thought comes popping into your head, it feels very much like deja vu. In fact, I think I figured it out when I was curious about the feeling of deja vu when I was little (this was before I learned there was even a term for it). I reasoned that surely I didn’t have some buried “memory” of a future event, so I tried to induce deja vu like this. Eventually, I got it to work.
So does anyone else do this? If not, you should try it, it really works.