All posts by admin

Don’t Forget to Change the Sample Code

Windows 7 has the USB-to-Serial driver for my never-released development board.  Hmmm.  I’m good, but I’m not that good.

We’re using the Atmel AT91SAM 32-Bit ARM7 chip on a development board.  Apparently so is Wonde Proud because Windows 7 thinks my development board is their GPS Camera Detect.  Wonde Proud forgot to change the USB Vendor ID and Product ID from the sample code provided to them (and me) from Atmel.  A classic mistake.  I just wish they had done the same for 64-bit Windows 7 so I could use my hardware over on that platform – it would save me some time.

Windows 7 in Fusion: The 64/32-Bit Question

I created a Windows 7 Enterprise 32-bit VM and a 64-bit VM.  I wanted to see which provides better performance.  Since VMware Tools aren’t ready I treaded lightly with my tests.  Other caveats:  VMware Fusion does not support Windows 7 yet.  These are PassMark tests and not real world tests.  I didn’t run endless tests – just a handful.  Your milage may vary (greatly!).  The performance is based on Win7 32-bit (32/32).  The results are:

Win7 64-bit Running PassMark 65-bit (64/64)

29% faster on CPU
178% faster on 2D graphics
36% faster on Memory
19% slower on disk operations

Win7 64-bit Running PassMark 32-bit (64/32)

11% faster on CPU
13% faster on 2D graphics
11% faster on Memory
35% faster on disk operations

I was perplexed on the 64/64 disk performance being slower than the baseline and re-ran the test a handful of times and got similar results.  64/64 2D graphic results were impressive but not a driving factor for me.  For CPU and Memory 64/64 showed a nice bump over 32/32 and even 64/32.  In the end, the issue of whether to move to 64-bit Windows 7 is moot for me – the driver I need is only available in 32-bit so I’ll be running 32/32.

Here are all the versions used in the testing:

VMware Fusion Version 2.0.5 (173382)
Microsoft Windows 7 Enterprise [Version 6.1.7600]
VMware Tools for Windows Version 7.9.6. build-173382
PassMark PerformanceTest 6.1 (1010) WIN32
PassMark PerformanceTest 6.1 (1018) WIN64

Word Processing: Structure vs. Formatting

The state of word processing in 2009 is atrocious. Microsoft Word has all but won the race but what a bad tool it is. For years we’ve upgraded Word and exchanged one set of problems with another. Working with large documents invariably leads to a big bag of hurt. OpenOffice (NeoOffice) isn’t much better – they’ve chosen to implement a poor substitute for Word without stepping back and saying, “How can we get compatibility but also improve the user experience as well?” What we need is to get back to basic word processing and grow from there.

The Problem

Working with technical specifications in Word feels like working with a ticking time bomb. As the document gets larger and more complex you live in fear of the day in which the document’s formatting gets corrupted. Maybe it’s because you’ve pasted a section from another document. Or maybe it’s because you’ve moved a section and somehow the numbering is now inexplicably corrupted. In the worst case scenario you give up; export the document as plain text; and then reformat the document from scratch. If only Word would let you see all the formatting. Back in the day WordPerfect had “Reveal Codes” which gave you a chance to root out your problem and delete it. Instead Word hides behind a curtain of “I know what’s best for you. Let me do it.” only to be left at the alter yet again as you try in vain to figure out how to fix something broken in your document.

A Solution?

For engineering documents the biggest problem is separating formatting from structure. When I bring a section of text into my existing document I care about the numbering and structure but I don’t care about the display (font, size, tabs, rulers). In Word “Style and Formatting” are so intertwined that you’re relegated to pasting your section as plain text and then manually reformatting the pasted section. If you don’t, you run the risk of corrupting the formatting of your document.

My colleagues have expressed an interest in moving to LaTeX. LaTeX provides the control we’re looking for. It uses a Markup Language that allows you to specify the structure of the document in a separate step from the display of the document. Unfortunately this is a very un-WYSIWYG process. And worse, it severely limits what other people (marketing) can do both within the organization and outside it (partners).

Another solution?

This post was prompted by John Gruber’s mention of Pagehand. While Pagehand doesn’t seem to address the structure vs. display question, maybe a group taking a fresh look at the word processor can figure out how to solve this challenge.

Subversion (SVN) has Keyword Substitution Support

