Tuesday, December 28, 2010

Quote of the Moment

"Harvard Business School Dean Nitin Nohria ... says that if U.S. businesses keep prospering while Americans are struggling, business leaders will lose legitimacy in society. He exhorted business leaders to find a way to link growth with job creation at home"
--From an AP story by Pallavi Gogoi.

Will lose?  Ahem, it's possible you have your tense wrong there.  And there's that growth word again.

Sunday, December 26, 2010

We Need to Make Things

Though I hate to end the year on a depressing note, Nick Carey of Reuters wrote a heck of a story about the interlocking effects the collapse of American manufacturing, the fallacy of financial sector growth, the ineffectiveness of the education system, and the current political impotence have had and will continue to have on the economy.

And while I'm on the subject of the economy, I highly recommend the "Toxie" episode of This American Life, wherein some reporters buy one of the now-infamous toxic assets and use it to explore the financial crisis.  It's an utterly fascinating account and some great reporting.  Heck, This American Life has been doing great reporting on financial stuff for a while now, including "Return To The Giant Pool of Money," and "Inside Job."  Not to mention "NUMMI," exploring how GM failed to learn lessons from Toyota, or "More Is Less" and "Someone Else's Money" looking at the health care system.

Thursday, December 23, 2010

Watching the Watchers: Who Says the Government Can't Do Humor

In a wonderfully self aware move, the CIA has set up a task force to find damage done by the Wikileaks document releases.  The group is called the Wikileaks Task Force, or as it's known around the office: WTF.

Tuesday, December 21, 2010

Some Joy and Hope for Christmas

What happens when two awesome things combine to make something even more awesomer?  Reese's cups.  Also this: Inigo and Roberts with lightsabers.  (Yeah, the poster disabled embedding.)

And if that wasn't enough to bring a smile to your face, then perhaps something a bit more serious.  In a section from "The Joy of Stats," Hans Rosling takes us through the life expectancy and wealth changes of two hundred countries over two hundred years.  It's more worth your time to watch than you might think.

Big News from the Small

A virus that attacks the family of plants including tomatoes and tobacco is being put to a more benign and very impressive use: making lithium ion batteries ten times better.  Building off the rigid structure of the virus, scientists are constructing electrodes with much higher surface area, which in turn increases the efficiency of the battery.  With ten times the capacity in the same size, or the same capacity in one tenth the size, electronic devices could become smaller and last longer between charges.  Think smart phones that could go a week or more without needing a recharge.  And of course, smaller batteries mean less waste.

While more efficient batteries are undoubtedly great, that isn't the news that got me fired up this month.  After years and years of waiting, someone finally announced a breakthrough in the green tech I want to see become reality more than any other.  Oh yes, there is finally news on the supercapacitor front.  Scientists working with single-atom-thick sheets of carbon (a.k.a. graphene) have devised a method which makes the energy storage capacity of a supercapacitor about that of a nickle-metal hydride battery.  While that is less than the currently used lithium-ion batteries, it is still quite impressive, and the scientists have not come anywhere near the theoretical maximum of the material yet.  Hopefully advances will continue apace and we can get those things into use.  I still want a battery-free life!

Space: the Veteran and the New Guy

It isn't just science, it's rocket science!

Voyager 1, the most distant man-made object from the sun, reached another milestone.  It has entered a region where the solar wind, outflowing gas from the sun, is no longer at its back.  The solar particles are now a cross-wind, meaning it is nearing the official edge of the solar system.  Already on its mission for thirty-three years, the probe will likely pass into interstellar space in the next couple of years.  The Voyager program remains a markee of the heyday of NASA.  Sadly, it appears the glory days are gone, even as the science continues unabated.

But now there are some new folks picking up the torch.  Space Exploration Technologies became the first non-governmental entity to put an object in orbit.  The test mission ended with a successful re-entry and splashdown from the unmanned craft.  There will be several more test flights as the corporation seeks NASA approval to dock with the International Space Station and eventual manned flight.

Military Tech, on the Way Out and on the Way In

The Harrier Vertical/Short Takeoff and Landing jet has made its last flight for the British military.  They are on their way to decommissioning, eventually to be replaced by a variant of the Joint Strike Fighter.  The carrier Ark Royal is likewise being retired.  It marks the end of an era for British aviation, and closes the book on a truly unique aircraft design.

Meanwhile, the U.S. Navy's railgun program has gone from a record setting ten and a half megajoule shot two years ago to a whopping 33 megajoules, on their way to a desired 64.  It is a long way from being a useful weapon, but it's still impressive tech.

Saturday, December 4, 2010

A New U.S. Space Plane Successfully Tested

The Air Force's newest space vehicle, sort of a modern small pickup truck compared to the Shuttle's 70s cargo hauler, has returned to Earth after a seven month test flight.  Speculation abounds about the ultimate purpose of the robotic plane, currently designated X-37B.  Some say it is an orbiting spy platform, others that it could be used in anti-satellite operations.  It began its life as a NASA testbed, and likely continues in that role for the Air Force.  The official word states that it is a continuation of the types of missions the Shuttle has been used for.

In any case, it's nice to see at least some work still going on in creating space vehicles, especially as the Space Shuttle program winds down.

Watching the Watchers: WikiLeaks Edition

I have been darkly captivated by the ongoing saga of the WikiLeaks website, or more precisely the reactions to the ongoing leaks.  The latest document dump revealed approximately zero surprising details while confirming a great many most people would have expected anyway.  Russia has an organized crime problem.  Corruption is endemic in a war zone.  Diplomats communicate like regular people when nobody is looking.  None of this is really shocking is it?

