How to Read Output From diff

Programmers sometimes use a program called ‘diff’ to compare two files. While diff is a tool created by geeks, for geeks, there are only 4 rules you need to know in order to read the output from diff. Here is sample output from running diff to compare two files, which we’ll call File1 and File2. The geek might tell you (s)he ran “diff File1 File2”.

<pre> 0a1,4

This is an important notice! It should therefore be located at

11,14c14 < This paragraph contains < text that is outdated. < It will be deleted in the < near future. — 17c17 < check this dokument. On — check this document. On

</pre></code>

  1. Ignore all lines except those that begin with either "<" or ">".
  2. A line which begins with "<" is in File1 but not in File2.
  3. A line which begins with ">" is in File2 but not in File1.
  4. If you see a line which begins with "<" and it is followed by a similar line which begins with ">", then the line in File2 is a changed edition of the line from File1 (i.e. the line was deleted from the first file and added to the second file, with revisions). </ol> In the example above,
    This is an important
    notice! It should
    therefore be located at
    [blank line here]
    
    is in File2 but not File1
    This paragraph contains
    text that is outdated.
    It will be deleted in the
    near future.
    
    is in File1 but not File2 There is a line in File1 which reads:
    check this dokument. On
    
    and File2 corrects the spelling of "doKument" to "doCument", and the line in File2 is
    check this document. On
    
    Piece of cake! Just remember the 4 rules:
    1. Ignore all lines except those that begin with either "<" or ">".
    2. A line which begins with "<" is in File1 but not in File2.
    3. A line which begins with ">" is in File2 but not in File1.
    4. If you see a line which begins with "<" and it is followed by a similar line which begins with ">", then the line in File2 is a changed edition of the line from File1 (i.e. the line was deleted from the first file and added to the second file, with revisions). </ol> Some content adapted from http://en.wikipedia.org/wiki/Diff#Usage.

Why I Run Office Via a VM Instead of Crossover (or Wine)

I’m an occasional Mac user. When I do use a Mac, I’ve got spreadsheets that contain lots of things which Numbers won’t handle, so I need to use Microsoft Office. (Also, when I send a resume, I can’t go with pretty close Word files – I need real Word files.)

OK. So I’m going to use Microsoft Office on the Mac. That leaves 3 choices:

  1. Microsoft Office for Mac (The OS X edition of Office.)
  2. Crossover or Wine
  3. Parallels or Fusion (VM)

