Wednesday, July 29, 2009

Other Virtualization Solutions to Play Audio in Ubuntu 9.04

I was running 64-bit Ubuntu 9.04 (Jaunty Jackalope). I wanted to use IrfanView to listen to .wav files. I had been using it in a VMware Workstation 6.5.2 virtual machine (VM) running Windows XP, but I had lately been having a problem with stuttering audio playback, and my efforts to fix it had failed so far. It was possible that I had not correctly applied all of the suggestions I had encountered, so one option was to go back and review the recommended steps, perhaps by spending a few weeks working through the Comprehensive Video & Multimedia Howto. Since there seemed to be users whose problems persisted after trying those suggestions, however, I thought perhaps I should try out some alternatives. I posted a question about the VMware problem and left it at that for the time being, reserving the option of trying the supposedly surefire solution of installing a second sound card.

One alternative was to try running IrfanView directly on Ubuntu, with the assistance of Wine. I had made some progress on that, but that, too, was still pending resolution of a posted question. Another possibility I had overlooked was to use VMware Player instead of VMware Workstation. Player (a free download) had been installed when I had installed Workstation, and was now available to me in Ubuntu at System Tools > VMware Player. I opened a VM that I had powered down (i.e., that was not merely suspended) in Workstation. I hadn't really used Player before. I was pleased to see that it seemed to run VMs a little faster and simpler than Workstation.
I tried playing audio in VMware Player. To my surprise, both IrfanView and Windows Media Player played .wav audio files just fine, with no stuttering! I had shut down the machine the previous evening and powered it back up again that morning, so I wondered whether the cold restart had made a difference. I started up Workstation, resumed a previously paused VM, and tried playing .wav files in there. Those, too, played fine. Apparently the restart had indeed temporarily fixed the problem - might, indeed, have been the reason why the other solutions I had tried had seemed to work. I had rebooted the system previously, but it now seemed that I simply hadn't left it turned off long enough.
Since the problem seemed to be fixed, I abandoned (at least for the time being) the other possibilities that I had begun to explore. In case I (or someone else) needed them, however, that list of possibilities included the following:
  • Perhaps I could successfully run IrfanView inside a virtual appliance. These would seemingly be subject to the same VMware Workstation problems, but perhaps not, somehow. I searched the VMware Virtual Appliances webpage for IrfanView but, not surprisingly, found nothing. My Google Search for WinXP applications in the VMware catalog didn't seem to turn up anything special, but a search for "Windows 7" indicated that, for $10, I could download something called the Bagvapp RC Windows 7 beta. They said this thing also came with additional software installed. (Microsoft provided additional information on this free (possibly bug-filled) Release Candidate.) For ten bucks, of course, it made huge good sense to just buy the pre-installed VM from Bagvapp; but since I didn't really need it, I contented myself with signing up for Bagvapp's RSS feed. (Most of their stuff was free, but they said they were swamped with orders for the RC and had to pay for a ton of bandwidth.) There also seemed to be other free Windows 7 beta virtual appliances, such as one from Tuxdistro, although not all appeared to be as fully tricked-out as the one from Bagvapp. The Win7 RC, in any case, was said to be valid for another eight months, until March 2010.
  • In March 2009, Jonathan DiPrizio discussed four virtualization options in Linux. Those four were Qemu, Parallels, VMware, and VirtualBox. DiPrizio found VMware and VirtualBox to be the clear winners among these four, and actually preferred the latter. So I would have the option of trying to run IrfanView in VirtualBox, if the VMware problems continued.
  • I had also located Wikipedia articles on application virtualization and platform virtualization. These led to consideration of other possibilities, such as Microsoft Virtual PC and DosBox.

Tuesday, July 28, 2009

Review: Olympus WS-321M Digital Voice Recorder

I bought an Olympus WS-321M Digital Voice Recorder (DVR) in January 2009. I sold it on eBay not much thereafter, and went back to using an Olympus VN-960PC instead. Here is a summary of the reasons for that decision.

The most immediately noticeable advantage of the VN-960PC is the audio volume. It picks up everything and plays it back loud and clear. The WS-321M was much harder to hear. It appears that the latter does not normalize its audio recordings effectively. This, by itself, was such a marked difference as to help me decide which recorder I preferred. The same problem occurred with input from a remote microphone; there was also a problem with distortion of loud sounds. It really felt as if Olympus had taken a substantial step backwards in these regards.
One feature I like on the VN-960PC is that it has a red LED light that blinks when you pause recording. You don't have to read anything; you can tell right away that you didn't accidentally push the wrong button. Speaking of buttons, on the VN-960PC it is much easier to tell, without looking, which button you are pressing. Also, when you do pause the DVR, you can hear a click on the recording on the WS-321M, but not on the VN-960PC - which is distracting if you are dictating something one phrase at a time, as you think through it. And when you start recording with the VN-960PC, it starts recording almost instantly, whereas the WS-321M requires a second or so to get warmed up. It may not sound like much, until you listen back to the things you thought you had captured well on the recorder.
The WS-321M is white, with relatively large flat surfaces. In other words, it looked like it was designed to appear beat-up and dirty. By contrast, I carried the VN-960PC for years, in pockets with keys and such; I dropped it; and after all that it still looked pretty much the same. I did like that the WS-321M boasted long battery life with just one battery. The downside was that, when the battery did die, it did not save as much as it had already recorded, as the VN-960PC does. Instead, whatever you were recording is lost in its entirety if the juice dries up midsentence.
I liked the WS-321M for having the date and time right in the names of the files it was recording. On the VN-960PC, the DVR would record the date and time, and you could see it in the supplied Digital Wave Player software; but if I wanted the date and time to be part of the filename for multiple recordings, the best solution I could figure out was to display those data onscreen, use a program like Aqua Deskperience to capture them, do a directory listing of filenames at the DOS prompt in Windows XP, and then use an Excel spreadsheet to merge the two. Not a pretty sight.
The WS-321M did have the advantage of being more Windows-compatible. I didn't need an adapter cable to transfer recordings from the DVR to the computer (although they did say I was supposed to use the cord they provided), because it was designed with a standard USB connector right inside its case. When I connected the WS-321M to the computer, it appeared as a regular USB drive in Windows Explorer; not so with the VN-960PC. Also, in my limited testing I did not find that connecting the WS-321M to the computer caused the computer to reboot. The VN-960PC did cause that problem. In years of experience, I noticed that this occurred primarily when I had already connected the DVR once since my most recent reboot. That is, after uploading my recordings from the VN-960PC to the computer, I would try not to do so again until after the next reboot. This problem happened on a couple different computers, so I do think it was a problem with the VN-960PC. I also sometimes got an unwanted reboot when I'd had the computer on for a day or more at the time when I connected the VN-960PC to it.
Finally, see my other post if you're thinking about using a DVR to record speech that will then be converted to written text.

