Archive for the ‘Making It Work’ Category

Fix Broken Windows Boot After Installing Linux (grub)

Monday, October 8th, 2012

When you install Linux or another OS alongside Windows in a dual-boot configuration, the installation often sets up a boot loader like grub to manage the booting alternatives. This can sometimes break the Windows boot loader, which can cause problems in certain situations.

One situation is where you have a Windows hard drive and a Linux hard drive. It works fine as long as both drives are installed, but say you remove the Linux hard drive: you would expect the Windows drive to boot up straight into Windows. But instead you might get a message like “BOOTMGR is missing”.

Another situation that I ran into was that I could not upgrade Windows 7 to SP1 in my dual-boot configuration.  Reasons why are discussed here.  I had to revert the boot loader back to booting directly into Windows before the Windows 7 SP1 update would stick.

There are also a few other situations that might cause your Windows boot loader to get corrupted, and you probably don’t want to resort to restoring your entire drive from a backup image or re-installing Windows from the ground up.  So here’s one relatively easy way to fix your boot.

Repairing the Windows boot loader

Here is one way to repair the Windows boot:  Find a Windows Full or Upgrade install disc. Boot from it. When it comes up, select your language, then at the next screen, select the Repair Windows option at the bottom of the screen. Select the Startup Repair. Indicate which version of Windows you would like to repair, if it finds more than one installation on your hard drive. It will do some checking, and should find that your BootMgr is in need of repair. Tell it to repair the problem. After that it should boot directly into Windows again.

This works with a Windows 7 Upgrade disc.  I’m not sure about Windows XP.

Setting up Cygwin

Wednesday, September 19th, 2012

CygwinThis is my procedure for installing Cygwin on a Windows desktop. There are many ways to configure the Cygwin environment. This one suits my taste:

Go to cygwin.com
Click on the “Install or update now! (using setup.exe)”
Download setup.exe to your desktop
Run it

Use the following settings to answer the setup questions:

Root dir:  c:\cygwin
Install for:  All users
Default file type:  DOS
Package dir:  c:\cygwin_install (recommended; can be deleted later)

Be sure to install the following packages:

Section  Package
------- -------
Net     inetutils
Net     ncftp
Net     ping
Perl    perl
Perl    perl-Tk
Perl    perl-Win32-GUI
Perl    perl-libwin32
Shells  chere
Shells  rxvt
Shells  tcsh
Shells  xterm (for resize)
Utils   ncurses (for tset)
Web     wget

Set the HOME environment variable in Windows (Computer->Properties->Advanced->Environment Variables) (put your username instead of username):

Win XP:
HOME  c:\Documents and Settings\username
Win Vista/7:
HOME  c:\Users\username

Optional environment variables:

$JAVA_HOME
$OSG_HOME (OpenSceneGraph)
$OPENTHREADS_HOME
$ANT_HOME

Set the PATH environment variable. Cygwin will inherit the Windows PATH, but you need to add the directories containing the Cygwin executables. This is a very minimal .cshrc file. You will probably want to add a more sophisticated one. I have a small set of “dot” files that I copy into a user’s HOME directory when setting up Cygwin. To create the minimal .cshrc file, type the following lines at a shell prompt, ending with the <Ctrl-D> (Cygwin EOF) character:


/usr/bin/cat > $HOME/.cshrc
set path=(/usr/local/bin /usr/bin /bin $path)
setenv CYGWIN nodosfilewarning
<Ctrl-D>

Run the following commands (put your username instead of username):

Win XP:
/usr/bin/mkdir /home
cd /home
/usr/bin/ln -s /cygdrive/c/Documents\ and\ Settings/username/My\ Documents username
Win Vista/7:
/usr/bin/mkdir /home
cd /home
/usr/bin/ln -s /cygdrive/c/Users/username username

rxvt shortcut:

C:\cygwin\bin\run.exe rxvt -sr -vb -cr red -ufbg gray95 -fn courier -sl 5000 -geometry 80x40 -e /bin/tcsh

Put rxvt in Windows Explorer folder right-mouse menu:
Create ~/.Xdefaults containing the following:

rxvt.scrollBar_right: True
rxvt.visualBell: True
rxvt.cursorColor: red
rxvt.saveLines: 5000
rxvt.geometry: 80x40
rxvt.font: courier
rxvt.foreground: black
rxvt.background: white

Run the following command to create a windows explorer context menu entry [Edit: I now prefer mintty over rxvt because it supports drag-and-drop of files and folders]:

/usr/bin/chere -i -t rxvt -s tcsh -e "Unix Shell"

/usr/bin/chere -if -t mintty -s tcsh -e "Cygwin Terminal Here" -o "-i /Cygwin-Terminal.ico"

If you get an error like this:

Error (5): Access is denied.
/usr/bin/chere Error: Hive not writable
/usr/bin/chere: Aborting.

it is a UAC (permissions) problem.  Launch the shell as Administrator and try it again.

Modify /etc/csh.login as follows, to let the chere shell start in the proper directory:
Replace the last line:

cd

With:

if ( ! ${?CHERE_INVOKING} ) then
cd
endif

KeeFox on Ubuntu

Tuesday, May 8th, 2012

KeeFox is a plugin for Firefox that communicates with the KeePass2 password manager. I like KeePass2 because I can maintain a local secure password database without involving a server. It works great under Windows, and runs with Mono on Linux. However, KeeFox was complaining that the KeePassRPC.plgx plugin (in ~/.keepass/plugins) was incompatible. To fix it, I had to install the mono-complete package.

