Born Geek
Posts Tagged "how-to"

High Contrast Mouse Pointer

February 19, 2018

As I age, my vision is getting worse (and it’s already pretty bad). At work, I use a three monitor setup: my laptop is the middle screen, and two external monitors sit to either side. Given the large screen real estate, and given my increasingly bad eyesight, I’ve been having a tough time finding my mouse pointer. Windows has an option to show the location of the mouse pointer when you press the Ctrl key, but that has limited usefulness (though I do use it from time to time).

I recently stumbled upon a neat feature in Windows 10 that has helped me tremendously. There are several mouse-specific features in the Ease of Access section of the Windows settings. The pointer size can be adjusted (which is helpful to a degree), but the most helpful feature is the Pointer Color setting. There’s an option to adjust the pointer color based on whatever color is beneath it. It took a little getting used to, but I can now find the mouse pointer a lot easier than I could before.

Fixing the Thinkpad Hot-key On-Screen Display

April 6, 2015

Lenovo Thinkpads have an on-screen display for various hot-keys. For example, when you change the monitor brightness, or the volume level, an on-screen overlay will display showing the current brightness level or volume level, respectively. Twice, I have received laptops from Lenovo that have this software installed, but the on-screen display never appears. Frustrated by this bug, I used the Dependency Walker to troubleshoot this problem a while back, and subsequently found the solution.

Simply install the Visual Studio 2010 C++ redistributable, available from Microsoft (make sure to install the x86 version, even on a 64-bit system; the on-screen display application is a 32-bit process). Once this package is installed, and the laptop rebooted, the problem should go away.

Comments Off on Fixing the Thinkpad Hot-key On-Screen Display Tags: ,

Setting the Time Zone in GitLab

February 27, 2015

GitLab defaults its time zone to UTC, which may not be what you want. Thankfully, you can update the value directly from your gitlab.rb file. Here’s the relevant line:

gitlab_rails['time_zone'] = 'America/New_York'

Once you’ve added the field, simply reconfigure and restart:

sudo gitlab-ctl reconfigure
sudo gitlab-ctl restart

A list of all the available timezones is available on Wikipedia.

Comments Off on Setting the Time Zone in GitLab Tags: ,

Using the FormHistory Module

March 4, 2014

In recent times, Mozilla has deprecated the nsIFormHistory2 and nsIFormHistory interfaces (see bug 878677 for more information), replacing both with the FormHistory.jsm module. This module provides an asynchronous way to store form history items, which is good for performance. Like many of the Mozilla interfaces, however, documentation is nearly non-existent. I like learning by example, and I’ve figured out how the FormHistory module works. Here are a few examples showing how to use it:

// Import the module

// Remove all stored history for a specific field
// ('GBL-Search-History' in this example)
FormHistory.update({op: "remove", fieldname: "GBL-Search-History"});

// Add specific terms to a specific field
FormHistory.update({op: "bump", fieldname: "GBL-Search-History", 
                    value: termsToStore});

Update: This article previously indicated to use the add operation to add a term to a specific field. That function, however, will result in duplicate entries as of this writing. The bump operation is now what I recommend to use. End Update

As you can see here, the update() function is the one I most care about. This function has several operations (specified by the “op:” property above) available to it:

  • add
  • update
  • remove
  • bump

The header comment in the FormHistory.jsm file details the specifics for these operations, as well as other functions. Hopefully these simple examples will help someone out. It wasn’t immediately clear to me how to use this module when I first switched over.

Logging to Firebug From XUL

January 23, 2013

The Firebug extension is a very helpful tool for web development. But did you know that you can use its console as an output target for your Firefox extensions? It’s pretty simple to do:

Firebug.Console.log("Text to log"); // Output text
Firebug.Console.log(myObj); // Output an object

Is that easy or what? Having this capability is a great way to print out JavaScript objects from your Firefox extensions, making your debugging life much easier.

Fixing Location Services in Android

November 5, 2012

I have a Samsung Galaxy Tab 7.0 Plus running the Ice Cream Sandwich version (4.0.4) of Android. For some unexplained reason, the location services feature stopped working a few months ago, but only for what seemed like a few applications. Google Plus no longer knew my location, Radar Now no longer knew it, and the stock web browser was also clueless. Google Maps, on the other hand, knew right where I was. Since I use the tablet in the house, GPS isn’t much help. I frustratingly was unable to fix things, until today, when I stumbled on a solution. Here’s how I did it:

  1. I opened up Settings » Location services and unchecked the Location and Google search option
  2. I rebooted my device
  3. Back in Settings » Location services, I rechecked the Location and Google search option
  4. I then toggled the Use wireless networks option, and answered a prompt that appeared about using my network location in third-party apps (or something similar; I don’t have the exact message in front of me).
  5. Success!

Using GPS to lock in on my position worked outside, but that alone didn’t seem to set things right. Disabling the above option, rebooting, and then re-enabling it seemed to do the trick. Hopefully this will help anyone else who might have a similar problem.

Installing iTunes Without the Bloat

October 25, 2012

I went looking for how to install iTunes recently without the bloat (because I remember seeing an article about doing just that a while back), and though I found the article, it had apparently moved from its original location. As such, I’m going to note down the steps here in case said article ever disappears. The following is intended for use on a Windows 7 64-bit system, but I think these steps should work in general. It’s also intended for using an iPod classic, which is the only Apple device I care to use (though these instructions also work with the nano, mini, and shuffle variants).

  1. Download the iTunes installer
  2. Unpack the installer using something like IZArc
  3. Run the installers, using the given commands, in the following order:
    • AppleApplicationSupport.msi /passive
    • Quicktime.msi /passive (if this installer is present)
    • iTunes64.msi /passive
Comments Off on Installing iTunes Without the Bloat Tags: ,

Using the nsIFind Interface

October 3, 2011

In a recent update to Googlebar Lite, I made a number of improvements to the search term highlighting feature, fixing several bugs along the way. This feature uses the nsIFind interface available in Firefox, which is poorly documented in my opinion. Unable to find any decent examples, I picked apart another extension I found that uses this interface, and I now better understand how it works. As such, I thought I’d provide an example of how to use this interface so that future developers won’t have to dig down in the source like I did.

Read the rest of this entry »

Adblock Eats Tracking Links

February 1, 2011

Adblock Plus is a terrific extension for Firefox, along with the EasyList rule set. One minor problem I’ve run into recently, however, is that EasyList blocks the automatic package-tracking links that appear in the sidebar in GMail (when viewing emails that contain a tracking number). I found the offending rule in the list and disabled it, allowing me to get my links back. Here’s how to do it:

  1. Open the Adblock Plus Preferences dialog (Tools » Adblock Plus Preferences)
  2. Press Ctrl + F to open the find bar
  3. Search for the following text (only one rule should match it): &view=ad
  4. Disable said rule

The entire rule looks like this, in case you’re curious: ||*&view=ad

User Defined Messages in Visual C++

August 27, 2009

Before we get to the meat of this article, here’s a quick introductory story. The next release of Paper Plus will only allow one instance of the application to run at a time. One strange bug I ran into during the testing phase of this new feature, was the case where the application was minimized to the system tray. If a previous instance is already running (and minimized), I wanted the action of trying to start a new instance to restore the old one. For a number of reasons which I won’t go into, I couldn’t get the level of control I needed to restore things properly. So, to get things working, I turned to user defined messages which, happily, solved my problem. Here’s a quick guide to getting custom messages up and running in a Visual C++ application.

Step 1: Define the Message ID

This is straightforward, but you’ll need to make sure your definition appears in the appropriate place. I put mine in stdafx.h, which is included by nearly every file in the project.


Step 2: Add the Message to a Message Map

Next, your custom message needs to be added to the appropriate message map. I added mine to the message map down in my CFrameWnd derived class. Here’s how the entry looks in my case:


Step 3: Implement the Custom Callback

Your callback function declaration must adhere to the appropriate form, as shown below:

LRESULT MyCustomCallback(WPARAM wParam, LPARAM lParam);

Custom message callbacks must always return an LRESULT, and must accept two parameters: a WPARAM and an LPARAM (down under the covers, both are simply pointers of varying types).

Once you’ve got the declaration in place, it’s time for the definition:

LRESULT CMainFrame::MyCustomCallback(WPARAM wParam, LPARAM lParam)
    // Do something clever here
    return 0; // Make sure to return some value

Step 4: Post Your Custom Message

Now that we’ve got our custom message callback installed, we need to post our new message in the appropriate place. I decided to use the SendMessageTimeout function, based on some code I saw which used this function to prevent the application from hanging. Here’s a variant of the code I used:

DWORD_PTR dwResult = 0;
// The hWnd parameter below is a handle to the window this message
// should be posted to. Setting this up is not shown, in order to keep
// this article as short as possible.
SendMessageTimeout(hWnd, WM_MYCUSTOMMESSAGE, 0, 0,
                   SMTO_ABORTIFHUNG, 5000, &dwResult);

And that’s it! Being able to post your own messages can help you out of some sticky situations, and lets you take control of your application in some interesting new ways.