And yet some media outlets are comparing the release to that of the Pentagon Papers, which is patently ridiculous, at least so far.  Nothing that has come from WikiLeaks has had anywhere near the impact the Pentagon Papers had.  However, I find it fascinating that the government and some pundits are reacting as if it did.  It seems quite probable that WikiLeaks will cease to exist as a centralized site very soon as public corporations pull their support and the authorities make life harder on Assange.  It's also just as probable the leaked documents will continue to see the light of day, given the nature of the Internet.

The web was envisioned to allow open and easy communications, and that's a knife that can cut in many ways.

Friday, November 26, 2010

Not Quite Cutting the Cord

A little while ago, I went through my twice-yearly phase of wanting to cut my cable bill.  Even though I maintain a fairly strong TV watching habit for someone who works full time, cable prices annoy me.  It gets more expensive every year, the quality is uneven, especially for the smaller viewership networks, and thanks to switch digital channel delivery, every once in a while a channel just won't be available.  And while I could defect to a satellite company, that brings its own limitations, and doesn't save much money either.  That leaves the Internet.  This time around, I really took a serious look at it, including calculating costs.  What I found was more interesting than I expected.

How do Netflix, Amazon Video on Demand, iTunes Video, streaming sites such as Hulu, and so on compare?  We'll start with cable's strengths: DVR, at-release availability for all broadcast shows, a wide variety of HD channels, and ACC football and basketball.

The American football and basketball bit is the easiest.  If you want to watch those sports at the collegiate level, you have to pay a provider for the ESPN family of networks.  Period.  There currently is no alternative (which is why ESPN is the most expensive cable network).  The NFL is in a similar situation, though they push their own network as well.

Release availability is slowly becoming less and less of an issue.  The rise of the DVR continues to push against the rigor of network scheduling.  I virtually never watch anything the day it airs anymore, and even when I do, I often start it late to speed through commercials.  If you really don't care about watching things right when they are released, the "Netflix plan" is a no-brainer.  All the TV you could want, fairly conveniently, with more and more available on-demand as time passes, for a fraction of a digital cable bill.  All you have to do is hold out until the show is released on the service.  However, one of the things I discovered when looking at the shows I watch was how many of them were free to view a day or a week after air.  (Cable's on-demand programming typically reflects the same spreads.)  These shows are often only around for a limited time, but they are a viable free alternative when you can get them.  The pay video segment, most strongly represented by Amazon and Apple, also makes shows available in similar time frames.  Plus, if your VOD purchases are "buy" rather than "rent" you have eliminated the need for DVD/BluRays as well.  Pay video also tends to be available in higher quality than the free services, and quality matters.

I like High Definition, and not just because it lets me read the game scores without needing my glasses.  When a show is made in HD, I want to watch it in HD.  HD content on the web is almost exclusively 720p, rather than the 1080p you get through more traditional means.  It's something to keep in mind if you are going to be viewing on a large HDTV.

I mentioned before that I had run some numbers.  Let's say you want the best HD quality you can get and you prefer to watch stuff while it's airing, but not necessarily the same day.  Plus, you don't want to have to mess around visiting a dozen different web sites trying to find the shows you are interested in.  If you assume the current upper prices of HD shows on Amazon ($3 per episode) and assume ten shows a year at the American standard twenty-two episodes a season, you end up with a working estimate of $55 per month.  Add in a Netflix subscription and you suddenly aren't saving much money over the cable bill.  Of course, this is just an estimate, and a rather high end one at that since prices vary.  So the viability of going to the net for your TV depends on what you want to get out of it.  Cable remains very competitive thanks to its quality and convenience, but there are more options now than ever before than can save you a little or a bunch, depending on your preferences.

During the research that lead to this ramble, I was quite surprised to see that going without cable is completely and totally a viable option now.  Should I lose my job, as so many of my friends and neighbors have, I will immediately cancel my cable.  But for now, cable still wins in my house.

I don't want to do this, but I can't leave without nodding toward the elephant in the room.  Yes, there are other ways of watching TV via the Internet that I have not mentioned due to their illegality.  And yes, using these methods often result in better viewing experiences than the legal means currently available.  And if I'm going to rant, I also wish the media companies would get the fact that making the FBI warning at the beginning of the DVD unskippable does nothing but annoy their paying customers.  These things aren't likely to change soon, but in truth, we have come a very long way.  You can watch TV from the Internet now, legally and competitively priced.  That's not something that could be said even a few years ago.  And it will continue to improve.  Google TV is currently being resisted by the networks for all the wrong reasons, but it might still succeed in turning the Internet into the world's DVR.  Or perhaps the Apple model will take hold and true a-la-carte subscription TV will arise.  Or maybe Netflix will be the sole distributor of a new show, bypassing the networks to create the new form of independent TV that web series have been hinting at for years.  In any case, the future of entertainment comes through the Internet.  And the revelation is that that isn't a revelation anymore.

Sunday, October 31, 2010

The Practice and the Art

A funny thing happened on the way to the text editor the other day.  A Firefox update came in, and after the restart, there on the promo section, was an add-on called Morning Coffee.  Normally, I wouldn't take any notice, but this time the extension did something I was interested in.  It provides a way to organize the sites you visit on a daily basis by what day it is.  By coincidence, that is exactly what I had planned to work on for my first little Javascript project.  And that brings me to this quote written by Ville-Matias Heikkilä a.k.a. viznut/pwp:

"Programming is no longer a fashionable way of expressing creativity, as there is ready-made software easily available for almost any purpose."

