DaedTech

Stories about Software

By

How to Prepare for Windows 8.1 Update Fail

I was going to publish the next Chess TDD post today, but I got caught up in the worst kind of yak-shaving where I was basically just trying to get my computer functional again. So, I didn’t get the audio recorded, and I have something different to talk about, to-boot.

Last night, I stayed up late programming and left my computer on. This morning, I got up and it had powered off for some reason or another. When I turned it on, it told me that it was installing updates. Whatever, new OS (for me), same difference on the updates. Except, this time it got to 99% installed, stayed there for a really long time, and then eventually came back with the message:

We couldn’t complete the updates
Undoing changes
Don’t turn off your computer

I let this go for around 45 minutes before figuring there must be something wrong. I did a hard reset, and it booted right back into that screen. Tried again, same result. Let it go for another half hour, nothing. At this point, I tried to boot into safe mode, but there are apparently six different ways to do it and three of them don’t work because Windows 8 is too fast or something. It appeared as though the only way to boot into safe mode was to launch the OS normally and enable it. Sigh.

I figured I could boot from some kind of media, but none shipped with the PC. I figured I could make one, but all of the guides about making Windows 8 recovery CDs/USB Drives all seemed to start with “boot into Windows 8 and…” Double sigh. So, pretty much everything you might do to recover the machine in light of an unexpected problem involves you having prepared ahead of time for such a problem. And, while it’s certainly good practice to do so, it hadn’t occurred to me that the source of instability would be an OS update. And, apparently, it’s a common problem with this update that has yet to be fully resolved for everyone.

To solve my problem, I eventually managed to mash F8 at just the right time, get the advanced startup menu, and find a restore point that had been set yesterday morning. After wasting a couple of hours of my life, I’m going to take steps to prevent this kind of nonsense and minimize headaches. If you’re running Windows 8.1, I’d suggest that you follow some of these relatively quick steps. They’ll take you little time and, since these updates seem rather issue-prone, they might save you a huge headache later.

So here’s what I’m doing.

Turn off automatic updates

The last thing I want is to go to bed tonight and have a repeat of this morning. If updates are going to be a source of problems, I want to be opting into them instead of having them pushed. To do that, go to the start screen and type “Windows Update,” which will return the Windows Update menu. Go to “Change Settings” and you can choose a less aggressive setting. I chose “check for updates but let me choose whether to download and install them.”

Updates

YMMV on how you want to handle this, but it might be a good idea if you don’t want some update bombing out and costing you a couple of hours.

Make Sure Safe Mode is Accessible

I lucked out in that I was able to get into safe mode, but having that be a crapshoot is silly (and, in my opinion, should absolutely not be the default setting). Here’s a guide for how to do this. You basically have to run a command line utility to make it happen. It might marginally slow down your boot. Whatever, this is a no-brainer, and shaving a few seconds off of boot time at the risk of not being able to launch the OS in safe mode is completely not worth it.

Create a recovery USB Drive

Here are instructions for doing this. I haven’t actually done this one yet, but I’ve ordered a USB drive for the purpose and will do it when it gets here. It never hurts to have options and since my computer didn’t ship with an OS disk, I think this is something I should have.

Here is an alternative method if you’d prefer to use a DVD.

Create a custom refresh image

Windows 8 has a refresh feature that will basically reinstall the OS while leaving your files and Metro apps alone. However, it will blow away your installed applications, which is a bummer. You can create your own refresh image that will include the things you’ve installed, though. Instructions for that are here. I believe you’ll still have to reconfigure your applications when you launch them, but it’s better than nothing.

Create a system restore point before updates

It probably never hurts to create system restore points to recover to (and you can actually use them if you do the F8 enabling). But, given the trouble with system updates, it might make sense to create them immediately prior to trying an update. Here’s a “dummy’s guide” if you’re so inclined, but if you just type “restore point” at the start screen, you can probably figure it out from there.

Remove any extraneous things plugged in

