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.





Thursday, January 27, 2011

Improve Firefox Performance with Processor Affinity

Firefox seems to frequently stutter or lag while doing seemingly trivial tasks like scrolling or even typing following the most recent Firefox 3 update.
 
Enter the concept of processor affinity, which enables you to direct applications to utilize one or more specific CPU cores in your multicore system. I discovered a blog post where the author describes creating a shortcut in Windows Vista or Windows 7 which will execute a given application with a specific processor affinity configuration.


PROCEDURE

  1. Copy and paste to create a copy of your current shortcut to Firefox on the Desktop.
  1. Pick a single CPU core, in decimal, to dedicate to Firefox, according to the chart below. I chose CPU 3 on my quad-core system.
0001 = 1 (CPU 0)
0010 = 2 (CPU 1)
0100 = 4 (CPU 2)
1000 = 8 (CPU 3)

  1. In the Target box, copy and paste one of the following lines (the first for 32-bit Windows, the second for 64-bit), and change x to match the value you chose in the above step (change the paths as necessary if your Firefox lives in a different location).
C:\Windows\System32\cmd.exe /c start "C:\Program Files\Mozilla Firefox\" /affinity x firefox.exe

C:\Windows\System32\cmd.exe /c start "C:\Program Files (x86)\Mozilla Firefox\" /affinity x firefox.exe


  1. Click OK to accept the changes, then close and reopen Firefox using the modified shortcut.

Windows XP also allows for changing the processor affinity setting for a given process via the Processes tab in Task Manager, but this setting is applied only for that instance of the application, so you can't use the above method to have a shortcut which automatically sets the affinity every time. If you try it, you'll get this error message:

Invalid switch - "/affinity"

Fortunately, a freeware utility called RunFirst exists which will perform in a similar manner, except it will by default assign only the first CPU core in the system to have affinity with the application you're running it with. To use it, create a batch file to execute firefox.exe like this:
      RunFirst.EXE "C:\Program Files\Mozilla Firefox\firefox.exe"


Now, Firefox has its very own CPU core to use on my Windows 7 system, which is advantageous in that the other applications running on my system need only contend with one core being potentially monopolized by some CPU-expensive operations which Firefox initiates.

I tend to browse with many (read: dozens) of tabs open simultaneously, as well as a plethora of add-ons installed such as AdBlock Plus, DownThemAll, FireBug, GreaseMonkey, FoxyTunes, Stylish, FiddlerSwitch, and more. Mine is hardly a “vanilla” setup, and given that these various add-ons let alone Firefox itself are developed by a variety of developers with a variety of coding styles, even bugs, it’s entirely likely that I’m a victim of chaos, that an unfortunate confluence of events are conspiring to kick my browsing experience in the teeth. 

At least this way, I'm letting Firefox do it's thing on just a single core, rather than having it bleed over onto the others and potentially making my other running processes unhappy.

So far, Firefox seems to be significantly more responsive than before!



Tuesday, January 11, 2011

Just Another Day...

This is January 11, 2011, or 1/11/2011 in middle endian format.

Some in numerological circles claim that this day is one of opportunity, but not without hardship. Others interested in conspiracy theories feel intuitively that something "big" will happen this day.

Really, though, isn't it just another day??

The Gregorian calendar is today used by much of the civilized world to track and organize days. Remarkable as it is that the international community could agree upon using this convention to track the passage of time, it's nevertheless a tool, like the clock, even the chip in computers used to store the date and time.

That's not to say this day is meaningless. People will be born, die, get married, have a birthday, have sex for the first time, celebrate an anniversary, enjoy their first day of vacation, and countless other activities which will etch this date as meaningful to them or their loved ones for the rest of their lives. 

In the meantime, though, the world keeps turning, and we're just along for the ride. The earth continues to journey as part of the Milky Way galaxy from its point of origin in the distant past to wherever it's destined to go at a speed of around several hundred kilometers per second.

The day surely is meaningful, as we are living it here and now, experiencing it. It has value if for no other reason than that we're here to participate in and enjoy it. Nevertheless, it's just a convention. I seriously doubt the universe cares how we keep track of the time we occupy in life, since it's been here and will likely still be here far longer than we ever will.



Saturday, January 8, 2011

Windows 7 to XP FIle Sharing Problems

Recently, I had serious issues with trying to enable file sharing between my newly-installed Windows 7 laptop and my Windows XP SP3 desktop.

Windows 7's Network and Sharing Center

I have a home wireless network, where my Windows 7 laptop, on wireless, normally shares files perfectly well with my Windows XP desktop. Inexplicably, one day the capability to share files via wireless ended; I couldn't even ping my XP desktop from my 7 laptop let alone browse its file shares, whether by computer name or IP address. And yet, over a wired connection, file sharing performed flawlessly!


Here's a list of what I tried:
  • Updated drivers for network hardware.
  • Disabled Windows Firewall on both machines.
  • Verified internet connectivity from the laptop.
  • Ensured both PCs share the same workgroup name.
  • Verified connectivity over wireless, from the laptop to the router.
  • Completely reinstalled the TCP/IP stack on the Windows XP computer.
  • Deleted and recreated routes using the ROUTE command on both computers.
  • Reinstalled the Link Layer Topology Discovery (LLTD) responder on the XP box. 
  • Followed Microsoft's docs on enabling File and Printer Sharing under Windows 7.
  • Verified that shared folders on both PCs had proper permissions.
  • Removed remnants of Norton Internet Security with the Norton Removal Tool from the XP box, which I'd long since uninstalled but remnants of which still remained.
  • Followed Microsoft's steps for sharing files among different Windows versions, including rerunning the network setup wizards for each respective operating system.

In spite of all these steps, I still couldn't even ping the XP box from the 7 laptop, and I couldn't see the XP box from the 7 laptop in the network, although I could see, but not access, the 7 laptop from the XP box.

The solution turned out to be unexpected.

A few years ago, I replaced the factory firmware of my venerable Buffalo WHR-HP-G54 wireless router with DD-WRT, a free, open-source, Linux-based firmware which can be applied as a drop-in replacement for the manufacturer firmware, and can expand the features of your router to boot.

The firmware, as with most anything in IT, is evolving, and it'd been some months since I'd last updated the version of DD-WRT; it was v24 SP1 from around August, 2010, whereas the newest version is v24 pre-SP2. Some other DD-WRT users had reported issues sharing files on their own networks. DD-WRT itself has an option under Wireless => Advanced Settings called AP Isolation, which allows you to prevent wirelessly networked devices from interacting with one another, and presumably with wired clients, via the router (in my case, this option has always been disabled).

At this point, my options were exhausted, so I took the plunge and updated the DD-WRT firmware. Even though the latest version is technically still in beta, it seemed worth a shot; I've never had trouble since first installing DD-WRT, and the fact that it allows you to preserve your existing settings without wiping the router's NVRAM made it even more appealing.

The result? It worked! Suddenly, rather than being met with the dreaded System Error 53 when attempting to map a network drive letter from the laptop to the desktop or trying to browse to a shared folder via Windows Explorer, I got a prompt asking me to authenticate to the XP box using my credentials, and finally regained access!

If you haven't updated your router's firmware in a while, it might be worth a shot, particularly if you use DD-WRT as I do and have perhaps encountered what might be a bug in your current version of the firmware. 

If you still have the factory firmware, I'd strongly suggest you consider replacing it with DD-WRT or another like Tomato, which can not only offer your router and network more stability and performance, but also unlock features that the manufacturer might not even offer in their own relatively anemic firmware. 





Monday, January 3, 2011

IE8 Process Priority in Windows 7

I wanted to bump up the process priority of Internet Explorer 8 under Windows 7.

There are at least a couple of ways to do this. If the app is already running, you can open Task Manager, right-click the app on the Applications tab and click Go To Process, then right-click the process name on the Processes tab and Set Priority to one of the levels above the default, Normal.


I chose a relatively quick-and-dirty method to create a batch file to boost the process priority of IE8, in conjunction with the START command, which can be tested via the Command Prompt.

Generally, the syntax is as follows:

     START /Priority ProgramName