Installing and Using IrfanView for Audio in Ubuntu 9.04

I have an Olympus VN-960PC digital voice recorder (DVR). It saves its recordings in compressed .wav format files. When I listen to those recordings, I usually use IrfanView to listen to them. I have been using IrfanView for years, and have found it to be markedly more useful and flexible than any other program for many image editing, audio listening, file viewing, and other multimedia tasks. It is really amazing freeware.

I use IrfanView for this particular task because I have not yet found another program that allows me to move from one recording to the next so quickly. I listen to the notes I have saved on the DVR; I highlight some of them, one by one, in Windows Explorer, and then I cut and paste the selected recordings to subfolders for further use. I have developed the habit of beginning many of my recordings with a single word (e.g., "Monday" or "shopping"), so I know right away which folder it goes into. Sorting a number of audio recordings this way is very fast.
IrfanView was a Windows-only program. I could not find anything in the Linux world that could replace it, for my purposes, so I looked for ways to run it in Ubuntu. One possibility, which I used for a long time, was to run it in a virtual machine in VMware Workstation (or perhaps I could have used a freeware virtualization program) on Ubuntu. I was engaged in a long-term effort to move away from dependence on Windows, though, and sometimes virtual machines could be somewhat clunky.
Finally, at one point I reached a situation where I invested a bunch of time and still could not resolve a VMware audio problem. This seemed to be the opportunity to try running IrfanView, a Windows program, in Ubuntu. I planned to do so via Wine, which (in that wacky Linux way) is short for "Wine is not an emulator." The stable release of Wine at this point was 1.0.1, and that is the version that was available in Ubuntu's (System > Administration > ) Synaptic Package Manager. I searched for wine in Synaptic, marked it, and clicked Apply. It downloaded and installed the necessary stuff. Next, following the steps I had researched when I had tried Wine a year earlier, I proceeded as follows, typing these commands into Ubuntu's (Applications > Accessories > ) Terminal at the command prompt:
sh winetricks mfc42
Then, in Ubuntu's File Browser (Places > Computer), I navigated to the folder where I had saved the downloaded IrfanView program. This program was called iview425_setup.exe. I copied the Location of this folder from the address bar at the top of File Browser and put it, between quotation marks, after a cd command in Terminal, as follows:
cd "/media/CURRENT/Miscellany/Installation/Programs"
and then I typed the Wine command to install IrfanView:
wine iview425_setup.exe
This gave me the regular IrfanView Setup dialog, just as if I had been installing it in Windows. I told it to install a link on the desktop, and it did; but I could not get that link to run. So I used cd again, to get to where it had been installed (cd "/home/ray/.wine/drive_c/Program Files/Irfanview", where "ray" was my username), and typed wine iv_uninstall.exe. This removed everything except iv_uninstall.exe itself from that folder; I deleted that last file manually.
I decided to try an older, simpler version of IrfanView. I went to and downloaded IrfanView 3.0. Then, as above, I used cd to navigate to the place where the downloaded file was. In this case, the program (after extraction from the downloaded .zip file) was named i_view32.exe, so I used that instead of iview425_setup.exe in the installation command presented above, as follows:
wine i_view32.exe
Unfortunately, this installer did not run at all. About this time, I rediscovered Wine's reports on the various efforts people made to run different Windows programs under Wine. In particular, I found the reports on IrfanView. These, supplemented with the instructions and replies posted at, seemed to indicate that what I really needed was to use relatively recent versions of both Wine and IrfanView.
To get a version of Wine more recent than the one that was available in Synaptic (above), I had to modify Synaptic. That is, I had been using Synaptic out of the box, the way it came in the original Ubuntu installation; but Synaptic could be configured to look in additional places for more software. In this case, I wanted it to look in the WineHQ repository. So I went back into Synaptic and clicked on Settings > Repositories > Third-Party Software > Add. In the APT line box, following the WineHQ instructions for Ubuntu 9.04, I typed this:
deb jaunty main #WineHQ
Then I clicked on Add Source. Next, while still there in Software Sources, I went to the Authentication tab and clicked on Import Key File. I didn't have the key file yet, so I had to go to the webpage that they call Scott Ritchie's Key to get it. I saved that page (in Firefox, the command is File > Save Page As). Its default name was Scott Ritchie.gpg, so I accepted that. So now, back in the Software Sources > Authentication > Import Key File window, I navigated to where I had saved Scott Richie.gpg and selected it. Then I clicked on Close > Close. Now, back in Synaptic, I clicked Reload. I could have done a Quick Search, there in Synaptic, to see that Wine now needed to be updated; but I decided instead to update everything on my system that might need to be updated at that point. So I closed Synaptic and went to System > Administration > Update Manager and installed everything it had for me.
Normally, it can be more convenient and/or easier to remember one's way around by using the Graphical User Interface (GUI), as just described. In this case, though, for some reason the whole thing about Scott Ritchie was a little weird and hard to remember (though not Scott Richie himself, oh, no, we'll never forget ol' Scott), and I would probably have found it simpler just to copy and paste these lines into Terminal from the bottom of the WineHQ instructions page:
wget -q -O- | sudo apt-key add -
sudo wget -O /etc/apt/sources.list.d/winehq.list
sudo apt-get update
sudo apt-get install wine
but whatever. It was done, and I had my other updates to boot. Plus, I got a free opportunity to screw around with Synaptic. (Later, I discovered that I should have uninstalled the older version of Wine first. I also discovered that apparently I should have been doing my work in a folder dedicated to Irfanview.) Now, at any rate, I had some more recent version of Wine installed. To see which one, I went back into Synaptic and searched for Wine again. It was 1.1.26. This was more bleeding-edge than the 1.1.14 that they had used in that Wine-Reviews article. I wasn't sure how to get back to 1.1.14, though, and anyway that was a half-year earlier, and they were using Ubuntu 8.04, so maybe this was better for my purposes. The Wine-HQ report indicated that Sven Plaga had just recently used 1.1.25 with great success. The version of IrfanView that Sven had used was apparently 4.25. He had used it with a beta release of Ubuntu 9.10, which I wasn't up to yet; but if it worked now, I figured that might defer whatever updating I might otherwise have to do later.
So now I tried again to install IrfanView on this newer version of Wine. I had already done the whole winetricks and mfc42.dll routine (above), so this simplified the process for me. Following the Wine-Reviews and Wine-HQ instructions and comments (with some help from some older Ubuntu Community Documentation), I repeated the foregoing steps of navigating to the folder where I had stored iview425_setup.exe, and then I typed this:
wine iview425_setup.exe
The installer ran, but again I couldn't get IrfanView to start. This time, though, it was not surprising. According to the instructions, I next needed to go into the installation directory (in my case, /home/ray/.wine/drive_c/Program Files/IrfanView) and delete the i_view32.ini file. The comments indicated that IrfanView would replace it with a simpler i_view32.ini that would cause no problems. I had forgotten to download and install the IrfanView plugins, so I did that now:
wine irfanview_plugins_425_setup.exe
Now I had an embarrassment of riches, in terms of IrfanView launchers. There were three different Ubuntu icons on my desktop, and they all worked. I deleted the two that didn't have the Ubuntu red cat (or whatever that is) on them. I also saw that Wine had installed itself as an option under Applications on the Ubuntu menu, and under Wine > Programs I had an IrfanView menu plus an apparent freebie, a link to an actual working copy of Notepad.
The key question, now, was whether IrfanView would now function in Ubuntu as it had functioned in Windows, for purposes of listening to and moving through .wav files. I went into IrfanView's Options > Properties and adjusted the settings to my preference. Then I double-clicked on an audio file . . . and watched it open in Totem Movie Player. OK, so this was my opportunity to learn how to set the default application program in Ubuntu. I started to Google for some guidance, and then I realized this was probably somewhere under System > Preferences - and, sure enough, there it was: Preferred Applications. I went to Multimedia and indicated that I wanted to use a Custom multimedia player. I right-clicked on the IrfanView desktop icon and went into its Properties > Basic tab. I copied its Command line to Terminal, to try it out. It worked: IrfanView started. So then I copied that same command line into the Multimedia command box. But either way, with or without the "Run in terminal" box checked, it didn't default to IrfanView; I was still getting Totem. So yes, I had to Google the question after all. The answer was easy enough (apparently a lot easier than it had been a year earlier): right-click on a .wav file and select Properties > Open With > IrfanView > Close.
Ah, but now, when I double-clicked on a .wav file, I got an error message:
Error: Windows can't play this file! Windows error text: Invalid MCI device ID. Use the ID returned when opening the MCI device.. You can try to install additional video/audio codecs from this site: or try the DirectShow option in Properties->Video.
Weird thing: I got that same error message three or four times in a row. I'd click OK, and there it would be again. And then, when it stopped, I got a little "No Device" window and the audio file played after all. But then that No Device window wouldn't go away; I had to kill IrfanView to banish it. I went into IrfanView's Properties and tried clicking the DirectShow option as advised. Same result. Seeking truth, I went back to Google. And I could tell that I was at last getting close to the truth indeed, because this time my search turned up only a small number of results, none of which seemed relevant. Fortunately, I was able to revise my search into something even less helpful. As the day drew to a close, I posted a question on this at Wine-HQ. Someone there suggested that I should post it as a bug in Wine, so I did that. I didn't know how long it would take them to address and resolve this bug, if that's what it was, so I decided it was time to post this message as-is and think about other ways of getting Irfanview to work.

