TBT – My Favorite ’80s Software (WinDOS and PC-Write)

MS-DOS Executive Main Screen
MicroSoft Windows “MS-DOS Executive” main window (courtesy Wikipedia)
Today, I decided to take a walk down memory lane and dust off one of my oldest and favorite programs that I wrote back in the late ’80s:  “WinDOS(tm)”.  This was my first semi-graphical application and my first “file-manager”.  This was during the heady days of MS-DOS.  Children, if you don’t know what MS-DOS was, ask your folks!  At that time, Windows was new and at version 3.  There was no internet, very little graphical software for personal computers (Windows was coming onto the scene to change all of that forever though)!  My computers at the time (at home and at work) were still running “MS-DOS 5” and few had Windows, which (as Windows always does) required purchacing new, beefier (and pricier) hardware.  There were one or two computers at work that had Windows and so I got to play around a bit with it, but the interface was clunky and different and I was still USED to working in DOS which involved working a lot from the command line (what was known then as the “C> Prompt”)!  Meanwhile, Windows had this interesting little “app” called “MS-DOS Executive“, which was their early attempt at what we would now call a “file manager”.  I liked the new “mouse-based” interface that Windows offered.  In my daily workflow I found myself as a software developer often repeating a handful of commands with different files, ie. “Copy, Edit, Compile, Link, and Execute”, etc.  I looked at MS-DOS Executive to make this simpler, but alas, it didn’t really seem to work at all the way I was used to in DOS and besides, it was only for Windows, and I couldn’t afford Windows anyway, nor had it at work.
WinDOS Main Screen
WinDOS “WinDOS Executive” main screen
I wanted something similar for MS-DOS, something that would allow me to select a command (or “.BAT” script), select a file (or more than one file for commands like COPY) with a mouse, and click and run.  I also wanted to be able to do the same with the keyboard when my hand wasn’t on the mouse, and be able to click once on a list of the last dozen or so commands I had just executed to repeat them (or make a slight edit to one and run it again).  There was a cool program called “Norton Commander” (now the free “Midnight Commander” for Windows and Linux) which provided this capability, but it (like nearly all software applications and utilities at the time) cost money!  I was already writing some programs at home using the “Modula II” language and the $89 Logitech Modula II compiler (Yes, boys and girls, Logitech USED to make software back in the day, not just mice and keyboards!) for personal computers and MS-DOS!  So (being me) I decided to write my own program for MS-DOS and call it “WinDOS” (a combination of Windows and DOS, sort of a “poor man’s version of MS-Windows”).  I even patterned the main screen to look something like Windows’ “MS-DOS Executive” window but instead captioned “WinDOS Executive” and including the date and time and a “C> Prompt” for quick-typing and editing DOS commands (when my hand was on the keyboard).  WinDOS permitted me to greatly automate my workflow using a mouse to launch commands and programs while still providing enhanced keyboard-editing and entry of DOS commands!  MS-DOS Executive provided customized “.PIF” files as an early version of file/mime type associations and I quickly found myself needing something similar so I created text-based “.CIF” files (Command Information Files) to handle that in WinDOS, for example COPY.CIF configured WinDOS to prompt for TWO arguments for the COPY command.  I also created a “GUI” for creating and editing “CIF” files and an “installer” program and made it available as share-ware (open-source) and installable from a single floppy-drive!  One interesting programming feature was that I wrote WinDOS with an executable and a looping batch script to invoke it so that when the user executed a command, the WinDOS executable would exit freeing up nearly all of the 640K of system memory to run the program, then restart the WinDOS executable after the command finished.  This freed a lot of memory without noticably sacrificing speed.  My effort was not in vain as WinDOS quickly became one of my most-used programs for several years (along with the shareware / open-source editor “PC-Write(tm)”, which I also ended up purchasing the paid version because I loved and used it so much) until I finally moved my world to Linux in the mid ’90s (I pretty much skipped Windows all together)!  Heck, I even had several coworkers using WinDOS on their machines too!
Now that I’ve been on Linux for nearly twenty years now, I’ve long since developed my own file-manager (since I couldn’t find one that I liked) that incorporates the same basic principles as WinDOS, but also all the modern features one would want in a file-manager.  This is “JFM4“.  You can get it and see a screenshot on my download site.

Spiral-bound PC-Write(tm) Users’ Manual
PC-Write(tm)“, by Quicksoft (Bob Wallace and his wife Megan Dana) was my other fav. app. in my MS-DOS years as it provided a very nice and customizable full-screen (and full-color) text editor that was great for editing program source-files and writing letters, etc.  It was both a good code-editor and (for the time) a full-featured auto and manual-formatting word-processor, and it was free and shareware, and fit on a single floppy disk, so I could carry it anywhere with me!  I liked and used it so much, I ponied up the $69 (I believe) for the “fully-registered” (paid) version for which Quicksoft sent me a fully spiral-bound 426 page plus index manual (fully written and illustrated in PC-Write itself by Bob’s wife Megan Dana, seen on the cover), a free one-year subscription to their (paper) newsletter “Quicknotes”) and two free update coupons!

I got more than my money’s worth out of this program too using it for all my code development and word-processing needs for nearly ten years until I switched from DOS to Linux.  I wrote a full customization file (text file) with the colors and keyboard sequences all set the way I wanted to facilitate my work in the ways most natural to me.  After moving to Linux, I ended up writing my own full-color text editor named “E Editor” taking many ideas from this one and adding language-specific syntax-colorizaton, code-evaluation, and quick-compile that I still use today and you can get it (and JFM4) here from my download site for Windows and Linux.  “E” is not a full-blown word-processor though (I use LibreOffice for that).

PC-Write(tm) Intro screen
PC-Write(tm) Intro screen
PC-Write(tm) Editer screen
PC-Write(tm) Editer screen (editing an ancient FORTRAN program)

