Wednesday, January 18, 2012

WebROWS: An Old Friend Reborn

"Luke, you will find that many of the truths we cling to depend greatly on our own point of view." —Ben Kenobi

Once upon a time, back in the last century, I was working with a programming language called C and attempting to learn a little bit about making computer graphics. The first little graphics program I wrote was a three-layer false parallax star field. I revisited that idea a couple of months ago when learning Javascript and the HTML canvas API. After doing a few small exercises to get some familiarity with the language and API, it was time to do something a bit more ambitious. I decided to try my hand at recreating something else I did back in the 90s in C: a simplistic Columns knock-off that I called ROWS.

Re-implementing something I had not looked at in a decade was an interesting experience. The browser model is quite different than the old C direct-to-graphics-memory method. In fact, you basically can't do the old way anymore thanks to the evolution of operating systems. Still, re-solving a known problem gives you the advantage of knowing at least one way it will work. That does not mean I did not make any mistakes along the way.

I wrote a few years ago about a defect in one of my programs at work. The solution involved looking at the problem I a new way. I ran into a different kind of issue when implementing the program in the browser. After working through each piece of the application, finding errors along the way and removing them, everything looked like it was working. And then I tested embedding it in this blog. It still worked, but I had made one rather egregious oversight. I had used the cursor keys to control the game.

Perhaps this sounds reasonable to you; I know it did to me. After all, the old version used the cursor keys, why shouldn't the new version. Well, you see, the cursor keys already have defined uses in the browser environment, namely to scroll web pages around. That didn't matter when the game fit on the page with no scrolling needed, but as soon as I put it in a page larger than the browser window those cursor keys moved the page again, shifting the game around with it. All in all a rather unacceptable situation when trying to actually play. Off I went to search for people's solutions to this problem, and I found a few that purported to fix the cursor key behavior. I even tried out a couple, to no avail. But I also found other people saying that using the cursor keys was not the way to behave. The browser, and more importantly the browser's user, already expects those keys to perform a specific function. Breaking it is bad form, they said, perhaps you should consider another way. And of course they were quite correct.

I moved the controls for the game to a different set of keys and the thing I perceived as a problem was revealed for what it was. My program didn't have an issue, I did. In attempting to override the browser's desired behavior I had created difficulty for myself that shouldn't have existed in the first place. And isn't life just like that sometimes? How often do we cause problems for ourselves by projecting our expectations onto others without really stopping to consider them? Admitting you are wrong can be hard, but sometimes it can help too.

Now I am not going to finish this post without putting in the link to the WebROWS page. The link is also over in the sidebar. I hope you enjoy playing around with it, and I would be happy to answer any questions about how it works or how I built it.

Tuesday, January 3, 2012

Quote of the Moment

“A pervasive emphasis on the expectations market,” writes Martin, “has reduced shareholder value, created misplaced and ill-advised incentives, generated inauthenticity in our executives, and introduced parasitic market players. The moral authority of business diminishes with each passing year, as customers, employees, and average citizens grow increasingly appalled by the behavior of business and the seeming greed of its leaders. At the same time, the period between market meltdowns is shrinking, Capital markets—and the whole of the American capitalist system—hang in the balance.”
— Roger Martin, Dean of the Rotman School of Management at the University of Toronto, quoted in "The Dumbest Idea in the World: Maximizing Shareholder Value" via Forbes

And if you will permit a smidge of editorializing, let me say yes, yes, a thousand times, yes!

Watching the Watchers: Leaders, Manipulators, and the Panopticon

Welcome to 2012 everyone!  Personally, 2011 was a rough year, and I am hoping that the new year will bring a brighter future for everyone, we sure could use it. For that reason, I'm not going to bother with a retrospective or resolutions this year.  Nope, let's start it off with some nice, ambiguous stories about what our Big Brothers are up to.

Whatever your opinion of the public schools, you will be hard pressed to argue the proliferation of standardized testing over the last couple of decades has not caused changes. Recently a member of a school board in California tried his hand at the tenth grade standardized reading and math tests. Of his performance on the math test he had the following to say, "The math section had 60 questions. I knew the answers to none of them, but managed to guess ten out of the 60 correctly." He performed at a D level on the reading test as well. This prompted much derision from the usual suspects, especially after his identity was revealed and it showed his degrees to be in education. One expects that from the internet, but the article itself is knocking the testing itself. So the trick to this story is figuring out where you believe the incompetence lies.

Over in Washington, the SOPA bill which seeks to give the big media companies the right to break the internet and potentially put people in jail for five years for a first copyright offense is generating jobs.  Lobbying jobs that is. Are these people fighting on in the private sector for the things they believed in while in public service, or are such things evidence of corruption and quid pro quo relationships between the government bureaucracy and large corporations?

Meanwhile, people still want to know what you are up to, for your own protection of course. The proliferation of personal technology and the sensors and data that go along with it have created a market wherein shady, potentially malicious exploits are used in products sold to corporations, governments, and police forces around the world. Also unsurprisingly, military drones are trickling down into police use. Are these the necessary steps needed to protect a technologically advanced society from crime, or bricks in the metaphorical panopticon wall of a controlled society?

The choices my friends, are yours.