After I had started writing this post, I continued to try to update because I needed to upgrade to Windows 8.1 Pro and because I wanted the problem solved. In the end, I wound up doing a complete “refresh” and then unplugging various things from the USB ports, including a Fitbit and my USB web cam. After these steps were taken together, I was finally able to get through the offending update. I can’t say for sure, but I suspect the latter cause, particularly because at one point I’d found a blurb about someone having the same experience.

So as a good troubleshooting step, you might consider ripping out everything not strictly necessary (and perhaps disabling various applications that startup at boot and anything else not necessary).

Good Luck and Happy Computing

An ounce of prevention is worth a pound of cure… I learned the hard way, today. Hopefully this saves you some headaches, particularly if Microsoft belches out a problematic but ‘mandatory’ system update. I encourage you to do some of these things (at the very least, make sure you can run the OS in safe mode when it’s not critical) now before you’re panicked or furious.

By

The Secret to Avoiding Paralysis by Analysis

A while ago Scott Hanselman wrote a post about “paralysis by analysis” which I found to be an interesting read.  His blog is a treasure trove of not only technical information but also posts that humanize the developer experience, such as one of my all time favorites.  In this particular post, he quoted a stack overflow user who said:

Lately, I’ve been noticing that the more experience I gain, the longer it takes me to complete projects, or certain tasks in a project. I’m not going senile yet. It’s just that I’ve seen so many different ways in which things can go wrong. And the potential pitfalls and gotchas that I know about and remember are just getting more and more.

Trivial example: it used to be just “okay, write a file here”. Now I’m worrying about permissions, locking, concurrency, atomic operations, indirection/frameworks, different file systems, number of files in a directory, predictable temp file names, the quality of randomness in my PRNG, power shortages in the middle of any operation, an understandable API for what I’m doing, proper documentation, etc etc etc.

Scott’s take on this is the following:

This really hit me because THIS IS ME. I was wondering recently if it was age-related, but I’m just not that old to be senile. It’s too much experience combined with overthinking. I have more experience than many, but clearly not enough to keep me from suffering from Analysis Paralysis.

(emphasis his)

Paralysis by Lofty Expectations

The thing that struck out to me most about this post was reading Scott say, “THIS IS ME.” When I read the post about being a phony and so many other posts of his, I thought to myself, “THIS IS ME.” In reading this one, however, I thought to myself, “wow, fortunately, that’s really not me, although it easily could be.” I’ll come back to that.

Scott goes on to say that he combats this tendency largely through pairing and essentially relying on others to keep him more grounded in the task at hand. He says that, ironically, he’s able to help others do the same. With multiple minds at work, they’re able to reassure one another that they might be gold plating and worrying about too much at once. It’s a sanity check of sorts. At the end of the post, he invites readers to comment about how they avoid Paralysis by Analysis.

For me to answer this, I’d like to take a dime store psychology stab at why people might feel this pressure as they move along in their careers in the first place — pressure to “[worry] about permissions, locking, concurrency, atomic operations, indirection/frameworks, different file systems, number of files in a directory, predictable temp file names, the quality of randomness in my PRNG, power shortages in the middle of any operation, an understandable API for what I’m doing, proper documentation, etc etc etc.” Why was it so simple when you started out, but now it’s so complicated?

NervousTestTaker

I’d say it’s a matter not so much of diligence but of aversion to sharpshooting. What I mean is, I don’t think that people during their careers magically acquire some sort of burning need to make everything perfect if that didn’t exist from the beginning; I don’t think you grow into perfectionism. I think what actually happens is that you grow worried about the expectations of those around you. When you’re a programming neophyte, you’ll proudly announce that you successfully figured out how to write a file to disk and you’d imagine the reaction of your peers to be, “wow, good work figuring that out on your own!” When you’re 10 years in, you’ll announce that you wrote a file to disk and fear that someone will say, “what kind of amateur with 10 years of experience doesn’t guarantee atomicity in a file-write?”

The paralysis by analysis, I think, results from the opinion that every design decision you make should be utterly unimpeachable or else you’ll be exposed as a fraud. You fret that a maintenance programmer will come along and say, “wow, that guy sure sucks,” or that a bug will emerge in some kind of odd edge case and people will think, “how could he let that happen?!” This is what I mean about aversion to sharpshooting. It may even be personal sharpshooting and internal expectations, but I don’t think that the paralysis by analysis occurs as a proactive desire to do a good job but out of a reactive fear of doing a bad job.