I own a license for Office for Windows, and, similar to Numbers, Office for Mac can’t handle some of my spreadsheets. (e.g. I have a ham radio logbook spreadsheet that uses macros to build a SOTA export and to fetch data from QRZ.com.) That rules out Office for Mac. (No, I’m not going to rewrite my spreadsheets. I want to use my spreadsheets, not develop them. See http://www.rondebruin.nl/mac/mac027.htm for info on VBA issues.)

So now I’m down to Crossover/Wine versus VM. If I’m going to use Crossover/Wine, the price of Crossover is a bargain, when compared with messing with Wine settings all day. (Or maybe for a week or two.) Crossover simplifies all that. Just install Office per the Crossover instructions and it works. I could get Wine to work… eventually. Life is too short for that.

Now I’m down to Crossover versus a VM. I haven’t really settled on Fusion or Parallels yet. For the sake of discussion, I’m going to refer to Parallels, but everything I say about Parallels can pretty much be said about Fusion.

Crossover doesn’t render fonts just right. Most of them are readable, but ugly, and they don’t quite match what prints. Furthermore, every time I start an Office application, I have to wait 30 seconds while Crossover spins up and loads its libraries plus the application. With Parallels, I pay a 60 second penalty the FIRST time I launch an Office application, while it spins up the VM, but it leaves the VM running in the background, so Office starts in 2 seconds every time after the first.

You could make a good argument that using Parallels requires a Windows license, and Crossover doesn’t. But I already own multiple Windows licenses, so that only matters if I’m a crusader against Windows. (I’m not. See “Life is too short,” above.)

Parallels 5 Versus VMware Fusion 3.1.1

I installed both Parallels 5 and VMware Fusion 3.1.1 on my Macbook. Here are some observations:

In Fusion’s favor:

  • Fusion is more robust. I’ve got an ISO of a TrueImage 11 boot CD. Parallels just couldn’t boot it. Fusion could. I tried lots of different OS settings and “Safe Mode” and Parallels kept reporting VM crashed. No problems with Fusion. Ultimately, I created a VM with Fusion, and restored the disk image, and then I imported the VM into Parallels.
  • Parallels can’t boot one of my Boot Camp drives. I’ve got a Boot Camp which boots Windows from a fully-encrypted system partition. Parallels can’t boot it. Fusion can, with no problem.
  • Parallels messed up one of my Boot Camp drives. I’ve got (another) Boot Camp partition with a “plain vanilla” XP on it. At some point, I got a kernel panic in OS X, and my Boot Camp partition was left without a partition table.
  • It appears that Parallels doesn’t really give a raw disk to a VM. When you tell it to use a raw disk, it can’t deal with it unless it is a format which OS X understands. e.g. I can tell it to use a raw FAT or a raw NTFS volume, and it mounts it in OS X and then makes the mounted volume available to the VM as a disk, but if I give it a raw disk which my VM can understand but OS X can’t, the volume is not mounted in OS X and it is not available to the VM.

In Parallel’s favor:

  • It runs my plain vanilla Windows XP VM faster than Fusion.

How Do I Mount a Parallels .fdd Floppy Image

If you want to update the content of a Parallels Floppy.fdd file, from OS X, just rename the .fdd to .dmg, and mount it as you would any other .dmg file. When you’re done writing/reading it, dismount it, and rename it back to a .fdd file.

eReader and the Unabridged Dictionary on an iPhone

eReader was doing e-books long before Amazon or iTunes, so I own a number of eReader e-books. One of them is Webster’s Unabridged Dictionary. If you tell eReader to download this book, it will warn you that it will probably time out on the download. It is right. It will. Here’s how to get a large book onto your iPhone.

If you haven’t done so already, go to the eReader site (www.ereader.com) and download every one of your books to your Mac/PC. Disk space is cheap, and eReader could go out of business. They could be in business for another 100 years, but why take chances?

As near as I can tell, the problem with downloading really big books is that the eReader server won’t let a download run for long enough to download to your iPhone. The solution: Download the book from your own, local web server.

Here’s how to do it on a Mac:

  • Go to System Preferences and then Sharing, and enable Web Sharing.
  • Copy the dictionary's .pdb file to /Library/WebServer/Documents/dictionary.pdb
  • On your iPhone, start eReader, select the Reference category, and click on the "+" button.
  • Select "Another Site" and enter the URL ereader://your-mac-ip-address/dictionary.pdb </ul> Note: Make sure you use the "ereader://" protocol and not http://.

Upgrading Chrome Portable

I have Chrome Portable 4.1.249.1036 (41514).  I'm having trouble with extensions crashing.  One of the extension vendors suggested upgrading to a newer version.  Google has 5.0.375.55 at chrome.google.com, so here's how I (tried to) upgrade.

Chrome 4 is installed in S:\Chrome-Portable.  I'm going to (try to) put Chrome 5 in S:\Chrome-Portable-5.

  1. Install from chrome.google.com.  Google installed itself to C:\Documents and Settings\username\Local Settings\Application Data\Google\Chrome\Application.
  2. Copy S:\Chrome-Portable to S:\Chrome-Portable-5
  3. Rename S:\Chrome-Portable to S:\Chrome-Portable-4 (just in case some of the files I copied refer to S:\Chrome-Portable).
  4. Start Chrome Portable from S:\Chrome-Portable-5, just to be sure it works before I start messing with it.
  5. Copy the contents of C:\Documents and Settings\username\Local Settings\Application Data\Google\Chrome\Application to S:\Chrome-Portable-5\App\Chrome-bin.
  6. Delete S:\Chrome-Portable-5\App\Chrome-bin\4.1.249.1036.
  7. Run S:\Chrome-Portable-5\GoogleChromePortable.exe, and check the version.  It reports 5.0.375.55.
  8. Uninstall the installed Chrome via Control Panel.  (The uninstall in the Google Chrome folder of the Start menu failed to find setup.exe.)  Choose "Also delete my browsing data."
  9. Run S:\Chrome-Portable-5\GoogleChromePortable.exe, and check the version.  It reports 5.0.375.55.
  10. Spot check some extensions.  They work.
  11. Call it a success.

Windows Registry Won't Let Me Update/Delete Some Items

Issue: You receive an error message resembling Cannot delete xyz: Error while deleting key.” when you try to delete an entry in the Windows registry.

Solution: Right-click on the item, select Permissions, and grant yourself permission to update the item!

Sharing a TrueCrypt Physical Partition From a Linux Portable Virtualbox Guest

First, I’ll describe what I did; then why; then how.

What:

  • I've got a Windows XP computer (host).
  • I've got Portable VirtualBox (PVB).
  • I've got a physical partition on the computer that is encrypted with TrueCrypt (TC).
  • I've got Ubuntu 10.4 (Lucid Lynx) installed as a guest in PVB.
  • I made the TC partition available in the guest as a physical partition.
  • I mounted the TC partition with TC in Lucid.
  • I shared the mounted TC file system from Lucid.
  • I accessed the shared file system from the host. </ul> Why:
    • To see if I could!
    • I have a very aggressive anti-virus installed on the host. It treats several legitimate programs as "PUPs" (potentially unwanted programs) and it deletes them. It does NOT do this on network shared drives. I want these files accessible both in a VM and on the host. The AV program is an all-or-nothing affair. </ul> How:
      1. See Portable VirtualBox to set up PVB.
      2. Installing Ubuntu in PVB is not covered here. It is a plain vanilla Ubuntu install.
      3. Create a Virtualbox physical partition descriptor for the TC partition:
        • vboxmanage internalcommands listpartitions -rawdisk \\.\PhysicalDrive1
          • MY TC partition is on my second physical drive, which Windows calls \\.\PhysicalDrive1. If you have only a single physical drive, it is probably called \\.\PhysicalDrive0
          • Note that the Windows TC's partition numbering scheme does not match VirtualBox's, so you really do have to do this step! </ul>
          • VBoxManage internalcommands createrawvmdk -filename raw-k.vmdk -rawdisk \\.\PhysicalDrive1 -partitions 8
            • Substitute the file name of your choice for raw-k.vmdk.
            • Substitute the partition number of your choice for 8. You can list multiple partitions, separated with commas. </ul>
            • Move raw-k.vmdk and raw-k-pt.vmdk to \pvb\pvb-data\.VirtualBox\HardDisks
            • Use the VirtualBox GUI to add raw-k.vmdk to you list of available virtual disks (File/Virtual Media Manager/Add...)
            • Use the VirtualBox GUI to add the vmdk to your Machine's disks. Mine was added as IDE Secondary Slave. </ul>
            • Start your virtual machine via the GUI, and mount the partition from Lucid. I recommend mounting it read-only, at least until you're sure things are set up correctly. Run /usr/bin/truecrypt and mount it via the GUI. Then dismount it, and set up a shell script to run:
              • mkdir /media/tc
              • /usr/bin/truecrypt --mount /dev/sdc8 /media/tc
                • Of course, you will want to substitute YOUR correct device for /dev/sdc8 </ul> </ul>
                • Because I'm using PVB, I don't have any network interfaces created by installing VirtualBox. I needed to set up port forwarding with VirtualBox's NAT pseudo-interface. First configure a loopback adapter:
                  1. Create a loopback adapter in the host: Cpanel/Add Hardware/Yes I have already connected the hardware/Add a new hardware device/Install the hardware that I manually select/Network Adapters/Microsoft/Microsoft Loopback Adapter.
                  2. Rename the loopback adapter to "loopback1"
                  3. Bind Client for Microsoft Networks to loopback1.
                  4. Un-bind File and Printer Sharing from loopback1. This frees up port 139 on loopback1.
                  5. Bind TCP/IP to loopback1. Set TCP properties to Address=192.168.2.1, Interface Metric=9999, Enable LMHOSTS, Disable NetBIOS over TCP. </ol>
                  6. Set up port forwarding ("ubuntu-10.4" is MY guest's machine name; use your own. smb139 is an arbitrary name for the forwarding rules; use your own. 139 is the port for Windows SMB/CIFS file sharing):
                    1. vboxmanage setextradata "ubuntu-10.4" "VBoxInternal/Devices/pcnet/0/LUN#0/Config/smb139/HostPort" 139
                    2. vboxmanage setextradata "ubuntu-10.4" "VBoxInternal/Devices/pcnet/0/LUN#0/Config/smb139/GuestPort" 139
                    3. vboxmanage setextradata "ubuntu-10.4" "VBoxInternal/Devices/pcnet/0/LUN#0/Config/smb139/Protocol" TCP </ol>
                    4. Not it is time to share /media/tc from Lucid. I was lazy, so I installed KDE. Then I clicked System/Preferences/System Settings (which KDE adds, even to Gnome)
                      1. On the Advanced tab, click Samba
                      2. Workgroup=HOME (Use your choice of workgroups)
                      3. NetBIOS Name=UVM104 (Use your choice of computer name)
                      4. Server String=%h (Use your choice of server description)
                      5. Security Level=Share
                      6. Add a share for /media/tc, named tc.
                      7. Allow All unspecified users.
                      8. Users: Add kevin and kk. (Note: I created a synonym user "kk" to match my host user ID by editing /etc/password, copying kevin, renaming it to kk, keeping the same UID and GID, and passwording kk.)
                      9. /etc/service restart smbd
                      10. /etc/service restart nmbd </ol>
                      11. From Windows map a network drive to \\192.168.2.1\tc, using user=kevin. (I eventually got kk working, after I defined an SMB password for kk to match kk's password in Windows.) </ol> Some helpful links:
                        • http://www.blisstonia.com/eolson/notes/smboverssh.php
                        • http://virtualboximages.com/node/158
                        • http://www.aviransplace.com/2008/06/12/virtualbox-configuring-port-forwarding-with-nat/ </ul>

Google Calendar Sync Not Synching All Items

I had trouble with Google Calendar Sync (GCS) deleting some of my Outlook calendar items when I set it up for 2-way synch between Outlook and Google. Then I dialed it back to 1-way sync, and found that some Outlook items weren’t getting copied to Google. Bummer.

I looked in “C:\Documents and Settings\kk4056\local settings\application data\google\Google Calendar Sync\logs” and found the error message:

Participant is neither attendee nor organizer

Well excuuuuuse me! For some reason, if Google doesn’t see your email address in the invitation (perhaps you were a BCC?), it refuses to add what it considers to be someone else’s appointment to your calendar.

In my case, my Exchange ID was something like k12345@example.com. I went to GMail, and told it that I sometimes send email as k12345@example.com, and now it believes that appointments for k12345@example.com are appointments for me.