No Dogs Please Sign

Archive for March 2009

March 26, 2009

Good Times in The Office

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.

2 Comments Filed under: Entertainment
March 21, 2009

Trip to Raven Rock

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).

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. :oops: 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.

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.

2 Comments Filed under: Programming
March 17, 2009

Reading With Franz

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.

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 »

No Comments Filed under: How To
March 15, 2009

Fun With Ultra Zoom

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.

No Comments Filed under: Photography
March 14, 2009

Category Cleanup

Frustrated by the confusing nature of some of the categories here at this site, I’ve done a little cleanup. Occasionally, I never knew what categories to assign to a particular post, which is pretty sad seeing as I’m the one doing the organizing. The primary culprit was “The Web” category; it has since been renamed to “On the Web,” which makes things a little easier to understand. I’ve gone back through all my old posts and updated the categories where needed.

No Comments Filed under: Blogging

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.

1 Comment Filed under: Programming
March 8, 2009

Burrito Filling

  • 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 cumin
  • 1/4 tsp kelp
  • 1 tsp chili powder
  • 1/8 tsp thyme
  • 1 tsp vegetable seasoning
  • Dash of cayenne pepper
  • 1 can (5-oz) tomato juice

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

No Comments Filed under: Recipes
Older Posts »