New Build: Problems and Solutions

This weekend, I put together a new mixed purpose desktop. This is my first AMD build, and so far I’m quite pleased with it. Sure, Intel offers greater performance in general, but truth be told, their processors are above and beyond what I was willing to spend. I built this desktop with a few things in mind: 1) Be reasonably future-proof, 2) have reasonable performance for the few games that I do actually play, 3) support hobbies that I delve into infrequently (I’m looking at you, Blender), and 4) handle the abuse I toss at it, including when I’m working. I really abuse my systems with work and with play, so whatever extra power I can get within a reasonable price range is going to improve my productivity immensely.

Of course, no build is without its teething problems. There’s always an adaptation period where new hardware simply doesn’t “feel right” for whatever reason. Maybe it’s not broken in, maybe there’s a tiny little issue that’s driving you absolutely insane, or maybe you simply haven’t gotten everything configured precisely to your specifications. Whatever the problem, if you’ve ever built your own computer for yourself, it’s to be expected. Sure, it’s one thing building systems for other people–you select components you know work well with each other and are unlikely to cause issues in the future. But that’s because the more problems they have, the more problems they’re going to give you when they ask for support.

But for yourself? Hah. That’s no fun. You’ve got to live sometime, man. Be adventurous. Buy enthusiast hardware. Select something without checking reviews, first. Be reckless.

Actually, I’m kidding. Never do any of these things unless you want to be sorely disappointed. Always, always, always research and review your hardware purchases before making them. But be mindful that no matter how careful you are in selecting your parts, you’re going to run into issues. It’s just the nature of the beast. There will always be some little issue that, once it hits, you’ll be thinking to yourself “Man, I wish I had Googled for X, then I would have known this was going to be a problem.”

Don’t fret. It happens. Just persevere, and you’ll fix it sooner or later. Take my most recent experience to heart, and keep in mind that I’ve built my fair share of systems over the years, although I’ve never made a switch between major component providers (e.g. Intel to AMD) before.

Here are the problems I ran into:

  • My hard disks would click between 5-6 times during shutdown before finally powering off. Furthermore, my hard disks would power down (shut off) every single time I restarted or rebooted the system. Obnoxious.
  • The Windows 7 SP1 installation failed every single attempt with the erro 0x800f0a12. The solution was about as inane as could be expected with a Microsoft product.
  • Google Chrome exhibited some inexplicable weirdness that I’ve never encountered before. Every time I searched something on Google, the links wouldn’t switch to their visited style and were a different shade of blue than normal.
  • Finally, hibernate/sleep/suspend (whichever you prefer) simply wouldn’t work.

TL;DR version of the solutions (spoilers, if you want to read the background stories!):

  • Disable AHCI support in your BIOS to resolve unexpected HDD power downs and clicking during shutdown.
  • When installing Windows 7 SP1, unplug all other hard disks in your system if you have multiple, bootable disks. If you have multiple bootable partitions, set the Windows partition as active using a tool such as fdisk.
  • Weirdness in Google Chrome can often be resolved by deleting cookies.
  • Gigabyte boards have problems with sleep mode. If fiddling with the power management mode of individual devices doesn’t work and you’re at your wit’s end, try changing the setting for hybrid sleep under advanced power management settings from Windows’ power management. It might just fix the problem.

Note: These problems aren’t specific to my board, but it is the first time I’ve encountered anything of the sort.

If you have the attention span of a fly, you’re finished. You won’t find anything else of any use in this post. For the rest of you who enjoy reading and appreciate a good story, you may continue. Hopefully this will be of some entertainment to you.

The System

The source of two of these problems is the motherboard I purchased. Rather, I should say that the source of two of these problems was operator error and how I had configured the motherboard. I purchased a Gigabyte GA-870A-UD3 for my build and promptly discovered that I was not alone–particularly with regards to the sleep problem. There’s an assortment of other hardware in this build, both new and old, that I brought over from my previous desktop–my keyboard, mouse, and a soundcard (I like the HT|Omega’s environments better than those that ship with the Realtek chip). The other items aren’t relevant. I know, because I swapped and removed just about every component I could in pursuit of my solutions.

Let’s start with the hard disks.

Hard Disks: Mysterious Clicking

The mysterious clicking of my hard disks on the Gigabyte board was mostly more of a nuisance than a concern. I’ve had enough drives die from the Click of Death to know from experience that this was different. More importantly, booting to Ubuntu cleared the problem. Whenever I’d shut the system down from Ubuntu, the drives would emit the same single click they normally would when parking and powering off on my old system. Rebooting wouldn’t power the disks down, either, except when I would restart the system from Windows. Clearly, Windows was the problem, but why?

After a few hours of fruitlessly searching for an answer, I finally stumbled upon this post. Someone else with a similar problem was experiencing unusual clicks on shut down with AHCI enabled. Incidentally, I had enabled AHCI support prior to testing this system out. What had I to lose by disabling it other than a few minutes?

Thus, I restarted the system (and cringed when the disks powered down again), entered BIOS, disabled AHCI support by setting everything back to IDE, and then tried it again. I shut the system down. No clicks. After another restart, I applied a few updates, rebooted the system from Windows–the lo and behold! The drives miraculously remained powered up through a restart!

As it turns out, the generic AHCI support in Windows must be somewhat flaky. Gigabyte recommends installing their AHCI drivers during the OS’ install, presumably for some of the features offered by the various SATA chipsets that ship with the GA-870A-UD3, but I can’t help wondering if installing their drivers would resolve the clicking as well. That is a test reserved for another day–and another drive.

Of course, the drives’ behavior was normal under Linux regardless of the state of AHCI in BIOS. But hey, Linux generally Just Works. Windows… well, not so much. Whatever. If there’s one thing Windows excels at, it is its ability to consistently lower my expectations. (Although I absolutely love the Windows 7 taskbar. It’s fantastic.)

As a side note, my last desktop always had AHCI support disabled. It used an Intel reference board (DP965LT) back when they still called them reference boards and not some flashy name to catch enthusiasts’ eyes. Yet that Intel board would do weird things on a reboot. Sometimes it would behave normally and restart the system. Sometimes it would turn itself off for 5 seconds before powering back up and restarting. Sometimes it would power the disks down, reboot, and then power them back up. It’s nice to have a system again where I don’t have to worry about placing additional wear and tear on my drives from something as innocuous as a reboot.

Windows SP1 Installation Failure: 0x800f0a12

I love Microsoft’s cryptic hex error messages. Rather than outright explaining what the problem is, it seems so much easier for companies whose management still lives in the 1980s to barf up numerical responses that require a lookup table. I’d even be willing to bet that same lookup table only exists in a printed copy rotting away in some dusty storage room. If you’ve ever diagnosed problems (quickly, I might add) from /var/log/messages (or kin, though I hate other loggers), you’ll understand the burning disdain I hold for numerical errors. Storage is cheap. Memory is cheap. Processing power is cheap. An extra 16-18 bytes isn’t going to kill anyone.

Then again, I guess 640K is enough for everyone, right? (Misattributed, see link.)

So, to the failure. 0x800f0a12 was beyond me. Worse, it was apparent that the error was also beyond some of the Microsoft MVPs who suggested fixes like this one. I encountered this issue on both my previous desktop and my current one–both clean installs–and couldn’t for the life of me figure out a solution.

That is, until I read another post that gave me an epiphany. Specifically, the pertinent part responsible for my eureka-moment was this snippet written by D. Charles Pyle:

You don’t need to run fixmbr, bootsect, bootfix, run repair from the DVD,etc., in instances like that I mentioned above, for this problem if you have a hybrid, single disk, or a single disk with multiple operating systems.

Just marking the Windows partition as ‘active’ made it work flawlessly because the Service Pack 1 installer looks to the active partition for some of the files that need to be updated. When it does not find them on the expected active partition it throws the exception and generates error 0x800f0a12.

Emphasis mine.

I mentioned before that I use Ubuntu. What I didn’t mention was that I dual boot Ubuntu and Windows 7 on the same system. However, both operating systems reside on separate drives. My Ubuntu disk is set as the first boot device, and because it’s more powerful than the Windows’ boot loader, I use Grub to switch between operating systems.

If Windows 7’s Service Pack 1 requires the Windows partition to be marked active before it’ll install, would it be possible that having BIOS initially boot to a completely separate disk be a problem for SP1? To test it, I powered my system down and unplugged the Ubuntu drive. With some animosity, I restarted the SP1 install.

Presto. It worked.

Two completely different systems, two operating systems, and precisely the same problem. All of it related to SP1’s requirement that it be the only OS in control of the system’s boot order. Very funny, Microsoft.

As an addendum to the words of Mr. Pyle, not only does Windows require its partition to be marked active (bootable), but it may also require being configured as the first (or only) disk from BIOS. In some cases, unplugging any other bootable disk in the system may be the only resort. If your attempts to install SP1 failed and your setup is somewhat analogous to mine, this may be your only choice. If you have multiple partitions on the same disk, you may need to set the Windows partition as bootable from fdisk. Although, I would recommend giving each OS its own separate disk. They’re easier to control and isolate that way.

Google Chrome: Let’s make Google Search Powder Blue

…and also hide what links the user has previously clicked on such that everything looks the same.

I admit. Whenever I reinstall Windows, I always backup my user directory. This way, I never have to reconfigure software. I simply reinstall and copy my user directory back over (typically in parts), thus maintaining most of my previous configurations. Whether it’s Chrome, VirtualBox, GiMP, or any number of other software packages, I would much rather take the time to backup and restore my settings than configure everything from scratch. Plus, I like my browser tabs (see above).

The habit was one that I inherited from Linux. In particular, the home directory on my Ubuntu install has lived through 2 Gentoo 32-bit installs, 1 Gentoo 64-bit install, 1 Gentoo 32-bit revert, and 2 Ubuntu upgrades (x64). In one particular case, I even copied my entire Gentoo install to an external drive on the offhand chance I’d have to revert it (I did), and it worked. Unlike Windows, Linux requires little magic to work, and almost any backup method involving copying files (with permissions!) will invariably work–or work well enough that the system can be restored to a usable state.

Unfortunately, I’m not sure what happens half the time when copying completely unchanged configurations between two Windows installs. Sometimes, it may work without a hitch. Other times, you’re left with inexplicable problems. Like my issue with Chrome displaying all Google search pages with the same powder blue link color, no visited link coloration, and no indication of my history, the problem appeared only after copying my Chrome configurations over from my previous Windows install.

I couldn’t find anyone with a similar problem. Those who had problems with Google search appearing weird were suggested to clear their cache (did that), change their Google history settings (not about to do that), or reinstall Windows (haha, really?). So, I did what any other enterprising individual might do. I moved my Chrome directory to another location and re-ran the browser. Crossing my fingers, I ran another search in the hopes I hadn’t somehow corrupted my Chrome install–or something more sinister.

Google search promptly appeared normal as if nothing happened. Strange.

So, I removed the new Chrome directory, replaced it with the old one, restarted the browser, and bam! Same thing–Google search was totally borked.

I hadn’t any idea where to start, really, so I figured that the next best option was to simply start deleting parts of the Chrome user directory to see what got restored and what was affected. My first step was to obliterate everything but the folders under %APPDATA%/Local/google/Chrome/User Data/Default. It’s just user data, right? The only moderately important things I could see were files that clearly stored my browsing history, cookies, bookmarks, and so forth. I had a backup anyway, so who would care if I deleted any of this? I then pressed delete, restarted the browser, and…

…it worked perfectly fine.

Really? Okay, this isn’t funny anymore. I restored the Chrome user data from backup again, launched the browser, checked search, and noticed it was broken. Again. Yes, Google. Blue is a lovely color, but powder blue was something I wore when I was still in diapers. I want something that’s going to show me where I have been. Colorizing every visited link the same as every unvisited link was driving me nuts.

Then it occurred to me: What if it were a cookie problem? Hah. Right. Sure. May as well give it a try, right? I’ve got all Saturday evening…

I opened up Chrome’s cookie list, searched for Google, deleted everything Google-related I find, and then pulled up Google search. Taking a deep breath, I typed out something clever, and pressed enter.

Sweet, beautiful a:visited tags, how I love thee! My problems had been solved by banishing the demons plaguing some cookie in the deep, dark depths of my user directory.

Really, Chrome, you could’ve just told me. Sheesh.

It’s time to Sleep… or Not

The last problem I had with this Gigabyte GA-870A-UD3 board is that I couldn’t get sleep, hibernate, or suspend working on it no matter what I tried. Various forums I stumbled upon where others were having similar problems with identical (or mostly identical) boards suggested disabling “Allow this device to wake up the computer” and enabling “Allow Windows to power off this device” along with various other things like unplugging every device from the computer, turning your keyboard upside-down over your eyes (don’t do this), and even reinstalling Windows (I’m starting to see a pattern). Not a single one of these suggestions worked.

Let me repeat that just to be on the safe side:

Not a single damn suggestion I ever came across solved the Windows 7 sleep issue with this Gigabyte board. Not even a thread on the Seven Forums, ironically marked SOLVED!, offered any helpful advice.

In fact, it wasn’t until I was browsing Microsoft’s Technet forums when I ran across a poster complaining about his system sleeping–but not coming out of sleep–that it dawned on me that the problem might have multiple facets. I don’t have a link to the article anymore, but the poster resolved his wake-up-and-smell-the-roses resume problems by disabling hybrid sleep from the Windows advanced power options. Hey, it couldn’t hurt, could it?

I dug around for a while and couldn’t find it in my power profile under “sleep.” Then I realized I had changed some of the settings in BIOS related to sleep in a futile attempt to cure my system’s malady. Another reboot later, and I had changed ACPI suspend from S1 (power on sleep) to S3 (suspend to RAM), then checked the Windows advanced power options. There it was–under “Sleep”–“allow hybrid sleep: enabled.”

The original poster had hybrid sleep disabled, and claimed that enabling it had fixed the problems with his system waking up. But what if my problem was just different enough that I hybrid sleep wasn’t working at all? It’s possible.

I disabled hybrid sleep, closed my few remaining applications, and clicked sleep. A few moments later, the LED-lit fans in my case shut off and the disks spun down. It was fast asleep.

There’s no real moral to this story in particular other than the fairly obvious realization that suspend, hibernate, or sleep is something like black magic. It works when it works, and when it doesn’t, there’s no telling why. My previous desktop, an Intel board and CPU, entered sleep mode perfectly fine most times (although it would wake up about 1 out of every 10 times for no real reason), but that was hardware from 2006. This Gigabyte board is fairly new, and judging by the number of similar problems out there, I can only surmise that sleep mode problems are pretty common among Gigabyte boards. Yet the weird thing is that out of the three systems I’ve built using Gigabyte boards, mine was the only one that exhibited this issue.

A Penny Saved…

However you have come across this post doesn’t matter much, but I certainly hope that some of the stories I have shared will help you in your particular adventure. Building your own systems is rewarding, and it can also expose software problems and configuration-related issues you never knew existed. The trick is patience. There is a solution, somewhere, if you know where to look. Sometimes, you may need to spend a few nights searching the Interwebs for similar problems, and reading those links that you do come across no matter how unrelated they seem. In some cases, one man’s solution may not work for you, but his suggestions may offer insight that you wouldn’t have come across any other way. Oddly, there are a lot of answers found by no other method than by accident, often using unrelated suggestions as a guide.

If you have also purchased a Gigabyte GA-870A-UD3 board and are experiencing similar issues with sleep mode and mysterious power-down clicks from your hard disks, I hope that the solutions I found will help you. I wasted many hours before I finally resolved my problems, and I would be delighted if this post helps you find a solution much faster. If it does, then I know that time wasn’t wasted at all.

No comments.
***

jQuery Autosuggest

So a week or two ago, I was looking around for a decent autosuggest plugin that had behavior similar to WordPress’ tag manager. The best one I found required jQuery UI which, for various reasons, I didn’t want to use. Furthermore, I needed a plugin that had some extensibility and could differentiate between delimited items.

Failing in my searches, I decided to write my own. You can download it from here. You’ll also need the supporting CSS, but it should be fairly easy to draft your own once you see mine. Your backend script will need to supply a JSON-encoded response roughly as follows (PHP-based example):

echo json_encode(array(array('text' => 'Match 1', 'id' => '1'), array('text' => 'Match 2', 'id' => 2), array('text' => 'Match 3', 'id' => 3)));

I’ll be posting a more feature complete back-end example shortly.

XSuggest usage is also fairly basic. Simply bind it to a text input field and pass in some useful options. Here’s an example:

HTML:

<style type="text/css">
.search {
    background: #eaeaea;
    border: 1px solid #ddd;
    border-radius: 5px;
    padding: 10px 20px;
}
</style>
<div class="search">
  <input type="text" name="search" />
</div>

JavaScript:

(function($){
    $(document).ready(function(){
 
        $("input[name=search]").suggest({
            searchUrl: "search.php"
        });
 
    });
})(jQuery);

searchUrl is the only required option that you must pass to the back end. There’s quite a few other options that can control the behavior of XSuggest, although it isn’t complete, and I expect to add a few more–particularly event handlers. The options you can currently set are:

  • searchUrl – URL of the back end script that supplies a JSON-encoded response listing matching data for XSuggest.
  • searchVariable – Search variable to attach the user’s input to. This is sent via GET (query string) normally, unless you override it; the default is s
  • searchData – Optional data to send along with the search. You may use this to tweak the back end’s response.
  • searchMethod – Request method. Default: GET.
  • cssClass – CSS class of the dropdown field. Default: xsuggest-dropdown. You may change this to anything you want, but be sure to update the CSS you’re using. You have to use this class–that’s not negotiable. It’s used for selectors as well as styling.
  • activate – Function called whenever the user activates the control by pressing enter. This is useful for overriding the form’s default behavior and adding the matched text to the page, similar to what WordPress does with tags. The function can optionally accept one argument containing the jQuery object representing the source control (i.e. your input field). This is useful for reading the field’s contents. One example might be: activate: function(element){$(".search").append("
    "+element.val()+"

    ");.

  • append – Allow the control to append data from the user’s input. Mostly useful for tags.
  • appendChar – Character to use for appending user input to the control. Default: “,”.
  • I’ll have more complete documentation and a better tutorial posted later. This plugin does have some potential performance issues (see source) and a few other bugs. For now, it’s pretty good for basic usage, but it might do weird things on high latency connections.

    Enjoy.

    No comments.
***

Detecting IE6 with jQuery (sort of)

…and not using $.browser.

Or how to do a dirty deed with IE’s own quirks

Okay, so I admit two things. First, I hate MSIE6 with a passion; IE7 isn’t much better; IE8 is an improvement (unless it’s in quirks mode, but let’s not talk about that). Second, I came upon this after my initial searching turned up nothing. Once I got this trick to work, I was convinced this shouldn’t work and that there had to be a better way of doing it. So, I did a little more digging and then stumbled upon the very last response to a similar predicament on Stack Overflow. The poster obviously didn’t check their reply, because two fragments that look like they should have had example code are blank. It’s worth reading, though, and it gave me comfort in knowing that someone else was doing the same naughty things I was!

Either way, it didn’t matter–I figured out a separate way to trick MSIE without having to litter the page with new CSS classes or make any unusual modifications to the DOM. Better yet, my solution gives you some programmatic control. It does rely on a similar trick, however, and should probably be taken with a grain of salt. Of course, there’s about a dozen different ways you could do this, including many more that others have undoubtedly pointed out over the years (the earliest reference I’ve found in my searches goes back to 2008, but good luck finding them through Google).

Here it is:

<script type="text/javascript">
var ie6 = false;
$(document).ready(function(){
    // Do your stuff here.
 
    if (ie6) {
        // Do IE6-specific stuff here.
    }
});
</script>
<!--[if IE 6]>
<script type="text/javascript">
ie6 = true;
</script>
<![endif-->

Obligatory Disclaimer

Obviously, this isn’t the best solution. If you’re having to do weird things specifically to support a browser that is well on its way out of this world, you’re probably doing it wrong. There probably is a better solution (really!), but I can think of a handful of legitimate use cases where some trick like this is a necessity. For instance: Displaying some fancy code for people still running MSIE6 telling them to upgrade. Maybe even displaying a virtual sympathy card for being a corporate user chained to the dark past… :)

This has nothing to do with…

…jQuery? Nope, it doesn’t. I’m aware of that. However, because there are so many similar questions (“how do I detect browser X…”) related to jQuery and very few answers that actually provide a working solution that doesn’t include the deprecated $.browser methods, I figured that it couldn’t hurt to write something that has the words “detect,” “ie6,” and “jQuery” all in the same post title.

No comments.
***