Archive for March 2009

Good Times in The Office

Published on March 26, 2009

The Office has really seen a resurgence in quality over the past several weeks. I lamented once before about a perceived downward spiral for the show, but tonight’s episode was a real throwback to the good old days of seasons 2 and 3. Other recent episodes have been equally as strong, making the show a joy to watch again. Michael’s tension with his new boss Charles is truly palpable, allowing the viewer to share those awkward moments that made the early seasons so fun.

It looks as if the writers are setting things up for a huge season finale. We get to see Ryan for the first time in a while in the next episode (which is two weeks from tonight), and hilarity should ensue as Michael and Pam set out to start a new paper company. Will Michael hire Ryan as an employee in his new company? Could Holly make another appearance at the end of the season? Will the folks at Dunder-Mifflin realize that, despite his antics, Michael Scott is the right man for their company?

I can’t wait to find out.

Trip to Raven Rock

Published on March 21, 2009

I took a little trip to Raven Rock State Park today, and took some photographs while I was there. It’s a great park to visit, with some really nice vistas to view the surrounding area. Signs of Spring could be found if you looked hard enough, which I’m thankful for (I’ve gotten very tired of Winter lately).

A Stupid Interview Question

Published on March 20, 2009

Back in the spring of 2005, after having graduating from college, I went looking for a job. I got the chance to interview for Microsoft, though I’m not sure what I would have ended up doing had I gotten the job (they never really told me). My interview was conducted entirely over the phone, and consisted of the typical “brain teaser” type questions that Microsoft is famous for. Needless to say, I performed very poorly and was instantly rejected. The guy on the phone said he’d let me know and, 10 minutes later via email, I knew.

One of the questions they asked me stumped me beyond belief, and I butchered my answer terribly. Not only was I embarrassed for myself, I was embarrassed for the interviewer, having to patiently listen to me. 😳 Anyway, here’s a retelling of the question I was asked:

Given a large NxN tic-tac-toe board (instead of the regular 3×3 board), design a function to determine whether any player is winning in the current round, given the current board state.

I realize now that I misinterpreted the question horribly. The interviewer stated the question quite differently than I have it written above; I believe he used something along the lines of “given a tic-tac-toe board of N dimensions …” I assumed that the bit about dimensionality meant delving into the realm of 3 or more physical dimensions; essentially something like 3-D tic-tac-toe. Obviously, solving such a problem is much more difficult than solving on an NxN 2-D board.

Tonight, for whatever reason, I recalled this question and the fact that I never found an answer for myself. Happily, I subsequently stumbled upon someone else’s answer (see question 4), which is quite clever. It’s good to finally resolve this problem.

I know interviewing candidates for a job can be tricky, but asking these kinds of questions is silly. Does someone’s ability to answer this kind of question really prove they are a better programmer than someone who can’t? In the end, I’m eternally glad I didn’t get hired for Microsoft; I now realize they are one of the companies I would least like to work for. My current employer seemed much more concerned with real-world problems, my previous employment experience, and the (increasingly rare) ability to program in C++. For that, I am oh-so-grateful.

Randomizing MySQL Query Results

Published on March 18, 2009

When I added the favorite photos feature to my photo album software, I wanted a way to randomly show a subset of said favorites on the albums display page. I initially thought about implementing my own means of doing this through PHP. Ultimately, I wanted random selection without replacement, so that viewers would not see multiple copies of the same image in the ‘Favorites Preview’ section. Thankfully, MySQL saved the day!

When sorting a MySQL query, you can opt to sort randomly:

SELECT {some columns} FROM {some tables}
WHERE {some condition} ORDER BY rand()

The rand() function in PHP essentially gives you random selection without replacement for free! How great is that? It was an easy solution to a not-so-simple problem, and saved me a lot of programming time.

Update: I have since learned that the ORDER BY rand() call is horribly inefficient for large data sets. As such, it should ideally be avoided. There’s a great article describing ways to work around these performance limitations.

Reading With Franz

Published on March 17, 2009

My dad stumbled upon an incredibly well produced video entitled “Reading With Franz.” In it, we learn how Franz, a puppet representing a person with a disability, is able to read books with a simple switch device and Tar Heel Reader. For those who may not know, Tar Heel Reader is a website my dad started a while back with an emphasis on providing books for beginning readers. There are over 3000 books on the website as of this writing, with more being added every day. Over 2200 visitors surf the site every week, with nearly 300,000 weekly page views. This map of readers shows that visitors are coming in from all over the world (a total of 80 countries so far). If you know a beginning reader, particularly one with a disability, be sure to check out the site.

Comments Disabled

Updating Time Zone Information in Linux

Published on March 16, 2009

About this time last year, I noted that our build machines at work were way out of sync in their respective local times. As a result, we were seeing a bunch of “clock skew” warnings when building our code. To fix the problem, I figured out how to use NTP on a private network. Imagine my surprise when, while performing a build today, I noticed more clock skew warnings! I checked our setup, and NTP was still functioning as expected. The problem, it turns out, was that some of our build machines had not yet changed over to Daylight Savings Time (DST), something NTP doesn’t assist with. Only the oldest machines were affected, which wasn’t surprising, seeing as Congress feels the need to change the DST rules every few years.

Thankfully, updating time zone information is easy to do. Here’s how:

Read the rest of this entry »

Fun With Ultra Zoom

Published on March 15, 2009

I bought a new camera this past week: the Canon PowerShot SX10 IS. It has a tremendously larger optical zoom (20x) as compared to my current PowerShot A620 (4x), not to mention a host of other great features. I’m looking forward to using the camera; there are a number of places I’ve wanted to shoot with a larger optical zoom range.

Yesterday, I took a couple of shots out of my back door, one at the widest zoom, and one at the telephoto end. I’ve highlighted the area in the wide zoom shot that corresponds to the telephoto shot. Pretty incredible, huh? And apologies for the lousy white-balance; I didn’t tweak the images, but posted them just as they came out of the camera (sensibly resized, of course).

With any luck, some new photos will show up here in the next week or so.

GCC Dynamic Section Sizes Error

Published on March 13, 2009

I ran into a weird problem in one of our build scripts at work today. We compile our tools across a number of platforms and architectures, and I ran across this issue on one of our oldest boxes, running RedHat 9. Here’s the horrible error that I got when linking:

/usr/bin/ld: myFile.so: undefined versioned symbol name std::basic_string<char, std::char_traits<char>, std::allocator<char> >& std::basic_string<char, std::char_traits<char>, std::allocator<char> >::_M_replace_safe<char const*>(__gnu_cxx::__normal_iterator<char*, std::basic_string<char, std::char_traits<char>, std::allocator<char> > >, __gnu_cxx::__normal_iterator<char*, std::basic_string<char, std::char_traits<char>, std::allocator<char> > >, char const*, char const*)@@GLIBCPP_3.2
/usr/bin/ld: failed to set dynamic section sizes: Bad value

It seems as if the standard C++ libraries on this system were compiled with gcc 3.2, while the version we’re using to build our tools is 3.2.3. Unfortunately, the 3.2 compiler isn’t installed on the system, and I’m not sure where we would find it for RH9 anyway. Thankfully, I found a workaround for this problem. Our link step originally looked like this:

gcc -shared -fPIC -lstdc++ -lrt -lpthread -o myFile.so {list_of_object_files}

I found out that by moving the standard libraries to the end of the line, the problem disappeared. Here’s the new link step:

gcc -shared -fPIC -o myFile.so {list_of_object_files} -lstdc++ -lrt -lpthread

I don’t fully understand why ordering should matter during the link step, but by putting the standard libraries last, we were able to get rid of this error. If you understand the root cause of this, please leave a comment explaining. I’d love to know more about why changing the order makes a difference.

Burrito Filling

Published on March 8, 2009
  • 1 can (15-oz) kidney beans
  • 1 can (15-oz) pinto beans
  • 1 can (15-oz) black beans
  • 1 large carrot
  • 1 stalk celery
  • 1 medium onion
  • 1 garlic clove
  • 2 green chili peppers (optional)
  • 1 tsp chili powder
  • 1 tsp cumin
  • 1 tsp vegetable seasoning
  • 1/4 tsp kelp
  • 1/8 tsp thyme
  • Dash of cayenne pepper
  • 1 can (5-oz) tomato juice

Place all three cans of beans into a colander; rinse and drain thoroughly. Pour the beans into a large skillet and mash them. Place the carrot, celery, onion, garlic, chili peppers, and tomato juice in a blender, and blend well. Pour the blended ingredients into the beans, mixing them together. Add the rest of the ingredients, again mixing well. Simmer over low heat for 10 to 15 minutes, or until the mixture is warmed to your liking, stirring occasionally.

Medoc Mountain Photo Album

Published on March 7, 2009

My parents and I took a trip to Medoc Mountain State Park today, and I took several pictures along the way. This short photo album is the result. I recommend the park for anyone in the RTP area of North Carolina. It’s about a 90 minute drive to the north and east, and offers a lot of hiking possibilities (along with fishing, canoeing, and picnic tables).

Update: I’ve fixed the above link to the album (thanks Dustin). That’s what happens when you post late at night.

Bandwidth Usage Update

Published on March 3, 2009

In my recent post on analyzing bandwidth usage, I promised an update once February was done. Seeing as it’s now March, it’s time for said update. Here’s the graph of my bandwidth usage for the month of February:

Bandwidth Graph for February 2009

I didn’t break the 40 GB barrier, but I wasn’t far from it this month at 37 GB. The highest daily total was 3304 MB on February 2, though several other days came close to that total. This is the first month that I haven’t noticed any interesting trends, but it’s still enjoyable to chart my activity. As I predicted, my daily average seems higher this month, thanks to my Roku player and Netflix Watch Instantly. If I break the barrier in March, I’ll be sure to let everyone know. It appears Time Warner has done their homework on their proposed upper limit…

MonkeyAlbum Updates

Published on March 1, 2009

Late last night, I rolled out a new version of my photo album software. The largest new feature in this release is the Favorite Photos section. As I explain in that section of my photo gallery:

These images are my personal favorites from among all of my posted photographs, chosen either because I really liked the photo’s composition, or because the subject means a lot to me.

Here are some of the details about this new feature:

  • When browsing through the available photo albums, you’ll notice a ‘Favorite Photos’ section at the bottom of the page. This section will show 7 random images from the collection, and provides a link to browse all the favorites.
  • When browsing an album’s thumbnails, any favorites will be styled slightly differently (with a different background color) than their non-favorite counterparts. I tossed around using a ‘badge’ overlay with the thumbnails, and even implemented said feature, but I’m using the simpler styling for now (it presents a few less complications). I may switch to the badge at some point in the future.
  • Favorite images are also identifiable on their respective image pages (for those who browse albums by viewing all the images).

A few other minor features and fixes made it into this release. First, page titles now indicate where you are while browsing images. This is a big improvement over the previous “same title for every page” implementation. Second, page styles have been tweaked a bit. Colors have been improved in several areas, and text size has been decreased in the breadcrumb area. Finally, you’ll now note that my list of photo albums is now broken across multiple pages (I currently show 9 albums per page). This was a surprisingly difficult decision to make. Moving older albums off of the first page makes it more likely they won’t be viewed by new visitors to this site. At the same time, with the number of photo albums I have here, keeping them all on one page would push the new favorites feature to the bottom of a fairly tall page. In the end, I feel the new favorites feature is more interesting to new visitors than a listing of older albums.

I was hoping to have a new photo album to roll out with this update, but sadly I haven’t taken any serious photos in a while (my last album was quite honestly a halfhearted attempt). Since its inception, the number of photo albums I’ve posted per year has decreased dramatically (11 in 2006, 9 in 2007, and 5 in 2008). I intend to fix that this year.

Let me know what you think about the new features, and please report any bugs you spot. Thanks, and enjoy!

Copyright © 2004-2018 Jonah Bishop. Hosted by DreamHost.