(Please note: I have no idea whether this is true of Scott, the original Stack Overflow poster or anyone else individually; I’m just speculating about this general phenomenon that I have observed)

Regaining Your Movement

So, why doesn’t this happen to me? And how might you avoid it? Well my hope is that the answer to the first question is the answer to the second question for you. This doesn’t happen to me for two reasons:

  1. I pride myself not on what value I’ve already added, but what value I can quickly add from here forward.
  2. I make it a point of pride that I only solve problems when they become actual problems (sort of like YAGNI, but not exactly).

Let’s consider the first point as it pertains to the SO poster’s example. Someone tells me that they need an application that, among other things, dumps a file to disk. So, I spend a few minutes calling File.Create() and, hey, look at that — a file is written! Now, if someone comes to me and says, “Erik, this is awful because whenever there are two running processes one of them crashes.” My thought at this point isn’t, “what kind of programmer am I that I wrote this code that has this problem when someone might have been able to foresee this?!?” It’s, “oh, I guess that makes sense — I can definitely fix it pretty quickly.” Expanding to a broader and perhaps less obtuse scope, I don’t worry about the fact that I really don’t think of half of that stuff when dumping something to a file. I feel that I add value as a technologist since even if I don’t know what a random number generator has to do with writing files, I’ll figure it out pretty quickly if I have to. My ability to know what to do next is what sells.

For the second point, let’s consider the same situation slightly differently. I write a file to disk and I don’t think about concurrent access or what on Earth random number generation has to do with what I’m doing. Now if someone offers me the same, “Erik, this is awful because whenever there are two running processes…” I also might respond by saying, “sure, because that’s never been a problem until this moment, but hey, let’s solve it.” This is something I often try to impress upon less experienced developers, particularly about performance. And I’m not alone. I counsel them that performance isn’t an issue until it is — write code that’s clean, clear, and concise and that gets the job done. If at some point users want/need it to be faster, solve that problem then.

This isn’t YAGNI, per se, which is a general philosophy that counsels against writing abstractions and other forms of gold plating because you think that you’ll be glad you did later when they’re needed. What I’m talking about here is more on par with the philosophy that drives TDD. You can only solve one problem at a time when you get granular enough. So pick a problem and solve it while not causing regressions. Once it’s solved, move on to the next. Keep doing this until the software satisfies all current requirements. If a new one comes up later, address it the same as all previous ones — one at a time, as needed. At any given time, all problems related to the code base are either problems that you’ve already solved or problems on a todo list for prioritization and execution. There’s nothing wrong with you or the code if the software doesn’t address X; it simply has yet to be enough of a priority for you to do it. You’ll get to it later and do it well.

There’s a motivational expression that comes to mind about a journey of a thousand miles beginning with a single step (though I’m really more of a despair.com guy, myself). There’s no real advantage in standing still and thinking about how many millions of steps you’re going to need to take. Pick a comfortable pair of shoes, grab some provisions, and go. As long as you pride yourself in the ability to make sure your next step is a good one, you’ll get to where you need to be sooner or later.

By

Happy Independence Day

Here in the United States, the 4th of July is Independence Day. Traditionally, this holiday is celebrated with barbecues, warm weather activities, beer, and blowing things up, generally in the form of fireworks both professional and amateur. Given that it occurs on a Friday this year, it’s a big 3 day weekend here for most (though as of last Friday, my life is kind of a constant semi-weekend where I work on weekends), so I anticipate readership being a lot slower than normal as people are going to be at pool parties rather than browsing their RSS feeds.

While I do have several posts that are ready to go, I’m going to save those for next week and just wish all of my fellow American readers a happy 4th, and all of my other readers a happy weekend. To celebrate, please enjoy this picture of a bald eagle holding a sparkler:

PatrioticEagle

By

On My Own as a Free Agent: DaedTech Grows Up