Fauxdacious For Windows (with executable installer) Released!

Introducing
UPDATE (5/31):  Version 3.74-beta2  Fixed glitch that prevented creating song-specific Equalizer Auto-presets for Cue-file based songs. Added the song / video title to the Fauxdacious Video window titlebar. Merged Audacious commits: 3be5957, 450984e, e12ae5d, 2349933, d768ae1, 3cd305e, 60c4632, 475490c, 5384dc5, b855336, b34cbdb, c729ff5, ad0a172, 6b5bfae, 96a19b5, 5a8d6e5, and Plugin commits: 4ededd4 and ebf17e6. Eliminated (most) compiler warnings in ffaudio-core.cc from “depreciated” AVCodec stuff. Obtained a working version of libcue and compiled that in. Updated the Win32 build notes in the contrib directory to reflect additional Fauxdacious requirements and fixes for module compilation issues.  Added the Inno Setup build file (Fauxdacious.iss) to the share directory.  If you don’t trust me fearing that I might’ve put any malware (I didn’t!) in Faudacious, you can download the full source and build instructions to examine and or re-build it yourself!
I’m happy to announce my latest release of the Fauxdacious Media Player (version 3.74-beta1) with a full-functioning Windows version complete and bundled with a simple to use executable installer program created using the free and open Inno Setup Wizard!    (Get it Here:  http://phoenixcomm.net/~jturner/Fauxdacious_install.zip)  If you’re not familar with Audacious / Fauxdacious, it’s an audio and (with Fauxdacious) video player for both Linux/Unix and Windows.  Why use Fauxdacious instead of another video player?  With Fauxdacious, you also get one of the best audio player engines with many audiophile-ish sound-enhancing plug-ins!  Another reason is that unlike most Windows-based media players, Fauxdacious and Audacious are fully free and open-source programs with no binary blobs for malware to hide in!  One feature of interest to many Windows users is the option to use the classic “WinAmp Skins” interface, which uses the same “skins” as the old Windows “WinAmp” media player (see the bottom screenshot).  The default interface is the more modern-looking “GTK” interface, but it’s easily switchable to the WinAmp interface in [File].[Settings].(Appearance): Interface plug-in: and change the dropdown menu, then select your “skin”.  To turn on the video-playing option, simply select [Settings].[Plugins].[Input tab].[x] FFmpeg Plugin, then [Settings button] and check the box: “[x] Play video streams in popup window…”.
I understand the Audacious Team is rumored to be creating an installable version of their Windows version for v3.8, but this is still in the rumor mill.  Update/Correction:  They now have a v3.7.2 beta version, that I tested successfully, here: Audacious Windows Installer (the first link on the page is the download link), and it seems to work for me.  Why wait (and hope) when you can get it NOW with Fauxdacious (including most of their planned v3.8 features from their GIT)!  This closes Audacious-rejected feature request #613.  This culminates nearly three weeks of hard work to build this thing for Windows.  I had held off doing this until I had a new machine with a huge hard disk that I could dedicate plenty of space for the Windows 7 partition in order to accomodate downloading the MingGW C++ compiler and compiling and installing all the three dozen or so libraries needed to compile this thing from scratch on Windows.  Thanks to the Audacious Team’s detailed and concise instructions for building on Windows, I was able to do this with only a few minor glitches (all now resolved).  For the brave techies, the gory build instruction details (including the issues I encountered and corrected) are included in the “Fauxdacious/share/” directory (buildingFauxdacious.htm) created by the installer when you install (or the audacious/contrib/win32/notes.html file in the source tarballs, downloadable separately from the same site).
TODO:  The only known unresolved issue (Windows version) is audio is sometimes lost when jumping from some videos to audio playlist items when using the SDL Output plug-in, non-issue if using the new Waveout plug-in.  Also probably need to add a “file-association” in the Windows setup wizard to associate .xspm (playlist files) with Fauxdacious.  Someday, if I really get ambitious, I might write / modify a plug-in to merge in “youtube-dl” functionality in order to play Youtube video URLs directly, patches / help / advice welcome!  When Audacious v3.8 comes out and settles down, I hope to remove the “beta” moniker as Fauxdacious seems pretty stable now and has not crashed on me in months.  I need to create a DEB package too, but looking at the documentation howto for that just gave me a headache. At least John Lindgren’s Audacious build instructions for Windows were concise by comparisen!
Fauxdacious Installer
Fauxdacious Initial Setup Screen – Inno Setup Wizard
Fauxdacious Screenshot
Screenshot of Faudacious playing a video and using the default WinAmp skin with the main, playlist, and equalizer windows all displayed.

Make Special HP Laptop Touchpad Toggle Key Work In Linux

I recently purchased a new (refurbished) HP “Elitebook” 8440p laptop (see previous blog post) and docking station, and installed my custom “remastered” copy of Antix Linux!  Before buying, I had tried out my remastered Antix live-DVD on my wife’s laptop (same model with lower resolution screen) and everything basic seemed to check out.  As I expected, this laptop has proved to be a great laptop for Linux but I’ve been somewhat surprised at the number of additional (and difficult) issues/hacks I’ve had to resolve/make to my (already very customized) remastered linux installation.  In my previous post I described the nightmare I went through getting Linux to boot with Windows 7, though this is not at all a fault of the computer or it’s hardware, but rather owing to the way Windows 7 was partitioned and installed.  Another hack / workaround I ended up having to make (after another extended, but fruitless search) was downgrading my “AccelMethod” from “SNA” back to “UXA” in my /etc/11/xorg.conf file to stop screen corruption and lockup when exiting X without having to add a “chvt 1; sleep 2” sequence to each logout/exit/reboot command script in the window-manager, and disabling the “Ctrl-Alt-Backspace” command.  Switching to “UXA” eliminated the need for these workarounds (after I tried everything else I could come up with).  This machine has a LATER version of Intel graphics (Mesa DRI Intel Ironlake Mobile x86/MMX/SSE2).  The tradeoff is a slight reduction in video performance from up to 2000 fps to around 1700 or so, only really noticeable by running glxgears (My Dell never broke above 900 fps, but WORKED flawlessly with SNA!).
The hardware was very similar (driver-wise) to that of my old Dell D620, but more modern (Intel CPU, Intel integrated graphics, sound, and network interfaces).  The first issue that needed tweaking was to activate all the custom special-function keys.  Nearly all laptops have them and they all seem to be different not only between brands, but also between models.  I had long ago gotten the Dell’s all working using a now rather old program called “hotkeys”, however, I had not used them in ages since my Dell has not had a working battery since forever, and I’ve been using it almost exclusively docked (and the lid closed).  I’ve found that hotkeys seems to not work well anymore due to trouble staying up between suspends, etc.  I began looking for a better solution and found “xbindkeys”. This program also includes a GUI which permits you to actually press each key and then add your desired action command and builds the config. file for you!  This strategy proved successful for all the special keys, including the little “led” light-up ones above the keyboard that look more like status indicators than press-able keys.  The only ones not configurable via xbindkeys were the “wifi switch” led/key and the “touchpad toggle” led/key.

~/.xbindkeysrc:

     #Quieter
     "/usr/bin/amixer -q set Master 4- unmute"
         m:0x0 + c:122
         XF86AudioLowerVolume

     #Louder
     "/usr/bin/amixer -q set Master 4+ unmute"
         m:0x0 + c:123
         XF86AudioRaiseVolume

     #MuteToggle
     "/usr/bin/amixer -q set Master toggle"
         m:0x0 + c:121
         XF86AudioMute

     #Display
     "sudo /usr/local/bin/switchdisplay.sh"
         m:0x0 + c:235
         XF86Display

     #Internet
     "/usr/local/bin/browse.pl"
         m:0x0 + c:180
         XF86HomePage

     #LockScreen
     "/usr/local/bin/screenoff"
         m:0x0 + c:160
         XF86ScreenSaver

     #Dimmer
     "/usr/local/bin/setbacklight.sh -60"
         m:0x0 + c:232
         XF86MonBrightnessDown

     #Brighter
     "/usr/local/bin/setbacklight.sh 60"
         m:0x0 + c:233
         XF86MonBrightnessUp

     #ScreenToggle
     "/usr/local/bin/togglebacklight.sh"
         m:0x0 + c:248
         NoSymbol

     #Suspend
     "sudo /usr/local/bin/s2ram"
         m:0x0 + c:150
         XF86Sleep

The wifi key “works” in that it uses rfkill to toggle the wifi.  For most people, this will probably work fine out of the box, but I configure my networks manually, and need for the wifi to go off (and ethernet to come on) when docking so that my home network comes up on the ethernet connection (I needed to be able to execute a custom script whenever this key was pressed).  I ended up getting this key working by adding an ACPI event and script (see below).
/etc/acpi/events/hp8440p-wireless:

     event=PNP0C14:01 00000080 00000000
     action=/etc/acpi/hp-wifi-jwt.sh

In Linux Live-CD:

/etc/acpi/hp-wifi-jwt.sh

     event=PNP0C14:01 00000080 00000000
     #!/bin/sh

     test -f /usr/share/acpi-support/key-constants || exit 0

     . /usr/share/acpi-support/key-constants

     wifiblocked=`rfkill list wifi|grep "yes"`
     if [ "X$wifiblocked" = "X" ]; then
         echo "..WIFI BUTTON PRESSED: wifi not blocked!" >>/tmp/acpi.dbg
         #DO WHATEVER TO RESTORE PREV. CONNECTION:
     else
         echo "..WIFI BUTTON PRESSED: wifi BLOCKED!" >>/tmp/acpi.dbg
         #DO WHATEVER WE WANT WHEN WIFI TURNED OFF:
     fi

HP Touchpad Toggle Led/KeyI got all the special HP light-up buttons above the keyboard working with xbindkeys EXCEPT the one that looks like a tiny touchpad, that’s supposed to toggle the touchpad.  That little bugger just did not want to work, not even in Windows-7?!  The “touchpad toggle” led/key lights up cyan on startup and the touchpad is enabled.  Pressing it turns it orange and (should) disable the touchpad. Touching again turns it back to cyan (should re-enable touchpad).  In reality, it does nothing but change color when pressed.  X does not see it except the very first time it’s pressed, in which case xev sees a continuous spewing of keypresses and releases of keycode 138 killable by pressing Ctrl-C.  dmesg reveals that the kernel sees the alternate press as unassigned scancode “e058”.  Subsequent presses produce nothing visible to X until you reboot.  I tried adding the setkeycodes command the kernel suggested, googled and googled and could not find anything that would make this key visible to X. The console program showkey would show it alternately returning keycode 138 and keycode 140 (the one I assigned with setkeycodes) as I wanted, but for some reason nothing in X could see anything when the key was pressed.  Obviously, the key was seen by the kernel.  Several google pages described how to “translate” these kernel keycodes to X, including xmodmap, but nothing worked.
It was not like this particular key was very important to me, but at this point it had just become a determined challenge to force it to work!  I finally stumbled upon a tiny C program that could monitor the keyboard input device and report each key pressed.  I ended up modifying this program to look for these two keycodes and calling a command whenever one was seen.  I then set this program up as a tiny daemon so that I can now press the key and toggle the state of the touchpad!  Why?  Because I could and because I had already wasted too much time trying to figure this out!  😀
I finally found, stole and hacked up a tiny daemon C program that DOES make it work!  You need to do the following:
1)  in rc.local or somewhere in startup scripts add: /usr/bin/setkeycodes e058 140
2)  compile this little C program “keycheckd” (gcc -o keycheckd keycheckd.c) and place the compiled binary in /usr/local/bin/, and chown 4755 keycheckd
3)  In your X desktop session’s startup script do (must be started from w/n X desktop, NOT startup or console!):

     xset -r 138 -r 140 -r 146 -r 148
     keycheckPid=`pidof keycheckd`
     [[ "X$keycheckPid" == "X" ]] && /usr/bin/nice -n 10 /usr/local/bin/keycheckd &