Where /Priority is one of several values (Low, BelowNormal, Normal, AboveNormal, High, RealTime), and ProgramName is the name of a particular executable (EXE) whose priority you wish to boost.

I began with a simple batch file as a proof-of-concept to instantiate a High-priority instance of Notepad.

CLS

start /HIGH notepad



 



Success! Now I wanted to do something similar with Internet Explorer 8, and have it run with High process priority. The result wasn't quite what I wanted.


CLS

start /HIGH iexplore.exe





I'm running the 64-bit version of Windows 7, and have both the 32- and 64-bit versions of Internet Explorer 8 installed. Ideally I would've liked the 64-bit version to run, but it looks like by default the 32-bit one comes up via a command prompt if I omit the path (as I have lazily done here). That's no big deal, nor is the fact that there are two processes named iexplore.exe (see this article on Loosely-Coupled IE [LCIE] by Microsoft's Andy Zeigler regarding why IE8 creates two processes for itself instead of one). The problem is that neither iexplore.exe process has the desired High priority. I got around this by saving the batch file in the 64-bit version of IE's program directory, which by default lives here: 

     C:\Program Files\Internet Explorer

Now when I execute the batch file, START properly starts up one of the iexplore.exe processes at High priority.





But wait, why did it start only one process at High, and the other at Normal?? I'm not sure. I do notice, though, that unfortunately the process which appears to represent the default tab of IE8 that opens is the one set to Normal priority, which isn't exactly what I wanted. I can tell that this seems to be the case when I keep an eye on that process' CPU usage as I try browsing, as shown below.





Furthermore, as I opened additional tabs, which in turned spawned additional iexplore.exe processes in Task Manager, each of these too had only Normal process priority. Only the first process (note that the process with PID 87996 is High, while the second with PID 89476 is Normal).

The end result of this is that despite having set the priority of iexplore.exe to High via the START command in a shortcut, it seems to set this priority only for the "base" instance of iexplore.exe, not the instance which actually seems to be dedicated to browsing; not much help if your goal is to have browsing take precedence among the other activities of your applications. 

It looks like I may need to find some Windows settings specific to Internet Explorer or process priority elsewhere, whether by hacking the registry or some other means.


UPDATE 
1/4/2011

I stumbled upon a post on AskVG which links to a utility, Prio, which extends Task Manager to include among other things a Save Priority option, as shown below:




However, according to some of the comments in the article, some users of Windows 7 64-bit have reported problems getting their changes to process priorites to "stick" between reboots. 

I've installed the utility in a manner suggested by one of the commenters, woodburyadpost, who suggested the following installation steps:
  1. Install. DO NOT REBOOT. 
  2. Uninstall. DO NOT REBOOT. 
  3. Reinstall (and, presumably, reboot).

Curiously, the very first time I installed the utility, I received no prompt asking me to reboot, whereas after following the above steps, the installer did suggest a reboot. Perhaps this indicates the installer is missing something the first time through whereby a component isn't getting copied or installed on the system properly?

At any rate, we'll see if this works, and if so, it'll be a handy utility to have!


Friday, December 3, 2010

Roamatherapy!

Ahh, Christmas, the time for presents, tasty food, and ruminating on the memories of days when Santa Claus really existed outside mere childhood imagination.

For the cheapskate who's always wanted to dabble in aromatherapy, and because "road aromatherapy" or "road rage smells like Christmas" didn't seem catchy enough, I present ROAMATHERAPY


TRY THIS

  1. Go to your local live Christmas Tree seller. This might be your local supermarket with trees and wreaths out front, or some guy selling these out of a tent along the roadside.

  2. Grab a discarded sprig of Douglas Fir. You also could ask nicely, but I doubt the seller would mind if it's already fallen away from the tree.

  3. Using Duck™ tape, a chip clip, or a convenient crevice between the vent and the dash, secure the sprig so that hot air from the vents wafts across it.

  4. Turn on your car's heater. Akin to the principles used by various aromatherapy diffusers, the pleasant aroma of the Douglas Fir is expressed from the plant material into your car's interior.

 

If your memories of Christmas are gloomy or nonexistent, hopefully this will bring you some of the Christmas cheer I associate with the holiday that is far more enjoyable than its rampant consumerism.


 

Thursday, December 2, 2010

String Concatenation and Implicit Conversions

I needed to modify a SQL function to strip some leading zeros in order to concatenate a string. Part of this process involved dealing with pluralization of the number of cents (I'm picky that way).


SELECT
 CASE
  WHEN CAST(CAST(CONVERT(decimal(18,6), 0.30) * 100 AS float) AS varchar(10)) = 1 THEN ''
  WHEN CAST(CAST(CONVERT(decimal(18,6), 0.30) * 100 AS float) AS varchar(10)) > 1 THEN 's' 
  ELSE ''
 END
 

The idea is that if the value (0.30 representing cents) translates into a number greater than 1, the resulting concatenated sentence will read something like "The discount is 30 cents." If the value equals 1, however, it would read "The discount is 1 cent."

When the above is executed, I get an error:

 Msg 245, Level 16, State 1, Line 1
 Conversion failed when converting the varchar value '0.03' to data type int.



At first this baffled me. Data type int?? I wasn't trying to obtain an integer value, I was ultimately trying to obtain a varchar for this string I'm building.

Then it hit me, SQL is performing an implicit conversion when it is comparing the value resulting from the conversion first to decimal, then float, and finally to varchar, with 1.

Lesson learned, when attempting to compare two varchar with numeric values, make sure that if the value being tested is decimal, that the static value being used to compare it against is also decimal.

I made the following changes and now it works flawlessly.


SELECT
 CASE
  WHEN CAST(CAST(CONVERT(decimal(18,6), 0.30) * 100 AS float) AS varchar(10)) = 1.0 THEN ''
  WHEN CAST(CAST(CONVERT(decimal(18,6), 0.30) * 100 AS float) AS varchar(10)) > 1.0 THEN 's' 
  ELSE ''
 END
 





Saturday, November 27, 2010

Pretty Formatting for XML or HTML

Sometimes it's helpful to pretty up XML or HTML in order to more easily analyze it. Many tools create machine-readable XML or HTML, which is well-suited to being parsed by computers, but whose formatting can be painful for a human to wade through. 

You might think, why do humans need to be able to work with machine-readable text, anyway? Well, if you happen to be the new guy on the job and get stuck with having to debug some code that spits out some XML or HTML you've never dealt with before for some complex data transformation processing, you can see why it might be necessary, particularly if something changes between the sender and receiver and the XML, as produced, no longer does the job.

In Notepad++, one of my favorite text editors, I can utilize the TextFX plugin to take a given chunk of XML or HTML and clean it up, neatly indenting the nodes and attributes for easier examination. I paste the text into the editor and select TextFX => TextFX HTML Tidy => TiDy clean document - wrap. Finally I select Language => XML or HTML to enable syntax highlighting.

Prior to discovering Notepad++, I had discovered the freeware MoreMotion XML Editor a few years ago when I was having to dissect some XML being output by a tool whose XML output I needed to clean up. Provided the XML was well-formed, I could very quickly pretty it up by clicking XML => Pretty Format, or even more easily with a quick key combo, Shift-Ctrl-P.

BEFORE: Messy, messy XML!


AFTER: Ahhh, clean, legible, structured XML.

Unfortunately, the original download URL for MoreMotion XML Editor appears to be defunct, leading to a parked page rather than the actual file. You can download MoreMotion's more comprehensive XML application suite here, but if you just need relatively simple XML editing provided by the older (and much smaller, around 1.3 MB) freeware tool, this working download link fits the bill. The ZIP file contains the EXE, which can be copied to a convenient folder and run.

A few caveats, however. MoreMotion seems to have a few editing issues with extremely long lines of text; you may notice keypresses on such lines may take a long time to register. Also, whereas Notepad++ will do its best to deal with poorly-formed XML or HTML and log any errors it encounters, MoreMotion will not allow you to proceed until the errors are resolved, and in my experience some of these errors can be difficult to pin down.

Nevertheless, for relatively small chunks of well-formed XML or HTML, MoreMotion XML Editor makes cleaning up XML or HTML just a few steps quicker than Notepad++.


Friday, November 26, 2010

Dell Latitude E6410 Sound Problems

The time came a few months back at my workplace to replace my venerable Dell Latitude D800 with something newer, better, faster. That replacement arrived in the form of the Dell Latitude E6410.


Dell Latitude E6410


Featuring an Intel Core i5 64-bit CPU, 8 GB of RAM, and Windows 7 Pro, I expected great things, and in many respects, I got them. Performance was leaps and bounds ahead of my old D800; tasks that my D800 plodded through like building and debugging an ASP.NET / C# website or searching through thousands of files in my local source repository proceeded many times more quickly. 


Unfortunately, I was dismayed to discover that the sound provided by the onboard IDT HD92xxx device, utilized by the NVIDIA NVS3100M video hardware, stuttered frequently. Whereas my old D800 never missed a beat, literally, even through the most challenging tasks, this brand-new, supposedly state-of-the-art machine couldn't play MP3 audio without hiccuping many times throughout any given track!

Apparently this is not an isolated issue. One thread on Dell's support forums described many users' similar issues with erratic sound. Various other posts online that I found blamed the IDT hardware, such as the first review listed for this related IDT product, followed by a couple of other reviews for same which immediately reminded me of good old Baghdad Bob...

"good, and very nice"

I decided to take a reverse shotgun approach, meaning rather than pump a few satisfying rounds of buckshot into my employer's laptop out of sheer aggravation, I'd run through a short list of steps based on research I'd done into the problem so far.

To visualize the problem, I downloaded and ran the DPC Latency Checker, which represented the stuttering issue in the form of the big, ugly red lines representing relatively huge latency leading to stuttering audio.


If I were typing the way the audio stutters, it miiiight look liiiike ttttthhhis.

Dell Latitude E6410 driver download page
on Dell's support site was my first stop. I downloaded the latest available drivers and installed them, including those for audio, video, chipset, and even the touchpad. Following the experiences related by others in the Dell support forum, I also updated to the latest BIOS.


Updating the BIOS, as described in the Dell support forum thread, helped things somewhat, but the stutter was still recurring intermittently. I also completely uninstalled Dell ControlPoint System Manager, which I noticed made the stutter markedly worse when active.

I also tried using PowerMizer Manager, a free utility which lets you control and, if desired, prevent your video adapter from downshifting performance based on demand, which can cause undesired latency.

Most recently, though, after installing the latest drivers supporting the NVS 3100M from NVidia's driver download site, I've found that the stutter has improved significantly. Now, the DPC utility shows that latency is overall much improved, but still the stutter occasionally rears its ugly head.


Definitely better than before.




In summary, here are some suggestions if audio stutters on your Dell Latitude E6410:




Thursday, November 4, 2010

A Thousand Words Isn't Enough

They say that "a picture is worth a thousand words". Personally, I think the value of photos is overrated.

No photo, digital or otherwise, carries the essence of the memories in real life that photo captures. As we travel down the river of time, our motion through it is like watching a film with the afterimages remaining in our trail behind us, kind of like light painting.

These "pictures" are one with the space-time continuum, and only someone with the ability to encapsulate this and peer inside could see the entire span of all these images across all time, somewhat like looking into a peephole from outside our realm of existence.

It is truly mind-boggling to think of the data storage requirements for that kind of recording, for every moment of motion of every iota of matter all across the universe for all time. If I were some Q-like being that could freely travel across time and make such observations and manipulations as an outsider, I'd probably go back to my physical life like a universe-scale photo album or video and play it back, in all aspects.

Alas, I don't have that power, but it's not like snapping a photo will do any better than my brain's comparatively feeble but nevertheless serviceable chronicle of my life. Whether a photo, a video, or the final, frantic firings of the synapses of my brain at death, "All those moments will be lost in time... like tears in rain."







Friday, October 22, 2010

Windows 7 Haunted Command Prompt??

I encountered a weird situation on my Windows 7 x64 machine where the command prompt window couldn't be closed.

I'd logged on to my domain account, and out of (admittedly bad) habit, I tried to right-click on the command prompt in the taskbar and close it. Usually, it goes away in moments, but this time it decided to hang around, and it was impossible to remove. 

I looked in Task Manager, and although I could see the instance of the command prompt in the Applications tab, and even right-click on it and choose Go To Process, when it shifted me to the Processes tab, it selected nothing, or if I'd clicked on any other process in the list, it prompted me to end that process rather than whatever process remained which maintained this errant command prompt.

I would've liked to use a utility like PSKill to terminate the process (as described here), but if I can't find the process ID, that isn't an option.

I did notice one thing unusual in the list of processes, there were three separate instances of an executable named conhost.exe (Console Window Host). When I selected the first instance and clicked End Process, the command prompt finally closed. 

 

I also ended the other two instances, as these don't normally hang out in my process list. I'm guessing that I might've thrown a monkey wrench into whatever this command prompt had been executing when I tried to close it, causing some process it might've been waiting to close to hang out in limbo.



Friday, October 15, 2010

Hammering A Stored Procedures vs Dynamic SQL Debate

While looking for differing viewpoints on stored procedures vs dynamic SQL, I discovered an article by Frans Bouma from a few years ago, wherein he passionately criticizes elements of a post by Rob Howard.

At the time of Bouma’s post I’d had some experience with Microsoft SQL 2000, but I was at a stage where I was doing the SQL equivalent of meatball surgery on databases rather than design. My tasks mainly involved adapting existing code to suit new or revised business logic. As a result, I can relate to aspects of where each person is coming from.

Bouma and Howard both make strong cases for their arguments. Howard, clearly in favor of stored procedures, maintains that a balanced approach should be taken to designing the data access layer to optimize data interchange, and cites stored procedures as an effective tool to abstract the data and improve efficiency and performance. Bouma, a dynamic SQL convert, strongly advocates that paradigm, favoring SQL code emitted by high-level objects to creating discrete stored procedures for specific data management tasks on the fly. He also cites some deep technical details specific to Microsoft SQL which he uses to question some of Howard’s suggested implementations of stored procedures.

At face value, each person argues strongly for their viewpoint, but whether stored procedures or dynamic SQL are in and of themselves superior depends on the design and implementation of whatever system will be hitting the database. As I read each person’s arguments I got the distinct impression that each is somewhat mired in the advantages of their preferred paradigm.

The gist of this argument from years ago can be summed up in each author’s words. Howard states, “Embedded SQL script is very brittle; small changes to the database can have severe impacts on the application.” Bouma says in response to one of the comments in his blog post, “True, it requires some work to get a dynamic query generator right, but once you have one, you don't have to recode it again.”

Both these statements ring true… under a given set of circumstances. If I need code to grab values from a static lookup table, which do I use? Probably either, since unless something major changes in the design, I won’t need to touch the query frequently to modify it. However, what if I need to do something more exotic, like process a payment or mine some data based on input variables that might differ from one query to the next? Again, either methodology could be used for these purposes. It depends I think on how effectively the tools are built to deal with the data, and whether they meet the needs of the design.

Quite frankly, it seemed to me that the authors were each getting too wrapped up in their respective favorites, and arguably from two extremes of the IT spectrum. Howard’s argument seemed somewhat less technical and more geared towards an executive’s ear, with buzzwords about efficiency and performance, whereas Bouma’s deep technical knowledge describes a quintessent engineer, quite eager to implement some project with the tools he is comfortable and happy with.

A hammer is great for driving nails into wood, and for yanking nails out of wood with its secondary nail-removing end. It’s streamlined and clearly purposed for its intended use. Would it be appropriate to use a hammer to spackle a hole in the wall, or break pieces of tile into neat square shapes?

Sure, you might manage to adapt the hammer to the task, using some duct tape to secure a credit card or other stiff piece of whatever to more effectively spackle, or try to direct the blows of the hammer to snap the tile into shape without shattering it.

Would it be efficient? Absolutely not.


Tuesday, October 12, 2010

Capture the Flag FAIL

Back in the days of Jedi Academy for the PC, I enjoyed playing capture the flag (CTF) games with a passion.

One game had me in pursuit of the enemy flag carrier, a guy named Skooby. As the screencap below shows, I loosed a blaster bolt at him just as he's inches away from capturing the flag.

The result...?!