CMake Debug and Release Builds (in Eclipse)

Tuesday, May 1st, 2012

While coding recently in C++ on a project that uses CMake, I needed to build my code with Debug settings in Eclipse.  It’s Eclipse, so there are probably many ways to do it.  I followed this approach.

I ran into one small problem.  I was modifying a project that I had already been working with.  So when I tried running the cmake commands to generate the Release and Debug makefiles

mkdir Release Debug
cmake -E chdir Debug/ cmake -G "Unix Makefiles" ../ -DCMAKE_BUILD_TYPE:STRING=Debug
cmake -E chdir Release/ cmake -G "Unix Makefiles" ../ -DCMAKE_BUILD_TYPE:STRING=Release

nothing was written to the Release or Debug folder.  To fix this, I had to first delete the CMakeCache.txt file from my project folder.

rm CMakeCache.txt

AppleSyncNotifier.exe – Entry Point Not Found

Monday, April 30th, 2012

This error occurs on Windows (Win7 64-bit in my case) after an iTunes update.  I have had to fix this two or three times now.  I do the install, but on the next reboot I get a popup titled AppleSyncNotifier.exe – Entry Point Not Found.  The message in the popup is:

The procedure entry point sqlite3_clear_bindings
could not be located in the dynamic link
library SQLite3.dll.

To fix it, copy SQLite3.dll from

C:\Program Files\Common Files\Apple\Apple Application Support

to

C:\Program Files\Common Files\Apple\Mobile Device Support

It looks like other people might get slightly different errors, so you may need to copy other DLLs also.

My guess as to what is happening here is that putting a copy of the DLLs with the Apple software causes the Apple software to use that copy.  Otherwise it gets whichever  version of the DLL comes up first in the system search path.  Since many tools use some of these support libraries, it’s a bit of a crap shoot.

The last time I had to fix this problem, The How-To Geek blog article here helped me remember what to do.

Caffiene for Toshiba Drives

Wednesday, April 18th, 2012

I'm sleepy.  Where's my cover?We have some Toshiba USB drives whose power-saving feature puts them to sleep at inconvenient times. The spinning down and spinning up can make some long-running jobs take a lot longer. Fortunately, Toshiba has a utility that will turn off the sleep function. You can download it here.

RJ45 Network Cable Connector Wire Order

Monday, February 13th, 2012

I’ve spent so much time reciting this sequence to myself while putting connectors onto network cables that I will probably never forget it.

But just in case: the order of the color-coded conductors (from left to right when inserted up into the RJ45 connector with the contacts facing you) is:

  • Orange Stripe
  • Orange
  • Green Stripe
  • Blue
  • Blue Stripe
  • Green
  • Brown Stripe
  • Brown

…and crimp!

 Tips:  Remember to push the wires all the way up into the connector so the wires go under the contacts.  Then, push the cable’s outer insulation up into the connector, too, so that the connector’s plastic wedge will grab and hold the insulation when crimped.

csh vs. sh

Thursday, February 9th, 2012

Sadly, this describes me: CSH Programming Considered Harmful

I’ll try to be better.

I found the article referenced above while trying to solve something that was turning out convoluted in my csh script (redirect just stderr to /dev/null). It was trivial in sh.

It is a definite trade-off, though, when it’s something you don’t use daily, where maintainability is a concern, and where you work with people who pull their hair out even at the csh syntax.

Restore Thunderbird’s missing folder pane

Friday, January 27th, 2012

Here’s what to do if your Folder Pane disappears. The Folder Pane is the left one that shows the tree of mail folders: Inbox, Sent, Drafts, etc. If there is no space there (the other panes extend to the left side of the window) it is probably just not displayed, and you can drag its resize bar from the left, or display it with the View menu.

But if the Folder Pane just comes up as a blank space, it could be due to a previous crash of Thunderbird, or corruption of some auxiliary files that need to be rebuilt. Here’s how to fix it:

  • Exit Thunderbird
  • Find your profile folder.  In Windows, you can navigate directly to your profile folder at the following path:
       C:\Users\<user>\AppData\Roaming\Thunderbird\Profiles\<profile>\
  • In Linux, look for it here:
       ~/.thunderbird/<profile>/
  • or here:
       ~/.mozilla_thunderbird/<profile>/
  • The AppData folder might be hidden: to show hidden folders, open a Windows Explorer window and choose
    “Organize → Folder and Search Options → Folder Options → View (tab) → Show hidden files and folders”
  • You can (should) make a backup copy of your profile folder now, in case something goes wrong
  • In the profile folder, rename the session.json and foldertree.json
    files (to session.json.bad and foldertree.json.bad)
  • Restart Thunderbird

If something goes wrong, you can restore your old session.json and foldertree.json files, then go searching for a different solution.

Thunderbird Message Reading Order

Wednesday, July 27th, 2011

I finally went looking for one of my pet peeves with the Thunderbird email tool, and the Internet did not disappoint.

I like seeing my message list with the newest items at the top of the list, yet I normally read them oldest to newest.  When I finish reading a message and delete it, Thunderbird’s default behavior is to select and display the message below the previous selection in the list.  My newest-at-the-top sort order causes the next older message to be displayed, which is probably the one I looked at just prior to the one I deleted.  I want it to select the next newer message.

Turns out there is an option for this in Thunderbird’s config options.

Go to Tools->Options…, Advanced tab, Config Editor….
Change the option mail.delete_matches_sort_order to true.

Now if only someone would add the Reply/Reply All toggle that I’ve been pining for….