All the details are here.  But in a nutshell:

  • It must be turned on for each file via the command line.  For my project I issued:
  • svn propset svn:keywords "Revision" PuffinApp.rc

  • The setting is stored in the database so it doesn’t need to be done on other clients
  • You must enable for each keyword desired.
  • Keywords include: DateRevisionAuthorHeadURL, and Id (a brief synopsis)

Update 11/10: Cornerstone has the ability to add these directly.  Go to the Properties tab on a file and look for the Keywords field.  The key icon just below the field is there for easy entry.

    Changing Background Color in a CStatic Object

    Here’s a classic example of a seemingly easy problem actually being harder to implement.  I wanted a dialog with white static controls in MFC.  The resulting code is simple but divining the answer was no easy feat.  Ultimately it’s more a failure of documentation that it is a engineering challenge.  More details in my commented code which follows:

    Before and After
    Before and After


    HBRUSH TReaderDlg::OnCtlColor(CDC* pDC, CWnd* pWnd, UINT nCtlColor)
    {
    HBRUSH hbr = __super::OnCtlColor(pDC, pWnd, nCtlColor);


    // For static controls, draw black text on a white
    // background (instead of the default Windows
    // dialog background color)
    if (nCtlColor == CTLCOLOR_STATIC)
    {
    // Set the background color to white
    // This is a red herring. You will only affect the text
    // drawn and the static control is certainly larger than
    // the text drawn so you will have the original color
    // "leaking" out. (see pic)
    //pDC->SetBkColor(RGB(255, 255, 255));


    // Set the background mode for the drawn text to
    // transparent
    // If you use SetBkColor with SetBkMode you will further
    // compound the confusion/frustrtion. Using
    // SetBkMode(TRANSPARENT) after SetBkColor cancels
    // out SetBkColor.
    pDC->SetBkMode(TRANSPARENT);


    // The real solution is to create a brush with a solid
    // white background and return that from this function.
    // Also set the background mode to transparent.

    static CBrush mBrush(RGB(255, 255, 255)); // Solid white brush.

    hbr = mBrush;
    }


    // Return a different brush if the default is
    // not desired
    return hbr;
    }

    Fusion Bridging Broke After Software Update

    After installing a couple of Mac OS X 10.5.6 Software Updates today:

    • Security Update 2009-001
    • Java for Mac OS X 10.5 Update 3

    I received “The network bridge on device /dev/vmnet0 is not running.” error in VMware Fusion v2.0.2 (147997) when I tried to restore my Fedora 10 VM.  The Google search produced some interesting results but nothing worked.  I reinstalled Fusion and the dialog went away but network bridging still did not work.  I then uninstalled and then installed Fusion and the same result.  I rebooted my XP VM and it doesn’t have network connectivity either.

    What finally did work was to uninstall Fusion and follow the manual uninstall procedures here.  Then after a clean install network bridging is working again.

    VMware Tools in Fedora 10 Issues

    I used VMware’s instructions to install VMware Tools (VMwareTools-7.9.3-147997.tar.gz from VMware Fusion v2.0.2 (147997)) in Fedora 10 using the “Installing VMware Tools from the Command Line with the Tar Installer” section.  For the most part I feel that I was successful.  I can copy/paste and the system time updates coming out of standby which it never did before under Fedora 8.

    I am having to reconnect the NIC manually coming out of standby.  SELinux mechanism is firing and seemingly the cause of the problem.  I don’t have a solution.

    One example is: SELinux prevented mount from mounting on the file or directory “/usr/lib/vmware-tools/sbin32/vmware-hgfsmounter” (type “lib_t”) when I went into suspend and came out.  I issued the fix command explained in “settroubleshoot browser”.  It did take a few moments to complete.

    Another example is: SELinux is preventing ifconfig (ifconfig_t) “read” to /var/run/vmware-active-nics (initrc_var_run_t). This file does not exist.  I suspect this file exists when it comes out of standby but then gets deleted after the NICs are re-activated. 

    Before installing VMware Tools, I was able to boot with no problem.  Now when I boot the POST screen has two issues:

    • Mounting local filesystems: FAILED
    • Mounting HGFS shares: FAILED (This one is under “Starting VMware Tools services in the virtual machine:”).  I solved this problem by sharing a folder with my Mac from the Fusion Settings dialog for the Virtual Machine.

    Boa CGI Scripts Don’t Execute in Fedora 10

    Between my install of Boa on Fedora 8 and today’s install of Boa “boa-0.94.14-0.10.rc21.fc9 (i386)” in Fedora 10 a bug was introduced into the /etc/boa.conf file.  At some point they changed the location of the /srv/www/boa directory to /var/www/boa.  They forgot to update the ScriptAlias value in /etc/boa.conf.  Just change the svn in the path to var and then restart boa.  CGI scripts in that location will start working again.

    Don’t Panic

    It’s Tuesday and my MacBook Pro 17” (Mid 2007) succumbed to the NVIDIA GeForce 8600M GT graphics processor defect.  I confirmed I had a defective machine by using the serial number decoder ring.  What follows is what I did and how 4 hours later I sit here on my daughter’s iMac working with the same hard drive image I was using 4 hours ago on my MacBook Pro.

    Leaving work I closed the lid to put my machine to sleep.  I got home and connected it to my home office and after opening the lid I had nothing.  The machine sprang to life but the screen didn’t.  Uh-oh.

     

    I tried closing and opening the lid again – nothing.  I held down the power button for 5 seconds to force the machine to sleep and then reboot – nothing.  I removed power and the battery for 8 minutes; replaced the battery; booted and still nothing.  I powered off the machine again and tried to reset the PRAM – nothing.  

     

    At this point I realize the screen is dead.  What do to?  I jump on the Apple Retail web site and make myself an appointment with the Genius Bar at Valley Fair for 8:30pm.  My thoughts turn to how am I going to be productive without my machine?

     

    I have been using Time Machine via a Time Capsule but I’ve never recovered a drive with it and that would take a long time.  I also have a stale clone of my MacBook Pro drive built with SuperDuper.  My goal is to bring the clone drive up-to-date.  I grab my firewire cable, my dead MacBook Pro and my stale USB Laptop Drive used for cloning and head for my daughter’s iMac.  I connect the USB Drive to the iMac and the two Macs together via the firewire cable.  I then turn on the MacBook Pro and hold down the letter “T” to start it into Target Disk Mode.  Voila, my MacBookPro’s internal hard drive appears on the the iMac desktop.  I then launch SuperDuper on the iMac and have it Smart Update between my MacBook Pro and the clone on the USB drive.  

     

    After that process completes I shut everything down and drive to the Apple Store; hoping beyond hope that there is some trick I’ve missed.  Unfortunately there isn’t.  I’m informed there is a motherboard in stock and if it isn’t already assigned it will take a couple days.  Otherwise they’ll have to wait for the part and I won’t get it until next week.  Ugh.  I can hear my friend Drew in my head lamenting the no “in home” service from Apple.  I signed the paper work and drove home.

     

    Back at home, I’ve absconded with the girl’s iMac and have it in the office.  Now for my final trick.  With the iMac off, I plug in my cloned USB Drive.  As I turn on the iMac I press the “option” key.  This presents me with a list of bootable drives.  The internal iMac drive or the external USB drive.  I select the external USB Drive and poof – here I am back in my laptop environment telling you how I’m back to being productive in 4 hours.  When I get my machine back I’ll reverse the Smart Update process and bring the MacBook Pro drive inline with the cloned backup.    

     

    Update: Apple turned around the machine in less than 24 hours!

    Windows File Sharing Fails with Error Code -6602

    For the past couple days I’ve been unable to mount my Windows XP Professional Version 2002 SP3 home server from my Mac OS X 10.5.5.  On the Mac I would get the error “Sorry the operation could not be completed because an unexpected error occurred. (Error code -6602)”.  When I tried the share from another XP system I got, “\\totoro\Documents is not accessible. You might not have permission to use this network resource.  Contact the administrator of this server to find out if you have access permissions.  Not enough server storage is available to process this command.”  A Google search didn’t produce any useful results.
     
    I then remembered to check the XP Event Viewer system log.  In there I found a clue, “The server’s configuration parameter “irpstacksize” is too small for the server to use a local device.  Please increase the value of this parameter.”  Clicking on the accompanied link took me to a Microsoft page that said to change the registry value HKLM\System\CurrentControlSet\Services\LanmanServer\Parameters\IrpStackSize to the default 15 (decimal).  My system didn’t even have the DWORD value so I had to create it.  A restart is necessary after working with this value.
       

    After I rebooted I could connect to the shares again normally.