I'm in the process of moving my blog posts here to Born Geek. Lots of links, photos, and styles are broken at the moment, so please bear with me as I move all of this data.
Update: The migration has been completed.
I'm in the process of moving my blog posts here to Born Geek. Lots of links, photos, and styles are broken at the moment, so please bear with me as I move all of this data.
Update: The migration has been completed.
In further preparation for merging my blog with Born Geek, the "Code" section of this website has been relocated. You will now find all of the old Visual-C++ articles filed as back-dated posts beneath the Visual-C++ tag. If you spot a problem with any of them, let me know by leaving a comment here. Below is a master list of the articles, for convenience:
Over the next few days, as I have available time, I will be tweaking the design of this site. My ultimate goal is to merge my blog with this site, closing the former down once that's complete. The style changes I'll be making are in anticipation of that move.
If you spot something broken, let me know by leaving a comment here, but just be warned that things will be in a state of flux as I make updates.
At midnight Pacific time last night, the highly anticipated Diablo 3 was released. Judging by all the negative tweets I woke up to this morning, I'm glad I didn't buy in to the hype. It seems as though virtually everyone failed to connect to the Blizzard servers last night, something you're required to do even for single player games.
This point really gnaws at me. On one hand, I'm disgusted that you have to connect to a remote server to enjoy a single-player experience. I've seen some claims that this was done to prevent cheating, but we all know that this policy is about software piracy. Who really cares if I cheat while playing by myself? No one, that's who.
On the other hand, I use Steam all the time, which is an (albeit loose) analogy to Blizzard's Diablo 3 strategy. I typically connect to the Steam servers before I play, though for virtually all of the games I own, it's not a requirement. Perhaps it's the fact that you're required to connect that bothers me. It's one more online account that I'd rather not deal with.
A few journalists in the gaming world have predicted that this is the future of single player gaming. Only time will tell whether or not that's true. Maybe this launch will sour people's opinions enough that mandatory online gaming will be deferred for a little longer. As a single-player gaming enthusiast, I certainly hope so.
Last night, I finished reading Zen and the Art of Motorcycle Maintenance: An Inquiry into Values, by Robert Pirsig. What a thought provoking book! It's essentially an introduction to philosophy, by way of the story of a motorcycle trip that a father (the author) and his son take across the country. The narrative bounces between events of the actual trip and a series of Chautauquas on the author's nagging question: "What is Quality?" His explorations of what Quality is and what it means for each of us is very intriguing, and has given me some new insights into what I should be striving for in my life.
That said, this book isn't the easiest read. It's clearly a volume that warrants a second (and perhaps, third) reading. So much food for thought is presented to the reader, that it becomes difficult to digest. Approach this work with an open mind and with an eagerness to learn. Anything less and you may find yourself bored from the start. If you're willing to read through it, however, I can guarantee that this book will leave you pondering the same questions that have haunted philosophers all these years.
One other, similar book that I'd like to mention in passing is The Mind of the Maker, by Dorothy Sayers. I read this particular title before reading Zen and the Art of Motorcycle Maintenance, and found it equally as intriguing. This title is an even more difficult work to get into, but there are such gems embedded within it that the work is worth the effort. Although Sayers's work focuses primarily on creativity and the art of creating, it inevitably ends up treading over some of the same territory that Pirsig's work does. Quality, it turns out, is at the root of everything; very intriguing stuff.
My last post dealt with a few issues I encountered during my first 30 days of using Stack Overflow. I would now like to propose a few ways I think some of these can be smoothed over. This will be my final post on the Stack Overflow topic; I think I've pretty well worn it out.
If you have thoughts on these suggestions, I'd enjoy hearing them.
After thinking about it for a while, I've decided to remove the Software section of this website. The applications that were posted were all relatively ancient, and saw little (if any) download traffic.
The contact form at this site has been restored. If you see any additional problems with it, please let me know by leaving a comment on this post.
Having used Stack Overflow for over 30 days now, I'd like to share a few of my personal gripes with the site. Those of you who are frequent Stack Overflow contributors may disagree with the views I express below; if so, feel free to leave a comment. I'm going to try my hardest to point out issues that seem particularly problematic to new users. My next post on this subject will cover a few ways I think some of these problems could be smoothed over.
Now that my 30 days are over, I will be dialing back my use of the site considerably. My original intention of helping others may have been noble, but it turns out that there are already too many operators standing by. I question whether that game is really worth playing.
I am aware that the contact form at this site is broken (though I'm not sure why). Until I get some time to fix it, if you have a bug report or question, simply send me an email at: removed
My apologies for the inconvenience.
In my last post, I complained about my initial experience with Stack Overflow. I decided to give myself 30 days with the service, to see whether or not I warmed up to it. Now that those 30 days are over, I will be posting several of my thoughts and observations. This first post won't be about the site itself; instead, it will cover some of the things I learned during my 30 days. A second upcoming post will cover some problems I think exist with the Stack Overflow model, and my final post will provide a few suggestions for how I think things can be improved.
Let me first say that I learned a lot simply by browsing the site. Reading existing questions and their answers was fascinating, at least for the programming topics I care about. Some of what I learned came through mistakes I made attempting to answer open questions. Other bits of information just came through searching the web for the solution to someone's problem (something that a lot of people at Stack Overflow are apparently too lazy to do). Without further ado, here's a list of stuff I learned, in no particular order (each item lists the corresponding language):
$a = $b ?: $c; // No true clause (too lazy to type it, I guess)
$a = $b ? $b : $c; // The above is equivalent to this
$
in a regular expression doesn't literally match the absolute end of the string; it can also match a new-line character that is the last character in the string. Pattern modifiers are usually available to modify this behavior. This fact was a surprise to me; I've had it wrong all these years!test
, [
, and [[
.# Old way of doing it (how I learned)
open OUT, "> myfile.txt" or die "Failed to open: $!";
# The newer, recommended way (as of Perl 5.6)
open my $out, '>', "myfile.txt" or die "Failed to open: $!";
Update (Sep. 26, 2016): See my updated post on how I think new user's should approach Stack Overflow.
Stack Overflow has always been a better-than-average resource for finding answers to programming questions. In particular, I have found a number of helpful answers to really obscure questions on the site, many of which helped me get past a road block either at work or in my hobby programming. As such, I decided I'd join the site to see if I could help out. Never before has a website given me a worse first impression.
In an effort to keep the community as clean and orderly as possible, new users have very little rights from the get-go. On paper, this is a pretty nice idea. In practice, it makes it difficult for new users to gain any traction. I read through a number of questions today and had several comments for the original poster. Unfortunately, I couldn't make my comments, since new users cannot post comments on articles they themselves didn't write (you have to gain "reputation" in order to gain that privilege). Posting my comment as an "answer" to the original question seemed like bad form, so I didn't do that.
Looking elsewhere around the site, I found a few questions I felt I could answer. As soon as I went to answer said questions, someone else (in some cases, a number of other people) had jumped in and beaten me to the punch. I never had a chance to provide a helpful answer. Not only do you have to be very knowledgeable about a subject, you've also got to be very fast in providing said answer. I eventually did provide an answer for a question, then realized that my approach wouldn't work. Before I could take action and modify the answer, my submission had already been modded down by several people, several of whom left snarky remarks. What a warm welcome for a new user! I subsequently deleted my answer.
I later searched the Meta Stack Overflow site, looking for advice for new users. It turns out I'm not the only one who thinks that it's very easy for new users to get dumped on. Take a look at the questions revolving around new users on the site, and note how a number of them revolve around how hard it is for new users to improve. Documentation for how best to contribute as a new user is sorely needed.
The folks who manage these websites need to examine the barrier of entry for new users. I fully understand the need for keeping spammers and trolls out, but someone needs to develop a tutorial (or better yet, a set of tutorials) for how to properly use the website. New users do occasionally need hand holding, especially with websites as complicated as Stack Overflow. I think the community as a whole would benefit, and it would certainly help people like me who have been quickly overwhelmed by what the site offers.
For those who live under a rock, The Elder Scrolls V: Skyrim was released ten days ago. I'm already nearly 70 hours into this game, and there's still a ton of stuff I haven't done. That said, I figured I'd post a few quick thoughts about this game. In short, this is easily one of the best games I've ever played.
There is simply too much to do in this game. You could spend all day making potions, crafting items, enchanting items, or simply exploring the world, all without ever starting a single quest. I found myself completing many of the "miscellaneous" quests long before I joined any particular faction, or started along the main quest line. There are still giant chunks of the map that I have yet to visit, which is incredible given that I'm so far in.
The game's graphics are outstanding; head and shoulders above Oblivion's engine. I'm really impressed with the draw distance, and every dungeon, cave, and mine has a unique feel (fixing one of Oblivion's few failings). It's also silky smooth on my system, running on the "High" detail level. Story lines have been interesting so far (though the Thieves' Guild seemed a little weak), and I'm loving the Dragon Shout abilities. Blasting an enemy off the top of a mountain is so incredibly fun.
I do have a few complaints. The user interface on the PC is pretty terrible, though I'm hopeful that a mod will come along soon to fix that. Voice acting is good, but some of the voices are reused way too much for my liking. Perk points (a new way of leveling your character) are too rare. Give me 2 or 3 points per level, not just 1! Finally, as is usual with this type of game, there are still quite a few bugs. Another patch is coming after Thanksgiving, which should hopefully smooth out some of the rough spots.
If you like role playing games, and you enjoyed the previous Elder Scrolls titles, you'll like this title. It's an instant classic in my opinion, and has taken its rightful place in my "best games of all time" list.
A couple of years ago, I blogged about two helper functions I wrote to get HTML form data in PHP: getGet
and getPost
. These functions do a pretty good job, but I have since replaced them with a single function: getData
. Seeing as I haven't discussed it yet, I thought I would do so today. First, here's the function in its entirety:
/**
* Obtains the specified field from either the $_GET or $_POST arrays
* ($_GET always has higher priority using this function). If the value
* is a simple scalar, HTML tags are stripped and whitespace is trimmed.
* Otherwise, nothing is done, and the array reference is passed back.
*
* @return The value from the superglobal array, or null if it's not present
*
* @param $key (Required) The associative array key to query in either
* the $_GET or $_POST superglobal
*/
function getData($key)
{
if(isset($_GET[$key]))
{
if(is_array($_GET[$key]))
return $_GET[$key];
else
return (strip_tags(trim($_GET[$key])));
}
else if(isset($_POST[$key]))
{
if(is_array($_POST[$key]))
return $_POST[$key];
else
return (strip_tags(trim($_POST[$key])));
}
else
return null;
}
Using this function prevents me from having to do two checks for data, one in $_GET
and one in $_POST
, and so reduces my code's footprint. I made the decision to make $_GET
the tightest binding search location, but feel free to change that if you like.
As you can see, I first test to see if the given key points to an array in each location. If it is an array, I do nothing but pass the reference along. This is very important to note. I've thought about building in functionality to trim and strip tags on the array's values, but I figure it should be left up to the user of this function to do that work. Be sure to sanitize any arrays that this function passes back (I've been bitten before by forgetting to do this).
If the given key isn't found in either the $_GET
or $_POST
superglobals, I return null
. Thus, a simple if(empty())
test can determine whether or not a value has been provided, which is generally all you care about with form submissions. An is_null()
test could also be performed if you so desire. This function has made handling form submissions way easier in my various work with PHP, and it's one tool that's worth having in your toolbox.
As I mentioned in my previous post, I learned two photography lessons on my recent trip to the mountains of North Carolina. Today, I will be covering the second lesson I learned. In short, never fully trust your camera's automatic white balance setting. While shooting under cloudy conditions, I found that the automatic setting resulted in photos that were way too cool in color, resulting in inaccurate representations of what my eye saw. Here's a great example from my visit to Mount Mitchell State Park (a wonderful place, I might add):
Compare the automatic white balance photo with the following one, which was taken with manual white balance (on the "Cloudy" setting):
Note how this second image is warmer in color, with richer greens and reds. This second image is much closer to what I really saw, and the color difference was enough to be apparent in the little LCD display on my camera. The morning I visited the park, weather conditions were definitely cloudy. It's interesting then that the automatic white balance didn't pick up on those conditions better than it did.
One obvious solution to this problem is to shoot in RAW mode (assuming your camera supports it). My camera does not support RAW, and I'm not entirely sure that the additional post-processing work necessary with RAW photos is worth it (though I'm sure plenty of pros would disagree). As I have learned, you're probably better off manually setting your white balance for a given scene. Just don't forget to change it each time you go on a shoot. You wouldn't want to shoot in "Cloudy" mode on a bright, sunny day.
I learned two very important photography lessons during my recent vacation to the southwestern mountains of North Carolina. Today I will cover one of those lessons, and I'll get to the other one in a future post. As you might have guessed from this post's title, the first lesson involves a tripod.
In my previous outings to the various state parks here in North Carolina, I've never carried a tripod with me. On a bright sunny day, it's typically a tool I feel that I don't need; lots of light, a steady hand, and my camera's image stabilization feature help me out. On cloudy days, however, I inevitably end up with a load of blurred shots, especially when in a heavily forested area. On this particular trip to the mountains, I knew I would be shooting a number of waterfalls, so I was willing to haul my tripod down the trail with me.
Since I already had the tripod with me, I found that I used it for way more than the waterfall shots I had intended. Wow, what a difference it made! Instead of lots of blurred shots, the vast majority of my photos are keepers this time around, thanks to this handy tool. I've also learned a few things about the type of tripod I want in the future:
My current tripod is a tad bulky, and the multiple controls are a bother to work with. A multidimensional bubble level for my camera's hot shoe connector would also be useful.
In short, if you're planning a photo shoot in a forested area, or you're shooting on a cloudy day, make an effort to carry a tripod along with you. Your end results will justify the extra effort of lugging extra gear down the trail. As an added bonus, carrying a tripod will pique people's curiosity. I struck up more conversations with random people about photography on this trip than I've ever done previously. It's a lesson I'll remember for a long time.
Update: This problem has been fixed in PuTTY 0.62.
Back at the beginning of last month, PuTTY 0.61 was released after four years (!) of development. Since upgrading to this new release, I've noticed the occasional "Access Denied" message when connecting to certain Linux systems at work. The odd thing about this message is that it appears between the user ID prompt and the password prompt; in essence, before I even get the chance to log in! Example output looks something like this:
login as: root Access denied root@myserver's password:
Making things stranger, I can enter the correct password and log in to the system with no problems. As I found out from a commenter on another blog, it turns out this message is due to a new feature in PuTTY 0.61. To prevent this message from appearing, do the following:
The phantom access denied message should then go away.
This afternoon, I finished season 2 of the original Star Trek series. The last few episodes of this season are incredibly bad, even by 1960's-era science fiction standards. What really gets me about the last few episodes, is the feeling that they were written by grumpy old men, unhappy with the political climate at the time. Let's take a look at the three worst examples:
Episode 23: The Omega Glory In this bizarre episode, Kirk finds a star-ship captain violating the prime directive. The Yangs (yanks) and Kohms (communists) are battling one another in a bizarro-world parallel-Earth scenario. Worst of all? The Yangs have their own "American" flag, and the Declaration of Independence is considered their "holy word" (which, ironically enough, is kept in a large King James Bible). Be sure to listen for the strains of "The Star Spangled Banner" and "America the Beautiful" every time the flag is shown.
Episode 25: Bread and Circuses While attempting to locate a missing star-ship crew, Kirk and company stumble upon a planet whose oppressive government is a 20th-century version of Earth's Roman empire. In the final 2 minutes of the episode, Lieutenant Uhura figures out that the "sun worshipers" (who are slaves in this world's society) aren't actually worshiping the sun, they're worshiping the son of God. The "aw, shucks" sentimentality of the crew at this discovery is really misplaced and simply feels tacked on. Maybe a network exec forced the writers to put this twist in?
Episode 26: Assignment: Earth The season finale plays on the cold war fears of the 1960s, and shows a lot of badly edited NASA footage of early Apollo-era flight tests. A stereotypical "dumb blonde" female character sums up the entirety of her generation's shortcomings in this unforgettable scene:
Mister Seven, I want to believe you. I do. I know this world needs help. That's why some of my generation are kind of crazy and rebels, you know. We wonder if we're going to be alive when we're thirty!
Is a quote like that the hallmark of an out-of-touch, angry old man, or what? "Kids these days ... am I right?"
There are some other particularly annoying episodes, like Episode 22: By Any Other Name. This episode was terrific for the first 45 minutes of the 50 total. In the last few minutes, the aliens who have taken the Enterprise crew hostage simply cave in to Kirk's reasoning for peace, totally destroying the tension that had built up to that point. I was hoping for the death and destruction of these monsters, but all they gave me was peace and harmony. This could have been a solid episode, but the ending ruined it completely.
I'm looking forward to season 3 (some of the episodes sound very interesting), but I'm boldly going forward with a grain of salt. There are bound to be rocky episodes ahead.
Way back in February of this year, I started a Musical Voyage: listening to my music in order, sorted by album title. Today, I finally finished the journey with Van Halen's "5150" (an album I consider mediocre at best; I never was a Sammy Hagar fan). I found this to be an interesting way to enjoy my music. Sometimes the jump from one album to the next was very pleasant (e.g. Relayer by Yes to Revolver by The Beatles); other times, it was jarring and unexpected (e.g. from Best of Schubert to Best of The Doors). I heard a ton of stuff I rarely listen to, reintroducing myself to some terrific music. Occasionally, I even heard something I didn't like (and which I've subsequently purged from my iPod). At least I can buy some new music for myself now; upon starting this goal, I set a rule that no new music could be added. There's several things I've been eager to get, and now I finally can. Mission accomplished!
One minor annoyance I have always had while surfing the web, is the non-standardized order in which you consume a website's content. Two pertinent examples spring to mind. First, are the "post navigation" links that you find on many websites. Out of the box, WordPress uses a link pointing to the left to indicate older posts (example: « Older posts), while a link to the right indicates newer posts (example: Newer posts »). This design decision no doubt stems from the humble beginning of the blog: the journal (as in the pen and paper variant). In English, we read left-to-right, top-to-bottom; and in a pen and paper journal, newer entries are always "to the right of" older ones. I'm sure this is one reason why WordPress themes come as they do. I have always taken the opposite stance, however. Digital entries on a site are not (in my mind) the same as handwritten entries in a journal. So I have always used a link pointing to the right to indicate older posts, while a link pointing the left indicates newer ones. In short, the newest content appears "first".
My opinion changes with my second example, however. The Twitter timeline presents the newest tweets at the top of your home page. This seems like a major design flaw, since I am seemingly shoe-horned into reading tweets in reverse order. My typical modus operandi for reading Tweets is to scroll down to my last known position, and work my way back up to the top of the page. This is really bothersome to have to do. I'd love to have an option to have the newest stuff appear last, so I could consume the content as it was presented to me.
I take a similar stance in Google Reader. I used to browse items in "newest first" mode, but I stopped doing that since I would see stories in reverse order. After switching to reading items in the "oldest first" mode, I've been much happier; it feels much more natural to me. I'm not sure why I feel so differently about two remarkably similar items, but I do.
Which order do you prefer? Is there a "right" way to do it?