Thursday, February 24, 2011

Windows 7 Service Pack 1 Boot Failure

Windows 7 SP1 has been released, but upon installing it, I found my system no longer boots into Windows. I get the BLACK screen of death, with the cursor flashing helplessly in the upper-left corner and no hard drive activity.

The dreaded BLACK screen of death, complete with animated cursor!


There were no obvious issues during the installation of the service pack, so I'm going to try using the BOOTREC utility in the Windows Recovery Environment in case some aspect of the service pack install, or some weird twist of fate, decided to damage the master boot record rendering my system unusable, for now.

Please feel free to share your own Windows 7 SP1 experience, whether good, bad, or ugly!


-= UPDATE =-

As I inserted my Windows 7 disc and rebooted, ready to attempt a repair through the recovery environment, I remembered something.


Before updating to Windows 7 SP1, I made a change on my system to enable AHCI (Advanced Host Controller Interface), which enables two of the best features of SATA, hot swapping and native command queueing. I'd just recently replaced the last of my old IDE hard drives and went full SATA.

To see whether this made a difference, I entered my system BIOS and changed the setting for "Configure SATA as" from IDE to AHCI, and then rebooted.




No more black screen
, my system successfully booted into Windows! 


Here are the steps I'd used originally to enable AHCI:
  1. Exit all Windows-based programs.
  2. Click Start, type regedit in the Start Search box, and then press ENTER.
  3. If you receive the User Account Control dialog box, click Continue.
  4. Locate and then click the following registry subkey:

        HKEY_LOCAL_MACHINE\System\CurrentControlSet\Services\Msahci

  5. In the right pane, right-click Start in the Name column, and then click Modify.
  6. In the Value data box, type 0, and then click OK.
  7. On the File menu, click Exit to close Registry Editor.

However
I stumbled upon a Microsoft support article (922976) which is slightly different in that it specifies an additional registry key that may be modified in order to enable AHCI.

    HKEY_LOCAL_MACHINE\System\CurrentControlSet\Services\IastorV


In my system's registry, the subkey value for Msahci I had changed to 0, but IastorV was still set to its default value, 3. I changed the latter so that both subkey values are set to 0, then rebooted, entered the BIOS, and this time changed the SATA setting from IDE back to the desired AHCI, saved changes, and rebooted once more.

Now, my system appears to be back to normal.
From this troubleshooting misadventure, it seems like the question of whether Windows 7 service pack 1 may want just ONE of those two registry subkey values set to 0 is no longer a question but a fact as far as AHCI goes.

 






Tuesday, February 22, 2011

ASCII Art

Here's a quick guide on how to create ASCII art in posts on sites like Reddit, forums, email and elsewhere.

ASCII art has been around for decades now. This site provides a very nice summation of the history of ASCII art, including its beginnings in hieroglyphics, monasteries, and finally on computer screens. You can find ASCII art online today in the form of emoticons, and also at various sites (like this one) that have compiled all kinds of ASCII art creations for your enjoyment.

Creating most ASCII art relies mainly on using a fixed-width font, such as Courier New. Doing so ensures that your work will look the same when rendered by the browser or email client or whatever medium as it does in whatever tool you're using to create it, because each character has a set width, a set number of pixels that it occupies.

Many text editing widgets on websites and email clients give you the option of picking what font to use. For purposes of ASCII art, pick a fixed-width font. Then, begin crafting your design. You can also simply copy-and-paste someone else's ASCII art, like this cupcake, for example, but if you do so, it's best to keep any attribution the artist might've tagged their creation with (thanks Krogg, whoever you are):

          )
         (.)

         .|.
         l7J
         | |
     _.--| |--._
  .-';  ;`-'& ; `&.
 & &  ;  &   ; ;   \
 \      ;    &   &_/
  F"""---...---"""J
  | | | | | | | | |
  J | | | | | | | F
   `---.|.|.|.---'
               Krogg



Many forums have a WYSIWYG text-editor that lets you pick from a variety of fonts. In those cases, you can typically create your art in any text editor (I use Notepad++) then copy-and-paste it into the forum's editor, and then highlight the text and then change the font to apply fixed-width formatting.

Email clients, too, usually have WYSIWYG editors. Microsoft Outlook, for example, can be configured to use Word to create emails, allowing for great flexibility in formatting. For email messages, you can simply configure your email client to use a fixed-width font like Courier New, or alternatively change the email format it uses to plain text, rather than HTML or Rich Text; by default many email clients will render incoming such email messages in a fixed-width font, saving you some guesswork about whether the ASCII art will appear as intended.

