Posts Tagged “how-to”

Infinite WordPress Redirects at DreamHost

Published on September 29, 2018

Do you run a WordPress site hosted at DreamHost? Are you seeing infinite redirect errors after adjusting the Do you want www in your URL? setting in the DreamHost control panel? Well friend, I had that same issue. Let me tell you how I fixed it. In this example, I will be migrating from the Add www to the Remove www value for the aforementioned setting.

Step 1: Change WordPress internal settings

  1. In WordPress, browse to the Settings » General menu item.
  2. Change both the WordPress Address and the Site Address to the new URL (in this case Make sure there’s no trailing slash.

WordPress URL settings

Step 2: Change DreamHost control panel settings

  1. In the DreamHost control panel, navigate to the Domains » Manage Domains menu item.
  2. Click the Edit link next to the domain you want to change.
  3. Set the Do you want www in your URL? setting to the desired value.
  4. Click the Save button to save the change.

DreamHost URL settings

Step 3: Change https settings (if applicable)

This is the step that I got tripped up on (but finally stumbled upon). My site has HTTPS turned on, and there’s a setting we need to change.

  1. On the Domains » Manage Domains page, click the https On link next to the domain you’re changing.
  2. Change the Choose exact URL setting to the variant of your choice.

SSH settings

Now sit back and wait the 5 to 10 minutes for everything to take effect.

High Contrast Mouse Pointer

Published on 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

Published on 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.

Setting the Time Zone in GitLab

Published on 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.

Logging to Firebug From XUL

Published on 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

Published on 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

Published on 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

Adblock Eats Tracking Links

Published on 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++

Published on 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.

Disable Compress Option in Disk Cleanup

Published on July 5, 2009

The Disk Cleanup utility that comes as a part of Windows has an annoying feature. As a part of its scan procedure, it tries to figure out how much space you’d save by “compressing old files.” This step takes a ridiculously long time to complete, and is highly annoying. Thankfully, disabling this feature is simple, though it involves editing your Windows registry. As always, be very careful during the editing process.

To disable the “Compress Old Files” operation, navigate to this registry key, and delete it:

HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\VolumeCaches\Compress old files

Once you’ve deleted the above key, start up the Disk Cleanup utility and marvel at how much faster it loads!

Updating Time Zone Information in Linux

Published on March 16, 2009

About this time last year, I noted that our build machines at work were way out of sync in their respective local times. As a result, we were seeing a bunch of “clock skew” warnings when building our code. To fix the problem, I figured out how to use NTP on a private network. Imagine my surprise when, while performing a build today, I noticed more clock skew warnings! I checked our setup, and NTP was still functioning as expected. The problem, it turns out, was that some of our build machines had not yet changed over to Daylight Savings Time (DST), something NTP doesn’t assist with. Only the oldest machines were affected, which wasn’t surprising, seeing as Congress feels the need to change the DST rules every few years.

Thankfully, updating time zone information is easy to do. Here’s how:

Read the rest of this entry »

Default Startup Projects in VS 2005

Published on July 28, 2008

I ran across another weird and subtle bug in Visual Studio 2005. If you’ve got a solution with many project in it, you can set one of those projects to be the default project at startup (i.e. when you open the solution file). But this setting apparently resides in the user options file (.suo), which is something we don’t keep in our code repository (since it differs for every user). So how can you set a default startup project that affects anyone working with your code? Simple: hack the solution file.

Thankfully, the solution file is just plain text. Apparently, if there’s no user options file for a given solution, Visual Studio 2005 simply selects the first project it comes across in the solution file. Here’s a quick example of what a solution file looks like (wrapped lines marked with »):

Read the rest of this entry »

Unicode and the Web: Part 1

Published on July 25, 2008

Dustin and his wife recently uncovered an interesting limitation of my Monkey Album software: characters outside of the ISO-8859-1 (Latin 1) character set don’t render properly. This comes as no surprise, seeing as I didn’t design for Unicode. Being a rather egregious display error, I decided to set out and fix the problem. In the process, I learned quite a lot about Unicode, and how it affects web applications. This post will be the first of two detailing how to add Unicode support to a web application. I will only be exposing a tip of the Unicode iceberg in these posts. The ideas and practices behind Unicode support can (and do) fill the pages of many books. That said, let’s jump in.

Read the rest of this entry »

Exiting Batch File Contexts

Published on May 22, 2008

While working on a Windows batch script earlier today, I ran across an interesting side effect of the call and exit commands. Let’s take this simple example, which we’ll name script_a.bat:

@echo off

call :function

goto :functionEnd
    set foobar=1
    if "%foobar%" == "1" exit /B 1
    goto :EOF

Read the rest of this entry »

Using NTP on a Private Network

Published on April 3, 2008

At work, I’m in charge of 20 individual build systems for one of our larger software project (18 Linux systems and 2 Windows systems). Every machine is connected to a private network that cannot see the outside world. As you might expect, the occasional “clock skew” warning would be thrown by gcc, since some of the source files had date stamps in the future. To fix this, I set out to learn about configuring NTP on a private network. As is typical of the Linux world, there was little useful documentation to be found. After gleaning little bits of information from a number of sources, I figured out how to do it, and I’m writing it down for everybody’s benefit.

Read the rest of this entry »

Disable Search Suggest at Google

Published on March 25, 2008

Google recently enabled “Search Suggest” at their official home page. I find this feature annoying, and I wanted a way to disable it. Thankfully, the solution was very simple:

  1. Visit the Search Preferences page
  2. Set the Query Suggestions option to “Do not provide query suggestions in the search box”
  3. Save your preferences

I wish Google had made disabling this a little clearer, rather than quietly adding the preference to the preferences page.

How to Tell Windows Explorer Where to Open

Published on March 14, 2008

By default, Windows Explorer opens up in the “My Documents” folder, which is far from useful (assuming you don’t store all your documents there). Just today, I figured out how to get Windows Explorer to open in a folder that you specify. Here’s how to do it:

  1. Right click the Windows Explorer shortcut and select Properties.
  2. Make sure you are on the “Shortcut” tab.
  3. Clear the Start in: field. Contrary to what you might think, Windows Explorer seems to ignore whatever you type here (which seems stupid to me).
  4. Change the Target: field to the following:
    %SystemRoot%\explorer.exe /n,/e,{Desired_Path}. For example: %SystemRoot%\explorer.exe /n,/e,C:\. Note that the commas are required!
  5. Accept your changes.

Now, each time you open Windows Explorer, it will point to your desired location. This is an incredibly useful tip that will now save me two clicks for every explorer window that I open!

Creating Cookies in Perl

Published on February 18, 2008

A little over a year ago, I inherited a productivity tool at work that allows users to enter weekly status reports for various products in our division. The tool is web-based and is written entirely in Perl. One of the mangers who uses this tool recently suggested a new feature, and I decided to implement it using cookies. Having never implemented cookies from a programming perspective, I was new to the subject and had to do some research on how to do it in Perl. It turns out to be quite easy, so I figured I would share my newfound knowledge:

Read the rest of this entry »

Copyright © 2004-2019 Jonah Bishop. Hosted by DreamHost.