The source (keycheckd.c) (note: you could add other keysyms / actions, if needed):

#include <stdlib.h>>
#include <unistd.h>
#include <fcntl.h>
#include <errno.h>
#include <linux/input.h>
#include <string.h>
#include <stdio.h>

/*
JWT:THIS DAEMON PGM WATCHES THE KEYBOARD FOR PRESSES OF THE SPECIAL HP ELITEBOOK 8440P "TOGGLE-KEYPAD" KEY WHICH X (xev, xbindkey & FRIENDS REFUSE TO SEE AFTER THE 1ST PRESS PER REBOOT) AND INVOKES THE COMMAND TO TOGGLE THE TOUCHPAD (AS IT WAS DESIGNED TO DO). X DOESNPT LIKE THIS SPECIAL KEY B/C IT ONLY SENDS A "KeyPressed" EVENT W/NO CORRESPONDING "KeyReleased" EVENT. IT WORKS LIKE OTHER "LED"DED KEYS SUCH AS CAPSLOCK AND NUMLOCK! THE INITIAL STATE IS "BLUE" (TOUCHPAD ON), FIRST PRESS SENDS KEYCODE 140 (148 TO xbindkeys) AND SWITCHES THE LED TO "ORANGE". NEXT PRESS SENDS KEYCODE 138 (146) AND SWITCHES THE LED BACK TO "BLUE". SUBSEQUENT KEYPRESSES ALTERNATE BETWEEN THESE TWO STATES. I STOLE THIS PGM. FROM HERE: http://stackoverflow.com/questions/20943322/accessing-keys-from-linux-input-device.  I MODIFIED IT TO ONLY CARE A/B THESE TWO KEYCODES. NOTE: I HAD TO ADD "setkeycodes e058 140" TO rc_local.pl WHEREAS THE OTHER ONE (138) WAS ALREADY RECOGNIZED BY THE KERNEL. THIS PROGRAM SHOULD BE STARTED THE FIRST TIME AFTERSTEP STARTS UP (.afterstep/autoexec)
*/