In 2013, I made a mildly rambling life update post. In it, I described that I had decided to leave the job I had at the time with the intention of job seeking and blogging about it all the while (and also possibly striking out on my own). Things passed in something of a whirlwind and, when the dust settled, I had an offer and was back to W2 employment the Monday following my last Friday at the previous job. So many lost opportunities for interview anecdotes and “holy crap I’m actually on my own” posts about what it’s like to be a freelancer.

Well, the good news is that I’ve managed to double back after taking the commonly traveled road and set out this time on the one less traveled. Take that Robert Frost; I’ve now taken both roads and it has made all of the difference. Anyway, my point here isn’t to antagonize icons of poetry, but to announce that, starting this week, I am now in business for myself.

FakeItTilYouMakeIt

Like last time, my situation is somewhat fluid. I’ve agreed to consult with my now-former company on an extended basis and will continue my work with Pluralsight and on the blog and in the community in general. I have a few engagements lined up, both potential and scheduled, and the aim at this point is to start building and broadening my book of business. But there are also a few companies I’ve had conversations with about various intriguing full time opportunities. So the next month or two will probably be a busy, marginally confusing and formative time for me that is likely to determine the course of my career in the near term future, depending what I decide to do.

If you’re interested in working with me in some capacity, look for updates to the site’s menu soon to formalize and organize my thoughts, but I’ll speak to it a little bit here in the shorter term.  I’m willing to do some software application delivery work — essentially implementing applications needed by prospective clients.  But two areas in which I see myself as a fairly high value add, given my experience, are true consulting and what I’ll loosely describe as coaching and related delivery.

In the capacity of “true consulting,” I can bring a variety of experience to bear, ranging from line level development to C-level departmental management.  If your firm needs advice on implementation or architecture, I can certainly supply that, but I can also help provide gap analysis, recommendations for technical strategy, ROI calculations for software initiatives, help selecting and evaluating candidates/staff developers and plenty more.  Under the heading of coaching, I can help your group out with agile transformations, implementing and selling external stakeholders on accepted best practices (automated testing, continuous integration, TDD, automated builds and deployments, etc), mentoring/teaching developers, performing code reviews, speaking to your group etc.  But beyond that, I’m happy to put my money where my mouth is beyond just coaching; if you want to hire me to clean up your group’s build, move you over to a new source control scheme, refine your ALM tooling, etc, that’s an excellent fit for me.  And, if any of you reading are not in a decision-making position but would like to see these changes implemented in your group, I have a knack for selling management on change and sidestepping Expert Beginners.  We can talk and see if maybe we can’t get a meeting with your management and the winds of positive change blowing through your company’s halls.

Those are the arenas in which I see myself being most valuable to prospective clients, and I really enjoy working with developers and people in the industry, so I’d be happy doing that sort of work.  But really, I’m open to anything that sounds interesting.  If you have an idea for a project you’d like to work on with me, a pitch for a startup, a full time position you need filled (I’d probably really only be looking for leadership roles if I were going to consider W2 work), some writing or developer evangelism (but only if I believe in the product) that you need help with, or really anything you can think of at all, please don’t hesitate to reach out.  I’m always up for a discussion.

I don’t doubt that I’ll have more refined messages about what I’m doing later, and certainly I’ll have posts about my experiences, struggles, and learning moments.  My goal here was just to make a quick announcement of what I was doing and invite those interested in possible arrangements to reach out so that as many interesting opportunities as possible presented themselves.  Someone recently asked me what kind of working I was looking to do, and my eyes sort of widened and a really obtuse response came out before I could stop myself: “interesting work.”  This was actually an intense bout of honesty, though, and I don’t know that I’m looking for too much more than that, in terms of the work.  I’m looking for an opportunity to be autonomous, diligent and creative, and to solve challenging problems.  Beyond that, I kind of grow where I’m planted.  I could be happy working on implementing programming language, detangling a nasty legacy code base, selling your management on the virtues of iterative approaches, cranking out code for a product idea, writing an interesting story about a compelling developer tool, and just about anything in between.  So please don’t hesitate to reach out with anything that you think might be interesting, fun or challenging, and I promise in return, I won’t hold back on relating anything interesting about my experience, even if it’s lessons that I learn from embarrassingly stupid or naive things that I do as a fledgling business owner.

By

P, NP And Decision Problems (Really, It’s Not that Bad)

After a relatively lengthy hiatus from this series, I’m going to bring back the Practical Math series, but with two changes. First, in spite of my rather intense predilection for symmetry and order, I’m going to dispense with the stock set of headers to fill out and get a little more free form with these. And secondly, I’m going to expand it to kind of be “Practical Math for Programmers but also Practical Computer Science and all of the Discrete-Mathy things in between.” With the former concession, my aim is to remove my own blockage from writing these posts — the template is good for consistency, but it sort of sucked the fun out of it and I’d stare at the headers and think, “ugh, okay, that’s a lot to do.” With the latter concession, I mean to acknowledge that computer science and a lot of the algorithms involved are fundamentally “mathy” and that’s okay. We’ll work together to make this thing approchable.

One of the coolest concepts that I ever encountered as a student or in life was NP Complete problems. It’s a rather mind blowing subject and it’s simultaneously philosophically complex and simple to approach.  I’d also like to offer the caveat here that I’m a long, long way removed from formal study of this topic, so what I’m posting here is my recollection of the topic combined with a hodgepodge of visits to various .edu sites to refresh my memory on some of the finer points.  The intention here is to give an approachable introduction to those programmers who’ve never really had formal CS backgrounds and not to defend a PhD thesis.  I’ve made a good faith effort to keep things accurate, but let no one confuse this with a textbook.

Now, lest I scare anyone off too quickly with that disclaimer, let’s do some grade school math. What are the prime factors of 12,317? You’ve got 20 seconds. Ready, set, go!!!

(In my best Alex Trebeck voice) Oh, no, sorry — you’re out of time. Let’s try a different one. How about 109 x 113? Bet you can hammer that one out in 20 seconds either by firing up Calc.exe or just doing it longhand. Well, look at that, 12,317. Whaddya know? And both of those are prime factors, so you now have the answer to the last question too. But… why is it so much harder to reduce a composite number to prime factors than to do multiplication. I mean, 5 x 5 isn’t a whole lot harder than 25/5. Why is factoring so much harder than multiplying? Kind of interesting to think about, huh? And just like that, you’ve dipped your toe into the waters of pretty heavy discrete math and computer science theory.

See, it’s not that bad. Let’s consider some concepts now before we give them names. I think the names get pretty weird pretty fast if you don’t first understand the concepts. Thinking about the idea of factoring versus multiplication and contemplating the nature of the uneven difficulty level, you might think as follows. Multiplication is a problem that you can solve pretty easily. Prime factoring is a problem that you can solve, but not as easily. However, given a number and a candidate prime factor, what you can do is check really easily. In other words, when you were trying to find the prime factors of 12,317, you were doing something like, “let’s see, is it divisible by 2… no… 3… nope… 5… etc.” But if someone came along and said, “is 109 a factor of 12,317,” you would say, “wow, it sure is, and now I’ve also found the only other prime factor to boot. Thanks man!” So we can differentiate between whether a problem can be solved easily (e.g. multiplication but not factoring) and whether a prospective solution for a problem can be checked easily (e.g. both factoring and multiplication). And we can also phrase our approaches to these problems in yes or no forms, requiring a decision to be rendered: “Is 109 a factor of 12,317 — yes or no?” or perhaps, “do any smaller prime factors of 12,317 exist?”

With me so far? Good. Let’s not confuse things any more quite yet, opting instead to give voice to the reasonable question, “alright, whatever, but who cares?”  Well, for starters, the NSA and cares and so should you’re concerned about the degree to which they trample on your various rights.  The reason for this is that the imbalance between time required to solve multiplication and factoring plays a crucial role in a number of public key encryption schemes.  If you want to go beyond the realm of encryption and civil liberties, consider the implications of the discovery of a fast, polynomial time solution to NP Complete problems: you’d basically solve all of mankind’s problems.  Aside from personal glory and every conceivable medal/prize under the sun, you’d be able to answer the question, “how do I build the fastest possible fighter jet” in relatively short order, especially when compared to the way we’d currently need to approach the problem, which would be to build every possible fighter jet and see which one is best (perhaps applying some limited heuristics).

If this sounds comically grandiose, it sort of is, but also, it’s sort of not.  It’s unknown whether this unicorn solution (fast polynomial time algorithm for NP Complete problems) is even theoretically possible, but if it is and then it were solved, it would probably be the most ground breaking mathematical discovery in the history of mathematics.  But if you’re the sort who likes practical answers to “why should I care?” then consider the ability to recognize problems NP problems as a sort of “road closed” sign when looking for algorithmic efficiency.  If you realize that a problem is NP Complete, you can give up on finding a slick way to do it and realize that it’s either time to go with brute force or time to seriously reconsider what you’re doing.

So what is this P and NP and NP Complete and all that?  Well before we go back to some of the discoverable concepts from the factoring example and before things get all formal, let’s consider an example of an NP Complete problem.  Things are always easier by example than by mathematical definition, so let’s talk about a salesman and his travels.

Let’s say that there are a bunch of cities that are on a salesman’s route, and that the salesman has to visit each city exactly once.  Obviously, there is a mileage distance associated with each trip between cities, and let’s say that our salesman can only fly on one particular airline and that it’s not a given that there are flights between any two cities.  So, to review, one airline, all cities visited exactly once (which theoretically may or may not actually be possible, depending on the cities involved), mileage tabulated along the way.  The question that is then NP Complete is, “is there an itinerary for the salesman that results in him traveling less than X miles?”

I like this because it’s pretty simple to understand what’s being asked, as far as examples of heady discrete math concepts go.  And, it’s also possible to understand where the subtle complexity creeps in.  Can you think of a way to solve this other than brute force through all possible routes and then checking to see if a given one is less than X?  (If you can, email me your solution and tell no one about this!  I’ll see that it winds up in good hands.)  Can you also see that, while answering the question is a matter of brute force, checking the answer is a simple, polynomial time proposition (walk the given path adding up the miles and then see if the total is less than X)?

Okay, so let’s finally get to some definitions, but I’m going to keep them colloquial rather than mathematically rigorous, given the theme of this series.  First off, as touched on earlier, there is the concept of a decision problem.  A decision problem is simply a problem in which an algorithm is applied to some set of inputs and will produce an answer of “yes” or no.”  Examples include “do any smaller prime factors of 12,317 exist?” and “is there any sales route to be traveled where the salesman can fly less than 120,000 miles?”

Now to spice things up a bit.  P problems are a class of decision problems where the decision can be rendered in a time that is polynomial in relation to the input.  This means that in O notation terms, you’d be talking about things like O(n), O(n^3), O(n^20), etc.  The time might be awful, but it wouldn’t be exponential like O(2^n) or combinatorial like O(n!).  NP problems are a class of decision problems where a proposed solution can be verified in time that is polynomial in relation to the input.  Conceptually, P problems are a subset of NP problems, which makes sense.  After all, if you can answer whether or not there’s any path that the salesman can travel in short order, you can certainly check one particular path in pretty short order too (and, conceptually, if you can enumerate all of them in polynomial time, you could simply solve the verification problem by just paying attention when you happened to get to the proposed solution).

Now, at this point you might wonder whether P is more than a subset of NP, but actually the same as NP.  This puts you in good company with the entirety of those who study theoretical computer science.  This is one of the most important problems in the field in need of a solution.  Okay, so what’s NP Complete, exactly, since we’ve been talking about it?  To answer that, I’m going to reach back to an old post where I talked about this concept obliquely.

I don’t have a fast (polynomial time) solution for the traveling salesman problem, but let’s say that I did.  Let’s say that I had some magical oracle that solved this in short order.  Since the traveling salesman problem is NP Complete and I have an oracle that can solve it quickly, it means that I can use my oracle to solve any other NP problem quickly (polynomial) as well.  To be a little more rigorous, I could, in polynomial time, transform my oracle into a solution for any other NP problem, in polynomial time.  So NP Complete problems are those where if you find such an oracle, you win life.  If a problem is not in NP complete, your oracle is a bronze medal.

There is a lot more that could be covered, but I think this is probably a good stopping point on the subject.  For more reading, here are some interesting links: