Kip Touchy Photos

One of the main uses of this website nowadays, for me, is to serve as a digital photo album that I access from my phone. Everytime I did this, I was reminded of just how out-of-date my photos are when viewed on a mobile phone. When I would hand it to people, I would have to instruct them on how to advance to the next photo. The text was too small to read on a phone. So I decided to do something about it.

A few weeks ago I set out to create a new version of my photo-viewing page that works with smart phones. I opted not to use jQuery Mobile or Sencha Touch, just because they felt like overkill for what I was doing. After a little Googling I found that there really is not that much to it. You just listen for HTML5 touchstart, touchmove, and touchend events. So now I have a photo album that behaves a lot like the native photos app: swipe left or right to move through photos, tap a photo to view title/caption/timestamp. Tapping also displays forward/backward navigation buttons. It all works in a desktop browser too, but you can’t swipe. (At one point I emulated touch events with mouse events, but I disabled it because it was kind of weird. Keyboard left/right buttons work though!)

I’ve also played around with the HTML 5 History API, so the URL in the address bar updates itself even though the browser hasn’t actually loaded a new URL. And you can use the browser’s forward/back buttons to navigate. It’s pretty cool!

A few caveats: I’ve mainly tested on iOS. I did cursory testing on a coworker’s Android and everything seems to work. Windows Mobile is broken pretty severely. Nothing will work with Javascript disabled. I’m no longer worried if Google can’t index me, and everyone else enables Javascript, so I dropped support for the plain-old HTML version.

If you run into any issues let me know!

No Comments | Add Comment
Kip My thoughts on Amendment One

Today North Carolina votes on Amendment One. It’s touted as the gay marriage amendment, but the fact is that no one in North Carolina today voted to either make gay marriage legal or illegal. Your options in this vote, if you chose to vote, were: “Against”, meaning keep gay marriage illegal; or “For”, meaning make gay marriage even more illegal than it is now. I’ll be surprised if the amendment doesn’t pass. It is on the ballot during the primary election in a year when there is a real republican primary but there is not a democratic one. But even if it doesn’t pass, gay marriage will still be illegal in North Carolina.

The theory, I believe, is that if it is an amendment, not a law, then it will be harder for future generations to overturn it. But is anyone really myopic enough to believe that? Can’t we all see where this is going? In fifteen or twenty years the Supreme Court is going to rule that it is unconstitutional for the government to prohibit gay marriage. Then it will be legal in North Carolina, and every other state, whether it is a law or an amendment.

And my great grandchildren are going to look at my generation and say “why did they hate the gay people so much?”  The same way my generation looks at the greatest generation and says “why did they hate the black people so much?”

I posted a variation of that last paragraph on Facebook today, but I’ve since deleted it because I got tired of trying to keep it civil in the comments, and Facebook doesn’t allow you to close comments on your posts. (For the record, the uncivil comments I deleted were both from the pro-gay-marriage side.)

No Comments
Kip Pinteresting

It seems like every woman I know uses Pinterest nowadays, to varying degrees. (No, this is not a post announcing that I have joined Pinterest.) One of the things that immediately struck me about the site is the layout. The screen is organized into columns. Each pin is the same width, but can vary in height. When you resize the browser, you can see that the pins fill horizontally, even though the site doesn’t align to a grid.

I thought this could be something that would look good for my photo albums. I’ve struggled with how best to display my thumbnails in my photo albums for a while. Basically since I first wrote the software. My original algorithm was to resize the images to fit within a certain maximum width and height, and then arrange them in a grid. The problem with this is that there is lots of wasted space if you have one portrait-oriented photo in a row of otherwise landscape-oriented photos.

After a while, I changed the site to use thumbnails that are all exactly the same size. I went with thumbnails in the golden ratio because, I mean, it’s golden. It had been that way for a few years, but I wasn’t crazy about it. Some photos—especially the portrait photos—get all the important things cropped out. This has become more common as I have learned more about photography and composition (things like the rule of thirds), and stopped trying to make the dead center of a photo the most important part. (Here’s an example I’m particularly proud of!)

I had considered doing what the iPhone does—crop every image to a square. This would have the same basic problem as my golden ratio solution, but it would handle portrait images a little bit better. So I put off doing this for a while. And in that time I came across Pinterest, and realized that this was the solution I had been looking for for so long. It seems so obvious in retrospect. I once thought about doing something like it but decided it would be too complicated. (You can’t make the browser do it with just CSS—you either need to do some Javascript manipulation or some server-side preprocessing.)

But, seeing Pinterest, I thought about it more and decided it would not actually be that difficult to do something similar here. So I sat down for a few hours over the weekend and banged out some code. The results can now be seen on any of our photo albums. I think it looks pretty great. There are a few downsides I see. First, if the thumbnails are supposed to be ordered, the order can be confusing. (Most apparent in the year-numbered album groups on our main photos page.) Also, there is an increased emphasis on portrait images, but I’m not sure how concerned with this I am. The only other problem I see is that the bottoms of the albums look a little ragged. Pinterest doesn’t have this problem because they have an essentially infinite supply of photos. My supply is a bit more limited.

All things considered, I think it’s an improvement. The lack of an ordered horizontal grid kind of makes it feel like there is a lot more activity on the page. The effect is better on some albums than others, of course.

Kip A few more photos

I put up a few more photos today. These are from our cruise to Cozumel and Costa Maya. All but two of these photos come from a disposable waterproof camera. We got it to use on our snorkeling excursion in Cozumel, but that was cancelled because the water was too rough. So we decided to use those exposures. Which I say just to explain why these pictures generally look so bad.

Also, I have a video that I moved from my previous post to this one. This video shows Stephanie coming in on the final zip line, which goes over a lagoon near the end. It was lots of fun!

No Comments
Kip Lights and Sounds

I haven’t posted any pictures or videos on this site in quite a while. Time to fix that!  Some of these things have already been seen on Facebook. Others are enjoying their world premiere right here. For photos, there are some Christmas photos that have actually been on the site for several months. We also have: a look at our new house (which should be ready for us to own in about two weeks!); photos from Emma’s fourth birthday; not one but two sets of Easter Egg hunt photos: one on Palm Sunday with Steph’s family, and one on Easter Sunday with my family. And finally, we have some day-old photos of Emma going on a bike ride.

Now for the movies. First up is one that I uploaded to this site six months ago, but never got around to writing the accompanying blog post. This is Emma playing a video game with (Super Stardust HD). And I apologize in advance for Grayson screaming in the background. He does that a lot.

Next we have Emma riding her new tricycle for the first time, at her fourth birthday party.

Next are two videos of the kids hunting Easter eggs at Grammy and Pop-Pop’s house. I apologize for the awful white balance.

Finally, we have a video of Emma riding her new bicycle. It turned out that her tricycle was too little for her, so we exchanged it for a bike.

No Comments
Kip New directions for Vacant Nebula

So it’s come to this. The obligatory “I haven’t been blogging as much lately” blog post. I think I’ve held out for a while, but in February I went a full calendar month without a blog post for the first time in over seven years. I actually had to write some code so that there wouldn’t be a dead link over there on the right. It hasn’t been for want of something to blog about—lots of things are going on right now. Namely, we sold our house a few weeks ago, and we will soon be moving to the Raleigh area. We are kind of homeless now, staying with family until our new house is ready at the end of next month.

But our busy life doesn’t actually have much to do with why I haven’t been blogging. For that, we must go back about a year ago, when I was viewing the search queries that brought people to this blog. Two of the most common ones were “violent art” and “barefoot and pregnant”. This caused me to contemplate why I would want strangers to come here at all. When I started this blog I thought I might attain some degree of internet fame. But the content of this site isn’t really anything deserving of recognition or outside attention. So I started blocking most of this site from search engines. Only a few hand-picked pages are allowed through, consisting mainly of my more technical blog posts. Since then, more of my blog posts have tended to be technical. More personal things that might have been blog posts three years ago are often just a tweet or a Facebook status update today. Or, perhaps more likely, they just wouldn’t go on the internet at all today.

The other main factor is simply that I spend less time surfing the web on a computer lately. I don’t have time to blog or surf the web at work. When I think back to how much time I spent surfing the web at my previous job, I can’t imagine how I got any work done. Today I probably average less than ten minutes of web surfing at work per day. And since I got a smartphone last summer, and an iPad for Christmas, I spend less time surfing the web at home (from a computer). Using either the phone or the iPad is faster than waiting the five minutes for our six-year-old laptop to boot—so much so that the laptop doesn’t even get turned on all that often.1

So the future of this blog probably looks a lot like the present- sparse updates, tending to be less personal, but hopefully things that someone actually wants to read. I enjoy writing here, and I don’t intend to stop. But I refuse to ever force myself to write a post just because I haven’t blogged enough lately.

1 In fact, I’m only writing this blog post because I started up the laptop to pay bills tonight.
Kip Gambling

Stephanie and I recently went on a 5-night cruise to celebrate our seventh anniversary. One of the activities on the boat was a casino, which opens up once you hit international waters. My understanding is that nothing is illegal in international waters. I had planned to go on an Assassin’s-Creed-style murder spree, but decided it would be too much work. Maybe next time.

Anyway, back to the casino. People in Vegas always seem to be having fun in the casinos, so we decided to try it out. We took ten dollars each to the casino. (High rollers.) I went to the blackjack tables, and watched as three dollars disappeared, then three more dollars disappeared, and three more dollars disappeared. I turned to Steph and said, “I will never have a gambling problem. Nothing about that was in any way addicting. In fact, I feel like I just got raped a little.”

No Comments
Kip Twenty Twelve

There exist two traditions here at Ye Olde Vacant Nebula: a long, introspective blog post on my birthday, and a long, retrospective blog post at the beginning of the new year. What you are reading is the latter. As I noted at the begenning of twenty-leven, my blogging frequency has dropped precipitously. (I only wrote twenty posts this year.) As such, this long, retrospective blog post may be merely a retrospective blog post.

My blogging has tended more toward the technical and geeky this year. I detailed the code I wrote to generate gradient images, shared my thoughts on how to write SQL queries, wrote not
once but twice on HTML5 video, provided password tips for non-geeks, compared online backup services, and closed the year by sharing my process to creat photo mosaics.

For the more family-oriented content on this blog, I posted pictures from our trip to Disney World, Emma’s third birthday, a trip to the beach, Grayson’s first birthday, Emma’s first day of preschool, our trip to Dollywood, and Halloween. I also posted a ton of videos all at once.

Some other odds and ends: my thoughts on Donkey Kong Country Returns, some comments on what it’s like living near a race track, the obligitory birthday blog post, and a follow-up review of Anathem.

All in all a pretty good year. Too bad a Mayan version of the Y2K bug is going to somehow tear the world apart in twenty-twelve. Or so they say. Happy New Year!

No Comments
Kip Photo Mosaics

Over the holidays, Stephanie’s family was working on a jigsaw puzzle which featured an image from Winnie The Pooh, which was made up of hundreds of tiny animation cells from Winnie The Pooh cartoons. The puzzle was super tedious, but it did inspire me. I realized it would be a fun programming exercise to try to write a program to generate one of these mosaic images. So that’s what I did that evening, staying up till about four in the morning.

In this post, I’ll be talking about some of the challenges I faced in writing the code. If this doesn’t sound at all interesting to you, but you’d like to see the images I created, you can just view my mosaics photo album that I just posted.

Here is the original image I’ll be working with in this example:

To start with, I take a library of images and reduce them all to 12×9 pixels. This takes a while, so this library is cached. I then use these simplified images to determine which image to use for each tile in the mosaic.

In my first try, I picked the best match possible for each tile. Unfortunately, this results in a lot of duplication, which doesn’t actually look that great.

So, my next attempt was to prevent any image from being used twice. Unfortunately, you need lots of suitable images for this to work; my library of photos wasn’t sufficient. Additionally, because I was processing tiles column-by-column, from left to right, the mosaic generally was truest to the original image on the left, and furthest from the image on the right.

My next idea was to allow an image to be reused, but to limit reuse. So I implemented a system where an image receives a “penalty” each time it is used. The next time I check to see how suitable that image is for a given tile, I add the penalty to that tile’s score. This has the effect of allowing other similar images to be substituted. But after other similar images also have the same penalty, the original image will be selected again. And it will get another penalty. This produces a better image, but it still has the problem of the image getting worse as you go from left to right.

So, I next decided I would fill in the tiles in a random order. This gives better results:

Next, I had the idea that instead of filling them in randomly, I should fill in the tiles with the most detail first. (For those curious, I calculate the level of detail in a tile by computing the average RGB color of each pixel in the tile. Then I take the standard deviation of the “distance” of each pixel’s color from the mean color in the RGB color space. So the most detailed image would be one that is half black and half white. And the least detailed would be one that is one solid color. This isn’t perfect: a tile that is a black and white checkerboard pattern is more detailed than one that is half white and half black, split evenly down the middle. I suppose a better approach would be to do a frequency analysis, and find the areas of highest frequency changes. Similar to the way JPEG compression works. But I thought that was too much work for what I was trying to do.)

So now we have something that I’m pretty pleased with. The next step was just to up the resolution. The image below has 4560 individual tiles:

I’m not releasing the program right now because the code is way too bad. It is very sloppy, nothing is parameterized. (I adjust the parameters right now by editing the code and running from within Eclipse.) Plus, I’m sure there are programs out there already that do the same thing better. If you’re really interested, you can email me. If there’s enough interest, I can try to make the code presentable. But I don’t have any plans for that now.

No Comments
Kip Anathem review part II

Vacant Nebula superfans may recall that I wrote a brief review of Anathem by Neal Stephenson on this blog about two years ago. I have recently recommended the book to at least two people, and started to worry that maybe it wasn’t as good as I remembered it being. I’ve had a similar situation with movies before, where I think a movie is really good the first time I watch it, then I watch it a second time and think it is pretty awful. (The most egregious example that comes to mind is Phone Booth.)

So I recently embarked upon the task of rereading Anathem. I believe this is actually the first time I have re-read a novel in over a decade. And I’m happy to stay that I stand by my original review. In fact, I liked it a little better the second time because I remembered a lot of the Orth and Fluccish vocabulary, so I didn’t have to consult the glossary all the time. And I believe the previous sentence tells you enough about the book to determine if it would be interesting to you.

No Comments
RSS feeds: Kip's - Stephanie's - Both