int main(void) {
    const char *dev = "/dev/input/by-path/platform-i8042-serio-0-event-kbd";
    struct input_event ev;
    ssize_t n;
    int fd;

    fd = open(dev, O_RDONLY);
    if (fd == -1) {
        fprintf(stderr, "Cannot open %s: %s.\n", dev, strerror(errno));
        return EXIT_FAILURE;
    }
    while (1) {
        n = read(fd, &ev, sizeof ev);
        if (n == (ssize_t)-1) {
            if (errno == EINTR)
             continue;
            else
             break;
        } else
        if (n != sizeof ev) {
            errno = EIO;
            break;
        }
        if (ev.type == EV_KEY && ev.value >= 0 && ev.value <= 2) {
            /* printf("0x%04x (%d)\n", (int)ev.code, (int)ev.code); */
            if ((int)ev.code == 138) {
                /* TURN ON TOUCHPAD: */
                /* printf("--138: turn touchpad ON!\n"); */
                system ("/usr/bin/synclient TouchpadOff=0");
            } else if ((int)ev.code == 140) {
                /* TURN OFF TOUCHPAD: */
                /* printf("--140: turn touchpad off!\n"); */
                system ("/usr/bin/synclient TouchpadOff=1");
            }
        }
    }
    fflush(stdout);
    fprintf(stderr, "%s.\n", strerror(errno));
    return 0;
}

Now, when you press this “key”, it should turn orange and actually disable your touchpad, a second press should turn it back blue and re-enable your touchpad.  I believe you could add the “/usr/bin/synclient TouchpadOff=1” in your X session startup script above where you start this daemon, and reverse the two “TouchpadOff=#” commands in it to have it start out disabled, then toggle to enabled, then disabled, etc.

Gettin’ Down & Grubby with Grub!