Saturday, July 25, 2009

How to Find a Large Number of Random Files on Your Computer

I had a list of more than 1,600 old files that used to exist on my computer. I wanted to find out if these files were still there and in good condition, or if they had gotten lost or accidentally deleted over the years.

I was using Windows XP. If it had been just a few files, I could have done a search manually, one file at a time. (I use WinXP in classic mode, so for me the sequence would be Start > Search > For Files or Folders.) But with this large number of files, I needed to automate the process. Here's the approach I used.
1. Spreadsheet. Put the list of files in Excel. If you don't have Excel, one free alternative is the spreadsheet in OpenOffice. Sort the list of files alphabetically and view it to see if you have any duplicates. Duplicates will make your computer repeat an unnecessary search. These searches can take a long time if you have a lot of files. If you know how, you can use the spreadsheet to filter out unique records. In Excel 2003, that option is in Data > Filter > Advanced Filter. For me, this reduced my starting list of 1,600 file names to just a few hundred.
2. DOS. Write a DOS command for each file, in the spreadsheet column next to the filename column. The DOS command will search for the file. The command for this purpose is DIR. (Capital letters aren't necessary in DOS commands, but I'll use them here for clarity.) Most DOS commands come with additional options. In this case, I used the S, B, and -C options. To write the DOS command automatically for all of the files in my list, I figured out the command format in the first row of the spreadsheet and then just copied it down to all the other rows. Using my first row as an example, the command I wanted was DIR "FILE1.DOC" /S /B, with the quotation marks. Those options would (a) search all subdirectories for the file and (b) give me the location of the file on the same line as the filename. My list of files was in column G of my spreadsheet, so on line 2 of column H, under the column title (i.e., in cell H2), I wrote this:
="DIR "&CHAR(34)&G2&CHAR(34)&" /S /B"
with the quotation marks. CHAR() inserts a symbol; 34 is the number of the quotation mark symbol. That is, CHAR(34) allowed me to show a quotation mark in the result, without confusing Excel as to what that quotation mark was supposed to mean. Thus, when I was done entering those characters in cell H2, the cell looked like this:
These characters, if entered as a DOS command, would search for the file named FILE1.DOC and would tell me where it was, if it existed. The quotation marks were useful because some of my filenames contained spaces, such as "Letter to Joe.doc." Without the quotation marks, DOS would stop at the first space, assuming that the name of the file was simply "Letter," and the rest of the filename would confuse DOS and yield a failed search. When I had the formula for the search command I wanted to use in DOS, I copied it down to all rows in the spreadsheet. Thus, for instance, cell H3 now displayed a search for a file called FILE2.DOC, in this form:
3. Redirect. Indicate that you want to save the search results in a file. To do this, I needed to add a redirection sign to my commands. The redirection sign ">>" would create the output file if it didn't exist, and would append the results of the current command to the file if it did already exist. I went back to cell H2 and revised its formula to look like this:
="DIR "&CHAR(34)&G2&CHAR(34)&" /S /B >> "&CHAR(34)&"D:\File List.txt"&CHAR(34)
I needed the additional CHAR(34) items because my output file name, "File List.txt," contained a space. When I entered that revision in cell H2, the resulting command looked like this:
DIR "FILE1.DOC" /S /B >> "D:\File List.txt"
This would list all of the found files in an output file located at the root of my drive D. If I didn't know the exact filename I was searching for, I would use wildcards in my DIR command. For example, a search for FILEX*.* would give me all files whose names began with FILEX. Finally, copy this revised DIR command down to all rows in your filelist spreadsheet.
4. Batch. Copy all of these commands into a DOS batch file. To create a DOS batch file, open Windows Notepad and copy and paste from the spreadsheet to Notepad. In my case, the first two lines in Notepad now read as follows:
DIR "FILE1.DOC" /S /B >> "D:\File List.txt"
DIR "FILE2.DOC" /S /B >> "D:\File List.txt"
Save the DOS batch file, but don't close it yet. For simplicity, I saved mine to the same place as the output file (i.e., D:\), and I called it simply BATCH.BAT. The BAT extension is important; it makes the file executable. Without that, you've just got a text file that won't run. Also, in Notepad, be sure to save BATCH.BAT in ANSI format. You will find this option under Notepad's File > Save As > Encoding option.
My batch file was now sitting in D:\, but the place I wanted to search was on drive E. So I needed to add commands on the first two lines of BATCH.BAT. While I was still in Notepad, then, I went to the top of BATCH.BAT and inserted these two lines:
CD \
These commands would tell DOS to go to drive E and then go to the root directory (which is also known, confusingly, as the "top" of the DOS subdirectory tree) before it starts its search. Now it was all set to run its searches across the entire drive E. Of course, I could go back into BATCH.BAT later and change its first line to refer to drive F instead, and then it would run the whole search again on drive F and would append the results to my D:\File List.txt file. (To edit a batch file, right-click on it and select Edit.) To automate the whole thing, of course, you could just repeat the contents of BATCH.BAT in a separate batch file for drives E, F, etc., and run them all at the same time (though you'd better do a global find-and-replace so they aren't all trying to write to File List.txt at the same time); or if you didn't want them all running at once, you could just copy and paste the list of commands again and again in BATCH.BAT, adding a line in front of each set to direct the computer to drive D, then E, then F, etc.
If you would like to test any lines from BATCH.BAT at any time, you can copy and paste them to a DOS command box. You can open a DOS command box by going to WinXP's Start > Run option and typing CMD into the space (and then hit Enter). You can also test the batch file as a whole by saving some of its lines into another batch file (let's call it X.BAT) and running that.
Note: when you're done with these batch files, delete them or rename them without the BAT extension. For instance, you might rename BATCH.BAT as BATCH.TXT. You don't want executable batch files sitting around, ready to go off and do all kinds of strange things if you accidentally click on them. You can put explanatory comments into batch files, but be sur eto precede each comment line with "::" or "REM" (short for "remark"). If you don't "comment out" your textual remarks in a batch file, DOS will try to run them as though they, too, were commands.
5. Run and Wait. Used to be known as "hurry up and wait," but then life sped up. (Kidding.) To run BATCH.BAT, save it with the changes just described, and then go to D:\ in Windows Explorer and double-click on it. The search can easily take hours if you are searching for a lot of files on several large hard drives.
6. Problem: Long Directory Names. As I watched the command run, I saw that I was getting an error message. It said, "The directory name [name of folder] is too long." It seemed to be doing this for one folder in particular. When I checked that folder in Windows Explorer, I found that it was buried so deep that I could not even view its contents. I killed the CMD window where BATCH.BAT was running, moved that deeply buried folder to a shallower location, deleted File List.txt (so that it would not contain repetitive information), and then re-ran the batch file. This fix told me that DOS commands in WinXP did not suffer from the much shorter file name limits found in original DOS. (If this hadn't worked, I was considering a revised batch file in which I would first have the system go to each subdirectory and then run its DIR command there. This approach might have involved printing out the directory tree and using the results as input to DIR.)
7. Further Operations. The foregoing steps resulted in a list showing that some of the files I sought did indeed exist on my computer, and showing where they were. That was the purpose of this blog post, so I won't detail additional steps. Briefly, though, in my case I wanted to gather those files in one location, so that I could take a look at them. I created a folder (D:\Gather) for the purpose. I could have copied this list of files into an Excel spreadsheet, and (using the same kind of formula as above) could have developed, for each of these files, a new batch file that used the DOS MOVE command to achieve the move. Each line in that batch file would use basically this format:
MOVE /-Y "D:\Folder\Subfolder\Filename.doc" D:\Gather
The Excel spreadsheet would give me a count of how many files I was expecting to find in the Gather folder, and of course Windows Explorer would show me how many actually made it. Before doing that in Excel, though, I realized it would be easier, with search and replace, to add the necessary ingredients to each line using Microsoft Word. Since not all filenames ended with ".doc," I had to do at least one search and replace involving ^p (Word's formula for the end of a line). Note that Word may default to using smart quotation marks, or may otherwise insert characters that won't run as plain text in a batch file, so be sure to do a final check (and run one or more search-and-replaces, copying samples of the smart quote and an actual, typed Notepad-style quotation mark from the text and pasting it into the search box, if needed) in Notepad. If you want to preserve the error messages (if any) produced by DOS in this process, you may want to run BATCH.BAT from the DOS command line instead of double-clicking on it in Windows Explorer.
As always, if you find this helpful, please enter a comment. Cheers!

Wednesday, July 22, 2009

Ubuntu 9.04, VMware Workstation 6.5.2: Failed to Open Sound Device

I wanted to have multiple virtual machines (VMs) open at once in VMware Workstation 6.5.2, running on 64-bit Ubuntu 9.04 (Jaunty Jackalope). If I tried to do this in a single session of Workstation, it would crash or malfunction whenever I tried to close or suspend or de-maximize one of the VMs. The workaround I arrived at was to open multiple sessions of Workstation, each dedicated to just one VM.
After starting to use this approach, I got an error message telling me that I had too many VMs. I didn't write down the exact wording of that message, but shortly thereafter I got another one, one that I had encountered previously: trying to play sound in a VM gave me a "Failed to open sound device /dev/dsp" error message.
At about the same time, it seems, there was a new version of VMware Tools. I installed that on each of my VMs. I don't know if that new version materialized before or after this audio problem, or whether it was involved in the creation or solution of this audio problem.
I first tried an approach that I had tried before: replace "/dev/dsp" or "Auto detect" with "/dev/audio" in each VM. To change that, I had to power down (not just suspend) each VM, close Workstation, and then start Workstation again as root (i.e., type "sudo vmware" at the Terminal prompt). Then, in Workstation, go to VM > Settings > Sound Card > Use physical sound card. There, type in "/dev/audio" and save. Then save. Repeat for each VM. Then exit and restart Workstation as an ordinary user.
At first, that seemed to solve it for me, but then the problem returned, so I tried the suggestion to (1) install "paprefs" in Synaptic, (2) go to Ubuntu's System > Preferences > PulseAudio Preferences, (3) check the top-level boxes on all three tabs, and (4) reboot. Then, in each VM, I went to VM > Removable Devices > Sound Card > Connect. This time for sure: I was able to hear audio in each VM. But then, after a day or two of using the system, I was getting a "Failed to open sound device /dev/audio" error message.
The rest of the message, at least in this case, was, "Device or resource busy. Failed to connect virtual device sound." "Busy" seemed to imply that another VM, or Ubuntu itself, was hogging the sound resource. The sound card device was disconnected in all three of the VMs I had open at that time, but I was getting sound in Ubuntu (System > Preferences > Sound > Test). It seemed the problem might apply to VMware generally. To make sure VMware was able to access my soundcard, nxmehta suggested these steps:
sudo apt-get install alsa-oss
echo '#!/bin/bash' > ~/vmware
echo ' exec /usr/bin/vmware.orig "$@"' >> ~/vmware
sudo mv /usr/bin/vmware /usr/bin/vmware.orig
sudo mv ~/vmware /usr/bin/vmware
sudo chmod 755 /usr/bin/vmware
sudo chmod +s /usr/lib/*
I tried them and they didn't work. Rereading his post, I guessed (he didn't actually say) that I should have shut down VMware before trying. When I rebooted and connected the sound card again (VM > Settings), it worked. But the next day, after a bit of usage and another reboot, it was giving me stuttering sound. This was happening even when I was using only one VM. Another thread had a couple of suggestions, including installing a second sound card dedicated to VMware. The suggestion I tried, from that thread, called for typing "sudo gedit /etc/pulse/daemon.conf" and then changing some settings, as follows:
high-priority = yes
nice-level = -11
realtime-scheduling = yes
realtime-priority = 5
default-fragments = 4
default-fragment-size-msec = 4
resample-method = speex-float-3
Some of these changes were already made in my daemon.conf file, but realtime-scheduling was originally no, resample-method was src-linear, default-fragments was 8, and default-fragment-size-msec was 10. I unintentionally made these changes while VMware Workstation was still running. All of my VMs were either suspended or powered down. I then exited and restarted Workstation and fired up one of the powered-down VMs in which I had just encountered stuttering audio. The audio was still stuttering. Someone suggested that the problem may have arisen because s/he did an upgrade rather than a clean installation of Ubuntu 9.04, but in my experience I did have days of successful use of audio on the upgraded system before this started happening. Moreover, I was not having the stuttering audio problem when I played audio in Ubuntu, only when I played it in a Windows XP VM.
In case it was a Windows problem, I installed the K-Lite Mega Codec Pack in my WinXP VM and rebooted but, alas, this did not prove to be the silver bullet, and the problem occurred regardless of whether I played audio in IrfanView, Windows Media Player, or Media Player Classic. I powered up another VM that had been suspended during the foregoing operations and verified that it, too, was still having the stuttering problem.
Several days passed. It seemed that I would have to go back through the various suggestions, correct my mistakes, re-try what I had seemingly done right, and keep digging for more solutions. This, I knew, could be a huge time sink. I decided instead to see if I could find an alternative. Since I wanted to reduce my dependence on Windows anyway, I looked into the possibility of using IrfanView, at least, on Ubuntu itself, via Wine. That investigation is the subject of another post which, like this one, appears in my blog this month.

Tuesday, July 21, 2009

Suggestions for a Varied Approach to Running

The contents of this post have been moved to a post in my running blog.

Sunday, July 19, 2009

Recognizing Partitions Automatically in Ubuntu 9.04

In Ubuntu 9.04 (Jaunty Jackalope), disk partitions normally remain unmounted until you mount them manually. One way to do this is to start Ubuntu's File Browser (also known as Nautilus). You can do this by choosing the Places > Computer menu option. In File Browser, just double-click on the drive you want to mount, and its name will appear under the File System > Media folder there in File Browser. You can also mount drives by typing commands into Ubuntu's command-line window (Applications > Accessories > Terminal). First, type "sudo mkdir /media/[drivename]" to create a mount point. After doing this for all unrecognized drives, type "sudo mount -a".
But instead of doing this sort of thing, I wanted the system to recognize my drives on bootup, so that I would not have to mount them manually each time I rebooted. In my first approach to this problem, I typed "sudo ntfs-config." This approach worked OK on one computer, where I was doing a clean installation -- where, that is, I had formatted the partition before installing 9.04 on it. But on another computer, I installed 9.04 on top of 8.04 without formatting the partition. This was advantageous in that it preserved lots of files and settings from before. The drawback was that I was running into funky problems with ntfs-config.
On this system, I got an error message when I ran ntfs-config. The message was, literally, "Error : An error occured when trying to configure [partition name], please retry. Thanks." (For those who are searching with the correct spelling, let me retype that error message: "Error: An error occurred when trying to configure . . . ." When I tried to examine the partition in GParted (i.e., System > Administration > Partition Editor (see above)), I got this: "Warning: Unable to read the contents of this file system!" The partition had been available a minute earlier, when I had booted into Windows XP, and I had shut down WinXP normally before rebooting into Ubuntu. So I didn't think the partition was truly hosed.
I found a very, very long thread on the subject, but post no. 2015 in that thread said the thread's advice was outdated for purposes of newer versions of Ubuntu. In another thread, someone said they got this error message after installing a newer version without formatting the partition, and solved it by deleting the mount points. I had a fresh backup of the partition in question, so I tried taking that approach. First, I opened File Browser and went to File System > Media > CURRENT. File Browser said that partition was empty. When I right-clicked on it, however, File Browser didn't give me an option of deleting it. Its Properties said it was owned by root, so I logged in as root (see above), typed "cd /media", typed "dir" to make sure CURRENT was there, typed "dir CURRENT" to make sure it was empty, and then typed "rm -r CURRENT" to delete it. I restarted the system, started File Browser, went to Computer (in the Tools bar), double-clicked on CURRENT, and it was there, with all its contents. CURRENT was formatted in ext3 (i.e., Linux). I had another partition that was having the same problem. It was formatted in NTFS (i.e., Windows). But now that I had rebooted, it too was available and looking fine.
I dropped this issue for the time being. Next day, when I rebooted, I found that, predictably, the various partitions were not mounted. In Terminal, I typed "sudo gedit /etc/fstab." My fstab file did not show the partitions I wanted to be mounted automatically. I reviewed one of my old posts on ntfs-3g. It seemed to say that ntfs-config was the solution. I tried running ntfs-config again. This time, it ran. It recognized two NTFS partitions. Now I just had two ext3 partitions to set up for automatic mounting. I went back into fstab and saw the lines that ntfs-config had added. I hadn't thought to save the fstab file from my previous installation; it would have been handy to copy over the relevant lines. From the previous post, I gathered that the trick was to write something like this in fstab:
/dev/sda3 /media/VMS ext3 defaults 0 0
for the VMS partition, and likewise for the other ext3 partition. I double-checked that I had the right device addresses by checking them in System > Administration > Partition Editor (i.e., GParted). I rebooted, but the ext3 partitions were still not automounted, though the NTFS partitions continued to be automounted nicely. I didn't know why the line just shown, for the VMS ext3 partition, did not work in fstab now; according to the old post, it had worked in Ubuntu 8.04. Ubuntu documentation said something about pysdm, so I looked into that. They suggested typing this into Terminal:
sudo apt-get install pysdm
but I saw it was available in Synaptic (i.e., Ubuntu's System > Administration > Synaptic Package Manager menu pick), so I used that instead to install pysdm. I typed "pysdm" at the Terminal prompt, but got an error message indicating that I had to have root privileges, so I tried again with "sudo pysdm." (Also available via System > Administration > Storage Device Manager.) That gave me a Storage Device Manager (SDM) window that listed some, but not all, of my partitions. I noticed that, if I started pysdm while I still had the foregoing /dev/sda3 line for my VMS partition in my fstab file, SDM would not give me an option of configuring the VMS partition; but if I deleted that line from fstab and then started pysdm and clicked on sda3, SDM would give me a "Configure now?" dialog with the message, "/dev/sda3 hasn't been configured. Do you want to configure it now?" I said OK. I told it to set the mount point to File System > Media > VMS. Then I clicked on the Assistant button and saw that the option was checked that said "The file system is mounted at boot time." I also checked the option that said, "Check file system at mount time" on the options dialog's Mounting tab. I didn't change any other options. When I checked OK to leave Assistant, I saw an error message in Terminal: "wrong fs type, bad option, bad superblock on /dev/sda3, missing codepage or helper program, or other error." I went back into Assistant and removed the "Check file system" option I had just checked. This time, when I left Assistant, I got Warning messages that said, "Unknown option: rw" and "nouser is not suitable for user" and "Unknown option: async." I clicked on the "Set defaults" button in SDM and then clicked Apply. This produced no additional Warning messages in Terminal. Trying once more, I just went into Assistant and immediately executed, and this did produce the same Warning messages, plus an additional one that said, "Unknown option: defaults." I tried just emptying out the Options box altogether in SDM. Then I clicked Apply. I did the same with the other ext3 partition that was not yet mounting automatically. I restarted the system.
It occurred to me that I may not have restarted the system previously, but may merely have logged out and logged back in. Ubuntu 9.04 seemed to require two steps to reboot, and it seemed that I had forgotten to take that second step last time around. This occurred to me right around the time when I tried to restart the system and found that it froze with a black screen. Evidently my fstab file was not presently in an acceptable form. I punched the computer's reset button and rebooted with the Ubuntu installation CD, chose the "Try Ubuntu" option, and edited fstab as above. (Note that there's an fstab on the CD too; make sure you're editing the one on the hard drive.) I saw that I had failed to add the preferred mountpoint for one of my ext3 partitions: it said "/media/sdc5" instead of "/media/CURRENT." I fixed that and rebooted without the CD. This time, the system booted OK. But those two ext3 partitions were still not automounted.
In File System > media (i.e., /media), I noticed that there was a mount point for the VMS partition, but it had nothing in it. I typed "dir" to make sure there was nothing there, and then typed "sudo rm -r VMS" to delete it. I also deleted the "sc5" mountpoint mentioned above. In File Browser, I clicked on the Computer button at the top and then double-clicked on each of these two partitions (i.e., VMS and CURRENT) to create mountpoints (i.e., /media folders) for them. I tried rebooting again. They still weren't automounting, and the mount points I had created for them were gone, as I should have expected. Incidentally, at this point I discovered that the custom was apparently to mount fixed hard drives at /mnt, and use /media for removable hard drives.
About this time, I discovered that I had commented out the lines added by SDM (i.e., I put # signs (also called hash marks) in front of each of those lines). I forgot. I had done that to troubleshoot fstab, and then didn't go that route after all, and forgot to remove them. So I removed the hash marks now and rebooted. But that wasn't the solution. I re-ran SDM, went through more or less the steps described above, and rebooted. This time, it worked: the partitions were automounted, and their contents were visible. Not sure exactly what was different this time, but something was. So I guess the conclusion is, if it doesn't work in SDM the first time, tinker around for a while, reboot a couple of times, try SDM again, and reboot.

Thursday, July 2, 2009

Paradox for DOS Viewer in Ubuntu 9.04 and VMware Workstation

At the start of this project, I wanted to run Paradox for DOS 4.0 in Windows XP. I had WinXP running in VMware Workstation 6.5. For a while, my old Paradox was running, but then, I don't know, something changed, and it no longer worked. Instead, I got an "Access denied" error inside the WinXP DOS (i.e., CMD, command) window whenever I tried to run Paradox. It was probably something I could have fixed easily in the old days, but I had not devoted much time to Paradox and DOS in recent years, and the solution looked like it would take more re-learning than I cared to do. My reason for wanting to use Paradox was to convert some old files to a current format, so I could view them as needed. Getting them into a current database format (e.g., Microsoft Access) would have been good, but most of them could just be archived as PDF reports, as far as I was concerned.

I couldn't find a freeware Paradox for DOS converter, so I posted a question on the pnews.paradox-dos webpage. Rodney Wise advised me to try DOSemu. The idea here was that, instead of running Paradox in a DOS window in WinXP on Ubuntu, I would drop down to Ubuntu and run Paradox in a DOS emulator there. Before going with DOSemu, I noticed that DOSBox was the SourceForge Project of the Month for May 2009. It appeared, though, that this might mean DOSBox was a work in progress. I followed several links, but didn't get much detail, and finally I got a 404 error. So I decided to stay with Rodney's suggestion of using DOSemu. To install my DOS emulator (DOSemu) on Ubuntu 9.04 (Jaunty Jackalope), then, I proceeded as follows: 1. In Ubuntu, go to System > Administration > Synaptic Package Manager. 2. Search for dosemu. Click, mark for installation, and apply. That installs a menu pick for Applications > System Tools > DOS emulator. 3. That menu pick won't work until you enter some additional commands. The advice I got was to enter it all on one line, like this: echo 0 | sudo tee /proc/sys/vm/mmap_min_addr In case it's not clear in your font, that line begins with "echo zero," not "echo oh." But that gave me a password error. So instead, I did it in two steps: sudo -i echo 0 | tee /proc/sys/vm/mmap_min_addr 4. Now you can click on that menu pick. This gives you a window in Ubuntu entitled "DOS in a BOX." DOSemu defaulted to the following disk assignments: A: Floppy drive, if any C: A 2GB virtual drive with DOS config.sys and autoexec.bat files D: Uses /home/ray (my username) as a read-write drive E: CD/ROM drive The documentation provided some instructions to change these assignments, but I didn't need to. I could just move the old Pdx DB files I wanted to convert to that /home/ray drive in Ubuntu and tinker with them there using DOSemu. (I noticed, incidentally, that the DOSemu documentation dated from 2003 and earlier, so I did wonder if I should have been more patient in researching the DOSBox option. Basic DOS commands seemed to work normally. I created and deleted a couple of directories and then used Ubuntu's File Browser (Nautilus) to move some Paradox data files into a new folder called D:\PDXDB. I also copied over my Paradox program files to a folder called D:\PARADOX. But while DOSemu seemed to run fine, I was not able to get Paradox to run inside it. At best, my attempts to run Paradox within DOSemu resulted in an error message about PDOXUSRS.NET. This seemed to be a problem of Paradox rather than DOSemu. When I tried running Paradox from a batch file with additional commands I had used previously, I got an "Unexpected Condition" error. I had seen the latter error many times before, but it had been quite a while, and I could not remember how to get around it. Ultimately, instead of troubleshooting that, I hunted around for freeware alternatives. Unfortunately, I didn't find many. First, I downloaded and used a 30-day trial shareware utility, Paradox Viewer from BrotherSoft - Scalabium (about $15 if you buy it). I had large memo fields in the old Paradox tables, so I saved them in Microsoft Access format. (Other options: comma-delimited, plain text, HTML, XML, Excel, SPSS, SQL, ADO, and Lotus 1-2-3.) For the old data that definitely needed to be archived as PDFs rather than kept in a database, I exported from Access to .rtf format, cleaned them up, and printed them as PDFs. Note: 100 records maximum export per table in the free trial -- and unlike some of the other products mentioned here, there's no pop-up dialog to say so. You just lose that extra data in records 101+. For the most part, Paradox Viewer was a professional, easy-to-use program. One problem I had was that it would not export fields to Access if the fieldname had a period or other punctuation in it; but it would export them to Excel. (In other words, it's a viewer, not an editor; it wouldn't let me change field names.) Another problem was that it would not read BLOB (Binary Large OBject) fields. Maybe if they had been all text, it would have been fine, but they were from WordPerfect for DOS 6.0 -- that is, they were WYSIWYG. So a Paradox-to-text converter wasn't the answer either: the graphics would be lost in the conversion to plain text. BrotherSoft also offered a direct Paradox-to-Access converter, but it seemed safe to assume that it would be using their same technology to read BLOB fields. I tried another one: ABC Amber Paradox Converter. The trial version on this one would only let me export 10 records at a time. Also, batch mode was not available in the trial. Worse, when uninstalling it, I ran into a problem that is apparently with the Wise Uninstall program, not with Amber: I got a "Could not open INSTALL.LOG file." The solution was, I hoped, to reinstall the program, just like before, and then try again to uninstall it, but that didn't do it. So I wouldn't advise trying this product at this point. I tried Data Import & Export 2.0, but it wasn't able to do anything with Paradox. I don't know why it came up in my Google search. DTM Data Editor, too, was shareware. I decided not to try installing to see what its demo version would let me do. Next, I tried Paradox dBase Viewer, but it said "Unsupported database file." It did recognize that my files were Paradox 4.0 tables, but it could not read some of them. (For the ones that it could read, it worked well. See below.) Paradox Converter would only let me export 50 records without spending $60 for the full version; it also wouldn't export to Access, so I would have had to convert DB to DBF and then import from there into Access. I did have WordPerfect Office X4, standard version, but that didn't include Paradox, and trying to open DB files in WordPerfect X4 gave me an "invalid file name" error. Upgrading to the professional version of WordPerfect Office X4 would have cost me $260. I wondered whether an old copy of Paradox 7, which I could get for $14 (including shipping) at, would be able to read those old BLOB fields. I dug around for a while but found no answers on that, so I posted a question on it. After three or four days, my post still had no reply (though the website said lots of people had viewed it), so I suspected there might not be too many people who knew the answer for sure. So I went ahead and bought a copy of Corel Wordperfect Office 7 Professional, which apparently did include Paradox 7. While Office 7 Professional was installing, it showed me a series of promotional blurbs, including one that did confirm that Paradox 7 was part of the package. But Paradox 7 didn't install. Everything else did -- WordPerfect 7, Quattro Pro 7, etc. -- but not Paradox 7. I did a Google search and saw that a number of others had had some kind of problem along these lines. One suggestion was to right-click on the SETUP.EXE file and choose Win95 compatibility mode, but this seems to have been for Windows NT or Windows 2000 machines. Another possibility was to try to run Paradox 7 in compatibility mode, which involved right-clicking on the program icon under the WinXP Start menu and choosing Properties and then the Compatibility tab. Paradox 7 apparently needed Windows 95 compatibility. This was perhaps a step to take later, but Paradox 7 was not even installed yet, and I didn't know how to make the setup (installation) program run in Win95 mode.
About this time, I received another copy of Corel WordPerfect Office 7 Professional, which seemed to suggest that I had ordered two copies instead of one. Indeed I had, but I thought I had asked to cancel the first order. Anyway, this one was different from the first one in several ways: the seller had kindly included the serial number, which was requested but not required during the installation process; s/he had included the actual printed manuals; and the CDs were labeled differently. In the first copy I received, the CDs were labeled "Applications disc," "Corel A to Z," and "Library disc." In the second copy, the CDs were labeled simply Disc 1, Disc 2, and Disc 3. More about this in a minute.
Someone suggested installing the Paradox 7 Runtime first, and then install Paradox 7. Apparently the Runtime version was originally part of Borland (not Corel) Paradox 7 Client/Server and could also be bought separately. It seems to have come in 16- and 32-bit versions. At this point, though, it seemed to be hard to find. After digging around, I found something called the Rough Enough software system, which claimed to include the Paradox 7 runtime. I downloaded and unzipped it, renamed the resulting folder, and discovered that the installer would only run if I left that folder with its original name. But even then, I couldn't get the program to install.
Using a different approach, I tried the freeware Paradox dBase Access Reader 2.1.0. Or at least that's the name that appears when you hit Help > About in the program itself; but a search turns up no such beast, nor does there appear to be anything out there known as Sportamok Software, and a visit to (which is also named in Help > About) yields a webpage belonging to some kind of sports statistics organization that seems to have no information on any such program.. Yet here it is nonetheless. And you can have a copy if you search for Paradox dBase Viewer 2.1.0 (not exactly what the program calls itself, but what everyone seems to call it).
As Derek Duke kindly pointed out to me, this Paradox dBase Viewer (PDV) program will cough up the contents of a Paradox 4.0 for DOS database if you take the following steps:
  1. Start PDV. In its General tab, it will show a list of DB files in the indicated folder.
  2. Select one of those files and switch to the Data tab.
  3. Right-click on the column titles to sort, exclude a column from viewing, etc.
  4. Highlight the records you want. If you want to highlight them all, Ctrl-A is an easy way.
  5. There are two ways to get the data into another program. You can copy (Ctrl-C) and paste (Ctrl-V) what you have highlighted, or you can click on the program's HTML File button and export to HTML, Text, Excel, or XML files or to the Clipboard. Copy and paste works with BLOB files (at least with text BLOBs), even though the contents of the BLOB field are not themselves visible onscreen from inside Paradox dBase Viewer.
Consistent with Derek's tip, I exported to HTML and then opened the HTML file in Microsoft Word 2003. Word recognized the data as a table, so I did a Convert to Text (telling it to insert paragraph breaks between data fields). I cleaned it up some more, inserted page breaks, printed it to PDF, and broke up the PDF into individual files. And there, I had PDF files resembling my original data.