Now he was writing specifically about the transformation of the demo scene from the 90s to today, but his sentiments have resonance with where I am today in the hobby aspect of my programming.  I suspect there are really only three reasons for programmers to program: you get paid to do it, you need a program that doesn't already exist, or simply the art of it.

As the personal computer's power and use grew, so to did the programs.  PC operating systems have evolved from being primarily overlays to a file system into multi-headed beasts that can deal with multiple CPUs with multiple execution paths, hundreds of programs running at the same time, astounding sets of peripherals, security concerns, and machines acting as multiple other machines, all supported by scores of utility programs.  Line editors became file editors and on to word processors which became office suites.  The programmers' world of compiler/linker/assembler now holds Integrated Development Environments, Virtual Machines, database integration, and more languages than you can shake a stick at, all with increasingly huge libraries of built-in capabilities.  In short, the world is bigger now.

The world is also smaller, because people along the line had the brilliant idea that these general purpose computing devices could also be used to facilitate rapid communication between groups of like interest.  And thus the Internet was born, in all of its Tower of Babel glory.  Now the entire world of programming is out there for anyone to discover and explore.  As with so many things, a good academic grounding will help, but it isn't strictly necessary.  (This was the lesson in Visual Basic's success.)  With the flood of brainpower brought on by the Internet, and the pressure to make bigger, better, more usable programs, the programming world changed.  The Waterfall became too tall for programmers to survive if they weren't sufficiently Agile.  Programming has become less about the art of creating code, and more about integration and the processes needed to handle the increased size and complexity.  Which brings me to another quote, this time from Shamus Young's post, Object Disoriented Programming.

"I program in C++ for a living. ...I've gotten fed up with this language and its cryptic aggravating bullshit."

Shamus rants about the frustration of using libraries in the post-Internet world.  In a time when programming has gone from using the LEGO bricks provided by the basic languages and libraries to create new things, to a world where you use your LEGO to connect other peoples creations together, is there still art?

Of course there is.  Heck, combining things in novel and interesting ways could very well be the very definition of creativity.  But time comes in short supply when you have a day job, and there are a great many things already done for you and ready to use.  So the question becomes, do we persevere down the rough path through the weeds ourselves, or do we hop onto the walkway our fellows built?  The answer becomes apparent when you decide which of the three categories of programmer you fall into for the particular task.  If you are being paid to do it, or you simply have a problem to solve, you evaluate whether using the pre-built stuff will help or hinder from a purely pragmatic stance.  If, poor soul, you are programming as an artist, it brings up one last quote:

I shall be telling this with a sigh
Somewhere ages and ages hence:
Two roads diverged in a wood, and I—
I took the one less traveled by,
And that has made all the difference.

Saturday, October 16, 2010

Quote of the Moment

"Philosophers have explained space. They have not explained time. It is the inexplicable raw material of everything. With it all is possible; without it, nothing."
--Arnold Bennett, How to Live on 24 Hours a Day.

While on the Subject of Halloween

Since I'm on the subject of Halloween, there's this Ghostbusters-AC/DC mash-up by way of Dubious Quality. Epic.

The Arrival of October

October has finally arrived.  It was a bit slow in coming this year, but this morning dawned with bright skies, a touch of color on the leaves, and a cool crispness in the air.  As the year-round-work of the adult lifestyle settled in, the fall became my favorite time of the year.  November and December contain my major work holidays, with carefully hoarded vacation days standing ready to give me a spell from the daily grind, but it's October that wakes me from the summer doldrums.  The oppressive heat and humidity lifts, the pervasive pollen dissipates, and the cool temps snap you awake in the morning as surely as a warm bed cradles you to sleep.  Also there's Halloween.

It's a built in excuse to fire up the creativity again, especially for a fan of the weird such as myself.  So today, I thought I would share a couple of things that I've found interesting and inspiring recently.

I have been enjoying the writings of

Sunday, October 10, 2010

Cake in Honor of Chuck

I continue to be surprised Chuck has made it on the air as long as it has and that it continues to be great.  So partially in honor of the folks that make the show, and partly because it's a good song, here's Cake's "Short Skirt/Long Jacket."

Watching the Watchers

After a fairly long hiatus, watching the watchers returns with the disturbing story of the Pentagon spending forty-seven thousand dollars to purchase the entire first run of a book by a soldier said to be critical of the handling of the war in Afghanistan.  According to the government, the initial printing was not vetted properly and would have revealed classified information.  According to the publisher, it's all good because the publicity ginned up around the book.  (And of course they sold their entire first print run.)  According to the book... well, we'll just have to wait for the censored copy.

Nifty Medical Tech

I'm still working through the collected back-log, so these are somewhat old.  That doesn't diminish how cool they are though.

First up, Honda is working on an exoskeleton designed to help people walk.  It grew out of their work with the anthropomorphic Asimo robot program, showing that if robots can be taught to walk, then why not use the same tech to help humans who have difficulty with it.

Second, and particularly relevant to someone who had a flu shot earlier in the week, we have the fine folks at Georgia Tech working on a micro-needle patch that can deliver drugs without an injection.  The patches would be much less uncomfortable than a shot, require no special training, and remove the cost and need to dispose of used needles.

Quote of the Moment

"I know this: if life is an illusion, then I am no less an illusion, and being thus, the illusion is real to me."
--Conan, in "The Queen of the Black Coast" by Robert E. Howard

Thursday, September 30, 2010

Headline Hunting

Once again, the BBC RSS feed headline contains the funny that the linked story doesn't.  "The grape escape - theives make off with harvest" tells the story of a wine grape harvest absconded by thieves.

Playing Catch-up with Green Tech

Cripes, is it the end of September already?  I've been accumulating story links as usual, but quite lax at posting them, so prepare for a green tech link dump!

Out in the Pacific, there's a vast area covered in plastic trash, which is sort of appalling.  Now there's a research project to turn it into an island, which is sort of hilarious.  Hey, why not, we need the jobs.

In more current construction projects, excavation has started in France on the future site of the ITER fusion reactor.  And it only took twenty-five years to get started.

From the perpetually fifty years away we go to the probably fifty years away with Boeing's concept aircraft of the future.  One of the concepts uses hybrid electric battery/gas turbine to vastly decrease fuel use.

And finally, there's a story that sounds like pure science fiction, but like so many other things, it's coming true.  Scientists are researching using biological processes to create self-regenerating solar cells.

I'll admit, I sometimes wonder if most of my posts here lately would work better in twitter...

Sunday, August 22, 2010

What in the World is a Closure

Browsing programming blogs and sites like reddit's programming section, I keep coming across a CS term that my schooling missed out on: closure.  It's one of the touted features of Javascript.  (Which, as an aside, remains too low on the priority list for me to make much headway with.)  Folks seem to really like 'em, so in the interest of continuing education, I decided to see what in the world a closure could be.  Naturally, I visited Wikipedia first and got a browser full of code examples and this definition: "... a closure is a first-class function with free variables that are bound in the lexical environment."  Well, that's quite a mouthful.  Like any good programmer, when faced with a daunting puzzle, let's break it down into smaller parts.

First-class function is an easy one, it just means that functions are not just syntax but a true data type within the language.  If the language allows us to create functions, assign them, pass them, and otherwise treat them like any other data type available, then it supports first-class functions.  C doesn't, but it simulates some of the capabilities through the function pointer mechanism.  Of course Lisp, and other functional languages, are built on the foundation of first-class functions.  So a closure is a first-class function, but that's not all.

Free variables, again according to Wikipedia, are variables referred to in a subroutine that are neither local variables nor parameters to the subroutine.  This definition becomes a bit clearer when you think back to CS class and remember that variables become bound when they take on a value.  In other words, a free variable in a subroutine is one that is not bound within the scope of that subroutine.  The trivial example would be a function using a global variable; the global is a free variable in the scope of the function.

That bit at the end of the definition about "lexical environment" is another reference to variable scoping.  Basically, it's saying that the free variable in the subroutine has been bound by the syntax of where the subroutine is defined.  In our trivial global variable example, the global is bound in a scope that encompasses the function, the global one.  Assume for a moment that our example function was assigned to an object, ready to be passed around and you will see that it meets the requirements for a closure: it is a first-class function (or we couldn't assign it to a variable and pass it around), it has a free variable (the global), and that free variable is bound in the lexical scope where the function was defined.

But wait, a closure isn't necessary for this example, because the global variable, by definition, is visible everywhere.  To make a more interesting example, picture a module (or package, depending on your preferred nomenclature) that defines a variable which is private within its namespace.  It also defines a procedure that uses the variable.  And finally, it exposes that procedure as an object through its publicly available interface.  When the function gets called outside of the module's scope, it still references the module's private variable, even though that variable isn't visible in the scope where the function is used.  So our function object is carrying with it a piece of state, not from the scope where it is being executed, but from the scope where it was defined.  This somewhat mind bending ability defines a closure.

For further reading, see the Wikipedia pages above and this post about closures from Martin Fowler.

Solar Improvements, Nuclear Fallout

The rapid pace of innovation around solar cells continues.  Traditionally, one of the major weaknesses of photovoltaic cells has been their inability to use most of the sun's energy.  A new type of cell promises to help offset that disadvantage by allowing the cells to generate some power from heat as well.  The two methods combined can exceed the theoretical maximum efficiency for photovoltaics alone.  Although these cells only operate at peak efficiency at very high heat and don't set any records for absolute efficiency, there is the possibility the techniques can be used to improve existing solar tech.