Specific to Reddit, their text editor doesn't let you choose what font to use, beyond the font selections you choose for your web browser, but they do enable you to use a fixed width font by preceding each line of text with four blank spaces. Users in the programming field will sometimes post programming code, and while this feature is particularly suited to that purpose, it can also help you break up an otherwise serious discussion with some frivolous ASCII art creation.

To reproduce the above cupcake ASCII art on Reddit, then, you'd simply copy-and-paste the above into a new post or comment on Reddit, then copy a set of four blank spaces and paste them in front of each line of the cupcake. Then when Reddit displays the text, it will apply formatting rules and display the cupcake in fixed width font for everyone's enjoyment. Here's an example.

Unfortunately, some sites like Facebook won't allow you to choose your own font, their text formatting is very limited. However, you could simply host either a plain ASCII text file or an HTML document on a free web host like Awardspace. Then, simply refer your friends to the URL for that page to show them your creation.


Wednesday, February 16, 2011

ImageShack, I Am Disappoint

ImageShack is one of many free online image hosting services.

Up until recently it's been one of my favorites because it allows you to easily copy a simple direct link to an image you've hosted. This allows you to link someone directly to a given image without any clutter, just the image by itself.

As of a week or two ago, however, they've disabled their Direct Link textbox and insist that you register with their site for this privilege. Sure, you can still freely obtain the Link code, which will show the image plus some minimal markup of ImageShack itself, and you can still copy various forum, thumbnail, widget and other markup for the image you wish to host, but really, most often I just want the image alone, that's all, nothing else. 

I freely admit it, I am a cheapskate.



There are several workarounds for this annoyance. 

First of all, you could simply visit another image hosting provider like imgur and use their service instead. Of course, you could sign up and create a user account with ImageShack; obviously ImageShack is in favor of this option. Another option is to visit BugMeNot and borrow somebody else's credentials. If, however, you yearn for ImageShack prior to their shenanigans, you can still obtain the Direct Link through this relatively convoluted series of steps:
1. Upload an image to ImageShack as usual.

2. Right-click on the Upload Successful page and view source.

3. Copy the direct URL to your image, and paste it wherever you like.

Why ImageShack chose to do this, I don't know. I've used their Direct Link for years, why they would choose to implement this, particularly when so many other image hosting sites like imgur continue to offer a plain URL to your hosted image, is a mystery to me. 

I'm certainly not enough of a die-hard fan of ImageShack that I would go to the trouble of digging into the HTML to grab that direct link each time, so I guess the easiest option is to just use another provider from here on out. Perhaps this will lead to a similar backlash to the infamous Gizmodo design change, which caused a significant reduction in visits to their site?

Yet another example of how a seemingly small change to the user experience can prompt users to seek an alternative.






LogMeIn Laptop Screen Stays Blank After Remote Session

LogMeIn is an excellent online service which offers a free method of remotely controlling a PC via web browser. 

Recently I encountered a minor glitch, however, and whether LogMeIn or Windows 7 or nVidia are the culprit, I'm not sure.

I had remoted in to my Dell Latitude E6410 laptop using the latest free version of LogMeIn. It is equipped with Windows 7 64-bit and NVIDIA NVS 3100M display adapter, each with the latest updates and drivers available. 

All seemed fine via remote, but when I returned to the office I found that although my secondary monitor activated normally, my laptop display remained seemingly asleep and unresponsive. I tried using the key combination of the Windows key and P then clicked Extend to try to have Windows reinitialize the displays and wake everything up, but no joy.



I then tried just changing one of my Display settings, the Resolution, to a different value in order to have Windows enable the Apply button, and then clicked it. 



After doing this, my laptop screen was no longer blank.

Monday, February 14, 2011

Blogger Blog Post Title Optimization

I've blogged with Blogger for a few years now, and overall it's worked pretty smoothly, but the blog post title can be a bit awkward to work with.

You'll notice that if your post title is particularly long, the resulting URL will get truncated once the post is published to a maximum length of roughly 39 characters. Spaces will be replaced with dashes, stop words like "to", "and", "of" will be filtered, and punctuation will be omitted.

Principles of SEO demand that blog posts are crafted such that search engines will return links to them as relevant hits for a given search. In addition, it is helpful to make it so that the blog post title is similar to the actual URL of the post.

In a Blogger blog, you can optimize your blog post titles by first deciding on a title which is both meaningful and concise. The title should reflect the content of the post, to make it easier for search engines (particularly Google) to categorize what you're blogging about, and decide how high up in the search results to place it. 

For example, if the title of your post is "How To Make Lots Of Money By Blogging On Random Topics" (which is 54 characters without quotes), try to distill the essence of your post into a title which meets or is under the 39 character limit, perhaps "Make Money Blogging Random Topics" (33 characters) or "HowTo Make Money Blogging Randomly" (34 characters). 

Ideally, you want the post title to meet that character limit for Blogger post titles, but sometimes it's difficult, particularly with stop words and spaces eating of valuable post title real estate. 

To mitigate this, you can try the following steps:
  1. Create a blog post with as brief a title as possible.
  2. Publish the post with the brief title.
  3. Immediately after publishing, Edit your post and modify the title to your original, more verbose version.

After doing this, you'll discover that Blogger keeps the concise title's wording in the URL, but in the post itself it will have your verbose title. 

Again, it's probably best that the title be the same in both the URL and the actual post title, but if you just can't do your post justice by pruning it below 39 characters, you can at least ensure that the post URL meets that requirement and yet retains value from an SEO standpoint.





Wednesday, February 9, 2011

Blogger Template Change Kills Google Analytics Script


For some reason, several categories of Google Analytics tracking my Blogger blog stats have flatlined within the last month or so.

I just realized why, I'd made some template changes, including choosing a different template from among Blogger's selections, and this clobbered the analytics script! 

Strangely, even though the tracking code was nonexistent, the Tracking Status indicator in Analytics still says that it's "Receiving Data" even though statistics like New Visits, Avg. Time on Site, and Bounce Rate have been flat.

Anyway, you can visit this Google Analytics help page to find out how to enter the necessary tracking code (the preferred one to use is asynchronous).


Friday, February 4, 2011

Block Reddit Gold on User Pages

Recently, Reddit added a new link beneath users' overview section of their page:
treat yourself to reddit gold

Also if you happen to be checking out another user's profile, you'll see:
buy (another user) a month of reddit gold

I enjoy Reddit a great deal, and I don't block their sponsored ad banners even though I otherwise have AdBlock Plus enabled, but I found this linkage a bit annoying.
ಠ_ಠ

To remove it from your own Reddit user page, you can copy and paste the following Element rule to your AdBlock Plus filter list:
reddit.com##A[href="/gold"]

To prevent the link from appearing on other users' pages, add another rule with the following slightly different syntax:

reddit.com##A[href*="/gold?goldtype=gift"]


Here's a screenshot showing how the rules appear:





Thursday, February 3, 2011

Random Numbers in SQL

I needed a SQL query to insert a range of values randomly into each record of a table variable.

The SELECT statement would use the random number in conjunction with a CASE statement to pick from two different values to insert into a field, in effect tagging records randomly with one value or the other. 

My first attempt involved trying to grab the one's digit of the second of today's date via the getdate() function, and based on whether this value is even or odd, pick one or another of the values to assign to a field for the record I insert.
INSERT INTO @MyTableVariable (MyField)
SELECT

    CASE
        WHEN RIGHT(DATEPART(s, getdate()), 1) IN (0, 2, 4, 6, 8) THEN 32
        WHEN RIGHT(DATEPART(s, getdate()), 1) IN (1, 3, 5, 7, 9) THEN 39
    END AS MyField

FROM dbo.MyTable t

The result wasn't quite what I expected. Instead of one of each inserted value appearing randomly in the resulting table variable for MyField, the same value appeared each and every time.

As it turns out, I didn't realize that in the CASE statement, the seconds portion of the current time, the "seed" if you will, only got set once at the beginning of the SELECT. There is nothing in the statement to prompt the function to update the current time with every iteration, every record examined from MyTable, it only performs a one-off examination of the seconds and goes with that for the rest of the operation.


My solution involved using instead the one's digit of the integer primary key of the source table, like so.
INSERT INTO @MyTableVariable (MyField)
SELECT

    CASE                  
        WHEN RIGHT(t.ID, 1) IN (0, 2, 4, 6, 8) THEN 32        -- Even
        WHEN RIGHT(t.ID, 1) IN (1, 3, 5, 7, 9) THEN 39        -- Odd            
    END AS MyField

FROM dbo.MyTable t

In this case, the subset of data that I'm querying from MyTable is just that, a subset, which means that the primary key (ID) won't be in any particular order; there are plenty of opportunities for the one's digit to be odd or even. This provides a reasonably random sampling of records in the resulting table variable.