Malware, viruses, trojans, rootkits, worms (what's the difference: http://en.wikipedia.org/wiki/Malware)... once upon a time they would simply wipe out your hard drive. Now there's "scareware" which extorts your money using fake virus scanners (telling you you're infected when you're not); or even worse, you can be infected and not even know it (your real virus scanner may tell you you're "clean"), meanwhile a rootkit may be hiding the presence of malware which could be watching your internet activity, stealing your passwords and financial information, and even using your computer as part of a botnet to perpetrate other crimes.

Here's some advice on avoiding these malicious programs, and what to do if you suspect you're infected.
Read the rest of this entry »

To modify Firefox 3 & 4's window UI chrome using userChrome.css, based on whether the window is in Private Browsing Mode, just prepend [browsingmode=private] before a given css selector.

For example, to change the color of Firefox 4's appmenu button (the orange button at the top left of the window that reveals the newly arranged application menu), add the following to your userChrome.css file:

/* this first line is required for userChrome.css to work */
@namespace url("http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul");

/* example of changing the appmenu button color from
   the default orange to a transparent black */

#appmenu-button {
  background-color: rgba(0,0,0,0.2) !important;
}

/* here we prepend [browsingmode=private] to the above
   selector to change the appmenu button color to
   transparent red only when in Private Browsing Mode */

[browsingmode=private] #appmenu-button {
  background-color: rgba(255,0,0,0.5) !important;
}

FYI, this file is typically located at:

C:\Users\{yourname}\AppData\Roaming\Mozilla\Firefox\Profiles\{random}.default\chrome\userChrome.css

If the file doesn't already exist, you should see an existing userChrome-example.css in that same location which you can use as a basis for creating your own new file.

This is a need I've run into more than once, yet there doesn't seem to be an elegant off-the-shelf solution that can handle a wide range of use cases, including simple (flat) objects, linear (one-dimensional) arrays, arrays of objects, and complex objects (objects within objects).

So here's a [relatively] straightforward recursive object comparison function that features optional loose type comparison (strict by default) for those times when you're working with data from different sources, (e.g., which give you quoted numbers ("3" == 3) or empty strings ("" == null == undefined == 0 == "0")), but your task at hand doesn't distinguish among these semantic differences.
Read the rest of this entry »

Quick solution: RTFM (yes, it was right there on Google's help page) - clear the captcha by going to:

http://www.google.com/accounts/DisplayUnlockCaptcha

or if you use Google Apps:

https://www.google.com/a/yourdomain.com/UnlockCaptcha

Read the rest of this entry »

I was having trouble getting Chrome to play nicely with Sandboxie - it loads and runs, but it was slow to show the "New Tab" page (with thumbnails of your most visited sites), the History page, and, well, most websites in general - so it appeared as though Chrome was trying to copy some needed files into the sandbox every time it loaded a page... Note that I have my sandbox set to automatically delete when the last sandboxed program ends to ensure I'm cleaning up after myself.

I couldn't find any specifics elsewhere, but after a little tweaking I solved the problem:
Read the rest of this entry »

The new Location bar in Firefox 3.x will, by default, take any non-URL input and:

  1. If it's a single word (no spaces): first attempt to prepend "www.", and/or append ".com", then lookup in OpenDNS to see if this makes a valid server name - if so, you are automatically redirected to this found server
  2. If there is a space: it is assumed this is a search phrase, so the the input is passed (by default) to Google's Browse By Name service. This works similarly to a standard Google web search, however if the search phrase is associated with an "authoritative" server (as deemed by Google), you are automatically redirected to this server (similar to an I'm Feeling Lucky search).

To disable these behaviors, resulting in similar functionality to Google Chrome's address bar, just make a couple changes in Firefox's hidden about:config settings (that is, type "about:config" in the address bar and hit Enter):

  1. Change the value of "browser.fixup.alternate.enabled" to false
  2. Change the value of "keyword.URL" to
    http://www.google.com/search?q=

    Note that there is nothing after the equal sign.

This appears to work up through Firefox 3.5b4.

I've had one particular network printer (installed on a local TCP/IP port) that has been incredibly slow since we've had it installed: it seems to be some bottleneck with the process of communicating with the printer in general, since even opening the printer properties window (or switching tabs within that window) can take 5-10 seconds, and sending over a print job generally hangs the sending application for a similar amount of time. However, pings are fine (<1ms), and two other network printers configured similarly work just fine, and I've exhausted most other possibilities (cabling, network hardware, port settings) for solving the issue.

However, it appears to be an odd bug in Windows, the workaround for which may not work in all cases, but seems to fix this issue. I had the printer installed on a local TCP/IP port (it has a built-in print server with a static IP), but by following this advice, I assigned the NetBIOS name for the printer to an unused LPT port at a command prompt:

net use LPT2 \\printserver\printername

And then, in the printer's Properties window, under the Ports tab, I changed the port from the TCP/IP port I had originally used to LPT2.

Voila - instant fix.

IE 6 and 7 can be a nightmare for debugging Javascript, especially after working with the quality tools available for other browsers such as Firebug for Firefox. However, one small step in the right direction would be the ability to View Source for the currently rendered page, after Javascript has been executed (since typically the View Source command displays the source code as it was sent by the server, prior to any script execution).
Read the rest of this entry »

Run the following from a command prompt or batch file:

@echo|find /I /V "echo" > file.txt

Most other, more straightforward techniques will result in a file size greater than zero bytes (usually containing spaces, linefeeds, or other less-than-obvious text).

Dead Space (PC) tweaks

November 14th, 2008

Since I've found this game is frustrating many users (myself included) with its tendency to force your mouse to work like a console game controller, among other things, I did some digging to overcome some of the issues I was having.

  • Very sluggish mouse input: Disable v-sync in the game options. You might still be able to force v-sync in your video driver configuration (see here for Nvidia driver) to eliminate tearing.
  • Mouse input too slow / "swimmy": You can only increase the mouse sensitivity so far in the game options, but if that's still not sensitive enough for you, try editing the setting manually in the config file. Open the file called config.txt in this folder under Windows XP:
    C:\Documents and Settings\<YOUR USER NAME>\Local Settings\Application Data\Electronic Arts\Dead Space

    or this folder under Vista:

    C:\Users\<YOUR USER NAME>\Local Settings\Application Data\Electronic Arts\Dead Space

    Look for a setting for Control.MouseSensitivity - this only goes up to 1.0 from the in-game options menu, but you can theoretically set it quite a bit higher. I currently have it set to 2.0, which is a pretty decent improvement. Note: setting this too high will make the mouse much too sensitive in the in-game menus, so turn it up slowly and experiment.

  • Brightness too high even at lowest setting: this one can also be tweaked in the config file above. The setting is called Window.Gamma - the in-game brightness adjustment only sets this as low as 0.0, but apparently it can go negative. Currently I have it set to -0.5, and it looks much more creepy and atmospheric.

Hopefully EA will patch the claustrophobic, controller-esque feeling of the mouse at some point in the future, but otherwise these settings make a huge improvement over the out-of-the-box experience.

Stable quicksort in Javascript

October 28th, 2008

Firefox < v3.0 doesn't have a stable Array.sort() function - that is, it doesn't maintain indexes for elements of equal value. This is undefined in the ECMA spec, and has been fixed in Firefox as of version 3 (and curiously enough has been stable in IE all along). As a result, I set out to find a stable, efficient Array.sort() replacement/supplement.
Read the rest of this entry »

Typically, using SELECT in a subquery to perform an UPDATE on the same table, such as:

UPDATE table1 AS target
SET field1 = (
    SELECT field2
    FROM table1 AS source
    WHERE source.id = target.id
)

is illegal in MySQL. To achieve the desired effect, you can perform an INNER JOIN in the UPDATE:

UPDATE table1 AS target
INNER JOIN table1 AS source USING(id)
SET target.field1 = source.field2

Cache control is a potentially hit-and-miss pursuit, but the most reliable and straightforward method I've found (that works for IE 6+ and Firefox), although it relies on access to your Apache server configuration, is simply setting Cache-Control headers manually.
Read the rest of this entry »

(Lifted from http://www.vistax64.com/tutorials/70819-windows-explorer-folder-view-settings.html)

Vista Explorer, by default, tries to determine what type of folder you're viewing based on its contents, and may dramatically (and seemingly unpredictably) change the folder's view settings: Details view, or List view, or Thumbnails view, etc., as well as applying Grouping, adding or removing visible columns, and so on. To disable this behavior, and have all folders work more like XP Explorer, do the following:

  1. Delete existing folder type customizations in the registry: Open regedit.exe, and navigate to:
    HKEY_CURRENT_USER\Software\Classes\Local Settings\Software\Microsoft\Windows\Shell

    Delete the keys Bags and BagsMRU.

  2. Add new registry setting to enable common behavior: Still in Registry Editor, under the same Shell key (above), create a series of new keys: Bags, then within that AllFolders, then within that another Shell, to end up with this:
    HKEY_CURRENT_USER\Software\Classes\Local Settings\Software\Microsoft\Windows\Shell\Bags\AllFolders\Shell

    Inside the last Shell key, create a new string value named FolderType, with a value of NotSpecified.

    Reboot or logoff and back on again to make these changes take effect.

  3. Make changes to Vista Explorer's view settings: In Explorer, open the Tools menu (if you don't see the menus, hit the Alt key to temporarily display them, or click Organize->Layout and put a check next to Menu Bar), and click Folder options. Set these as you like them, paying special attention to the option Remember each folder's view settings - if this is unchecked, and you click the Apply to Folders button at the top of the window, all folders will behave exactly the same.

When you need to update Internet Explorer on a computer without internet access (yes, it can happen):

http://support.microsoft.com/?kbid=257249

You have to jump through hoops, but it works. Just be careful with the syntax (there really are 3 quotes at the end of the command - good ol' MS engineering ;).

NOTE: You will be asked a few times throughout this initial download process, "Are you sure you want to install/run this software?" Don't be alarmed, the installer won't actually run at this point, it will simply continue downloading more components. When it completes, it will explicitly tell you that the components have completed downloading, and to run ie6setup.exe in the download folder you specified to begin installation.

When you just need to get the job done, sometimes it pays to visit the wayback machine. Recent DOCTYPEs can wreak havoc on even simple layouts when relying on deprecated functionality.

Read the rest of this entry »

Map network drives at login

December 27th, 2007

(Win2k, XP, Vista) Using NET USE in a batch file at login to force-connect mapped drives... useful for situations where mapped drives mysteriously disappear (this script can safely be re-run repeatedly) or to prevent conflicts between network shares requiring conflicting credentials.
Read the rest of this entry »

(Requires Win2k, XP, or Vista) Using FOR at the command line to step through every subfolder in a given folder, and create new folders with those names in a different parent folder.

Suppose you have a group of folders under C:\test1, like this:

C:\
|
+-test1
  |
  +-folder1
  |
  +-folder2
  |
  +-folder3

And you want to create a new test2 folder under C:\, which will contain emtpy folders with the same names as those in test1, like this:
Read the rest of this entry »

Windows tries very hard to prevent you from replacing or deleting critical system files, even something as mundane as notepad.exe.

Note that this behavior is designed to keep your system functional whenever a critical file is accidentally (or maliciously) deleted or modified, and any actions you take to modify your system at this level, even with the best of intentions and what may seem like reliable information, may very well cause unexpected results to occur, such as an unstable or unbootable computer, or even lost data. BACK UP YOUR DATA REGULARLY, especially before attempting modifications to your operating system files, and make sure you have a backup of your operating system to fall back on in case something goes wrong.

Suffice to say, there is a relatively simple way to bypass Windows file protection. In fact, there are two very different methods for XP and Vista due to the way they protect operating system files:

Read the rest of this entry »

You can start Windows normally, but your computer can't / won't / doesn't boot into safe mode - either the computer reboots itself after listing the drivers, or you get a BSOD (Blue Screen of Death) with a STOP 0x0000007B error - generally after a virus or trojan infection. To confirm this solution might work, in Registry Editor go to HKLM/System/CurrentControlSet/Control/SafeBoot. If it's not there, or there are only a few empty keys, then something has wiped/corrupted your safe mode configuration to prevent you from entering safe mode where you can run a more thorough malware disinfection.

Read the rest of this entry »

More secure motherboard heatsinks

September 11th, 2007

Apparently there's an oft overlooked trend in motherboard manufacturing: despite chipset and component cooling solutions growing ever more massive, these heatsinks continue to be secured to the board with cheap, unreliable plastic pins. Luckily these can be replaced with machine screws with minimal effort.

(Applies to v3.1.0.15) DynDNS Updater is a simple, free to use dynamic DNS utility: it automatically detects changes to your external IP address - such as when your ISP renews your DHCP lease - and forwards this information to your DNS service provider to ensure your domain name always points to your most current IP.

However, this utility is distributed by DynDNS.org (although designed and supported by third party Kana Solution) primarily to support the use of their specific service. But with a little tweaking, you can make this well-designed utility work for other service providers - for this example we'll be using the domain registrar Namecheap.com, one of the better rated affordable service providers.

Read the rest of this entry »

IE is leaving room for ascenders and descenders on characters within the elements - even if there is not text present. To workaround, set the element (div or table cell)'s properties like such:

font-size: 0px
line-height: 0px

Perhaps changing the content's vertical-align property (to middle?) might also help...