Adding to the massive upswing in solar potential comes an article in the New York Times citing a report that shows solar power now costs less than nuclear.  The study has apparently been called into question (see the note at the bottom of the article's pages), but it remains an interesting read, if only to give a glimpse into the web of industry and government considerations that swirl around nuclear power.  Whether the cost crossover point has been reached already, or if it is just looming, it does appear that fission may not be the go-to long-term solution for energy anymore.  I find that pretty surprising.

Sunday, July 25, 2010

Regarding Coding Style Goals

I'm currently creeping my way through a Javascript book. It's taking longer than I would like since it's not high enough on my priority list at the moment, and because it's summer. In the interest of keeping things rolling, I thought I might write about code aesthetics today. Everyone who programs has a slightly different preferred coding style. Here are a few of the things that I love to see when reading code and strive to do when writing it. Take a moment and think about general coding practices you like. Now you can be amused by how similar, or different, our priorities are.

When I'm reading code, I love seeing things that improve my ability to grasp both what the code is doing and where that piece fits in the larger whole. Descriptive naming is a huge help, and it goes beyond just what you call your functions and variables. I enjoy seeing complex Boolean tests broken into logical parts using descriptive Boolean variables. Meaningful constants in place of literals, especially numeric literals, are a joy to read.  Naming in libraries can help their users understand not what they are but their focus as well. Whether I prefer seeing a pattern like FileOpenFileRead, and FileClose to OpenFileReadFile, and CloseFile in a function library depends on what the library is for. The naming should reflect the usage pattern. If the library is focused on file I/O, I like the File part first. If it's a generic I/O library that provides similar operations across a large type of targets, put the operation name first and the File/Socket/PrintBuffer part next. I usually name GUI widget variables using the style of typePurpose, resulting in names such as labelTitle, and buttonStartCountdown, to make them easier to find both in graphical designers and the code. Similarly, I like to reflect class hierarchies in their naming. For example, think about an abstract socket class and two concrete subclasses implementing UDP and TCP sockets. I prefer the naming to help me see not just what the classes represent, but their relationships too. So, I wouldn't call them AbsSocketTcpSocket, and UdpSocket. Instead, I'd call them SocketSocketTcp, and SocketUdp, or something along those lines. Note the effects on auto-completion with this scheme: typing the base class will give you the subclasses because the name directly reflects the inheritance relationship.  And you can't talk about clarity without mentioning comments. Comments that tell why something is being done the way it is are often more important than comments that tell what is being done. And of course, misleading, incorrect, and out of date comments can quickly destroy your code's clarity.

Having similar things work similarly seems obvious, but I'm sure you've seen code that just doesn't do it. If the existing methods in a class report errors by throwing an exception, I don't want to add a new method that uses a return code, and vice versa. I like seeing consistent parameter ordering in related routines. Using I/O library example from above, I'm going to be much happier if all of the routines take their target identifier in the same relative position in the parameter lists than if some of them have it first, others last, and a few somewhere in between.

Having, and enforcing, coding style conventions is a big deal. They help keep you reading code rather than having to stop and check if the indention is misleading or if there is some significance to that one variable using underscores instead of being camel cased. And I doubt anyone likes having to change their editor's tab/indention settings every time they change what they are working on. It's just one more niggling little thing to forget. Personally, I'm a huge advocate of the generic conventions put forth in the second edition of Code Complete. To paraphrase a recent political slogan, yes we can use the same coding style across all languages.

Simplicity is a big pet peeve of mine. The KISS rule has real benefits. Writing working code is hard enough when you can keep the model in your head, and my memory is poor enough that I really hate extraneous noise. I strive to keep the noise down when I can with these personal rules. Avoid routines that do nothing but call one other routine, they can be an indication of poor design. (Language specific things such as compiler chaining and faking default parameters get a pass on this. Sometimes.) Don't create a whole new class when a method will do. An abstract class with only one subclass wastes programmer and compiler time. Really think hard about inheritance. Using true subtypes should reduce the complexity of the code. If it isn't, I may be coming at it from the wrong angle. Would composition be a better fit than inheritance? Can I use conditional statements instead, or will that cause me headaches later? Write classes/routines for specific tasks unless you already have a concrete reason for them to be more generic. Try to keep paths between where data is stored and where it is used as short as possible (ideally this would be handled within a single class/set of routines).

I tend not to follow this rule in my writing, but I do try to in my coding. The less code there is, the fewer places you have to check later to find defects. I try to follow the DRY rule. Comments that just restate code are always annoying. Plus, I have a pathological hatred of redundant header comments. (Why do I need to write the name of the routine in a comment right above the syntactic definition of that name!) Brevity speaks to design in a very similar way as simplicity, for instance not adding a transformation layer to code when you can correct the data differences to not require the transformation in the first place. It's worth noting that as code ages, it gets harder and harder to maintain brevity in the face of normal development accretion.

There are real tradeoffs between these goals, and in general I have listed them in my order of preference. I'd rather the code be clear than brief, and prefer consistent to simple. Striving for all of them at once is one of the things that makes programming fun (and frustrating). Actually achieving them all produces what a colleague once referred to as really sexy code.

Sunday, July 18, 2010

A Strategy for Strategy

The summer heat and humidity settled across the area early and in force this year.  June was the hottest June on record, ever, and July's temps are staying above normal so far.  Paradoxically, when the sun is bright in the summer, I tend to close up my south facing blinds more often in an attempt to keep the house cooler.  And if it's going to be cool and relatively dim in the house, well that's a perfect video gaming setup.

I've been anticipating Starcraft 2 for some time, despite having "finished" with the real-time strategy genre in the late 90's.  In many ways, the game is a throwback to the decade old original, which was in turn a mere evolutionary step above its even older predecessors.  That said, there is one new "killer" feature that has hooked my interest almost more than the game itself: replays.  Starcraft 2 automatically records every game you play.  You can then play it back anytime for review and analysis or upload it to the internet for others to examine.  I think it will be a revolution in analyzing ones own play.  Of course, the serious Starcraft community has been analyzing matches for quite a while.  One such commentator has taken the place of physical sports for me this summer.  His name is Sean Plott, his handle is Day[9], and the archives of his commentary can be found here.  Be warned, his enthusiasm for the game is infectious.  (Though like sports, there is a fair amount of shorthand jargon you may have a hard time immediately understanding if you aren't at least passingly familiar with the game.)  One cast, covering some basics of developing Starcraft strategy, really caught my attention.  I think the things he mentioned are widely applicable across all sorts of different strategy games, and I want to go into them here for a bit.  Honestly, I think there may be some aspects to the tips that can be applied to life in general as well.

Have a plan.
Seems obvious, right?  But really, the root of any sound strategy begins with an attempt to accomplish something.  You may succeed by acting randomly in the moment, but you won't know why, and you won't be able to reproduce your success consistently.  Come up with a means to get to your desired end.  It shouldn't be too rigid in the face of adversity, but neither should you abandon it at the first sign of trouble.

It's more about timing than speed.
Just because you are constantly doing things doesn't mean you are actually moving efficiently.  Having good timing means you can outpace competitors who are fast but not as good at using resources properly.  (And how many of us wish we could get that message through in our workplaces?)  Remember the lesson of the tortoise and the hare, and keep an eye on speed vs. quality trade-offs.

Remembering what you need to do is the key to good timing.
Sean recommends building a mental list of the things you need to constantly keep track of as you go about executing your plan.  Then just loop through the list over and over.  At each step make sure you have it covered and then move on to the next.  As the number of things you have to keep track of increases, so does your list.  This list becomes a tool to leverage repetition for learning.  With practice, the "simple/mechanical/housekeeping" stuff becomes internalized and you can focus your mental energy on the "big picture."

Don't think about what you are doing now, think about what you need to do next.
Now is already happening, stick to your list and you don't have to worry about it.  Given the situation, what do you need to do next to keep moving along your plan?  This is where your flexibility lies.  If you loose a battle in Starcraft or get your queen captured in chess, don't sit in the moment fretting about how it happened, use your list to keep moving forward and get straight into mitigation if you need to.

Improve your technique as you go.
Practice had to come in here at some point, and this is it.  You have to learn your sense of timing through focused effort.  The first step is to thoroughly learn your game's mechanics.  For a real-time game like Starcraft 2, this will also involve training your physical memory for the interface, which is the same thing one does when practicing a musical instrument or learning an artistic medium.  Games like chess or go lend themselves toward learning to intuitively see patterns developing on the board.

I want to give a big thanks to Sean for framing the bolded tips above.  I suspect I will be pondering their application in all sorts of areas for some time to come.  And when you think about it, they make a pretty good mental list in and of themselves, don't they?

Thursday, July 15, 2010

OK, It's Over Now. Old Spice Wins the Internet (at least this week)

Yes, I've posted a pair of Old Spice ads just because I find them hilarious.  It turns out that they are more than just hilarious, they are quite savvy.  Here's one story about it.  I promise I will not post anything else about it.  Besides, you should be watching hilariously silly videos rather than reading my magnificent words.

Sunday, July 11, 2010

Headline Hunting

It's been a while since a headline jumped out at me, but happily the BBC comes to the rescue.  And once again, the headline on the story is different from the one that showed up in the RSS reader.  Yes, "Body part scare on motorway proves 'armless" is less informative than "Plastic arm on M62 in Mercyside causes 'traffic chaos,'" but the original is just gold!

Monday, July 5, 2010

I Smell Awesome, Again

The man your man could smell like is back in action again, and it's another winner.  Yes, I'm posting someone else's commercial without them paying me.  Heck, I even went out and got some of the endorsed product (which turned out to be quite good).  Bringing the funny should be rewarded, darn it!

Sunday, June 6, 2010

Today's Musical Diversion

I first heard this one as the intro track for the videogame Borderlands.  It stuck in my head for weeks thanks to a catchy chorus and the slide guitar. Here's "Ain't No Rest for the Wicked" from Cage the Elephant.

High and Low Tech Medicine of the Future

I haven't collected many story links lately, being busy will do that to a guy, but the ones I have found in recent months centered around medicine.  There has been talk of the amazing nano-tech future for a long time, much of it centering around the more sci-fi aspects of ultra-small things.  However, the folks at Cal. Tech are in human trials with "nanobots" that can cure cancer.  With no side effects.  While we are curing cancer, let's take out genetic blindness using gene therapy too.  This is some seriously awesome stuff.  But it's not just the high-tech miracles that matter.  Sometimes simple ingenuity can make a difference too.  Like creating a medically useful centrifuge out of a salad spinner for places where electricity isn't a given, and costs are critically important.  Advances, both small and large, continue to bring the future closer to now, and I find it pretty encouraging.

Monday, May 31, 2010

Announcing Code Monkeying

[Update: I gave up on the Code Monkeying experiment in June of 2011, and folded much of its content back into this blog.]

For years, I've struggled with the programming section of this blog.  Generally, this is a place where I post what I've been spending my spare time with, or stories that caught my eye in the news, things I'm pondering, or general silliness.  As a programmer by trade, I continued to want to write about the subject, but I've never really been able to fit those topics into the tone of this blog.  So I'm going to stop trying.  From now on, the Bit-Stream of Consciousness will be free of programming topics.

That doesn't mean I will stop writing about programming.  Quite the contrary.  Over the years, I've often wanted to write more about programming.  After thinking about it for a long time, I decided to go ahead with an experiment: my new programming-related blog.  Things are a little ugly over there right now, because the first subject I'm tackling is building a working Blogger template from scratch, and it's still ongoing.  If you decide to start following, you will be able to see the evolution of the template live as I update it.

Without further ado, I present:
Fighting Programming Burnout with a Flamethrower

Saturday, May 22, 2010

Quote of the Moment

"I'm not a computer nerd, I'm a computer jock."
-Sean Plott a.k.a. Day[9], Starcraft veteran.  And yes, he said it quite humorously.

Sunday, May 9, 2010

Fossil Fuels at What Cost

As the extent of the environmental damage from the destroyed oil rig in the Gulf becomes worse with every passing day, will there be enough impact on the country for people to finally realize that oil really is a bad solution?  Forget global warming, that's an issue that people can't grasp properly.  Address pollution.  Imagine a world where cities don't have yellow-orange haze hanging over them in summer.  Imagine a world where parking lots don't have the rainbow sheen of petroleum on them after a spring rain.  Imagine you can't hear cars rumbling past your house even if it's built right next to the highway.  Solar power generation would certainly seem to be a safer alternative to deep sea drilling.  It's even possible the removal of the strategic oil need could change the dynamic of war and terrorism in the Middle East.

In today's advanced society, energy storage is the single most important technology.  A breakthrough that could compete with heavy, toxic, expensive chemical batteries really would change the world.  But so would ending the polluting reign of oil.  But you have to be willing to pay for change.  Are you?  Am I?

Tuesday, April 27, 2010

Today's Musical Diversion

It's funny, on a day when I was pondering the cost of cable and the time "wasted" watching TV, I watch Top Gear, and this guy (Seasick Steve) was the guest.  Looks like this round goes to the cable bill.

The Future (of Lightbulbs) is Being Made Today

Lightbulbs are rather ordinary.  Compact Fluorescent Lightbulbs are rather silly looking, and contain toxic gas to boot.  Well, worry not.  The real future of lightbulb technology is finally coming to retail this year.  And if Engadget's reporting of the fin-covered sphere that is the GE LED bulb is accurate, then the future of bulb style will be a bit more ... interesting.  And while the LED equivalent of a 40 Watt bulb will cost around fifty bucks, it will last for close to two decades at 4 hours of use a day, be ten percent more efficient than a CFL, and it won't poison your kids when they knock over the lamp.

Of course this is the Internet age, where Technology of the Future goes to be laughed at.  So naturally, folks over at Cambridge U. are "quite close" to production quality on a LED bulb that will last nearly seventy years at the four hour a day rate while bringing the cost down to less than three dollars.

Either way, I'm hoping to never have to buy a CFL again.

Friday, April 2, 2010

Sympathy For the Devil

Toyota has had quite a year so far. Now, experts from NASA have been called in to examine the computer systems and software in an attempt to figure out the cause of the sudden acceleration some cars experience. I'm really glad I don't have that job. Except that I kind of do. All working programmers do.

"What's puzzling you is the nature of my game." --Rolling Stones, Sympathy For the Devil

Programming is hard because it's complex: every detail matters all the time. And with this complexity comes the inevitable defects. We call them "bugs." Ideally, extensive design, reviews, and testing drive out all the critical bugs before any given product goes into production. But things are never really perfect, because the humans that build them aren't omniscient. And neither are the humans that use them. When market forces are involved (that is, money), even the definition of "critical bug" becomes a fluid thing. And guaranteed quality can be very expensive.

"Is this going to be a stand up fight, sir, or another bug hunt?" --Aliens

Bugs can come from the most innocuous of places, like a misplaced or missing character in a line of code, a typo in a specification, or any number of simple human mistakes. They can also come from unexpected external interactions, like electronics shorting when the power surges, or when the cleaning crew unplugs the it's-always-on computer once a week to plug in the vacuum, or the local horseflies land on and trigger a touch screen when the operator isn't in front of it, or when the color blind guy doesn't see the red-on-white annotation on the specification. (All based on true stories.) Finding and fixing these sorts of bugs resembles a combination of lab and detective work. If you can just get that one extra piece of information that will make the bug make sense, you can isolate it and fix it. Probably. Debugging makes up the lion's share of the drudgery of programming. Finding all the edge cases, closing all the logic holes, making the program bullet proof, it's all part of the job. And it's hard.

"Adjusting to the requirement for perfection is, I think, the most difficult part of learning to program." --Frederick Brooks, Jr. "The Tar Pit"

As a person, I can not overstate how bad it is that people have been hurt and killed by the problems with Toyota vehicles, but as a programmer, I feel for the people who are right now working as hard as they can to figure out what exactly is going wrong and why. Here's hoping they come across that elusive information they need to squash this particularly nasty bug.

Sunday, March 28, 2010

Alternative Power: Recent Hype, Potential, and Deployment

The green power news cycle tends to be about hype for future potential more than actual progress, mainly because the progress is still going on mostly in labs. However there was one announcement of a product that is actually out in the real world: the Bloom Energy fuel cell. Reportedly already in use with the potential to be price competitive with other sources. Unfortunately, details are quite slim. From a personal perspective, fuel cells are nifty, but this one still uses fossil fuels as the primary source, so it's not exactly solar-clean.

Speaking of solar, the good folks out at CalTech are experimenting with a new material that should be as efficient as the best solar cells on the market, but uses on the order of one one-hundredth of the material to produce. Yep, it's still in the lab, but it's nice to see progress in all sorts of different places. Happily, such advances may not stay in the lab forever. Local microchip maker RF Micro Devices has announced their intention to begin developing solar cells using their existing microchip technology. This could make them an early leader in solar production. They hope to be entering the market in about two years.

And while I'm talking about local news, the city has announced their intention to add a power generating turbine to the inflow of the local water treatment plant. The inflowing water has to be slowed, and the turbine will recapture some of that wasted energy to create electricity.

Saturday, March 27, 2010

A Plug for Better Writers than Me

Just a quick note to pass on a link to "Ordinary Average Guy." It's writing of this quality, and the discussion that follows, that keeps me returning to Gamers With Jobs, even during times when I'm not actually playing games much.

Tuesday, March 9, 2010

Quote of the Moment

"We're all going to be one big, happy family with guns locked in a bloody, never-ending struggle for cap points."
--The Team Fortress 2 blog post on the coming of Valve games to Macintosh computers.

Saturday, February 20, 2010

Exploring Creativity Through Lightsaber Fights

The hardest thing about creativity is all the work you have to put in before you can actually take advantage of it. No matter what endeavor you choose to pursue, chances are you will have to go a very long way before you can even start down the path you envisioned. With the Internet at our fingertips, we have a tremendous resource for learning, sharing, and encouraging one another, but it can also be distracting, discouraging, and overwhelming. This line of thinking started for me when, while link following one afternoon, I ran across this bit of nonsense from the Jace Hall Show.

Hey, I thought to myself, that's a pretty impressive lightsaber fight. The technology available to create such things has really come a long way, hasn't it. But the more I thought about it, the more I realized that reaction didn't tell the proper story. It doesn't really matter how cheap video cameras have become, or how video editing and processing software is within the reach of mainstream desktop computers. If I were to try and make a video like that I'd end up looking like that poor Star Wars Kid.

The story behind that video is a sad one, because what was posted publicly was someone captured in the early stages of learning, experimenting, and having fun. The first time you pick up a guitar, even if you have someone teaching you, you aren't going to sound like Hendrix. Your first attempt at anything isn't likely to be very good. Mostly it will be, if we stick to Internet memes, an epic fail. But you will be ever so slightly better the next time. A creative success is just another failure with a tiny, almost imperceptible improvement iterated over the course of months, years, or even decades. And there is another factor in the lightsaber fight between Mr. Hall and Ms. Day: the third person.

As you can see, there is some experience at play here. In fact, you have to do the tiniest bit of research to learn that everyone involved in the top clip is in the creative industry. Jace Hall works in interactive entertainment and television. Felicia Day is a writer and actor. Both have their own web series. The third person in the clip is Michael Scott, an independent filmmaker and special effects artist who has made some very popular lightsaber fighting shorts. They have put years into practicing the skills on display in a couple minutes of video. And these are just the people prominently featured in the clip. There are no doubt others filling in the "behind the scenes" roles that make the polished clip what it is.

Even solitary creative pursuits can benefit from collaboration that encourages, teaches, or supports. Sometimes just knowing that others are out there having similar struggles can be a balm for the ground down spirit. And often you can see people's progression in skill as they continue to practice their art.

So maybe you are a little discouraged at how hard something is to get into, or your latest attempt doesn't match the vision you had for it. Remember that everything is a learning experience. Heck, maybe this post didn't express what I was trying to say terribly well. It's OK, it's just practice.

PS: Higher res versions of the Ryan vs. Dorkman videos are available for download through ryanvsdorkman.com. DVDs too. Naturally, you can follow Felicia Day's and Jace Hall's work through their respective web sites as well.

I Smell Awsome

Old Spice has been running completely bat guano nuts commercials for a while now, but one I have been seeing lately cracks me up more than most. Here, without further ado is the man your man could smell like:

Sunday, February 14, 2010

Quote of the Moment

Those very principles of efficiency and flawlessness that earned Toyota Motor Corp. a near perfect reputation couldn't prevent problems cropping up in area outside the factory, areas just as crucial these days in the industry -- design development, crisis management, and software programming.
--Yuri Kageyama, AP Business Writer in "Recall woes show new challenges for 'Toyota Way'"

Monday, February 8, 2010

Quote of the Moment

"The leadership of a public company like Sun or Oracle, the kind that anyone can own a share in by buying public stock, is bound by what is known as the "fiduciary duty" -- their decisions must be made with the goal of maximizing company profit, to be paid out to its owners in the form of dividends to the shareholders. Shareholders supervise the executives' fulfillment of this duty through a board of directors, who are elected by the shareholders and usually represent the interests with the largest shares. Notice that the well-being of employees, or of the public at large in the economy in which a company participates, are not a part of this equation."
--Excerpt from an essay by Geoff Simmons on his departure from now-defunct Sun.

Sunday, February 7, 2010

Quote of the Moment

For every expert there is an equal and opposite expert. –(Arthur C.) Clark’s 4th law.

Sunday, January 31, 2010

January Grab-bag

The new year hit the ground running. The news of this week was the winter storm that blew through the area. I got about 5 inches of snow and another inch of sleet on top. It was very cold, so the whole lot is powdery and easy to shovel. As I tried to capture in the picture above, the ice crystals are big enough to really reflect the light, which made for a dazzling morning's view.

On the entertainment front, I've just finished reading William Gibson's Spook Country, which sadly wasn't up to the standard set by the exceptional Pattern Recognition. It's not bad by any means, but all the main characters are passive participants, being dragged along by events or other people. It made the stakes lower than I'm used to in a Gibson novel. I finally watched Hitchcock's "The Birds," thanks to BBC America. I'm not a big fan of the sub-genre of horror to which it belongs, so there was an automatic bias against it, but the moment when the birds are gathering outside the school is intensely creepy. The winter TV deluge is well under way, with Dollhouse finishing up this past Friday and new (to the US) Top Gear cranking engines tomorrow.

The news remains both depressing and utterly samey. So instead of messing around with links, I will just provide one that explains the rest.

Things have been slow on the hobby front lately. Had a blast playing guitar and singing with some old friends, further solidifying that I just don't spend enough time practicing. I have done even less drawing lately, though I did put in around three hours (over an extended period of time) to produce a fantasy style map. The iconography was heavily influenced by the old Dungeons and Dragons map symbols. With only three hours in it, it's just sketch quality. And since I don't have a lightbox, it's unlikely to ever get inked properly. It was a good learning exercise, and turned out decently enough. Happily, Tolkien's Lord of the Rings maps aren't all that complex, so he can provide inspiration without pressure. It also lead me to stumble across this post on Erwin Raisz's utterly stunning landform mapping technique. Attempting these will make for some wonderful sketchbook practice, should I ever get myself to sit back down to it.

Speaking of guitar playing, I ran across this fine example of skill levels I will almost certainly never attain, but it's fun to dream, and besides I haven't heard a straight instrumental electric guitar song in quite a while. Here's Orianthi and Steve Vai with Highly Strung.