Archive for the ‘Tools’ Category

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 seems to work for me:

  1. Go to
  2. Download the Cygwin installer/updater to your desktop
    1. Choose setup_x86.exe (32-bit installation), or
    2. Choose setup_x86-64.exe (64-bit installation)
  3. Run it

Use the following settings to answer the setup questions:

Root dir:  c:\cygwin  (for 32-bit; or c:\cygwin64 for the 64-bit install)
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     openssh
Net     ping
Python  python
Python  python-imaging
Python  python-tkinter
Shells  chere
Shells  mintty
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/8:
HOME  c:\Users\username

Optional environment variables:

$OSG_HOME (OpenSceneGraph)

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

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


mintty shortcut:

C:\cygwin\bin\mintty.exe -i /Cygwin-Terminal.ico /bin/tcsh

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
xterm.scrollBar_right: True
xterm.visualBell: True
xterm.cursorColor: red
xterm.saveLines: 5000
xterm.geometry: 80x40
xterm.font: Consolas
xterm.foreground: black
xterm.background: white

Put mintty in the Windows Explorer folder right-mouse menu:

Run the following command to create a Windows Explorer context menu entry:

/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 shell run by chere start in the proper directory:
Replace the last line:



if ( ! ${?CHERE_INVOKING} ) then

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

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.

Simple Popup Requester in Python

Wednesday, March 14th, 2012

Sometimes I think I should change the name of this blog to Mind Like a Sieve, subtitle Straining to Remember.

I’ve built some miscellaneous one-off GUIs with various Python toolkits like Tkinter and wxPython, but this time I wanted just a simple confirmation popup.  In this case it was to pause so I could attach a debugger.

The comment on this page of the tkinterbook had exactly what I needed.  Also, there is a page showing examples of all the different simple popups you can make using this approach.  One benefit of using this approach is that Tkinter is bundled with Python, so there are no additional packages to install.

Here’s the simplest code snippet:

import Tkinter, tkMessageBox
Tkinter.Tk().withdraw() # suppress blank Tk root window in Windows
tkMessageBox.showinfo("Debugging", "Attach debugger, then click OK")

You can, of course, get much fancier with some of the popup versions, and you can capture the return value from the user interaction.

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:
  • In Linux, look for it here:
  • or here:
  • 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.

Convert 3ds files to obj with Blender

Tuesday, January 24th, 2012


3DS is an aging binary interchange format for 3D models. OBJ is another aging, but ASCII-based format for 3D models.

Here is a simple Python script that converts one or more files from 3DS format to OBJ format using Blender:

# Convert 3ds to obj using Blender
# Run as follows:
#   blender -b dummy.blend -P -- file.3ds ...
# dummy.blend is just an empty Blender file needed as an argument.
# Put one or more .3ds files on the end of the command.
# The .obj files will be created with the same name (and path) as
# the .3ds file, but with the .obj extension.
# The export creates a .mtl file for each .obj file also.

import bpy
import sys
import os.path

for i in range(1, len(sys.argv)):
    if sys.argv[i] == "--":

for file in sys.argv[i+1:]:
    # Start with an empty scene

    # Read a .3ds file

    # Write a .obj file
    outfile = os.path.splitext(file)[0]+".obj"


Save the script code in a file named  You will also need a Blender file to use as a placeholder in the command line.  You can save an empty file from Blender, or use an existing one.  Assume it is called dummy.blend.

To convert 3DS files, use the following command:

blender -b dummy.blend -P -- file1.3ds file2.3ds file3.3ds

Tack on as many 3DS files to the end of the command as you want.

Note:  This assumes that dummy.blend and are in the same folder as your 3DS files.  If not, you will need to specify the proper path to each.

List: My Favorite Firefox Add-ons

Tuesday, December 6th, 2011

Firefox has lots of add-ons that make web browsing more pleasurable. There are many I have not explored, but these are my current favorites:

Tree Style Tab
Lets me have the tabs down the left side in a collapsable tree view. Saves screen real estate and makes more tabs readily accessible.
I find myself trying to use the same mouse gestures in other tools. I wish I could get this as a desktop add-on.
Hides ads: rose-colored glasses for web browsing!
Old habits die hard: muscle memory lasting longer than other types.
Nice if you are trying to grab several large files at once.
Great for figuring out why web pages don’t work.
Adds some capability to the address field.
Searchbar Autosizer
Makes the search field big when you use it.
Keeps bookmarks synced between machines. I appreciate it when I move into a new computer.
Integrates the KeePass password manager with Firefox. Now I feel at least a little bit more secure.
Makes me feel like I’m not being tracked quite so much, but it breaks some Google things, so I have to turn off the Google blocking for Google Maps or logging in to a Google account.
Currently disabled. Hasn’t kept up with the Firefox release cycle.

You can get add-ons for Firefox by typing about:addons in your Firefox browser’s address field.