Last week I broke down and bought myself a shiny new (refurbished) an HP “Elitebook” 8440p lappy! :D  It’s been ten long years or so since my last computer purchase (also a corporate refurb).  My way is to buy a good used one from a generation or two back, put Linux on it and have a faster machine than most brand new ones whilst saving a ton of money.  My last one’s been great as a docked desktop paired w/a big monitor, but has become a very crappy laptop that runs hot, has no working battery, and the hinge won’t hold the lid up anymore.  Portability issues aside, it still performs very well, especially for its age.  I’ve even been complemented on how snappy it is, considering it’s age.
This “new” lappy came with a huge, terrabyte SCSI hard drive (the good ol’ fashioned spinning kind, which I prefer) loaded with a fresh install of Windows-7 Professional 64 bit to complement it’s eight gig of RAM.  I ended up shopping longer and paying a tad more in order to nail down one of the (apparently rare) ones that has the higher-resolution (HD+) screen sporting 1600×900 resolution (most come w/a crappy 1366×750 screen) combined w/the non-dedicated integrated Intel graphics.  The reason I wanted Intel graphics is that it’s no hassle to get to work well with Linux, runs cooler, and yields longer battery life than the Nvidia dedicated version.  The box arrived from Odyssey Computers via Amazon with free shipping in three days!  It contained a nice, shiny clean new-looking computer and 65 watt HP power supply wrapped in a generous supply of bubble wrap.  I plugged it in, opened the lid, turned it on and was greeted with Windows-7’s “First Use” screen.  I read the eula, signed over my first born to lifetime servitude to Bill Gates Inc., created an abUser account, and set it up. I confirmed the graphics, screen, hard drive, and RAM quickly through Windows’ Device Manager.  One fear that I had was that Windows would be set to boot under UEFI, making my task much more difficult, but I poked around in the bios and determined that, thank goodness, that was not the case.
Now, on to the Linux setup!  I remastered my current Antix Linux setup using Antix’s unique and very cool “snapshot” tool onto a DVD, inserted it and booted it right up.  First order of business was to run gparted and determine the partition layout for Windows.  This revealed three existing NTFS partitions: a 12 gig “Recovery”, a 150 meg “SYSTEM”, and the remaining 919 gig “Windows” (C:).  This meant we had the fourth and final partition slot available for creating an extended partition and filling it with logical partitions to our hearts content for Linux!  I then proceeded to create the extended partition and added logical Linux partitions for root, var, swap, and home in that order.  It’s fully ok and preferable (to avoid tiny slices of unusable disk space) to select “Alignment: None” for each one as you create it.
This is where the good ended and the bad began: ALL three were NTFS (INCLUDING the first) AND, the SECOND (NOT the first) one was marked as the “boot” partition.  This meant NO installing Grub boot-loader in the MBR (The normal location) and most likely having to modify the Windows boot-loader to launch Grub and Linux from the Linux “root” partition we would create.  Still no biggie, right? (WRONG!)  Fortunately for me, I started googling around BEFORE I attempted an install and found out that this might be a bit more difficult (little did I know yet!).  I had installed Antix once before on another Windows-7 machine with only a couple of minor hiccups involving Windows booting via “chainloading”, but that one was set up the “normal/proper” way with a FAT32 partition at the beginning for booting (just put Grub in MBR, add “hide/chainloader” entries for Win-7 and I was good to go).  I quickly learnt that GRUB would not play nice if put into an NTFS partition.  I also became acquainted with an obscure Windows program called bcdedit.  I went ahead and played with that and successfully added a second entry in the boot menu for Linux.  I then cautiously created all my Linux partitions using gparted and installed Antix. Then I carefully created the special “antix.bin” file and gently placed it into the Window’s C:\ directory as instructed in my research and rebooted.  I was quickly greeted again with my Windows boot menu containing two entries:  “Windows” and “Antix”.  I selected “Antix” and…BLACK SCREEN.  Tried again with “Windows”, Windows booted up as normal.  Oooo-kaaaay, back to Google . I then learnt that Grub Legacy (the version I use since I’ve found Grub 2 very hard to configure with a labyrinth of separate configuration files) also doesn’t play nice if installed into an ext4 partition (unless it’s the MBR/boot partition (hd0,0)).  So, rinse, spit, repeat – this time, tried making the root partition ext2 (ugh!)  This likewise did not work because, come to later find out, the Windows-7 boot loader does not like to talk to ext2 filesystems, even just to boot.  Then came a full twenty-four hour haze of gory details of experimentation that I won’t bore you with here, with little to show for it.  As a last resort, I ended up creating a separate 1 gig FAT32 “boot” partition and with a lot of kicking and screaming from Grub, I finally got it installed there and a working 512 byte “antix.bin” file in the Windows “boot” partition (not C:\) and was able to boot “manually” (It would boot to a cold bare “GRUB>” prompt (when “Antix” was selected), where I could type in a partition identifier (hd0,4), then a kernel line (see menu.lst), then an initrd line, and boot. More googling and T&E revealed that I could just type “configfile /grub/menu.lst” and boot right in. Still more led to making copies of everything in /boot/grub/ to /boot/boot/grub/ (guess we need two matching boots, LOL), and finally, VALA, Linux nirvana!
Lessons learned:
1)  To install Grub in a separate partition (other than the first in the MBR) and be accessible by the Windows-7 boot-loader, one needs to create a separate FAT32 partition and mount it in Linux as “/boot”.
2)  To create the “linux.bin” (I chose “antix.bin”) file for the Window boot-loader, you must first coax Grub into installing it in said FAT32 partition and then use the dd command to grab the first 512 bytes of THAT partition writing it to that file (antix.bin in the root directory of /dev/sda2).
3)  Grub Legacy expects to find it’s “menu.lst” file in /boot/grub/ off of THAT partition (/dev/sda5 or (hd0,4) in my case) even though Linux will have to mount that partition as /boot off of it’s (Linux’s) root (/dev/sda6) and will, along with “update-grub”, expect to find it, along with the other grub stuff in /boot/grub/ off of Linux’s root (/grub in the /boot partition).  Therefore, you must create a “/boot/boot/grub/” subdirectory (off of Linux root – when Linux is booted up) and copy everything in /boot/grub/* to there.  The logical thing to do would be to move it there and create a symlink (cd /boot; ln -s boot/grub grub), but this WON’T WORK because this is all in a FAT32 partition, a rickity old filesystem from the MS-DOS era, so you must COPY the grub tree. You will also need to update BOTH menu.lst files whenever you do “update-grub” or upgrade your kernel, then make sure both menu.lst files match!  NOTE:  It’s only grub that must be copied, NOT your kernels, etc.  They reside one level up in /boot/.
4)  You really should reinstall your kernel package (at least if installing via Antix remaster’s “cli-installer” installer) after you successfully get booted up, since I ran into a few devices modules missing, etc. as I tested things out.  All were fixed by reinstalling / updating my preferred kernel).
5)  Making a “bootable” USB-stick was a good way to test the bootability of my Linux install, but NOT a good way to configure Grub after booting up with it as the system came up with the USB stick seen as “sda” (the FIRST “hard drive”), and my hard drive as “sdB” (the SECOND) – NOT what neither I nor Grub were expecting, forcing manual typing in the boot entry each time!
6)  Grub Legacy is a total BEEACH when asked to configure itself in any way out of the ordinary as far as partitioning goes.  It really wants to reside in the MBR.  As a biased and unabashed Linux user, I expected Windows-7 to be the problem child in the sandbox, but no, it was grumpy, grubby ol’ Grub that had to be dragged kicking and screaming every step of the way and be absolutely beaten into submission!  All the while, Windows gave me no grief whatsoever nor even sneezed or snickered at me as I struggled and fought with Grub.
Ok, here’s the gory details that worked (NOTE, this is only for other unlucky souls who have a non-UEFI booting Win-7 installed with no FAT32 first partition with the “boot” flag” set and no Windows re-install disks).  Otherwise, IF non-UEFI booting, you can MAYBE, MOST LIKELY install Grub (at your own risk) the usual way in the MBR and (maybe) ignore all this!:

NOTE: THIS ASSUMES THE FOLLOWING PARTITION SETUP (I had the 1st three, shrank the third (using gparted), and created the rest and you’ll need to adjust as needed for yours):

     (hd0,0) /dev/sda1:  NTFS - Windows "Recovery"
     (hd0,1) /dev/sda2:  NTFS - Windows "SYSTEM" (boot flag set!)
     (hd0,2) /dev/sda3:  NTFS - Windows (C:)
     (hd0,3) /dev/sda4:  Extended
     (hd0,4) /dev/sda5:  FAT32 (mount as /boot in Linux)
     (hd0,5) /dev/sda6:  ext4 or any other Linux filesystem (mount as / (root) in Linux)

Boot up in Linux Live-CD:

1)  Use garted to shrink the Windows C: partition (I tried to do this in Windows, but it wouldn’t allow me to shrink it as much as I wanted, since Windows likes to put “immovable” – (to Windows), files in the middle or latter part of the partition) gparted SHOULD handle this without fuss (it did for me).

2)  Create an “extended” partition and then your Linux partitions (First one must be FAT32 and will later be mounted as “/boot” in Linux).  Next should be your Linux “root” (mounted as “/”) and be ext4 (my preference) or any other modern Linux filesystem.  Additional partitions are optional (I like to create ones for “/var”, swap, and “/home” in that order).  With 8 GIG of RAM, I don’t really need a swap, but I created an 8+GIG swap for hibernation perposes (Hibernate is a very useful feature on laptops).

3)  Install your Linux, but do NOT install Grub in the MBR!!!  Instead install it in “root” (Linux’s root directory – /dev/sda6 in my case)!  If you are lucky enough to be installing a distro that gives you Grub install choices OTHER than “MBR” or “root” (I wasn’t), then choose your FAT32 partition!  I had to choose “root” (and the slightly-buggy Antix “cli-installer” did not do THAT quite right either – I looked at the script’s code and it appeared designed for Grub-2 with options that Grub Legacy does not recognize), but at least it did not touch my MBR, thank goodness!.

4)  I had to do the following to get Grub Legacy properly installed:

Boot up (again) into my Antix live-CD and:

     mount /dev/sda6 /mnt
     mkdir /media/boot
     mount /dev/sda5 /media/boot
     mount /dev/sda6 /mnt
     vi /mnt/boot/grub/menu.lst:  #WE NEED TO CHANGE OUR "root"s in "menu.lst" AS SO (root=our Linux root (/), (hd0,4) IS OUR NEW /boot)!  (I use the Liquorix kernel, but you need an Antix kernel for the remaster/install):

         title Liquorix, kernel 4.4-6.dmz.1-liquorix-686
         root (hd0,4)
         kernel /vmlinuz-4.4-6.dmz.1-liquorix-686-pae root=/dev/sda6 quiet nosplash ro
         initrd /initrd.img-4.4-6.dmz.1-liquorix-686

         title Antix, kernel 4.0.5-antix.1-486-smp ro
         root (hd0,4)
         kernel /vmlinuz-4.0.5-antix.1-486-smp root=/dev/sda6 ro
         initrd /initrd.img-4.0.5-antix.1-486-smp
         ...

     vi /mnt/etc/fstab:  #THIS NEEDS TO PROPERLY MOUNT /dev/sda5 AS /boot!

         /dev/sda2  /media/Recovery  ntfs-3g noauto,noexec,...
         /dev/sda3  /media/Windows  ntfs-3g noauto,noexec,...
         /dev/sda5  /boot  vfat  defaults,noatime  0 0
         /dev/sda6  /  ext4  defaults,noatime  1 1
         ...

     cp -afv /mnt/boot/* /media/boot  #THIS COPIES ALL OUR BOOT STUFF (GRUB & KERNELS TO OUR /boot PARTITION):
     umount /media/boot  #MAKE SURE THIS IS UNMOUNTED!
     #NOTE:  OUR ROOT PARTITION (/dev/sda6) IS MOUNTED, OUR BOOT PARTITION. (/dev/sda5==(hd0,4)) IS *NOT* MOUNTED!
     for i in /sys /proc /run /dev; do mount --bind "$i" "/mnt$i"; done
     chroot /mnt  #MUST BE IN OUR NEW INSTALL AS "/" TO INSTALL GRUB.
     update-grub  #SO OUR UPDATED "menu.lst" GETS USED!
     #FOR SOME REASON, grub-install DOESN'T LIKE OUR PARTITIONS, SO WE ENDED UP (SUCCESSFULLY) TRYING:
     grub
         grub>root (hd0,4)
         grub>setup (hd0,4)
         grub>quit
     mount /dev/sda2 /media/Windows  #MOUNT OUR WINDOWS "BOOT" PARTITION:
     ls /media/Windows  #CONTENTS OF THE WINDOWS BOOT PARTITION:
         Boot   bootmgr   System Volume Information
dd if=/dev/sda5 of=/media/Windows/antix.bin bs=512 count=1  #(RE?)CREATE OUR BOOT FILE (antix.bin) FOR WINDOWS BOOT-LOADER:
     cd /mnt/boot
     rm -rf *  #WE MUST NOW REMOVE EVERYTHING IN OUR LINUX ROOT'S /boot DIRECTORY SO IT WILL MOUNT PROPERLY!
     mount /dev/sda5 /media/boot #/boot DIRECTORY
     cd /media/boot
     mkdir boot
     mkdir boot/grub
     cp -afv grub/* boot/grub  #VERY IMPORTANT: GRUB LEGACY WILL LOOK FOR menu.lst in "/boot/grub/" WHICH IS "/boot/boot/grub/" TO LINUX ROOT!  GRUB2 MAY NOTE NEED THIS?
     umount /media/boot
     exit
     reboot

5)  Now reboot into Windows-7 and do:

Select Start.Accessories menu, then right-click on “Command Prompt” and choose “Run As Administrator”.
In the (admin) DOS window, do:

     bcdedit /export C:\originalbcd  #BACK UP YOUR ORIGINAL! (/import to restore if you should screw it up!)
     bcdedit /create /d "Linux" /Application BOOTSECTOR
     #THIS WILL RETURN A LOOONG STRING OF CHARACTERS IN CURLY BRACES
     #IMPORTANT:  REPLACE "{ID}" WITH THIS STRING (INCLUDING THE CURLY BRACES):
     bcdedit /set {ID} device boot
     bcdedit /set {ID} PATH \antix.bin
     bcdedit /displayorder {ID} /addfirst  #THESE TWO WILL MAKE Antix THE FIRST AND DEFAULT ENTRY.
     bcdedit /default {ID}
     bcdedit /export C:\backupbcd  #BACK UP YOUR NEW ONE TOO!

6)  Now reboot and select “Linux” and (hopefully) boot up into your shiny new Antix Linux install!

7)  Re-install or update your kernel package and run “update-grub” – (I installed a PAE version so I could access my 8-GIG of RAM)  I found that the Antix installer did not seem to quite carry over all the kernel modules (my cd-rom disappeared, etc.) and this corrected everything.  I also backed up my “antix.bin” file somewhere on my Linux filesystem too!  (YMMV!!!)

Overall, I’m very pleased with this machine, all hardware seems to work well with Linux (Only thing I haven’t tested is the thumbprint reader).  Googling shows that it can be used in Linux.  The modem’s an Agere “losermodem” (winmodem).  I haven’t purchased a docking station yet).  The Intel Centrino Advanced-N 6200 wifi card needed:  “options iwlwifi bt_coex_active=0 swcrypto=1 11n_disable=8 led_mode=0” in a file I added to /etc/modprobe.d/ to work at proper speed with my 802.11G home wireless network, however.  The computer itself runs fast and fairly cool, and the fan is much quieter than any of the previous machines I’ve owned!  Here’s my /proc/cmdline:  root=/dev/sda6 quiet nosplash cgroup_disable=cpuset,cpu,cpuacct,blkio,memory ipv6.disable=1 libahci.ignore_sss=1 vga=0x365 ro
Links that I found very helpful along the way:

     https://www.iceflatline.com/2009/09/how-to-dual-boot-windows-7-and-linux-using-bcdedit/
     http://askubuntu.com/questions/88384/how-can-i-repair-grub-how-to-get-ubuntu-back-after-installing-windows
     http://www.troubleshooters.com/linux/grub/grub.htm
     http://ubuntuforums.org/showthread.php?t=1342241
     http://ubuntuforums.org/showthread.php?t=1163686
     https://wildstar84.wordpress.com/2015/09/17/copying-replicating-your-linux-install-to-a-different-hard-drive/
     https://www.boyans.net/DualBootWindows7andLinuxOrUnix.html

UPDATE:  The WIFI card, an “Intel Centrino Advanced-N 6200” is a bit wonky.  It seems to work find in Linux (no dropped connections, etc.), but there are a couple things I had to do due to the fact that I use a rickity old Linksys WRT54G (11G) router with Tomato firmware installed. Using iwconfig, the wireless card reports a pathetic “Bit Rate=1 Mb/s”. I tried everything I could think of or find to get it to work properly and have given up.  Every once in a while, it’ll come up showing a larger number (once showed 54)!  I’ve since determined that the card seems to be working properly (speedtest.net shows my internet at the full 6.4 Mb/s on it!), but it’s just REPORTING the wrong value (1).  My final settings are (/etc/modprobe.d/iwlwifi.conf):  “options iwlwifi bt_coex_active=0 swcrypto=1 11n_disable=1 uapsd_disable=1“.  This tells it to ignore any blue-tooth interference, turns on software encryption capability, disables 802.11n service, and turns off an obscure power-saving capability (primary power management is off by default).  I also blacklisted all bluetooth modules (btusb, btintel, btrtl, btbcm, and bluetooth), as I don’t use any bluetooth devices, though if you do, this should not be necessary.  I also had to go into /lib/firmware/ and do:

     sudo ln -s iwlwifi-6000-4.ucode iwlwifi-6000-5.ucode
     sudo ln -s iwlwifi-6000-4.ucode iwlwifi-6000-6.ucode

to eliminate a complaint in dmesg about the kernel not being able to autoload the firmware.  Not doing this did not prevent the card from working, but I didn’t like the error (warning?) and wanted to make sure the correct and best firmware available (6000-4) was being loaded. The 5 and 6 versions do not appear to exist yet!

Sql*Perl Plus, E Editor, and JFM File Manager for Linux and Windows, Oh My!

(Finally) Announcing the official release of three of my all-time favorite Perl/Tk applications in both Linux and Windows versions!  These three programs are like old friends to me since I wrote them years ago and have been using them both on and off the job and improving them for years now.  They have made my work much easier and now I’ve finally had the time to actually get them ready for use by others.  They are:  “Sql*Perl Plus” – an all-purpose “Swiss Army knife” database manipulation and report-generating tool; “E Editor” – an all-purpose full-screen, full-color context-highlighting text and code editor and viewer; and JFM4 Filemanager – an all-in-one file-manager, application launcher, shell, and *FTP client for managing files, launching applications and shell commands with many unique features.  I wrote all three of these tools to improve my daily workflow and meet specific needs that were not being fully and efficiently met by other tools available to me at the time, and when I found myself just needing “something extra and unique”, and, because I could!😀 They each allowed me to hone my programming skills in different ways and learn new techniques.
Each started out as something relatively simple, designed to meet a need, but all quickly mushroomed into much larger and more capable tools as needs arose and changed.  The most liberating thing about writing and using them is that I know that whenever I think up a new need, use, or feature, I can add it.  I have decided to finally bundle each up in both a Linux/Unix tarball and create an easy-to-run Windows installable executable (using the very handy and free Inno Setup Wizard), along with all the requisite bugfixes, touchups, tweaks, and documentation polishing, in the hope that others may find one or more of them useful.  They are all fully open-source and released under the GNU public license, though I retain all copyright to the source code.  You are free to use and modify the code as permitted under that license.  However, I make no warrantees explicit or implied, thus you use this code solely at your own risk. You can download these and other open-source software I’ve created here at my software download page and / or on my CPAN page.
Sql*Perl Plus is the oldest of the three having just turned 20 this month.  It started out as a work request to make an in-house multi-database GUI tool similar to Oracle’s Sql*Plus(tm) tool.  The goal was to create SQL queries and simple reports using a GUI tool and a mouse to save a lot of typing.  Later, I added the ability to create formatted reports, and even M$-Excel spreadsheets which lead me to create the String::PictureFormat CPAN module.  I also added the ability to query database tables and generate M$-Excel spreadsheets, XML-formatted output, and DBD::Sprite tables.  This led to creating the ability to load database tables with data from M$-Excel spreadsheets as well.  Later still came the ability to auto-generate Perl scripts from queries both for batch-loading data into tables (the generated scripts can be used repeatedly as scheduled batch jobs), and for repeatedly generating reports on a scheduled basis or as-needed.  The tool can aid greatly in the creation of just the right query and formatting template for whatever the input data format is expected to be and / or the desired report layout.
E Editor provides a full-featured, but simple to use desktop application development environment, particularly for Perl development as it provides optional language-specific code syntax highlighting for dozens of different languages and markup, easy search and replace including via Perl regular expressions, a one-button Perl compile / syntax check feature and the ability to highlight code snippets and apply Perl’s eval() function to it.  There’s also named bookmarking, auto-backup on startup capability, quick temporary backup capability, Perl, C, and HTML structure insertion, reformatting, indenting, tab or space indents, choice of wrapping, fonts, colors, tagging, split-screen, and multi-tab/open files, custom configuration, etc.  Using a simple symlink, a “read-only” “viewer” version can be created in Linux/Unix using the same program executable.  I created “E” after moving from the DOS world to Linux/Unix back in the mid ’90s and having to give up my trusty full-featured, full-color “shareware” DOS editor “PC-Write“(tm) for the cryptic over-nerdy “vi” of Unix.
JFM4 is much more recent.  This started out with me wanting a graphical Norton Commander-ish filemanager with split-screen capability for easily copying and moving files about with options for more than one application-association with given file types / extensions (including directories), an enhanced command-line and command-repeat for quick shell commands (like I had on DOS with my handy “WinDOS Executive” (named after the old Windows MS-Dos Executive) I wrote for MS-DOS for the same reasons back in the ’80s.  The “something extras” I wanted was the aformentioned multi-app file assocation via a right-click popup menu (most filemanagers only offer one per file type, and with us Perl-ers are so used to “there being more than one way”), including a default (double-click) action, a separate “multi-file” association popup menu for invoking programs that can take multiple files at once / or loop to apply a program / command to all selected files, and a similar association menu for directories too that can invoke your choice of programs that can open entire directories at once like Audacious(tm).  It also has an “Action menu” of frequently-applied actions that can be performed on selected files, or just stand-alone, such as mounting frequently-used filesystems.  Another unique feature in the Action menu is one can have commands like “diff” gui-tools that can take two files, say, for comparisen.  I can select a file from the top panel and one from the bottom, select “tkdiff” from the action menu, and quickly compare the two files.  I can also craft shell commands with parameter placeholders and select files to process with the parameters being replaced with the selected and matching files in a loop.  It saves all typed-in commands, along with frequently-visited directories, and remote-host connections for quick, one-click reactivation.  There’s even a custom drop-down menu and text field to enter custom file-selection groupings, such as “Music”, “Perl”, etc.; and Perl regular-expression patterns for reducing the list of files shown in the file panels. There’s also multiple-tabs for having more than two directories and / or remote-connections open at once.  It also uses my “Net::xFTP” module to allow mounting file-systems on remote hosts as if they were local, allowing nearly all these features to be performed on remote files too!  This obsoleted another program I had previously written as a GUI wrapper to Net::xFTP called Ptkftp.  Later, to add a little eye-candy, I created the CPAN module “Tk::HMListbox” to allow for a column of tiny file-type icons to be displayed next to each file and directory.  While JFM4 does work on a limited basis on Windows and I’n not hesitant to use it on those rare occasions that I’m forced to work (“with one hand tied behind my back”) on Windows, it’s really designed to be a Linux/Unix tool, but it also comes with the install wizard for Windows.  It still could use some more work, features, and testing on that platform, however.

“JFM File Manager” screenshot; Feb. 3, 2016;  image by (©:2016) me.

“E Editor” screenshot; Feb. 3, 2016;  image by (©:2016) me.

“Sql*Perl Plus” screenshot; Feb. 3, 2016;  image by (©:2016) me.
Follow

Get every new post delivered to your Inbox.

%d bloggers like this: