Ubuntu Stuff

This is a continuation of my Gnome 3 notes.
Disclaimer - editing system files can break your system, all information is presented as-is and without warranty.


5/19/12

Summary of Configuration Changes I made to Ubuntu 12.04

The default Unity and Gnome Shell interfaces don't work well for me, mainly because of a lack of a normal app menu and a task bar that supports window buttons. Unity is somewhat better but its taskbar icons represent apps, not windows, and more often than not I have several instances of the same app running (terminal windows, file manager windows, edit windows etc). This situation can be corrected by installing a traditional panel such as lxpanel, which with some configuration works with both Gnome Shell and Unity. Other options that provide an old-style Gnome-based interface with the nautilus desktop include Gnome Classic (gnome-panel), Cinnamon, Mate, and creating custom Gnome sessions. Non-Gnome interfaces that can be installed include KDE, LXDE and XFCE. These are all just different interfaces to the same underlying operating system (in Linux the operator GUI is really just another app), for the most part they all run the same apps and can be installed in parallel. The desired GUI can be selected from the login screen.

Gnome 3 makes it fairly easy to create custom sessions by adding files to the /usr/share/gnome-session/sessions and the /usr/share/xsessions directories. The xsessions directory contains .desktop files that are made available from the login screen and specify which .session file to run from the sessions directory. Not all components (including lxpanel) can be run directly from a session file, so I add a script to my autostart programs that runs additional components based on the contents of the DESKTOP_SESSION variable, which is set to whichever .session file is running. When playing around with custom sessions it's a good idea to (at least at first) set up the system so that it does not automatically log in, otherwise if something goes wrong you might end up in a non-functional session with no easy way to change to a working session - if that happens you can boot to recovery mode, navigate (cd) to /usr/share/xsessions and rename (mv) the non-working .desktop file. It also helps to create desktop launchers that run the Gnome logout/restart tool, a terminal and a file manager (or enable the "Home" icon) so if the panel fails to load you can still operate the session to fix it or get out of it. Gnome 3 removed the option to create desktop icons but the function can be accessed by installing gnome-panel and running the desktop-item-edit applet, I use a nautilus script to make it easy to run.

This material assumes basic knowledge of how to use a command line, navigate the file system, and creating scripts. Scripts must be set to be executable to be able to run them, to create a new script right-click in the directory you want to create the script in and select Create Document then Empty File, rename the file to what the script filename should be, then right click the script file and select Properties, click on the Permissions tab, then check Allow executing as a program. By default when executable scripts are double-clicked a dialog is displayed giving the options to Run in a terminal, Display, Cancel or Run - to edit scripts select Display. Only scripts under your home directory can be directly edited, scripts in system directories require root permissions to create and edit. Two ways to do that - one way is after navigating to the directory in a terminal enter gksudo gedit file_to_edit (presently there's a bug where it creates a second empty but modified tab, click it gone with no save, see below for a workaround) - another way is to make a nautilus script that runs nautilus in root mode then you can create/edit system files normally. Be very careful when editing files in system directories, a typo can result in a non-booting system - it's a good idea to know how to use recovery mode and the command line to fix things when you break them (nano can be used to edit files without a GUI). Note - the nautilus file manager hides the true filename of .desktop files, to see and edit these use a terminal and run the editor directly - if in a system directory then use gksudo gedit filename.desktop to create or edit them.

Tinkering with the guts of the system can be daunting at first, but it becomes fairly easy after some practice. Main rule is if you don't know what a file does, don't mess with it. The mods in this section do not change existing files so should be safe enough even if something goes wrong, but remember there's no warranty, if you break it you get to keep all the pieces. If unsure or you don't want to take any chances then don't try it, stick with the pre-configured sessions (install gnome-panel to use Gnome Classic etc).

To get started, use Software Center to install Synaptic, Software Center is nice for browsing but it's a whole lot easier to use Synaptic to install packages when you already know what you want, plus if using Unity you probably don't want it adding a launcher for everything installed (and for some things a launcher won't work anyway). You'll probably have to jump through some hoops at first to enable additional repositories. Once Synaptic is installed and all the repositories are enabled, installing packages typically is just a matter of typing in the package name or key word into the quick search box, checking the package, clicking apply and confirming the changes. To duplicate something like my setup install gnome-panel and lxpanel. Other almost must-have packages include gnome-tweak-tool (which pulls in gnome-shell), gconf-editor and dconf-tools.

To make things easier I use nautilus scripts, which (once enabled) can be accessed by right-clicking and selecting Scripts. To enable nautilus scripts, open the file manager and navigate to [your home dir]/.gnome2/nautilus-scripts (in these docs your home dir is often specified as ~) (to access files beginning with a dot do View then check Show Hidden Files - might want to go to Preferences and make that permanent), then add a script. I use the following scripts...

Terminal...

#!/bin/bash
gnome-terminal &

CreateLauncher...

#!/bin/bash
gnome-desktop-item-edit --create-new $(pwd) &

BrowseAsRoot...

#!/bin/bash
gksudo "nautilus $(pwd)" &

Once scripts have been added to nautilus-scripts, the Scripts menu is enabled and contains an option to open the scripts directory.

To work around the gedit bug where it creates an empty modified edit tab, add the following system script...

gksudo gedit /usr/local/bin/mygedit (or name it however you want - just not gedit or any other existing command name)

#!/bin/bash
gedit "$1" < /dev/null

With this script in place you can do gksudo mygedit file_to_edit without the extra tab being made.

Now to create a custom "LxGnome" session... Add the following system files... (see above notes about editing system files)

/usr/share/gnome-session/sessions/lxgnome.session

[GNOME Session]
Name=GNOME (lxpanel)
RequiredComponents=gnome-settings-daemon;
RequiredProviders=windowmanager;
DefaultProvider-windowmanager=metacity
DefaultProvider-notifications=notify-osd
DesktopName=GNOME

/usr/share/xsessions/lxgnome.desktop

[Desktop Entry]
Name=GNOME (lxpanel)
Comment=Gnome with lxpanel
Exec=gnome-session --session=lxgnome
TryExec=gnome-session
Icon=
Type=Application
X-Ubuntu-Gettext-Domain=gnome-session-3.0

Add the following script anywhere convenient, I put it in my home directory for easy editing...

mystartapps.sh

#!/bin/bash
if [ "$DESKTOP_SESSION" == "lxgnome" ];then
lxpanel &
fi

Make sure it's executable. Go to the Startup Applications applet and add an entry for mystartapps.sh - you'll have to specify the full path to the script, for my system for the command box I entered: /home/terry/mystartapps.sh

To create custom shutdown and logout icons on the desktop, use the CreateLauncher script.
For Shutdown use the command line: /usr/lib/indicator-session/gtk-logout-helper --shutdown
For LogOut use the command line: /usr/lib/indicator-session/gtk-logout-helper --logout
Choose whatever icons you want for these, instead of trying to navigate through the hundreds of icons you can just make them, then launch a terminal on the desktop (using the "Terminal" nautilus script), do ls to see the filename, then do gedit filename.desktop to directly edit the launchers, change the Icon= line for the logout launcher to system-log-out and change the icon line for the shutdown launcher to system-shutdown.

Now you can try booting into the newly made lxgnome session - log out and select GNOME (lxpanel). The first run of lxpanel will be a mess, don't worry, will fix that. For starters the default system tray and desktop pager applets will probably be botched, right-click and remove them. Right-click the panel and select Panel Settings, click the Advanced tab and set File Manager to: nautilus   set Terminal Emulator to: gnome-terminal  and set Logout Command to: /usr/lib/indicator-session/gtk-logout-helper --logout  Click on the Appearance tab and set Background to a solid color, click on the color thing and pick something, probably generic gray, for coolness can make semi-transparent. Click on the Panel Applets and add back the system tray, which should add a proper volume control and network manager icons. To set the clock up to show date and normal AM/PM time, right-click it, select Clock Settings, and set the format to the string: %a %b %e %l:%M %p  Or to show just the time without the date use the string: %l:%M %p  Change the other lxpanel options to taste.. add and/or rearrange applets, edit the launchers to what you want etc.

For eye-candy (shadows, animations etc) install the mutter package then edit the lxgnome.session file to change metacity to mutter. Or make new session/desktop files edited appropriately to select whether to use effects or not.

If anything goes wrong and it doesn't work, log back into Unity (or Gnome Classic) and figure it out - the above documents what I did to get the kind of GUI I want but your experience might be different, and there will probably be other aspects of the system that need tweaking. I think I covered the basics but if there are any errors or issues in the above instructions, let me know. Also these techniques can be used with other panel apps besides lxpanel, which does have some bugs - the virtual desktop pager doesn't work quite right, the add-to-desktop feature half-locks-up and requires the resulting launchers be made executable (it was designed mainly for LXDE, not Gnome) - but for me being able to configure it to do what I want makes up for the glitches.

LxPanel can also be used with Unity and Gnome Shell. Since the panel settings probably need to be different, copy the ~/.config/lxpanel/default directory to a new directory or directories under ~/.config/lxpanel and rename as needed - I name new configs to match the DESKTOP_SESSION variable so for Unity call the new directory "ubuntu", for Unity-2D use "ubuntu-2d", for Gnome Shell use "gnome-shell". The lxpanel -p option is used to load alternate configurations. Edit mystartapps.sh to something like this...

#!/bin/bash
if [ "$DESKTOP_SESSION" == "lxgnome" ];then
lxpanel &
fi
if [ "$DESKTOP_SESSION" == "ubuntu" ];then
lxpanel -p ubuntu &
fi
if [ "$DESKTOP_SESSION" == "ubuntu-2d" ];then
lxpanel -p ubuntu-2d &
fi
if [ "$DESKTOP_SESSION" == "gnome-shell" ];then
lxpanel -p gnome-shell &
fi

Include only the sessions you want lxpanel to run in. BTW the & symbols at the end of the lxpanel lines tells the script to launch it and move on, this avoids having the script continuing to run waiting for the panel to exit, and also permits adding multiple items if other components are desired for a particular session.

Presently the default Ambiance theme looks a bit funny to me, so I made my own somewhat modified Ambiance theme. To use it copy the tar.gz file to the ~/.themes directory (make it if .themes doesn't exist) then extract the archive. Use gnome-tweak-tool ("Advanced Settings") to select AmbianceMod. This has the effect of making any GTK apps running as root look like junk, to avoid that rename the theme to Ambiance instead, then it overrides the stock Ambiance theme and root things get the stock theme.

This covers most of the tweaks I've made to my Ubuntu 12.04 systems (virtual and real). Other tweaks I've made include moving the window controls back to the right, disabling the overlay scroll bar, and/or disabling the global menu but that only matters when using Unity so I don't bother with that one. On my systems I had to uninstall apport to keep it from displaying useless crash warnings when nothing was wrong, that might be fixed now. There are numerous web pages explaining how to make basic Ubuntu 12.04 tweaks so I won't get into that here.


A Test Upgrade from 10.04 to 12.04

4/28/12 - Running from a USB stick is a safe way to test compatibility on my main system but I want a real install to play with.. so upgraded my HP Mini 110 that was running Ubuntu 10.04. I got the current 32-bit 12.04 ISO, used Startup Disk Creator to put it on a USB stick, booted it on my Mini, ran the install icon, chose the option to upgrade the existing 10.04 installation (already selected), used the same user name I was already using and let it do its thing. I didn't have internet connected at the time so it couldn't replace outdated installed apps that weren't already on the ISO, so it told me I'd have to reinstall some things - that's fine, I didn't want to be accessing the overloaded repositories during installation and I needed to clean out old cruft anyway. Rebooted into Unity, connected ethernet long enough to run the restricted drivers thing which installed the broadcom wireless driver. Tried to use Software Center to reinstall wine but it didn't work... just put a non-functional icon on the launcher. Opened a terminal and used sudo apt-get update then sudo apt-get install wine - had to accept a license for mscorefonts, I guess Software Center can't handle text-mode installation questions (or something else bugged out). Repeated sudo apt-get install for dosemu gnome-panel and other stuff I need or got removed that I still want. Logged out and logged into Gnome Classic - some minor cosmetic issues (already noted) but otherwise works fine. Did a good job of preserving my data and custom apps, all my wine/dos apps, usr/local/bin stuff, associations, desktop icons nautilus-scripts etc all work fine, all I had to do was some minor editing to a few of my corewar scripts to compensate for the new version of xterm. The unclean shutdown bug I was getting in VirtualBox and on an EXT4-formatted thumbdrive doesn't seem to be a problem on this upgraded EXT3 system, dmesg | grep EXT shows no errors... whatever causes that doesn't happen on this system. Sound works and the speakers stop when the headphone jack is inserted, video works, etc. So far it looks like a successful upgrade.

4/29/12 - "lxgnome" on my HP Mini 110, using the mutter window manager and the stock Ambiance theme...


...Nice. For me anyway.. lxpanel doesn't have integrated social networking and all that stuff like the Unity taskbar, but I don't use that stuff and I'd much rather have a panel with a normal app menu and window list. This is using lxpanel's included network status monitor applet (had to set the config tool to network-manager to make it work), wireless also shows up with the systray applet, at first that config (the default when first running lxpanel) was buggy but after removing systray, adding lxpanel's own volume and adding systray back it seems to work OK now. To get effects at first I tried enabling Metacity compositing, but that was too glitchy... icons leave trails when moved. Compiz looks good but has a bit of momentary glitching when restoring minimized windows. Mutter works very well with nice but not overbearing effects - minimized windows smoothly collapse to their proper place on the panel. To make the additional sessions I simply copied my existing lxgnome .session and .desktop files to -compiz and -mutter copies and edited to change the names and window manager, added extra entries to my startup apps script (while at it made a lxpanel config for gnome-shell). In all the sessions I can run the Unity 2D launcher as needed to make use of its facilities... not too crazy about Unity as a sole interface but when paired with a more conventional panel for task management, Unity provides some really cool features, especially for searching for files and videos. All one really needs to do to restore a traditional environment to Unity is to install lxpanel (or any conventional panel), add it to the startup apps and do a bit of configuring... the scripts and stuff are needed only if using multiple sessions.

5/10/12 - quite a few 12.04 updates have come through in the last week, fixing among things the unclean shutdown glitch and improperly-updating compiz window title bars under VirtualBox. Other VirtualBox graphics glitches remain but it's fine with no-effects metacity sessions... graphics card emulation only goes so far but that it can do as well as it does is quite amazing.. some video sites like Crackle work better from my virtual 12.04 system than from my native 10.04 system... buffers better with fewer or no stream lockups.

On my HP Mini 110 I replaced my Unity-On Unity-Off launchers with a single launcher/script that just turns it on and off...

#!/bin/bash
if ps -e | grep "unity-2d-shell";then
killall unity-2d-shell
else
unity-2d-shell &
fi

...one less icon matters with a single-bar setup.

5/14/12 [edited 5/19/12] - I had my first real-life app for Gnome 3 / Ubuntu 12.04 - I needed to configure my HP Mini 110 so that I could edit microcontroller source code written in Great Cow Basic (that part is easy - gedit),  recompile the code using the GCB compiler configured to use the gpasm assembler (from the gputils package) to produce a hex file, rig up a simple serial-port terminal to talk to the gizmo via a generic USB serial adapter, and upload the hex binary code to the gizmo through the USB serial interface. This wasn't for some optional hobby project but for a mission-critical tester used for a product manufactured by the company I work for, I had to bring the thing home to work on the code (on my 10.04 machine) but if other changes are needed I need to have a programming rig I can take to the factory. Sounds like a good test.

What I want... edit the source code, right click the source file and select the GCB compiler, double-click an icon or script to launch the serial terminal emulator, right click the hex file made by the compiler and select sendhexUSB to send it to the gizmo, watch the code being uploaded on the terminal. Which is exactly what I ended up with but getting there showed a Gnome 3 fail in its default configuration - an inability to associate files to arbitrary apps.

So... copied over my existing pictools directory containing GCB and my compiler scripts - it's a FreeBASIC app so already 32 bit, should work fine (and does), installed gputils from the repository, found the source for dterm - my favorite lightweight serial terminal - and tried to compile it, failed, edited the Makefile to remove -Werror so warnings won't stop it, compiled and copied the resulting dterm binary to /usr/local/bin. Now to get it to work... says /dev/ttyUSB0: permission denied. OK... did some googling, learned I had to do ls -la /dev/ttyUSB0 and note which group appeared after root (dialout) and add myself to that group. Not wanting to goof around from a command line I installed gnome-system-tools to get the traditional "Users and Groups" GUI, added myself to the dialout group, logged out and back in, now my script that runs dterm works and I can interact with the gizmo. So far so good.

Now to associate *.gcb and *.hex files to the appropriate tool scripts. I used the Assogiate app to create new file types for text/x-gcb and text/x-hex, adding text/plain to both and adding the appropriate file masks and file type descriptions. New file types show up in Nautilus, right-click to add my associations and that's where I ran into problems - it only can associate to "officially" installed apps or things already in its association database (thank goodness when I upgraded it kept all my many associations!). [...] More here about this association feature/bug.

5/20/12 - OK I think I figured out this association stuff... still don't fully understand how it all works but really the core issue is being able to make an arbitrary binary, script or command appear in the list of apps that can be associated, and it turns out that part is easy. The idea is to put a custom .desktop file in ~/.local/share/applications containing entries like this...

[Desktop Entry]
Type=Application
NoDisplay=true
Name=Name of the application
Exec=/path/to/the/executable %f
Terminal=false

The key to making it work is the Exec line has to end with %f or %U or it won't show up in the list of apps that can be associated. So now just need an easy way to create the .desktop file without having to jump through a bunch of hoops, the solution I came up with is this script...

#!/bin/bash
#
# "AddToApplications" by WTN 5/20/2012 modified 11/17/2013
#
# This script adds an app/command/script etc to the list of apps
# shown when associating files under Gnome 3. All it does is make
# a desktop file in ~/.local/share/applications, it doesn't actually
# associate files to apps (use Gnome for that). Delete the added
# customapp_name.desktop file to remove the app from association lists.
# If run without a parm then it prompts for a command/binary to run.
# If a parm is supplied then if executable uses that for the Exec line.
#
appdir=~/.local/share/applications
prefix="customapp_" # new desktop files start with this
if [ "$1" != "" ];then # if a command line parm specified..
execparm=$(which "$1") # see if it's a file in a path dir
if [ "$execparm" == "" ];then # if not
execparm=$(readlink -f "$1") # make sure the full path is specified
fi
if [ ! -x "$execparm" ];then # make sure it's an executable
zenity --title "Add To Associations" --error --text \
"The specified file is not executable."
exit
fi
if echo "$execparm" | grep -q " ";then # filename has spaces
execparm=\""$execparm"\" # so add quotes
fi
else # no parm specified, prompt for the Exec command
# no error checking, whatever is entered is added to the Exec line
execparm=$(zenity --title "Add To Associations" --entry --text \
"Enter the command to add to the list of associations")
fi
if [ "$execparm" == "" ];then exit;fi
nameparm=$(zenity --title "Add To Associations" --entry --text \
"Enter a name for this associated app")
if [ "$nameparm" == "" ];then exit;fi
if zenity --title "Add To Associations" --question --text \
"Run the app in a terminal?";then
termparm="true"
else
termparm="false"
fi
# now create the desktop file - the format seems to be a moving target
filename="$appdir/$prefix$nameparm.desktop"
echo > "$filename"
echo >> "$filename" "[Desktop Entry]"
echo >> "$filename" "Type=Application"
#echo >> "$filename" "NoDisplay=true" #doesn't work in newer systems
echo >> "$filename" "NoDisplay=false" #for newer systems but shows in menus
echo >> "$filename" "Name=$nameparm"
echo >> "$filename" "Exec=$execparm %f"
# I see %f %u %U and used to didn't need a parm, newer systems might be picky
# according to the desktop file spec...
# %f expands to a single filename - may open multiple instances for each file
# %F expands to a list of filenames all passed to the app
# %u expands to single filename that may be in URL format
# %U expands to a list of filenames that may be in URL format
# ...in practice all these do the same thing - %F is supposed to pass all
# selected but still opens multiple instances. If %u/%U get passed in URL
# format then it might break stuff.. so for now sticking with %f
echo >> "$filename" "Terminal=$termparm"
#chmod +x "$filename" #executable mark not required.. yet..
# when executable set Nautilus shows name as Name= entry rather than filename
# app should now appear in the association list

[updated 11/17/13 to also work with newer versions of Gnome]

To make it easy to use I saved it as "AddToApplications" in the ~/.gnome2/nautilus-scripts directory (executable of course). To add a custom script or binary to the list of apps that can be associated I right-click the file and select Scripts|AddToApplications, give it a name that will appear in the application list (choose carefully to avoid conflicting with existing apps), then click yes or no to specify if the app should be run in a terminal or not. The script will then save a desktop file named "customapp_name.desktop" where name is the name was entered, afterwards the custom app appears in the list of applications that can be associated. If command line parameters are needed then run the AddToApplications script without a selected file or parm, then it prompts for a command line first, the filename being run by association will be added after any parms. Assogiate is still needed to create custom file types based on specific extensions etc but I'm used to that, same with Gnome 2.

5/23/12 - Originally when trying to configure associations on my Mini 110 I had installed kde-plasma-desktop to make use of its association utility (and get another alternate desktop environment to play around with), but it turns out that associations made using KDE don't show up in Gnome's list of apps that can be associated, and while at first they appear in the right-clicks of the associated file types, they're subject to go away if the associations are further edited. I ended up having to redo the associations using the AddToApplications script, all good now. Other utilities that have file association options include Thunar, PCmanFM and Ubuntu Tweak - but at this point I prefer the simplicity of the script approach.. I know what my script does, the other utilities, not so much.

6/2/12 - LxPanel's battery monitor is broken in the current stock 0.5.8 version, at least on my Mini 110. So I downloaded the 0.5.9 source (which mentions that is fixed) and and prepared using the command ./configure --prefix=/usr so it would overwrite the stock install. Of course had to keep installing -dev packages until configure was happy - not a process for the impatient and packages are often named somewhat differently than what the error message asks for, might have to guess - but used to it. Once happy did make then sudo make install... battery monitor works. Sort of, percentage works, time remaining doesn't. By using --prefix=/usr the package system still thinks I have lxpanel 0.5.8 so if an updated version becomes available through the normal channels it should replace the compiled version.

I've been fooling around with my Gnome Shell session...


Thanks to user contributions Gnome Shell now works for folks like me that prefer a traditional app menu and window list. I was using LxPanel for the bottom panel in my Gnome Shell session, but it's been replaced by the super-cool Panel Docklet extension - I especially like being able to right-click minimized windows and get a live overview of what the app instances are doing. I had to do a bit of configuring - the All-in-one places extension needed some editing to get it to fit vertically, and used the gnome-shell-extension-prefs utility to set up the system-monitor extension so it would fit the panel and not disable the stock battery monitor icon (which properly shows time remaining when clicked). The preferences utility can be run through the extensions.gnome.org website or run manually, to make it easier to access I used Alacarte (Main Menu) to make a menu entry for it.

Unity 2D is optional, triggered by clicking the yellow shortcut which runs the on/off script I made. Sometimes Unity 2D is handy for listing recent files, launching apps, searching, etc. Mostly it runs fine this way but there are some "free" side effects of running it like a stand-alone app - occasionally it goes away when an app is closed (so far that only happens if the app was actually launched from Unity), and it spams the .xsession-errors file every few seconds with warning messages - a fix for that is to delete/rename .xsession-errors and replace with a symlink to /dev/null (ln -s /dev/null .xsession-errors), I hardly ever want to actually see that stuff anyway.

6/3/12 - One minor but somewhat irritating bug with Gnome 3 is how when launching Nautilus or more instances of Gedit the pointer spins for several seconds although it's still functional. The fix is to edit the desktop files of the affected apps in /usr/share/applications - in particular nautilus.desktop, nautilus-home.desktop and gedit.desktop - and change to StartupNotify=false (instead of true).

I got a better menu going... the Applications Menu extension is functional but I don't like clicking the categories to expand, so got the Axe Menu extension (from the author's site as extensions.gnome.org is down at the moment). Had to make some settings changes to make it fit the screen but that was easy to do, right-click the menu thing and tell it not fixed size, reduce the icon sizes, eliminate some of the left pane categories, set category box to scroll. One issue - it shows lots of "debian" categories with invalid icons that I don't want to see, so I made a little code change...

.....
while ((nextType = iter.next()) != GMenu.TreeItemType.INVALID) {
if (nextType == GMenu.TreeItemType.DIRECTORY) {
let dir = iter.get_directory();

if (dir.get_is_nodisplay()) continue; //added by WTN 6/3/12

this.applicationsByCategory[dir.get_menu_id()] = new Array();
.....

Got the idea from here. This is one of the coolest things about the extension system - it makes it easier than ever to change how stuff works. Sure there's a risk of breaking something but the shell is pretty good about saying no if something is wrong and if I totally bork it I can just boot into another session and remove the code - it's a whole lot safer than directly editing OS code. Now if I can find better docs...

6/4/12 - VirtualBox running Ubuntu 12.04/Gnome Shell with Axe Menu, Panel Docklet and other extensions...


The setup on my HP Mini 110 is very similar except no Places section to save vertical space. The Restart Shell option is handy when running under VirtualBox... fixes the corrupted "Activities" screen and reinitializes extensions after resizing the VB window or making code changes.

8/30/12 - a screenshot of my present HP Mini 110 Gnome Shell setup...


The maximus extension is currently disabled - although it provides more screen space when an app is maximized, it makes it harder to close or restore maximized apps. The main reason I was using it was for Firefox, and in that app I can simply press F11 to toggle full screen. The Reversi game is OTHOV, something I made for a hacked version of hpbasic running in simh simulating a HP21xx-type minicomputer.

2/16/13 - my current 12.04 "lxgnome_effects" (compiz) session running under VirtualBox...


The VM screen width was reduced for the screenshot. Normally the Unity 2D panel on the side isn't running, toggled by the yellow panel icon.. useful for some things like recent documents and searching for videos. For that matter, usually I just run this in a plain lxpanel metacity session (effects slow things down, especially in a VM) but compiz seems to working well. Also works with mutter but under VB it causes an irritating background color flash when selecting menu options. The theme is a modified version of Ambiance with a dark Nautilus side panel and tweaks to make tabs and scroll bars look better (to me anyway). LightDM now supports timed-autologin, yay.. that was almost a dealbreaker since I like to turn on my computer and it just boot, and GDM is still semi-broken in 12.04.

My main machine is still running Ubuntu 10.04 and although for the most part it works very well and I'm in no hurry to upgrade, desktop support is ending in a couple of months. Support for non-GUI and I presume security updates will continue for 2 more years, if that includes FireFox I'm tempted to stick with 10.04 for now - the real determining factor is going to be support for 10.04 by other providers (LibreOffice, VirtualBox, etc). But at some point I'm going to have to upgrade and I do not look forward to that - very disruptive as in have my stuff stops working until I fix it. As far as I can tell most of what I need will be fixable, just time-consuming redoing PPA's, installing new versions etc. The main issue I can see is getting temperature indicators to work with my hardware (a MSI KM4M-V motherboard with a cheap NVidia graphics card).. I can so long as I stick with Gnome Panel (I made a test USB install and verified that it can be done with a bit of compiling and hacking), but the temp indicators for LxPanel and Gnome Shell don't easily support adding an offset - my sensor returns readings relative to "too hot" rather than an actual temperature. The main reason I even need a temp sensor on this machine is the fan speed driver appears to be in the bios itself and doesn't always increase fan speed so I need to keep an eye on the CPU temperature or it will shut down... tempted to permanently fix that by adding a hardware fan speed control circuit.. and it would probably be easier to add a thermometer I can stick on the outside of the case rather than trying to hack in software support - it gets old having to recompile or reinstall the custom K10temp driver every time the kernel changes.

GUI-wise, a session running Nautilus and LxPanel seems to be the most attractive for what I do - I like simplicity, the extra screen space, and a normal app menu - but I'll have to trim down the number of launchers in the panel to leave as much room as possible for window buttons (when I'm working I typically have many open windows and need to quickly select them with a click). Gnome Shell with extensions or Gnome Panel are other possibilities but then I'm back to a 2-panel setup. Gnome Panel has retract buttons to reclaim space as needed but the new one isn't quite as configurable as the old Gnome 2 panel (but it is less buggy other than some fixable theming issues). Gnome Shell with certain extensions looks better but is more bloated and so far haven't found an extension that provides a normal app menu that doesn't cover up half the screen with eye candy or require extra clicking... when I'm working I don't care about visuals as much as being able to get to my work apps, files, directories and open windows as quickly as possible - I want my OS to do what I tell it to then get out of my way, not be the main show. No OS is perfect (especially stock - invariably they seem to be designed for someone else), but there are many GUI choices for Linux-based distributions.. and even more choice when one mixes up the pieces. Surely one of the supported options will do fine once I get past the upgrade and get used to it.


Ubuntu 12.04 on my main machine

[my main machine is at the moment a ZaReason Limbo 6000A tower from March 2011 with a quad-core 3ghz AMD Athlon II X4 640 processor, since upgraded with a cheap NVIDIA GT210 graphics card, 8 gigabytes of RAM and a 1T hard drive in addition to the 500G drive it came with.]

5/11/13 - Did it... upgraded my main production system from 10.04 to 12.04 using the update manager app. Went suprisingly well... after making a full image backup of my hard drive and making sure I could mount it, clicked the big fat upgrade button and let it do its thing. Wasn't exactly automatic and there were glitches - had to select the display manager (lightdm), decide whether to keep certain config files (kept grub, replaced the rest), a few buggy dialogs with bunches of unreadable blocks instead of text (hopefully not saying anything important, hit enter enter to clear), told it to keep "obsolete" software (some of that stuff I need for manually installed apps), tons of error messages in the console as it was upgrading but that's pretty much normal, upon reboot got a scary message about disk with /tmp not available but did nothing and it continued on its own, booted into Unity. Hillarious stack of icons on the side, logged out and back into LXDE (which was previously installed) to set about fixing stuff. Used Synaptic to fix a couple of broken packages, to remove one broken package had to make an empty directory it was complaining it couldn't change to. Installed gnome-panel for a more sane UI and set about putting my system back together... not much got clobbered, reinstalled wine, AcroRead, Google Earth (which installed ia32-libs, need that for many other things), fixed up gnome-panel with the stuff I like including adding my modified Ambiance theme, had to manually download and compile sensors applet to get CPU/Video temp back. Started the upgrade process about 9am, about 12 it was done, by 3pm had a functional system that for the most part is just like Gnome 2. After a bit more tweaking... [updated screenshot 5/13/13]


I can live with that (as in Yay It Worked).

It's not perfect - a few (expected) cosmetic glitches related to theming, especially with GTK2 apps... messing around with gtk-chtheme helps - but it came out a whole lot more perfect than I was expecting. Actually, doing an update manager upgrade-in-place on such a "used" system I was expecting an unbootable mess and was prepared to do lots more fixing and maybe delete it all and install from scratch, but thought I'd try the update manager method first just in case it worked so I could avoid having to redo all my custom stuff - and I was not disappointed! I'm sure there will be things to fix or adapt to, but it looks like most of my scripts, associations, virtual machines, wine apps, dosemu, manually installed apps and other stuff I depend on made it through the upgrade process - it would have taken a week or more to get to this point with a fresh install. The downside is lots of leftover cruft that no longer applies but that's OK.. easier to ignore the extra stuff than to figure out what is truly no longer needed.

5/13/13 - Replaced the screenshot from 5/11, not much changed but now using indicator app complete instead of separate indicators with a separate clock and having to run gnome-sound-applet in startup apps to get a volume control (that conflicts with other sessions), and configured a new session to use mutter instead of no effects. I had issues using the Classic with effects (compiz) session - the animations weren't exactly smooth and the desktop pager broke after telling it to use 2 workspaces (clicking the 2nd workspace resulted in an empty screen - no panel icons right-click or anything). I'm not into heavy graphics but basic things like shadows and simple animations are useful and I liked what I saw in Gnome Shell (after adding lxpanel and tweaking it a bit), which uses the mutter window manager. So installed the standalone mutter package then copied the existing fallback session files and edited them accordingly...

----- file /usr/share/xsessions/gnome-classic-mutter.desktop ---------------
[Desktop Entry]
Name=GNOME Classic (Mutter)
Comment=This session logs you into GNOME with the traditional panel using the mutter WM.
Exec=gnome-session --session=gnome-classic-mutter
TryExec=gnome-session
Icon=
Type=Application
X-Ubuntu-Gettext-Domain=gnome-session-3.0
----------------------------------------------------------------------------

----- file /usr/share/gnome-session/sessions/gnome-classic-mutter.session --
[GNOME Session]
Name=GNOME Classic (Mutter)
RequiredComponents=gnome-panel;gnome-settings-daemon;
RequiredProviders=windowmanager;
DefaultProvider-windowmanager=mutter
DefaultProvider-notifications=notify-osd
DesktopName=GNOME
----------------------------------------------------------------------------

Also mucked around using dconf-editor - mutter causes a very minor cosmetic glitch in the left-side title bar menu button, right-clicking the title bar brings up the same menu so set the key /org/gnome/desktop/wm/preferences/button-layout to ":minimize,maximize,close" (no menu). Did other stuff with dconf-editor to set up things like I want.. like adjusting the clock format under /com/canonical/indicator/datetime and enabling mutter's edge tiling under /org/gnome/mutter. I occasionally use Unity 2D (the yellow panel icon turns it on and off) so set the key /com/canonical/unity-2d/launcher/hide-mode to 2 to enable dodge-windows. Used Gnome Tweak Tool to enable other stuff, mainly affecting the Gnome Shell session but there's some overlap like showing mounted drives on the desktop. Other tweaks include uninstalling the overlay scrollbar packages (I want plain scrollbars not popup widgets), added my CreateLauncher and AddToApplications scripts (see 5/19/12 and 5/20/12 entries) to nautilus-scripts to make up for removed features. All my existing desktop shortcuts and file associations made it through the upgrade process so haven't needed the scripts yet, but I'm sure at some point I'll need to make a launcher or add a binary or script to the list of apps that files can be associated to.

So far so good... it's better than Gnome 2. Upgrading in place is usually not recommended but in my case it kept the vast majority of my customizations intact saving a huge amount of time, I know how to fix glitches like conflicting/broken packages, and I made a full backup image of my existing 10.04 disk before attempting the upgrade so if it didn't work I could restore things to the way they were or be able to pull stuff over after installing from scratch. Despite dreading it for a year the upgrade seems to be a phenomenal success, my system is snappier than it has ever been. Other than a couple cosmetic bugs in gnome panel that I don't care about (can't usefully make the panel transparent because widgets use the background from the theme, and sometimes the text temporarily overlays the icon on the first window button), a somewhat different (better) widget set, a few differences that make it work and look better, and more up-to-date apps (the main reason for upgrading), it basically IS my old system with a shiny new skin.

6/22/13 - After yesterday's update of mesa, the mutter window manager no longer works properly, breaking my gnome-classic-mutter session and also Gnome Shell which now just loads a disfunctional desktop with no panels etc. Mutter works (and restores classic functionality) if I run the command mutter --replace in a terminal, but the same command run from a GUI tool or mystartapps.sh does not work.. has to be run from an open terminal. So... until whatever broke stuff gets unbroken, using plain Gnome Classic with metacity. At least it's faster without effects...

This might be a malfunction in my video card or maybe the NVIDIA driver - mutter fails horribly in VirtualBox now (totally garbled graphics) and that virtual system has not been updated. I have been having video-related flakes lately - sometime back the system started intermittently failing to bring up the GUI (after a kernel update), a problem that was solved by installing the latest NVIDIA driver (which wasn't exactly easy - I failed to uninstall the previous version first which caused all sorts of issues). Now this issue - it seems correlated with the mesa update but with no easy way to roll back updates it's hard to test the theory, could just be coincidence. Regardless, things were humming along fine, then after an update mutter no longer worked unless run from a terminal - it's hard to imagine what sort of hardware failure would care whether or not my window manager ran from startup scripts or a terminal, and the issues happened after updates, so I'm leaning towards some sort of software issue. The new software might simply not be fully compatible with my cheap PNY/NVIDIA GeoForce 210 card using the NVIDIA driver (the nouvaeu driver doesn't work right on this machine configuration). Might be time to get a better video card...

6/23/13 - Problem sorted (for now).. basically just reinstalled the NVIDIA driver - should have thought of that but never had to do that before - apparently some updates stomp on the driver configuration (still weird that mutter would run from a terminal but not from GUI startup). To track down the problem I found the error in .xsession-errors and googled.. sure enough users reporting Gnome Shell not starting after some update then reinstalling the driver to fix it. The procedure is fairly simple - ctrl-alt-F1 to get a text screen and log in, run "sudo service lightdm stop" to kill X, change to the directory containing the driver then sudo ./NVIDIA-Linux-[press tab to complete the filename], follow the prompts to uninstall and reinstall (including the dkms module) then sudo reboot (might help to cross fingers). Part of the issue is probably because the driver is closed-source so developers can't fully understand or fix all the interactions... another part of the issue might be an incompatibility with vesafb as noted in dmesg output but so far I haven't found an easy way to disable it (lots of conflicting low-level info and I'm kind of getting tired of breaking then having to fix my system, plus without vesafb I'd likely uglify my full-screen text terminals), yet another issue seems to be poorly-tested updates that muck with stuff that should be left alone. Perhaps the solution is still to get a better/more compatible video card... but which one? [...]

7/6/13 - Disabling the conflicting vesafb driver is fairly easy... edit /etc/default/grub (back it up first) and change the lines...

GRUB_CMDLINE_LINUX_DEFAULT="quiet splash"
GRUB_CMDLINE_LINUX=""

...to...

GRUB_CMDLINE_LINUX_DEFAULT=""
GRUB_CMDLINE_LINUX="video=vesa:off vga=normal"

...then run update-grub to update the boot stuff. However, this blows away the pretty Ubuntu splash screen while booting leaving just a lot of text flying by (which doesn't bother me.. basically the same as dmesg output), and also makes virtual full-screen consoles (ctrl-alt-F1 etc) use a 80x24 screen instead of nice smaller fonts. This gets rid of the vesafb warning from the NVIDIA driver (making me feel a bit better) but otherwise can't tell any difference... there is still the bug where the first double-click of a session doesn't work (regardless of the GUI environment, workaround is do it again or right after booting highlight the file first - this bug does not happen on my HP mini 110 or under VirtualBox), and VirtualBox won't run anything that uses mutter (Gnome Shell, Cinnamon, custom sessions etc). I don't care that much about the double-click bug (only an issue right after booting) but it would be nice to fix the VirtualBox issue as that's how I experiment with different configurations before trying them on real hardware. There might not be a solution other than get another video card.. seems that NVIDIA is not fully compatible with Ubuntu (and likely other distros), the mutter window manager seems to be picky about what it will run on, and VirtualBox has always had issues running 3D or muttery things on this machine (just went from semi-broken to fully-broken). Modern PC's are very complex beasts with a huge amount of variation - it's almost a miracle that modern software works at all - especially free software - so not sweating a few bugs (just documenting them), it's just a matter of figuring out what works and what doesn't, fixing stuff if possible and learning to live without fancy stuff that doesn't work and in the grand scheme of things I don't really need anyway.

[update... got mutter and Gnome Shell working in VirtualBox again.. see below]

On the other hand, VirtualBox works quite well for Windows 7 when 2D/3D accelleration is turned off and that's what really counts since that's how I run Altium Designer to make circuit boards - it must work or I'd be stuck with having to set up a dedicated machine for it and I really don't want to do that. Especially considering the last time I had a dedicated Windows box for it I had bugs bugs bugs and it eventually crashed and burned taking out the whole damn OS, not to mention the hassle of having to transfer files between the Windows box and my main work machine. Running W7 virtually solved pretty much all the issues - backup is just a matter of copying a directory, Altium Designer works MUCH better when all it sees is plain video (sure enough if I enable VB's 2D/3D accelleration Altium crashes the OS as soon as it runs), and VirtualBox's shared directory feature works fine for transferring files back and forth. To run Windows 7 in a plain window without VirtualBox's menus to maximize screen area I use a shortcut launcher that runs the command...

VBoxSDL --termacpi --startvm "Win7pro"

...if for some reason I need to run it with VB's menus I can just start it from the main VirtualBox program. I've been running W7 from a 40 gig virtual disk but space was getting tight and it was time to attempt an upgrade to the new version of Altium (which due to upgrade risks needs to be installed in parallel with the old version), plus I might need to install other huge stuff like maybe SolidWorks (big maybe, will have to see how it reacts to plain video), so needed to increase the disk size. The existing virtual disk was dynamic, so I could use the command...

VBoxManage modifyhd Win7pro.vdi --resize 80000

...(in the virtual machine directory) to resize the disk to about 80 gigs. Reportedly this doesn't work if the virtual disk was set up to be a fixed size. This command only adds unallocated disk space, to make use of the extra space I attached an Ubuntu live CD image and booted it then used gparted to expand the Windows partition into the extra space, removed the CD image from the virtual CD drive and rebooted. Windows went through a CHKDSK thing to verify the file system but otherwise didn't complain and now I've got lots of extra disk space. Installing AD 13 went well, seems to be an improvement over AD 10 but without changing much (yes I hate change especially when I have work to do and have already invested huge amounts of time learning how to make the stuff work... the only changes I want to see are bug fixes and improvements).

Other software notes...

Recently Google Earth started failing with "invalid http request" when I entered an address, so got the new version 7 deb from the Google Earth page and installed it. Didn't work... uninstalled it, removed the .googleearth directory from my home dir, reinstalled the deb, works now. Much improved, the previous version had really ugly monospaced fonts but now it looks fine.

Sometimes I need to save video and audio playing on my computer and for some things browser-based tools won't work. Previously I tried to use a program called RecordMyDesktop but it never worked right (no audio and now it doesn't work at all), but found something called Kazam Screencaster in the repositories, works great once I set it to use H264/MP4 encoding for video (VP8/WebM didn't work) and "monitor of built-in stereo audio" (otherwise no sound). The GUI makes it easy to select the area of the screen to record, has an adjustable delay before starting and adds a "tray" icon to gnome panel to stop the recording and prompt for a filename to save the video. Haven't tested it much but seems to work, kept up with 30 frames a second while encoding a 360x200 view window. I'm sure at some size point the frame rate will have to be reduced, no option to dump raw uncompressed video.

7/8/13 - [edited] Was playing around and noticed that mutter was still working on my other older/stuffed-up 12.04 VirtualBox VM (but Gnome Shell just went to fallback)... I hadn't updated that system in 2 months so backed it up then applied all updates (expecting failure), but mutter still worked (but not Shell). After reinstalling the VB guest additions (have to after a kernel update to get a usable system), found that Gnome Shell worked too. Cool. Updated my newer/less-stuffed-up 12.04 VM... didn't make any difference, mutter still hopelessly garbled. Updated the VB guest additions (from 4.2.12 to 4.2.14), now mutter works, so does Gnome Shell (mostly.. on my newer 12.04 VM with splash/lightdm sometimes it fails to launch, and in both VM's the overview still has a garbled background but it has always done that and I don't use or care about that feature). Basically the fix was to update the guest additions.

9/7/13 - Ever since upgrading my main system from 10.04 to 12.04 it's had a minor bug when first starting the system - the first double-click of a desktop icon failed unless I highlighted an icon then clicked the background to unhighlight first (or just double-clicked twice), after that it was fine but I noticed that sometimes after running VirtualBox the bug would return. Didn't matter what GUI or window manager I used. None of my other systems did this (real or virtual) and couldn't find any reports of anyone else having that problem, figured it was probably some X thing related to my cheap video card, or maybe something to do with USB or my cheap generic mouse and just expected and ignored it. When it comes to complex operating systems, when that's the main bug it's probably in pretty good shape! But still whenever the kernel was updated I'd check to see if the double-click bug was fixed (instead of doing the click dance after booting to prime the GUI), and after today's update to 3.2.0-53 the bug seems to be gone. A little thing but one step closer to perfection, a few seconds saved each day. There is still an occasional apport system error dialog that pops up because some service I usually don't need had a problem but these tend to take care of themselves (and provide the devs with debugging info), usually involves some leftover cruft or service I don't need anyway, and it doesn't happen often enough to apply the real fix (remove apport:-).

So now, as far as the GUI itself is concerned.. I can't think of anything important I want to fix. Probably a rare moment that will pass! Sure there are plenty of app bugs (that will probably always be the case), but the combination of the Ubuntu 12.04 core, Nautilus 3.4 and other Gnome 3.4 components, Gnome Panel, the Mutter WM, a self-compiled indicator-sensors package (to get semi-accurate CPU/NVIDIA temperature readings), and a few hacks to the Ambiance theme, gives me a GUI that works pretty much exactly like I want (works like Gnome 2) and doesn't slow me down with unnecessary graphics effects.

10/21/13 - My initial double-click bug is back.. but whatever, used to "priming" things by clicking around when I start up. I'm thinking it's a result of some odd interaction between the NVIDIA driver, the X system and/or Nautilus based on an observation after an "incident". A couple of days ago applied a bunch of updates including Xorg and afterwards nothing using OpenGL (mutter, compiz, glxgears, etc) would work, had to boot into a plain metacity gnome panel session (yay for multiple sessions!). No double-click bug - a clue that it's something to do with the NVIDIA driver. Problem was the update cleared my xorg.conf file causing the NVIDIA driver to not be properly loaded. Not sure if this is a bug as I'm currently using the NVIDIA driver from their website, not the repository version which may (or may not) account for this lack of consideration. Not knowing the cause yet I proceeded to extend foot and shoot by installing the repo driver - don't do that, result is no GUI and having to reinstall the driver from a text console.. all I would have had to do is restore the xorg.conf from a backup. To properly convert to the repo driver I (theoretically) should run the installer from the website with the --uninstall option then apt-get install nvidia-319 to get the latest 3.19 version. But mucking around with video drivers is nerve-racking so putting it off, it's working now.

The PPA version of LibreOffice 4.1 has broken EPS import. To make docs for my circuits I need to extract the schematic from a PDF file output by Altium Designer and get it into a rotated EPS file to import into LibreOffice, using the following commands...

pdftops -noembtt -f 1 -l 1 "[name].pdf" "[name]_schem.ps"
ps2eps -R + < "[name]_schem.ps" > "[name]_schem_rotated.eps"

Some time ago, about when 4.1 came out, EPS import failed with a "graphics filter not found" error, to get by I installed OpenOffice from the website and associated it with DOC and ODT files, but I like LibreOffice better. Bug report says fix released, but not seeing it in the PPA. Not sure what the holdup is, got work to do so removed the PPA version and installed the website version of LibreOffice, problem solved and it's off the update system. Newer versions of software often do fix problems and work better, but for important apps I need to be able to roll back updates if something breaks. An example is SVG files, previously I had tried to import SVG graphics of circuit boards produced by the gerbview program in an attempt to make sharp zoomable docs, and it didn't work right (missing pads etc). Now it works perfectly.

From the I Want To Keep My Obsolete Software That Works Just Fine department...

I still have a few dos apps and batch files that I use (mainly QBasic stuff) which I run using DosEmu/FreeDos. Despite being over 2 decades over, for one-off stuff it's still easier to fire up QBasic and just do it rather than editing, compiling, repeat until it compiles, repeat until it produces the output I'm looking for - with QBasic all that is in one app, having used it for a long time I know it well, and when I'm working speed to answer counts, looks don't even figure (nobody else will see it). Previously if I had to process data I'd have to copy it to my DosEmu file tree, launch DosEmu and do whatever, copy the data back to whereever I was working then clean out the temp stuff. If I drop a symlink into the DosEmu tree then dos apps can access that target dir, so I wrote this "dosprompt" script...

#!/bin/bash
# launch a dosemu dos prompt in the current directory
dosroot=~/MYDOS # location of dos filesystem dosemu starts in
td=dp.tmp # temp dir in dos file system
pn=`pwd`
mkdir $dosroot/$td
ln -s "$pn" $dosroot/$td/cdir #link to current dir
echo >$dosroot/$td/run.bat "@echo off"
echo >>$dosroot/$td/run.bat "cls"
echo >>$dosroot/$td/run.bat "cd \\$td\\cdir"
xdosemu -E "\\$td\\run.bat"
rm $dosroot/$td/run.bat
rm $dosroot/$td/cdir
rmdir $dosroot/$td

The script lives in my Nautilus Scripts directory so wherever I'm at I can right-click, Scripts, dosprompt and it boots DosEmu with that directory current (named dp.tmp\cdir but that doesn't matter). DosEmu doesn't provide a way to launch in a particular directory, so instead the script creates a batch file that changes to the symlinked directory and runs the batch with DosEmu using the -E option to tell it to stay running after the batch exits.

Most of the time I'm running QBasic programs so if the program already exists it's nice to just run it (saves having to type qbasic /run program.bas), so using similar techniques I made this "qbasic_pause" script...

#!/bin/bash
# runs a BASIC file in QBASIC using dosemu
# current directory mapped so BASIC program will have
# access to all files in the current dir and subdirs
dosroot=~/MYDOS # location of dos filesystem dosemu starts in
td=runbas.tmp # temp dir in dos file system
if [ -e "$1" ]; then
bn=`basename "$1"`
pn=`dirname "$1"`
if [ "$pn" == "." ]; then pn=`pwd`;fi # in case run from terminal
if [ -n $bn ]; then
mkdir $dosroot/$td
ln -s "$pn" $dosroot/$td/dir.tmp #link to current dir
echo >$dosroot/$td/runbas.bat "@echo off"
echo >>$dosroot/$td/runbas.bat "cls"
echo >>$dosroot/$td/runbas.bat "cd \\$td\\dir.tmp"
echo >>$dosroot/$td/runbas.bat "qbasic /run $bn"
echo >>$dosroot/$td/runbas.bat "echo."
echo >>$dosroot/$td/runbas.bat "pause"
xdosemu "$dosroot/$td/runbas.bat"
rm $dosroot/$td/runbas.bat
rm $dosroot/$td/dir.tmp
rmdir $dosroot/$td
fi
fi

This one is designed to have BAS files associated to it but can also be used as a Nautilus script. To perform the association I used Assogiate (aka "File Types Editor") to create a mime type for *.bas files with text/plain as the parent type, then used my AddToApplications script to create a desktop file for the qbasic_pause script so  Gnome can be told to add it to associations for *.bas files (I miss being able to associate directly to a script but I guess that made too much sense..). Now I can right-click a QBasic file and open with qbasic_pause to run it with the current directory set to the location of the QBasic program, so no problem finding data files.

True I probably spent more time figuring out these scripts (then writing about them) than I save from using them.. but that's fine since time spent when not working is "free" and when I do need to use dos in the course of working I can just do it without being distracted by extra file copies etc, for me that makes it well worth the effort. If I could find modern software that works better for quickly writing code (I didn't say good-looking code, just code) I'd use it, but so far for simple input, process, output stuff nothing I've found beats the old QBasic (QB64 doesn't let me run it or a program from anywhere so it's out), and if I need to distribute the app I can use FreeBasic to compile it for Linux or Windows.

What else is going on...

I recently installed a mostly stock Ubuntu 12.04.3 (Unity and all) to a friend's HP110 netbook - same model that I have but mine usually runs a custom session I made using Nautilus and lxpanel. We'll see how she adapts to Unity.. for normal-user one-app-at-a-time use it actually works quite well, the global menu saves vertical screen space. My main beefs with the global menu are it's invisible unless the mouse is over it, and when an app is in a smaller window then the menu should follow the window, not stay at the top (when visible). In my opinion anyway. Added a few essentials like flash and codecs, and for me Synaptic, removed extra launcher icons leaving just the file manager and FireFox. Had a minor issue when installing that required googling... installed dual boot to keep the original (Ubuntu 8.04-based) HP Mobile system, when it got to the partition size screen it didn't label which side was which.. the new system is on the right so to make it bigger have to slide the slider to the left. Otherwise installation was uneventful and other than a black screen and stray message when booting (didn't do the framebuffer fix) the new system seems to work fine and the old system still works for a backup. Sort of.

Got NetFlix under Ubuntu.. followed the directions on the webupd8 site.. basically it's a plugin that uses a custom version of wine to run Silverlite as if it were a native plugin. Bloated but clever and so far works.. under Firefox once after pausing I had to refresh the page to get it to continue but otherwise no issues once I figured out the user agent string...the User Agent Switcher plugin didn't work under either Chromium or Firefox, the User Agent Overrider plugin works. Netflix also works in Windows XP under VirtualBox in case the complicated wine-based system goes down. But native is better. I really want something like Apple TV and (when I want to) bypass my computer altogether.. kind of inconvenient to do anything else on a computer when it's playing a full-screen video.. but still it's nice to be able to play NetFlix videos. Got Hulu too, it's flash-based and has always worked for me under Linux. Something will eventually have to be done about that as flash is no longer supported under Linux - unless using the Google Chrome browser (but pipelight now supports running the Windows version of flash so that might be a solution if the current Linux version of flash becomes unworkable). HTML 5 is proposing a controversial solution - basically a plugin system for DRM videos but I'm guessing it'll only support closed systems like Windows. What we really need is an open-source platform-independent solution that lets content makers do their DRM stuff but in any operating system. Yea that's a tall order.. but perhaps an interface layer with a "generic" x86 binary blob within.. blob supplied by the service. Like almost every other (especially Linux) user, I don't like DRM, but I do like good content and if those providing the content demand DRM.. well here we are. Thankfully there are clever hackers that can figure out how to make stock Windows code run under Linux.

11/17/13 - Fooling around with Pear OS 8.. here's what my VirtualBox install currently looks like...


The base system is Ubuntu 13.04 [corrected], running a customized gnome-panel "fallback" session with a custom dock called "plank". I added the "slanted e" icon next to the pear on the top bar, it's a standard gnome-panel drop-down app menu because for me the stock "launchpad" app launcher is full screen (sometimes, other times under VB it's offset and doesn't show everything) and has no categories.. not for me. To add the normal menu ran dconf-editor went to org|gnome|gnome-panel|lockdown and unchecked locked-down, then can alt-right-click and configure the panel. The global menu can also be disabled/re-enabled this way. Many installed apps aren't visible, had to run alacarte and unhide them to show in launchpad or the gnome panel menu. The system is a bit flakey running under VirtualBox.. sometimes the background goes away and the window manager crashes. The plank doc seems a bit fragile, when messing with the autohide settings it permanently hid itself.. had to install gconf-editor and poke around to find the setting to make it show again. It's a bit too easy to lose dock icons.. for apps in a window easy to get back but if say launchpad is accidently undocked then [...back up the launchers in ~/.config/plank/dock1/launchers, or go to /usr/share/applications and drag the launchpad icon to the dock]. The dock looks cool but if I were using this on a real system I'd uncheck it in startup apps and replace it with lxpanel (that works, just add to startup apps - makes it easy to select which panel to use) or add another gnome-panel for a bottom task bar. Actually, if I did use this setup on a real machine I'd wait for the next LTS, and then probably start with a stock Ubuntu install and add in the bits that I want - basically the theme. Still it's nice to see what people can do with the Gnome 3 infrastructure.

Rather (besides just being curious), I'm using the system to see what's changed in the new[er] Ubuntu. Perhaps in a slightly bent format but that's OK as I bend my system up pretty good too. So far other than some flakiness with the gala WM (based on mutter) when running under VirtualBox (mutter is also flakey under VB), and some usage issues with plank and launchpad - both optional apps - the core system seems fairly stable. But there are a few core issues - biggest one I've noticed so far videos play back in black and white (not single-color, blended black and white) - [... aha - it's an incompatibility with the new mutter.. do metacity --replace and videos now in color.. in the new daily ubuntu doing mutter --replace causes the same black and white bug. It's a VirtualBox thing.]

Another issue that has an easy fix - I found that I could not make custom associations by adding .desktop files to ~/.local/share/applications, turns out that the desktop file must contain NoDisplay=false for it to show up in the association list - fixed my AddToApplications script in the 5/20/12 entry. I can see why - it makes the list more trim by eliminating probably useless choices - but still a change from 12.04 that took some figuring out. File associations are extremely important to me so glad it was just a simple change.

In other happenings, updated my AmbianceMod theme so that scroll bars in gtk2 apps will show up better.

11/18/13 - Here's a CreateShortcut script for nautilus-scripts (derived from the AddToApplications script)...

#!/bin/bash
# CreateShortcut - 11/18/2013 WTN
# Makes desktop files for running scripts or binaries
# Put in ~/.gnome2/nautilus-scripts or in a path directory
# to use from a command line. Usage as a nautilus-script..
# Right-click executable, select Scripts CreateShortcut
# Enter name for the shortcut, OK or cancel to quit
# Select Yes or No when prompted to run app in a terminal
# Launcher will be created without an icon, to select an
# icon right-click, properties and browse for an icon.
#
prefix="launcher_" # new desktop files start with this
if [ "$1" != "" ];then # if a command line parm specified..
execparm=$(which "$1") # see if it's a file in a path dir
if [ "$execparm" == "" ];then # if not
execparm=$(readlink -f "$1") # make sure the full path is specified
fi
if [ ! -x "$execparm" ];then # make sure it's an executable
zenity --title "Create Shortcut" --error --text \
"The specified file is not executable."
exit
fi
if echo "$execparm" | grep -q " ";then # filename has spaces
execparm=\""$execparm"\" # so add quotes
fi
else # no parm specified, prompt for the Exec command
# no error checking, whatever is entered is added to the Exec line
execparm=$(zenity --title "Create Shortcut" --entry --text \
"Enter the command line for the launcher")
fi
if [ "$execparm" == "" ];then exit;fi
nameparm=$(zenity --title "Create Shortcut" --entry --text \
"Enter a name for this launcher")
if [ "$nameparm" == "" ];then exit;fi
if zenity --title "Create Shortcut" --question --text \
"Run the app in a terminal?";then
termparm="true"
else
termparm="false"
fi
# now create the desktop file
filename="$prefix$nameparm.desktop"
echo > "$filename"
echo >> "$filename" "[Desktop Entry]"
echo >> "$filename" "Type=Application"
echo >> "$filename" "NoDisplay=false"
echo >> "$filename" "Name=$nameparm"
echo >> "$filename" "Exec=$execparm %f"
echo >> "$filename" "Terminal=$termparm"
chmod +x "$filename" #make executable

Another way to make launchers is this script (what I used to use)...

#!/bin/bash
gnome-desktop-item-edit --create-new $(pwd) &

...however that requires gnome-panel and makes me browse for the executable. I thought hmm.. would be easier to just enter a name and choose terminal or no terminal, almost exactly what the AddToApplications script does except put the desktop file in the current directory and make it executable, I'll drag it to where I want it. A few minutes of editing, done. It doesn't set the icon (on my system the default is the same as for binaries), easy enough to right-click properties and pick an icon if I want something different.

11/19/13 - A few things. I've been tempted a time or two to set up a normal blog where each "thought" gets its own file - but for now probably not. Several reasons come to mind.. My notes files are references on how I set up my systems (primarily for me) and it works better when it's one big page so I can scan through it and find my favorite scripts etc. Regular blogs tend to get regurgitated ad nausium through the blogosphere and while I don't imagine my humble words being important enough to garner such treatment, I also don't want to encourage it either, especially when I might have something "political" to say about Ubuntu etc - when I write such things it's to document things and what I think about them in the context of my other notes, not to be picked out in isolation (that said, I don't care if anyone copy/pastes parts so long as attributed with a link back to the source page.. that at least preserves the overall context, not to mention I might change my mind or append to entries). Finally, it's a hellofalot easier for me to just right-click open with seamonkey than to mess around with blogging software - not that it won't happen in the future but right now I'm fine with the all-in-on-file format. TL;DR - then don't read it, I'm not writing for the fast crowd.

Lately Ubuntu has been taking quite a bit of flak.. occasionally deserved but mostly simply because Canonical is a business and they have to do business stuff. Like enforce trademarks and generate revenue and insulate themselves from upstream changes. Recently there was a somewhat overreaching C&D regarding www.fixubuntu.com that in my opinion was resolved nicely - site was fixed, apology issued, should be end of story. The shame is it involved a media storm, I would like to think that in the future such disputes can be handled more intelligently.

Generating revenue - well that's what companies have to do, if you don't like the way Ubuntu does it then read my notes here or go to the afore-mentioned site for a fix. The Ubuntu repositories carry a number of alternative desktop environments and Mark and Co have always supported the freedom to install and uninstall whatever software the user wants or doesn't want. Personally I don't use Unity (except occasionally the QT version on demand) and I really don't care if some searches are also sent to the internet (I find that useful for finding videos) even if to generate Amazon ads. A setting was provided to turn that off, plenty of other ways to disable that behavior, and while some of the criticism was warrented (resulting in a global on/off switch and other ways to control what gets sent outside the machine) we type stuff into Google or a number of other web sites and have stupid ads follow us around all the time without worrying about it. Ubuntu's version is mostly anonomized, the rest of the internet most certainly isn't. I'm more concerned about sites like Netflix and Hulu thinking I like certain things for all to see that see my TV because I or someone else clicked something.. but even that's like whatever, I still love my little Roku box (much better than streaming to my PC) and occasionally those web sites get it right and offer up something that I really do like. If Amazon ad placements generates Canonical a few bucks then that's fine by me - it helps the company keep the repositories up and updated which helps me because if Canonical/Ubuntu (and the infrastructure they provide) went away that would just suck. Keep in mind that a large number of derivitive distributions (including Mint) also tap into Ubuntu's repositories.. despite naming differences, Mint and Pear OS and many other derivitives ARE Ubuntu, whether officially sanctioned or not. I also think (and this might be a controversial thought) that derivitives with large user bases and operating income that tap into Ubuntu's infrastructure should help with the expense of maintaining that infrastructure by at least paying for the additional bandwidth imposed by their users.. if some popular website started in-lining my images and increased my internet bill I'd want compensation or some other resolution, derivitive distros should be no different. We should all share in the expense for the greatness that has been freely provided to us, in however way we can, lest it go away.

Then there is insulating one's self from upstream changes. Mir and Upstart cause a lot of controversy, the argument being why didn't Ubuntu go with Wayland and systemd and instead created their own solution. Well one reason is at the time the decisions were made, the latter projects were not complete enough. But another reason is so that Canonical can be free to do what it needs to do.. sometimes (actually often) the goals of upstream projects don't align with what a user wants - a distro is a user of upstream. When that happens, or if it's something very important, then the user must either fork or develop their own solution that isn't affected by upstream. Gnome went nuts with their shell, thus Unity. As far as I can tell Upstart was put in place before systemd was ready. Development of Mir started before Wayland was ready. Yet it's kind of funny that poking around in Pear OS 8, based on Ubuntu 13.10 [sort of], that I find bits of Wayland and systemd already installed - how odd given all the hype. Is that true of the official image? [downloading daily... installing... why yes it is. So like wow.] Everyone just needs to chill, stick to actual issues instead of personal preferences, try to be kind to one another despite differences, and stop being surprised that a company acts like a... company.

11/21/13 - Hacking around with Ubuntu "trusty" testing in VirtualBox (4.3.2)... [try 2]


This is a customized gnome-panel session with metacity, compositing enabled. Originally I configured it with the mutter window manager but that causes bugs with video playback when running under VirtualBox.. metacity with compositing looks/works almost as good other than the old metacity bug where desktop icons leave trails when moved.. and having to hit window borders exactly to resize - mutter gives me a bigger target. Had to upgrade to VirtualBox 4.3.2 to make the shared folder option work - as usual installed the guest additions and gnome-system-tools to get the Users and Groups app and added myself to the vboxsf group. Besides installing gnome-panel to get the "Flashback (no effects)" session, also installed synaptic, dconf-editor, gconf-editor, gnome-tweak-tool, gksu and alacarte (plus other stuff but those are the main things). To make it more compact for this virtual testing system, set up gnome panel to use just a single bottom panel with the compact menu, a few launchers, run dialog, close all windows, window list, notification area and a clock. To get a volume control in this minimal setup added a script to the startup apps that selectively runs gnome-sound-applet if the flashback session is running (right now $DESKTOP_SESSION returns "gnome-fallback" but that might change). Used gnome-tweak-tool to enable icons in buttons and menus, used dconf-editor to enable compositing in metacity, revert to normal scroll bars, among things. A few things still use gconf but the dconf settings takes precedence.

For the most part the system is "normal" but there are some oddities/changes... The right-click/create new file option doesn't work in the Flashback session unless something is put in ~/Templates, anything there makes the create empty file option show (this isn't an issue in Unity). The nautilus scripts folder has moved, now ~/.local/share/nautilus/scripts. Script options don't show unless a file or directory is selected, that's dumb IMO since it makes it harder to launch scripts that just need to run in the current directory (Terminal, BrowseAsRoot, MakeShortcut with no parm so it'll prompt, etc). The apport crash reporter is a bit hypersensitive.. sometimes it notices everything I broke or stopped then showers me the next time I log in.. but last time I tested a testing system it was like that, got dialed back before release. This is all totally pre-alpha so lots of stuff will likely break and change and get fixed before it finally becomes Ubuntu 14.04... but so far I like it [except for Nautilus not showing scripts when no file is selected.. that's an inconvenient usage regression - also gnome panel doesn't space launcher icons as closely as the version in 12.04 - and a stupid bug where the loading of nautilus and indicators are blocked for about a minute, workaround is to add the script /usr/local/bin/gnome-panel containing the command "gnome-panel &" to permit whatever is improperly calling gnome-panel to continue. This rather obvious bug was reported 12/2/13 and still hasn't been fixed by 1/17/14, not exactly encouraging but at least there's a simple fix...].

1/10/14 - Happy New Year... time for another borked x11/mesa update to kill mutter :-) On the forums one recommendation was to install the "raring" backported kernel/graphics stack but that wanted to remove stuff I really need.. like freecad, wine, multiarch support, etc.. no thanks. I've suspected for awhile that my manually installed NVIDIA 319 driver was causing issues (see 10/21/13 entry.. the last blowup) so logged out, ran sudo service stop lightdm to kill X, ran the downloaded NVIDIA driver package with the --uninstall option, sudo apt-get install nvidia-current nvidia-settings (which installs version 304), rebooted.. problem solved. Hopefully for good. Bonuses.. the initial double-click bug seems to be gone [but now it's back.. ugh], and google-earth works again (for now.. lately it had been crashing on startup but that program has always been kind of flaky).

Last month I had to do some audio processing work... My fiddle-playing friend Holly's Alesis HD24 recorder went down - first thing I did was use hd24connect from hd24tools to make an image copy of the drive and verify that the tracks were OK - there is a Linux version but it has issues, won't play the tracks and every time a new tab is selected have to move the window to refresh the window.. for previewing tracks had to use the Windows version running under VirtualBox with a symlink to the image added to the shared files directory. But the Linux version works for imaging and extracting tracks to wav files. The image file is just a straight byte-for-byte copy, have to run hd24connect as root to access the drive placed in a USB drive tray.. afterwards reset the image file permissions so I wouldn't have to run hd24connect as root for extracting. Used dd to copy the drive image to a new drive (same type and capacity.. an 80 gig WD800).. problem with the machine ended up being bad contacts, loosened and cleaned the bay connectors (common issue) and added some capacitors (common update), machine works fine now, finished the sessions.

I figured at some point I'd be called upon for mixing, so found a program called Ardour. Version 2.8.12 was in the Ubuntu Precise repository so installed that and played around with it enough to figure out how to make stuff work. Sure enough I was tapped for mixing one of the songs with a lot of tedious automation like piecing together multiple solo takes together to make one - the software did well, it was able to do everything requested by the artist. Here's the program in operation (click for full size)...


For me as a musician and working with other musicians, this is a game-changer! Until last month, we were mostly at the mercy of professionals who besides charging for their services (one way or another), often had their own ideas about mixing that made it more difficult to get the product we want. Call it producer's syndrom.. often professional mixers are very talented and mean well, but fail to realize that we're the musicians, already know what we want, and have to live with the results. I don't need a producer, I need someone (or some thing) that will do what we want without injecting what they want. So this is a game changer... and I didn't even have to set up a mac running ProTools. Now all we need studios for is to cut the tracks, say thank you and leave with the wave files.

Ardour has two main windows... an editor window showing wave views of the tracks, and a mixer window where it is more convenient to operate the controls and add effects pre and post fader. Tons of processing and effects are included and almost any parameter can be automated using an automation timeline. For automating cuts and stuff I found it more convenient to add pre amplifiers to the tracks and automate the gains (can draw points directly on the track timeline, sloping between the notes to avoid clicks), leaving the faders free for mixing. Would be better to run on a dual monitor setup to avoid having to go back and forth but that really wasn't a problem - I have a Gnome-2-like setup so just click click.

There are bugs but all had easy workarounds. When saving effect settings to a patchname, the first parameter isn't restored (workaround - set 1st parm manually, current settings are saved just fine when saving the session, only affects saving to a patchname). When using "touch" fader automation sometimes it caused a huge spike (workaround - do it again but automating amp gains works better anyway). When the beginning mark is moved down the timeline, the program would crash when exporting (workaround - always click the seek to beginning when reloading a session or before exporting [if it still crashes playing a little past the start usually fixes]). I'm used to the quirks now, I just automatically compensate.

This 2.8 version is pretty old so thought I'd try the new 3.5 version. Ardour is "donate-ware", to download the new binaries requires a payment - but you get to decide how much, plenty fair. Ardour can run from its own directory without actually installing so no need to uninstall or replace the repository version, can just unpack it and run it. In theory... didn't work for me, the log gave jack errors about not being able to use realtime scheduling. After some googling the fix was to add the file /etc/security/limits.d/99-realtime.conf containing...

@realtime   -  rtprio     99
@realtime - memlock unlimited

...then run the command sudo groupadd realtime followed by sudo usermod -a -G realtime myusername. Also added myself to the audio group and some other groups that looked like it might have an effect before finding the real fix. But there are still some usage issues which I won't get much into here  - some are just learning how the new version works, others are just that I usually like older simpler software better unless the new version does something I need that the old version doesn't do. For now version 2.8 works for me, and like I said, it's a game-changer.

3/20/14 - Ardour 3.5.357...


Sure looks good! Mostly I've been using the Ardour 2.8.12 that's in the Ubuntu 12.04 repository, but trying to adapt to the new version 3. The '357 update seems a lot more stable, just did a quick project mix with it and didn't run into any real issues - no crashers. The main issue I had this time around was with the position box at the bottom.. if grabbed wrong it resizes the track strips and not in a useful way, in my opinion all it should do is move the view. Scrolls quickly when dragging the position marker so learned not to touch that thing (or just disable it). Coming along... it still seems like a friggin' miracle to be able to do my own mixing without a "producer" telling us how our music is supposed to sound.. now we can cut our stuff get wav files see ya bye. After getting a mix I run the Ardour export through Audacity to do the mastering - usually shave off the high peaks and normalize but sometimes overall EQ too [however this isn't good enough for final production, for that found something called JAMin, page down] - then export to a "lame" (legal) MP3 at the max rate of 320K. Even if going to a CD I still prefer the MP3 conversion as it tends to get rid of stuff I don't want to hear anyway (in my opinion, I'm sure other audio folk will disagree), and let the Brasero burner app do the bitrate conversion and leveling. Sure has come a long way in the 30 or so years I've been messing around with studio audio.. the big expensive tape machines consoles and outboard gear have mostly been replaced with digital converters and PC's. At least the mics and actual musical gear is about the same, still playing through old tube amps. It took me a long time (years) to get on board with the new digital ways - my initial experiences with software-based studios were not good.. out-of-time tracks, crashed computers, and when it worked the mixes tended to sound too processed... but this time around recording with ProTools and mixing with Ardour I've had no issues whatsoever with latency, perfect feel, can make it as raw or processed as I want. Now I'm convinced the new ways really can be better - it's all about how the new tech is used.

Although... have to be careful about getting too whiz-bang with the stuff or the resulting software bugs can shift it back the other way.

In other software dealings... been tracking Ubuntu 14.04 development and not sure I like what I'm seeing [previous notes removed.. see below].

4/15/14 - For some odd reason the new Ardour 3 started crashing bad, more often than not if I select a track strip when the song is playing it makes a loud noise then closes. Fills up my xsession.errors file with megabytes of GTK warnings and Jack errors like Process error and Broken pipe. Had to go back to Ardour 3.5.74 to fix the crash issue and finish the mixes (latest is 3.5.357, 3.5.143 still has the issue). Something changed, didn't crash before, and no mention of it in the forums or bug tracker about it so assuming it's something to do with my system. Most likely with Jack.. Ubuntu 12.04 uses jack 1.9.8 which is known to be problematic, unfortunately several other things depend on it. But it's not all Jack.. something the software is doing is bigtime stressing the system (maybe it can't keep up with all the error logging going on). Ardour 2 works so probably will stick with the old repo version for new mixes, at least until this gets sorted.

Funny.. the nice thing about open source software (at least when manually installed) is I can install whatever version I want to find what works. The guy with the ProTools studio we record at recently upgraded and is having all sorts of crash issues, and revokes the license for the older version, he's stuck with it unless he buys a new license for the version he was using (if that's even possible). Now he has to save constantly to avoid losing work, at least when Ardour crashes it can usually recover unsaved changes when the session is reopened. Besides being able to freely reinstall the older version if there's a problem - I wish the regular software repositories had this feature! but that wouldn't be practical.

Ubuntu 14.04 has improved [sort of, the lightdm login manager still can't scroll, won't take KB entry, and can handle only so many entries before some push off the screen] but the new Nautilus 3.10 file manager sucks for what I do. It no longer has a context option to open folders in a new window in the usual place, have to either add a script to do that or right-click the location buttons (I guess they forgot to remove it from there - but that means to open a folder in a new window I have to go there first then open the parent in a new window.. that's just goofy), can't run scripts unless something is actually selected (makes no sense for scripts that simply need to run in a particular directory). Fortunately there's relief - Nemo is available in the default repository and it has none of these issues. Plus the handy extra pane feature. When installed it replaces nautilus as the default file manager so nothing else needs doing. The new Nautilus was my main blocker, so with that out of the way I can at least think about upgrading at some point.. after the dust settles. I would like to figure out how to get gnome-panel to space app icons closer together but that's not a huge deal.

7/12/14 - Ubuntu 14.04 in VirtualBox with metacity, lxpanel and nemo...


Ubuntu 14.04 with metacity, gnome-panel and nemo...


...still working on the theming (it ain't easy! no docs!!!). The gnome-panel.css is stock ambiance except for commenting out the border-image tags for the buttons. The gtk-widgets.css is hacked from my modified ambiance theme so the scroll bars will be visible. Not crazy about the button theme, cuts off the text decenders but don't know what to do about that, replacing with the stock widgets file didn't change that and broke other stuff, besides making the scroll bars nearly invisible again. Making the panel taller helps with the text but makes the icon spacing issue worse. One thing I noticed though... an earlier screenshot of 12.04 also showed the icon spacing issue, which went away. Not sure if from an update or if I accidently hacked something. I tried running 14.04 with the stock ambiance.. no go. Same issues, same broken look with radio buttons...

 

I think I'll stick with my modified version of Ambiance. [...]

7/14/14 - Computer users can be so stubborn.. especially those of us who rely on computers for their job. To me, the OS is that thing standing between me and what I need to do. It takes a considerable amount of effort to figure out how to efficiently do the things I need to do, find the right combination of user interface software, script stuff so I have the right-clicks I need, get my panel set up with the shortcuts and information I need... once it's all working then I'm working and doing my thing and I don't want my GUI to functionally change. Preferably, ever. Sure I want newer better apps, improved appearance, better stability, but functionally I don't want anything to change unless it truly helps me do my job better.. and if I do get on board with something new, I want to know it's going to stay about the same for many years, or it's not worth my time to learn how to make it work. New shells, new ways of doing things, are fine for new users, or users with certain needs - app-centric is great for folks who tend to run one app at a time, but that ain't me. If I want an app to be full-screen, there's a button for that, but usually I have multiple instances of multiple apps open at once and right now it takes just one click to pick the window I want to see. Any OS that complicates that simple thing I do hundreds of times a day is a non-starter no matter how good it looks - the OS isn't the app! I just want the OS to do what I tell it to, look good enough to not distract me, and otherwise stay out of my way. And I darn sure don't want features I've come to rely on to be removed to "simplify" things (it has the opposite effect). Fortunately at least some developers get that, recently there's been a surge of new desktop environments and components that work "the old way". Plus this is Linux - it will conform or I will hack it into submission. OK.. a certain amount of GUI hacking is fun... but once I got it the way I want, I want it to stay that way. Ubuntu LTS releases are that way - after an upgrade it might take some effort to get it the way I want, but I don't have to worry about some essential component or feature going away. The downside is after awhile it gets harder to run newer apps - PPA's help but only to the point the pinned library versions let it happen.

I'm tempted to clone my existing HD and try a 14.04 upgrade... it'll take a bit of cosmetic work but at least that'll let me keep gnome-panel for another five years and I won't need to fundamentally change my work flow. Or by the time 16.04 comes around perhaps the Mate version will be official.

7/21/14 - Mastering with Ardour (2), JAMin and TimeMachine...


Mastering is the process of preparing a song or other audio material for consumption. Uncompressed mixes can sound great, but even though the peaks are near clipping, it just doesn't sound "loud" compared to commercial productions. Unless doing symphony stuff, have to pump up the volume, generally by applying multi-band compression and fast limiting but doing it in a way that doesn't cause undesirable effects. Frequency equalization (EQ) may need to be applied, but as I have the source tracks I try to mix the stuff so that little or no overall EQ is needed. For test mixes I was simply using Audacity to limit the peaks then normalizing the volume, gaining about 3db, but that's not good enough... need more like 7-10db average volume level increase to compete with popular music. I'm not sure it can be done with Audacity (I don't see a multiband compresser plugin), even if it could be the process would be tedious. Besides on my system Audacity is very crash prone (sometimes even playing a track causes it to lock up) - usually I just use it to import, trim and other simple tasks that can be done visually, then export to the needed format. Plus I need something that works in real time so I can hear the results - often mix changes are needed as the increased volume tends to bring out flaws that would otherwise go unnoticed.

Enter JAMin - this app (available in the 12.04 repository) connects to a JACK source and outputs to the system audio and/or another JACK app, and processes whatever runs through it. To use with Ardour disconnect the master output from the system audio then in JAMin select Ardour for the input port (sometimes have to also make sure the left and right inputs come from Ardour's master outputs and not from a track). This kind of interconnection flexibility is where JACK shines.. any output from a JACK-enabled app can connect to any input of another JACK app. Now Ardour plays through JAMin, the defaults are pretty much spot-on to my ears, just increase the input level until the desired apparent volume is achieved. I also drop the limit level to about -0.4db to avoid touching the peak point. Now just have to capture the audio to an audio file.. I had no luck using the usual suspects (Audacity, sound recorder etc) but searched for JACK in the synaptic package manager and found something called "Time Machine" - it's main function is to record any JACK audio fed to it with a 10 second pre-buffer to avoid missing stuff but it works great as a general-purpose JACK recorder. When the button is pressed it dumps the audio into a wav file (by default) in the home directory named tm plus date and time info, press the button to stop recording. Once running just select Time Machine as an output in the JAMin ports setup. To avoid excess silence at the beginning I used Alacarte (main menu) to add -t 1 to the command line to specify a 1 second pre-buffer. The resulting wav file can be imported into Audacity, trimmed, and exported to the needed format - for me usually 320K lame mp3 but for a final can be flac or wav - but at that bit rate I can't hear any difference. This tool flow also solves another major issue I was having - Ardour's tendency to lock up when exporting - everything works in real time so it doesn't stress the system. I do everything in Ardour 2 now, version 3 just doesn't work on my system but other than export, version 2 from the repository works great.

One thing about JACK... when JACK apps are running it keeps non-JACK music players from working (I'd love to find a solution for that!), so to check the exported mp3 file without closing the apps I installed a command-line app called mpg123 and made a simple mpg123jack script...

#!/bin/bash
mpg123 -o jack "$1"

...used my AddToApplications script to make a ".desktop" file for it, specifying run in a terminal, then added it to the associations for mp3 files. It tends to cut off the very end of the sound if not enough trailing silence - but for now it works, until I find a JACK-aware music player that works without fiddling stuff. Installing the JACK plugin for VLC wasn't enough to make it "just" work, as in play the darn file when I right-click and play it.

Once again, I'm amazed by what I can now do on my own using only free software. This certainly isn't the only way to do it, some folk don't like what they get using JAMin and prefer using DSP plugins to do it all in Ardour. Thing is though, with audio production there are about as many opinions as those doing it. That's what I'm trying to avoid by doing it myself! In my experience, I get far better results mixing my own stuff using tools I select, than letting someone else unfamiliar with my music do it for me. No matter how good their stuff is. Here's a nice tutorial about using JAMin - but be careful, I suspect a lot of issues people have is from turning too many knobs - if you can hear the compression, it's too much.

9/1/14

A little mystery... one of the things I occasionally run in dosemu is an old The Need For Speed demo.. call it stress relief. But recently I went to run it and all I got was:

DOS/16M error: [17]  system software does not follow VCPI or DPMI specifications

Used to work.. and it does work if I boot using kernel 3.2.0-63 or earlier but doesn't work with later kernels. After some digging found this with the solution. Added the file "/etc/sysctl.d/ldt16.conf" containing the line "abi.ldt16 = 1", TNFS and other dpmi apps under dosemu work fine now. The issue was (apparently) a potential information leak, but pretty much every non-sandboxed task running on my system under my user permissions already has at least read-only access to all my files... if there were a malicious task running on my system that could take advantage of this, well it would be pretty much over anyway so not concerned about something being able to peek at bits of my memory. Of course for multi-user systems where users might do anything, something like that is a much bigger deal and bugs like that should be fixed. I'm the only one using my system and just want to run dos games, and I'm thankful an "off" switch was provided (by Linus) until there's a more proper solution. Used to have to set /proc/sys/vm/mmap_min_addr to 0 to make dosemu work right - eventually that got fixed (in dosemu itself - it now emulates vm86 mode).

16-bit software just won't die... and why should it? To this day nobody has come up with anything modern that lets me make computational programs as fast and easy as just running QBASIC under freedos/dosemu.. which wasn't affected by this latest kernel bug-fix so took awhile to notice - this time only extended memory programs (games) were affected. Occasionally developers assume nobody runs old code anymore, makes some change that breaks old userspace code, old-fashioned guys like me notice, workaround issued... sounds like the system is working just fine! The day may come that nobody cares anymore, but until then Linux supports old Dos and Windows programs better than Microsoft does.

The Crash

A couple of weeks ago I was working on a script that searched files for certain strings, and noticed several files showed I/O errors.. ran GSmartControl and although it gave the my main 500 gig WD drive a pass on basic health, under attributes it showed over 50 unrecoverable bad blocks. Ouch. For the most part the system seemed to work fine, the damage seemed to be restricted to old archived files I haven't accessed in a long time. Modern hard drives are supposed to self-correct - when a read error occurs, the next time the block is read successfully (possibly on retry from the same request?) the data is mapped to a fresh block and the bad block is added to the bad blocks list (some sources say bad blocks are remapped only if written to).. so for the most part users never notice blocks going bad. Unless a block fades away from lack of use.. read it or lose it? Lots of questions and lack of information, but it was clear the disk was going bad. So got a Toshiba 2 terabyte drive for about $100 (like wow..), downloaded Ubuntu 14.04 and put it on a thumbdrive, swapped the drives around so /dev/sda would be the new drive and /dev/sdc would be the old failing drive (/dev/sdb is my data drive). On my first attempt to save my old system I tried to use dd to copy the entire drive to the new drive then use fdisk to fix the partition... which might have worked except for 3 things: I forgot to include sync in the conv=noerror option so it horribly corrupted the file system; the new drive uses 4096 byte sectors and of course a partition boundary split a sector; and (as I figured out later) the UUID stayed the same and the system gets horribly confused when 2 disks have the same UUID.

So... installed Ubuntu 14.04 using the "do something else" option and partitioned the new drive with a ~500 gig partition for the new 14.04 system, a ~500 gig partition for my old 12.04 system (assuming I could save it..), about ~10 gigs of swap, and the rest /home for the new 14.04 install. My old system showed up as /dev/sda2 so when partitioning arranged it so the old system will remain on sda2 - not that that mattered. By this time I'm almost starting to panic a bit, the old system got to where it would no longer boot reliably (likely due to the UUID mixup I hadn't figured out yet)... I had backups of all important data, but the prospect of having to set up the operating system and reinstall all the apps I use was not sitting well with me (oh it's all shiny and fresh and boots so fast now... and does almost nothing I need to do). So.. mounted my old failing disk partition to /mnt/src, the new sda2 partition I made to /mnt/dest, and did cp -axv /mnt/src/ /mnt/dest to copy everything it could to the new drive. Should have left out the v option so I would see only damaged files.. but at the time seeing all my stuff being restored was comforting. Looked like all the system stuff was ok. Of course it wouldn't boot.. UUID stuff again. So (after some googling to figure out what I was doing) back in 14.04 I mounted the partition with a copy of my system, did mount --bind commands to add /dev /proc and /sys, did chroot to the new system, nano /etc/fstab and fixed the UUID's for / and swap, did update-initramfs -u -k all, did update-grub (from inside the chroot) - darn thing still wouldn't boot.. ended up at the busybox prompt. Taking a hint from the displayed text did cat /proc/cmdline - aha still was trying to boot with the old disk UUID (something didn't get fully updated), rebooted and manually fixed the incorrect UUID and then it booted right up (yay!!!). Poked around, the damaged user files were obvious in the file manager (marked with an X) and it looked like all the system files were fine, so did sudo update-grub followed by grub-install and that fixed the grub menu (replacing it with the one from 12.04 with 12.04 being default), boots fine now. Removed the damaged drive and replaced the damaged files from backups.

That was close. While losing my 12.04 system wouldn't have been a total disaster, it would have slowed down my work considerably until I got everything reinstalled and reconfigured in the new system. Backing up just "important" stuff is not sufficient, I want a copy of every single thing! All (at the moment) 1.3 Terabytes of it. So ordered two more of those 2T Toshiba drives, hooked up one as /dev/sdc, partitioned it as one big volume, made two directories on it (ubuntu1204 and datadisk) and used cp -ax to copy everything from both my main system and data disk to the appropriate directories. To keep the copy updated I made a script containing rsync -axv --delete --exclude=.gvfs / /mnt/bk/ubuntu1204 to for the main system (it mounts /dev/sdc1 to /mnt/bk first, the exclude is because of a bug that makes the ~/.gvfs directory unreadable by root and if any error occurs rsync won't process deletes), and rsync -avx --delete /mnt/datadisk/ /mnt/bk/datadisk to back up my data disk (which stays mounted to /mnt/datadisk via fstab). The script has checks to make sure the ubuntu1204 and datadisk directories exist on the backup first in case something changes the disk order and /dev/sdc1 ends being up some other disk. Every month or so will swap the backup disks.

And maybe I'll start fixing up 14.04.. so far all I've done to it is install the "flashback" session and the nvidia driver which triggered having to do other fixes (framebuffer stuff to avoid cosmetic boot glitches, same as for 12.04). But I'm in no hurry... for now my highly-tuned 12.04 system works for me.

10/14/14 - Various Random Stuff...

Still haven't done anything more to my 14.04 install.. other than stealing some of its huge home directory for "off line" file storage (VM backups etc) to give a bit of breathing room on my 12.04 system. 14.04 just isn't doing it for me.. doesn't really add anything new and I don't like the regressions in lightdm (limits how many sessions), nautilus (sucks now, have to replace with nemo), gnome-panel (too much space between panel icons), etc. It's there if I need it in case I need to take 12.04 off-line to work on it, or run into something that really needs 14.04 (maybe for Lightworks? a professional-grade video editor would be nice.. but if I had that it would probably increase my workload... less work if I just stick to OpenShot :-).

As of kernel update 3.2.0-70 a few days ago, dpmi programs under dosemu no longer work.. again. The new 3.2.63 upstream kernel removed the ltd16 workaround and was supposed to include a proper fix (espfix64) but looks like it doesn't work for whatever reason. I feel like a dinosaur... but I'm not alone. At least QBasic still works.. that's an almost mission-critical app for me (still the fastest/easiest way for me to make calculation programs). [was a configuration issue, kernel update 3.2.0-72 fixed the problem.]

The last few months have been tough for open-source security.. first the "heartbleed" bug, more recently the "shellshock" bash bug. Heartbleed was a bugger as it forced almost everyone to have to update passwords. Shellshock was just stupid... basically a combination of setting environment variables to untrusted input from remote users (what??? really???), bash allowing evars to contain functions (a dubious feature I didn't know about), then system software calling bash to do stuff that should be done with a true sh equivalent, not a shell meant only for local users. But for the most part it should all be fixed now, there were some breaches but compared to all the other breaches going on these days, not too bad. Just another reason why web-facing services need to be kept up-to-date. And the big lesson - watch what goes into environment variables! In my opinion functions-in-evars should be totally disabled but that would break a few things that use that "feature" so the patches work around it by only allowing code in specially-named variables.

Of course some have used these bugs to attack open-source software, but I don't buy it - the system worked just as it should - bugs found, bugs fixed, move on. Does kind of dispell the notion that with open-source bugs will be found sooner because of all the eyes on it... but I never really believed that anyway. All significant software has bugs, and systems need to be set up to assume that as much as possible.

Speaking of environment variables... for a long time I've had LESS_TERMCAP variables that contain ANSI escape sequences that colorize the output of the less command.. but they also mess up the output of the env command, so I had an alias for env that ran it through grep to remove the offending variables. I didn't know it until all this shellshock stuff came around, but that broke using env with parameters at the command line, causing the env-based shellshock tests to fail. So inspired by one of the bug-tests, I replaced the env alias with this function in my .bashrc file...

# normal env command will colorize output, redefine the env command...
env() { /usr/bin/env "$@" | sed "s/\x1B/[esc]/g"; }

...this runs the actual env command with any supplied parameters, then passes the output through a sed command that replaces any ascii-27 characters with [esc] so ANSI escape sequences won't mess up the output. Scary bug... learning!

[comments about systemd removed... it's a complex and evolving subject...]

10/30/14

Bug #1382251 seems to be similar to the dosemu bug - "Kernel update breaks Picasa". Picasa (actually no longer supported) is run using an integrated version of wine, and probably contains 16-bit code. Indeed, no 16-bit app (dos or Windows) works after the 3.2.0-70 kernel update.. tried the old reversi.exe from Windows 3.1 and it comes up with the same error messages as with the Picasa bug. Worse, after an nvidia driver update, I can no longer boot into the previous kernel with full-resolution graphics (was going to verify that [the old Windows] reversi still worked - pretty sure it used to). Tried apt-get install --reinstall nvidia-current in recovery mode, no effect - probably an easy solution but previously booting into the previous kernel worked fine, now it doesn't. Apparently the new driver removed itself from previous kernel versions and only installed itself on the latest version, effectively (unless I can figure it out) preventing me from running previous kernels unless I want to suffer 800x600 resolution. I'm not amused.. will figure out how to fix it later (running previous kernel versions is an important safety net in case more serious bugs arise), but sure do have better things to do than figuring out how to configure graphics and kernel modules from a command line (while avoiding booting into my environment graphically lest it mess up my icon arrangement - things are where I want them).

But back to bug #1382251 - apparently the issue is kernel compile option CONFIG_X86_16BIT is not set - it says that in a comment in the /boot/config-3.2.0-70-generic file. Notes regarding the upstream 3.2.63 kernel indicate the kernel must be configured to allow running 16-bit extended memory code at all (to make the kernel more compact for embedded apps).

[update 11/25/14 - Ubuntu kernel 3.2.0-72 fixes the configuration issue - dos dpmi programs now work under dosemu. Cool! I don't use dpmi stuff much but it's nice to run a few laps around the NFS track every now and then...]

11/19/14

The heck with bugs.. let's have fun. Can't figure something out?  Maybe see what this program says about it...

#!/usr/local/bin/blassic
10 rem yesno.bas - 11/19/14 WTN
100 dim a$(6) 'answer list... modify as desired...
101 a$(1)="Yes."
102 a$(2)="Probably."
103 a$(3)="Maybe."
104 a$(4)="Probably not."
105 a$(5)="No."
106 a$(6)="Don't know."
160 n=6 'must match number of answers
170 randomize
180 cls
190 print "This program answers yes/no questions."
220 print "Press just enter to exit."
280 print
290 print "Enter your question..."
295 u=int(rnd(1)*n)
300 f=1:print "_";chr$(8);
310 if u<n then u=u+1 else u=1
315 shell "sleep 0.02" 'linux specific! for other OS remove
316 'or replace with some other kind of millisecond delay
320 k$=inkey$:if k$="" then goto 310
330 if (k$=chr$(13) or k$=chr$(10)) and f=1 then goto 360
332 if k$<>chr$(8) and k$<>chr$(127) then goto 340
334 print chr$(8);"_ ";chr$(8);chr$(8);:goto 310
340 if k$=chr$(13) or k$=chr$(10) then goto 350
344 f=0:print k$;"_";chr$(8);:goto 310
350 print " ":print a$(u):goto 290
360 system

This is written in Blassic, a handy BASIC interpreter that can run in #!-style script mode. I use version 0.10.2 (local copy here) - to compile make sure g++ and libncurses5-dev are installed (may need other dependencies depending on what configure says - ignore the bit about not finding x, that's only needed for graphics), extract it then in the extracted directory do ./configure followed by make - if successful either copy the blassic binary to /usr/local/bin or do sudo make install.

Sample run...

This program answers yes/no questions.
Press just enter to exit.

Enter your question...
Should I just accept systemd and move on?
Don't know.
Enter your question...
What about MATE 14.04?
Yes.
Enter your question...
_

The underscore is a simulated cursor, only backspace editing is supported. The actual contents of the question is not considered, rather the program determines the response using a combination of a psuedo-random function which is further randomized by a free-running cycling counter so that the output is non-deterministic. Some programs like this use only the psuedo-random function but that returns a (very long) fixed sequence, but that would pre-determine the responses based on the exact moment the program is launched. That just doesn't seem right. With the counter, the response is ultimately determined by the moment the enter key is pressed, thus you (along with the quantum continuum or whatever you're into) determines what it says.

Blassic is cool but it's a hassle to compile and isn't supported much (if at all) anymore, so I rewrote the program in bash...

#!/bin/bash
# yesno.sh - 11/19/14 WTN
if [ ! -t 0 ]; then exit; fi # only run in a terminal
stty -echo -icanon time 0 min 0 # enable non-blocking input
sleep 0.2 # wait to take effect
# answer list... modify as desired...
a[1]="No."
a[2]="Probably not."
a[3]="Maybe."
a[4]="Don't know."
a[5]="Probably."
a[6]="Yes."
answers=6 # must match number of answers
empty=1 # flag to indicate empty line
quit=0 # flag to indicate quit condition (enter on empty line)
counter=$RANDOM # counter increments 1-6 to determine answer
# RANDOM returns 0-32767 but will be reduced to 1-6 by incrementer
echo
echo "This script answers yes/no questions."
echo "Press just enter to exit."
echo
echo "Enter your question..."
while [ $quit -eq 0 ];do # loop until quit gets set
sleep 0.02 # delay a bit so it won't consume all CPU time
# increment/cycle counter...
counter=$((counter % answers)) # reduce counter to 0 to answers-1
counter=$((counter + 1)) # add 1 to counter so always 1-answers
# get raw keystroke... term must be in non-blocking mode
key=$(head -c 1;echo x)
key=${key%?} # strip the x from key string
# without the echo x and subsequent removal it doesn't pick up enter
if [ "$key" != "" ];then # if a key was pressed
if [ "$key" == $'\x0a' ];then # if enter was pressed
echo # echo the newline
if [ $empty -eq 1 ]; then # if empty line then quit
quit=1
else
echo "${a[$counter]}" # otherwise print answer
echo "Enter another question..." # prompt again
empty=1 # set empty flag
counter=$RANDOM # randomize counter again
fi
else
# if using || (or) then has to be [[ .. ]] kind of test
if [[ "$key" == $'\x7f' || "$key" == $'\x08' ]]; then
echo -ne '\x08 \x08' # backspace (responds to either kind)
else
empty=0 # reset empty flag to indicate something was typed
echo -n "$key" # print the key that was just pressed
fi
fi
fi
done
stty sane # restore terminal

This is a lot easier to run under most versions of Linux... simply copy it to a text file, make it executable and run it in a terminal. Tested in Ubuntu 12.04 and 14.04 and Debian 6 and 7. The overall operation is similar to the Blassic version but the logic is implemented differently. The bash version is structured (there is no goto in the bash language), but that complicates the logic - in BASIC one simply jumps where needed but in goto-less languages one has to control the flow using the provided structures. Not that there's anything wrong with that, it just makes trivial code less trivial due to the extra code needed to get from one part of the code to another. The flip side is if a large program were written using unstructured goto flow it would likely be incomprehensible.

Getting the equivalent of BASIC's INKEY$ function in bash was tricky - the terminal blocks until a key is pressed so in order to have a free-running counter I had to put the terminal in non-blocking mode. Got the idea from here, that example used the dd command but I rewote it to use a simple head command instead. The output of a subshell removes the trailing linefeed so to pick up the enter key have to append a junk character then remove it.

11/23/14

Here's a python (2.6 or 2.7) version of the yesno program...

#!/usr/bin/python  
# yesno.py - 11/22/14 WTN
import random,time
answers = (
"No.",
"Probably not.",
"Maybe.",
"Probably.",
"Yes.",
"Don't know."
)
random.seed()
print
print "This program answers yes/no questions."
print "Press just enter to exit."
print
while (True):
question = raw_input("Enter your question...\n")
if len(question) > 0:
modtime = (time.time()%10000.0)*100.0
selection = int(modtime*random.random())%len(answers)
response = answers[selection]
print response
else:
break

This version is quite compact because it doesn't attempt to run a counter with non-blocking keystroke input (which in python doesn't seem to be exactly trivial), rather it adds entropy by checking the time when the enter key is pressed. More than one way to skin Schrödinger's cat. The time.time() function returns a float representing how many seconds since epoch (whenever that was), this is mod'd by 10000 to reduce the range and avoid potentially losing precision then multiplied by 100 so that the integer portion changes every 10ms. The selection is made by taking that value, multiplying by the float returned by random.random() then mod'ing by the number of answers. The list of answers can be trivially modified, thanks to the len function nothing else needs changing for any number of responses.

Python is pretty cool but there are issues. Biggest issue is the language is somewhat of a moving target.. python 3 is incompatible with python 2, and although python 2.7 is supposed to be supported for a long time, how long it will remain easily available is uncertain. Until "at least 2020" isn't really good enough. Need something for creating scripted programs that's at least as stable as bash but easier to write and read. Preferably that doesn't rely on an obscure interpreter that may not be buildable or even available in the future.

C has feature-creap incompatibility issues too, but mostly in extra libraries and fancy stuff - the core language is stable. At least the bits of it I'd be using for the simple kinds of programs I typically write. One obvious solution is a simple wrapper that permits C source to be "executed" directly...

#!/bin/bash
# cwrapper - 11/23/14 WTN
# this script lets simple C programs to be written like scripts
# by specifying this script in an initial #! line
if [ -e "$1" ];then # if script exists
ctmp=$HOME/.cwrapper_tmp # temp dir for building
cname=`basename "$1"` # derive base name of script
mkdir -p "$ctmp" # make sure it exists
tail -n +2 < "$1" > "$ctmp/$cname.c" # copy C source to temp file
shift # shift all parms down 1
# compile the source with gcc and if no errors run it with parms
gcc -o "$ctmp/$cname.bin" "$ctmp/$cname.c" && "$ctmp/$cname.bin" "$@"
if [ -e "$ctmp/$cname.c" ];then rm "$ctmp/$cname.c";fi # remove temps
if [ -e "$ctmp/$cname.bin" ];then rm "$ctmp/$cname.bin";fi
fi

Ha.. crude hack but I like it, copy to /usr/local/bin then can write scripts like...

#!/usr/local/bin/cwrapper
#include<stdio.h>
main()
{
printf("Hello World\n");
}

Another way to do it is to embed similar code with the C code to make it a stand-alone script program...

#!/bin/bash
# cwrapper_embedded - 11/23/14 WTN (this wrapper is public domain)
# this code lets simple C programs to be written like scripts
# by copying this code in front of the C code.
cstart=16 # line number where the C code starts
ctmp=$HOME/.cwrapper_tmp # temp dir for building
cname=`basename "$0"` # derive base name of script
mkdir -p "$ctmp" # make sure it exists
tail -n +$cstart < "$0" > "$ctmp/$cname.c" # copy C source to temp file
# compile the source with gcc and if no errors run it with parms
gcc -o "$ctmp/$cname.bin" "$ctmp/$cname.c" && "$ctmp/$cname.bin" "$@"
if [ -e "$ctmp/$cname.c" ];then rm "$ctmp/$cname.c";fi # remove temps
if [ -e "$ctmp/$cname.bin" ];then rm "$ctmp/$cname.bin";fi
exit
# ===== end wrapper code, C code follows ======
#include<stdio.h>
main()
{
printf("Hello World\n");
}

A problem with that approach is it messes up the C syntax highlighting when editing, but it's easy enough to reselect C mode.

There's an official way to do something like this called binfmtc (can be installed from repository), the main differences (besides being faster and more sophisticated) instead of a #! start line, have to make the first line /*BINFMTC: with */ on the next line, and it's pickier about the source code - my crude version doesn't complain about lack of a main type and return statement, and it only shows actual errors (no -W option in the gcc line).

11/24/14 [edits 12/1/14, 12/22/14]

Of course C as a scripting language kinda sorta sucks (almost everything seems hard to do), but this same general technique can be used to turn just about any compiled language into a scripted language. I've been playing around with a BASIC-to-C converter/compiler called BaCon and it's really cool. 64-bit deb and rpm packages are available, or build from source. BaCon and its GUI are written in the BaCon language (self-hosted) with a clever bootstrap mechanism - the compiler is also parallel-implemented as a huge multi-platform shell script which is used to compile the compiler. Should work on most Unix-like operating systems that have bash, make and gcc installed (or compatible alternatives) plus a few standard utilities.

The language itself is mostly stock BASIC with a few differences including...
Doesn't have INKEY$ but has WAIT which works great for non-blocking non-echoing key detection. Also has a blocking GETKEY.
DECLARE is used to declare arrays, subscripts are bracketed and C-style.. DECLARE a[10][10] instead of DIM a(10,10).
There is NO bounds-checking on arrays (just like C), be careful. Use OPTION BASE 1 for normal BASIC behavior.
RND returns a large integer between 0 and the constant MAXRANDOM, rather than a float between 0 and 1.
MOD is a function rather than an operator.
Some variable names (like y1 or anything else reserved in C and its libraries) can't be used. It'll complain about redefining.

...but it's all well-documented and not nearly as different (at least for the kind of code I typically write) as FreeBasic's native language, it's more like QBasic with a few different words. Many of BaCon's differences are because it converts the code to C so expressions are often C-like to keep it simple. BaCon provides the power and speed of C without having to suffer the complication of writing C code.

One thing I really like about BaCon is the compiler source is a single BaCon file (bacon.bac) that can be easily edited and recompiled as needed. When I first started messing around with version 3.0.1, I ran into an issue with reporting error messages (fixed in the 3.0.2 version).. quickly hacked a temporary fix despite being unfamiliar with the code. Ran into a minor issue running under CygWin (a gcc warning about not needing the -fPIC flag).. another trivial fix (or ignore, the resulting bacon.exe and library worked fine and normal usage was not affected). Being able to fix or change stuff myself is very nice!

Anyway... to turn it into "baconscript" I made this bash script... [updated 11/26/14 to handle INCLUDE]

#!/bin/bash
# baconscript - 11/26/14 WTN
# permits running BaCon programs like scripts using a #! line
# note.. script base name must not contain spaces
if [ -e "$1" ];then
bname=`basename "$1"` # derive base name of script
btmp="$HOME/.baconscript_tmp/$bname" # temp dir for building
if [ -e "$btmp" ];then rm -r "$btmp";fi # remove old temps
mkdir -p "$btmp" # create empty temp directory
tail -n +2 < "$1" > "$btmp/$bname.bac" # copy bacon code to temp dir
# also copy any included files..
grep "INCLUDE " "$1"|cut -d'"' -f2|while read f;do
if [ -e "$f" ];then cp "$f" "$btmp/";fi;done
shift # move all parms down 1
bacon -d "$btmp" "$btmp/$bname.bac">/dev/null # compile bacon code
if [ -e "$btmp/$bname" ];then # if compile successful
"$btmp/$bname" "$@" # execute the program with command line parms
rm -r "$btmp" # remove the temp directory and temp files
else # compile not successful...
if [ -e "$btmp/$bname.bac.log" ];then # if error log exists
echo;echo "===== C compiler error log ====="
cat "$btmp/$bname.bac.log" # show the log
fi
fi # if not successful leave temps in place for debugging
fi

...and copied it to a file named "/usr/local/bin/baconscript", now BaCon programs can be turned into scripts by adding #!/usr/local/bin/baconscript to the first line and make it executable. One big advantage of scripted code is on most Linux distros by default scripts can be double-clicked and the system asks if to run in a terminal. Usually if a binary is double-clicked it does not launch a terminal which of course won't work for a console program.. to run the compiled binary have to drop to a terminal first. Turning programs into scripts saves time.

Here's a sample program showing some BaCon features I find useful...

#!/usr/local/bin/baconscript
a$ = ARGUMENT$
z = INSTR(a$," ")
IF z>0 THEN
PRINT "Program arguments: ";MID$(a$,z+1)
END IF
PRINT "Enter something: ";
INPUT a$
IF a$ <> "" THEN
PRINT "You entered: ";a$
END IF
PRINT "Press a key: ";
toggle = 0
REPEAT
keycode = WAIT(0,200)
IF keycode = 0 THEN
IF toggle = 0 THEN
PRINT "*";CHR$(8);
toggle = 1
ELSE
PRINT " ";CHR$(8);
toggle = 0
END IF
END IF
UNTIL keycode > 0
PRINT " "
PRINT "You pressed: ";CHR$(keycode)
PRINT "Press any key to exit..."
keycode = GETKEY
END

Although some parts of the language are BaCon-specific and only work for unix/linux, simpler programs can be written so they'll work under just about any BASIC, or at least easy to convert - most of the time it's the algorithm itself I want to preserve, and BASIC permits algorithms to be expressed cleanly without a lot of programming-language baggage. In my opinion - maybe just because I'm used to it.. but what I'm used to is very important when I need a one-off program quickly - in such cases I usually need an answer fast and don't want to spend extra time figuring out syntax.

Here's a version of the yesno program for BaCon(script)...

#!/usr/local/bin/baconscript
' yesno.bs - WTN 11/25/14, 12/22/14
OPTION BASE 1
DECLARE a$[6]
a$[1] = "No."
a$[2] = "Probably not."
a$[3] = "Maybe."
a$[4] = "Probably."
a$[5] = "Yes."
a$[6] = "Don't know."
answers = 6 :'number of answers
PRINT
PRINT "This program answers yes/no questions."
PRINT "Press just enter to exit."
PRINT
counter = RND
exitprogram = 0
WHILE exitprogram = 0
empty = 1
PRINT "Enter your question..."
entered = 0
WHILE entered = 0
REPEAT
keycode = WAIT(0,20)
counter = MOD(counter,answers)
counter = counter + 1
UNTIL keycode > 0
IF keycode = 10 THEN
entered = 1
IF empty = 1 THEN
exitprogram = 1
ELSE
PRINT
PRINT a$[counter]
counter = RND
END IF
ELSE
IF keycode = 127 OR keycode = 8 THEN
PRINT CHR$(8);" ";CHR$(8);
ELSE
empty = 0
PRINT CHR$(keycode);
END IF
END IF
WEND
WEND
END

NOW returns a large integer representing the number of seconds since 1970, used to SEED the random number generator. RND returns a (large) integer between 0 and the reserved constant MAXRANDOM, the counter variable is reduced to the correct range using the MOD function so for this app, the size of the number does not matter. Three flags control the program logic.. quit, empty and entered - empty is used to detect entering an empty line so it can set the quit flag, the entered flag detects when an answer was printed so it can print the prompt again - probably could be coded better but was going for simplicity. The counter cycles between 1 and the number of answers, incrementing or reseting every 20 milliseconds while waiting for a keypress. As far as I can tell on all platforms the enter key returns a single code 10, the backspace key returns 127 or 8 depending on the terminal settings.

11/28/14 - OK I had to try it... BaCon under Windows.... it works!!! Tested under Windows 7 (32 bit, running under Virtual Box), requires a recent CygWin with make and gcc installed. Copied bacon.bac and bacon.sh to a directory under C:\cygwin (under my home dir for convenience), then in that directory under the cygwin bash shell ran ./bacon.sh bacon.bac - took a long time (cygwin's bash is fairly slow) but eventually completed, but with a (non) error - a warning about -fPIC not being needed for the target platform.. however it produced bacon.exe and libbacon.a which I copied to cygwin's /bin/ and /lib/ directories. That option is only used when building a library (recompiling bacon itself) and has no effect on normal compiling.. and was trivial to fix if one cares, just add IF INSTR(OS$,"CYGWIN) < 1 THEN before the code that adds the -fPIC option (in 3 places)... I love it [how easy it is to adapt the code...but some versions of cygwin/gcc may still need that flag]. After "installing" into the cygwin environment can do bacon program.bac to produce an exe - although cygwin is needed to compile, the resulting console program runs fine under regular Windows, all it needs is the cygwin dll runtime (as with any other cygwin gcc-produced program). Cool... now I have more options.

12/8/14 - MATE 14.04 running in VirtualBox after a bit of playing around...


That's a modification of the Dust theme (from gnome-themes-ubuntu), with Ambiance borders and Ubuntu-Mono-Dark icons. Dust doesn't provide a GTK3 theme, but all I had to do to fix that was to drag the gtk3 folder from Ambiance (or whatever) to the Dust folder, then apps like synaptic won't run with ugly defaults. At first I tried using a modification of the default Ambient-MATE theme but that causes some dialogs [including the menu editor and the dialog for creating desktop shortcuts] to show white text on a white background [at least for this virtual install].. so installed a bunch of themes and theme engines from the repository and found something that works. MATE itself is GTK2, and pretty much a clone of the way Gnome was before Gnome 3 came along, just the names of the components have changed to avoid conflicts. Some paths are different based on the new names, for example file manager scripts go in ~/.config/caja/scripts. No docs got installed and the mate-user-guide package isn't available from the official repositories, so found a .deb for the mint version on the UbuntuUpdates site. Also had to do that with Assogiate and its libgnome-vfsmm dependency - being able to create/edit my own file (mime) types is an absolute must for me. Installing "out of band" packages isn't usually recommended, can potentially break things, but in these cases it worked fine. As usual for a new OS had to install all sorts of stuff.. make dkms and gcc so the VB guest additions would install, gdebi and synaptic for installing and maintaining packages, utilities like htop and xterm, themes and theme tools, etc.. the virtual install is a test run to make sure the important stuff works before investing effort into setting everything up on real hardware.

I like it! It's like Gnome 2 was before it got "improved" - it has an Appearance applet that can save new themes based on controls, icons and window decorations from existing themes, built-in right-click options for creating desktop icons, launching a terminal and browsing files as root, an associations dialog that has the option to run with a custom command, a panel that lets me put stuff where I want.. those little things I used all the time until they got removed. I hope this becomes an official Ubuntu flavor, but official or not it's still tied to the current 14.04 infrastructure, should be good until 2019.

12/22/14 - Apart from the GUI, some system-related procedures are a bit different with 14.04 but that's to be expected. I still use many 32-bit apps in binary form (pmars/pmarsv, old stuff, anything made using FreeBasic), to enable 32-bit support I issued the equivalent of the following commands...

sudo dpkg --add-architecture i386
sudo apt-get update
sudo apt-get install libc6:i386 libc++6:i386 libncurses5:i386 libx11-6:i386

...that's should be enough to get most simple 32-bit binaries running. There used to be the ia32-libs[-multiarch] package that installed common 32-bit libraries, but it's no longer available (and most aren't needed anyway). Rather just install the libraries that are actually needed. Use the ldd command to find out what libraries are linked by a binary, if something isn't found it's marked as missing. Remember to run the ldconfig command after manually copying libraries into /usr/lib so that binaries can find them.

MATE 14.04 looks like it can work for me.. so far no problems running blassic, bacon, dosemu, freebasic, scripts, etc, and for creating custom file types Assogiate works even though I have to install an older version (the Rox MIME editor also still works). But it's not something I'll be able to simply switch to... there are many more things that need testing, and my current 12.04 system has had years of customization, much of which would have to be duplicated. Even if a new OS is perfect (although none are), it's still a pain to uproot and switch. Nevertheless it's comforting to know there's an alternative to all the "new stuff" going around.

7/26/16

Haven't made an entry in a while... not much has changed with my system. Still running Ubuntu 12.04, for now it works fine. Right now the only consistent bug is recent versions of FireFox don't always update the screen after keystrokes - Chrome doesn't do that so that's what I run if I have to type a lot. Ha! after googling I fixed that - in about:config set layers.offmainthreadcomposition.enabled to false, apparently it's a new feature that was added at v33 that isn't compatible with some video systems. Very occasionally when cold the system fails to boot to the GUI and I get dumped to a console, doing a control-alt-delete to reboot fixes that (or typing startx if in a hurry). Sounds like a video card issue, it's been that way for a long time. Very rarely my self-compiled "indicator-sensors" cpu/video temperature widget fails to initialize so have an icon that runs "gnome-panel --replace" to click when that happens. Hard to find much to complain about - that's why I'm dreading the upgrade. I had Ubuntu 14.04 installed in another partition for awhile, thinking I'd move to it, but when I boot into it it's depressing - my world is gone and getting it all back is not trivial, it took years to get this stuff set up the way I want. I wish Ubuntu would go to a rolling release model and do it right (from a user's point of view) - if something is incompatible or no longer available don't just remove it, just don't install whatever it conflicts with and let me decide if I want to fix it. I don't mind (some) change or shiny new things (if they work), but I very much mind changes that make the things I depend on no longer work.

Anyway... here are a few tidbits to share...

Fan speed control has always been a semi-issue on my system, sometimes heavy-load tasks "forget" to speed up the fan (motherboard issues). Seems better now since the k10temp driver became integrated into the kernel but still sometimes whatever speed it thinks it needs I want more. So made a simple circuit that connects in-line with the CPU fan...

pwm  O---blue---*--22K--.                    .-----O
tach O---yel----|-------|--------------------|-----O to
12V O---red----|---*---*--------------------|-----O fan
gnd O---blk--*-|---|------------------------|-----O
| | | speed control |
| | 2.2K max |
|4.7K | .-----> 1M(AT) |
| | | | |min |c
| | *--*---|<|--*--22K--*--|< 2N3904
| | |c 1N4148 | | |e
| `-|< 2N3904 1000p 100K |
| |e | | |
`-----*-----------*-------*----'

All it does is stretch the PWM signal - when the control is at minimum the fan runs at normal speed, as the control is advanced it adds extra time to each high pulse, at maximum the fan runs full speed regardless of the PWM input signal.

The recently used list in gnome panel and other apps is handy, but lots of times I'll move stuff around or delete stuff and it isn't smart enough to know about that, resulting in invalid entries. So wrote a blassic script... [updated 8/24/16]

------- begin remove_recent.blassic ---------------------------------------
#!/usr/local/bin/blassic
rem remove_recent.blassic - 7/12/2016 WTN
rem 8/24/16 - remove duplicate entries too
rem This blassic/bash program scans the recently-used.xbel file and
rem deletes entries that no longer exist. Understands %20 for space
rem but other % codes not supported, these will be removed.
rem note - redundant removal feature requires the realpath utility.
rem this script must be marked executable, make sure the
rem initial #! line points to the blassic binary.
on error goto errorhandler
dim fname$(10000)
nextfname=1
deletedcount=0
temp$="/tmp/_remove_tempfile_"
helper$="/tmp/_remove_temp_helper_"
result$="/tmp/_remove_temp_result_"
shell "2>/dev/null ls /usr/bin/realpath > "+temp$
shell "echo >> "+temp$
open temp$ for input as #1
input #1,a$
close #1
if a$<>"/usr/bin/realpath" then goto norealpathutility
print "Removing non-existent and duplicate recent file entries..."
goto startprocessing
label norealpathutility:
print "Removing non-existent recent file entries..."
print "(install realpath for duplicate entry feature)"
label startprocessing:
open helper$ for output as #2
print #2,"#!/bin/bash"
print #2,"fn=`echo ";chr$(34);"$1";chr$(34);"|sed -e 's/%20/ /g'`"
print #2,"if [ -e ";chr$(34);"$fn";chr$(34);" ];then echo yes"
print #2,"if [ -e /usr/bin/realpath ]; then realpath ";chr$(34);"$fn";chr$(34)
print #2,"else echo ";chr$(34);"$fn";chr$(34);";fi"
print #2,"else echo no;echo;fi"
close #2
shell "chmod +x "+helper$
shell "echo $HOME > "+temp$
open temp$ for input as #1
input #1,home$
close #1
kill temp$
open home$+"/.local/share/recently-used.xbel" for input as #1
open temp$ for output as #2
while not eof(1)
line input #1,a$
b$=ltrim$(a$)
if left$(b$,15)<>"<bookmark href=" then goto writeline
c$=mid$(b$,24)
q=instr(c$,chr$(34))
c$=left$(c$,q-1)
shell helper$+" "+chr$(34)+c$+chr$(34)+">"+result$+" 2>/dev/null"
open result$ for input as #3
input #3,d$
line input #3,e$
close #3
if d$<>"yes" then goto skipdupcheck
for f = 1 to nextfname
if fname$(f)=e$ then goto skiplines
next f
fname$(nextfname)=e$
nextfname=nextfname+1
label skipdupcheck:
if d$<>"no" then goto writeline
label skiplines:
line input #1,a$
b$=ltrim$(a$)
if left$(b$,11)<>"</bookmark>" then goto skiplines
deletedcount=deletedcount+1
goto continuelooping
label writeline:
print #2,a$
label continuelooping:
wend
close #1
close #2
shell "rm $HOME/.local/share/recently-used.xbel*":rem extra copies too
shell "cp "+temp$+" $HOME/.local/share/recently-used.xbel"
kill temp$
kill result$
kill helper$
if deletedcount=0 then print "No entries removed."
if deletedcount>0 then print "Removed ";deletedcount;
if deletedcount=1 then print " entry."
if deletedcount>1 then print " entries."
goto exitscript
label errorhandler:
print "An error occured: code ";err;" at line ";erl/10+1
label exitscript:
shell "sleep 3"
system
------- end remove_recent.blassic -----------------------------------------

Some fine spaghetti-code there... but I don't mind [it's very similar to the kinds of BASICs I grew up on, at least it doesn't require line numbers]. A handy command in the bash part is a sed line that does search and replace - sed -e 's/old/new/g' - echo a variable into it then capture the output into another variable, in this case fn=`echo "$1" | sed -e 's/%20/ /g` to change the %20's in the XML file to spaces so that filenames with spaces in them will be properly processed. [updated 8/24/16] The script now also removes redundant duplicate entries that can happen when files are opened from symlinked directories, to do this it uses the realpath utility which returns the true filename of a file. This usually isn't installed by default so it checks first. Also added variables for the temp files and better error handling, if an error occurs the temp files are not removed to help track down the problem.

For the last few months I've been recording the writers nights at the club where I run sound - recorded on my Tascam DR-40 then processed using Ardour/JAMin/TimeMachine/Audacity to create an MP3 file for each round, followed with EasyTag to add the title and artist metadata. Usually there are two artists on each half-hour set. I also rename the files to include the artist names but after over 200 set files with over 100 artists finding things manually was getting very tedious. So wrote these bash and blassic scripts...

------- file makemp3index.sh --------------------
#!/bin/bash
# requires soxi and blassic
# makemp3indexhelper.blassic must be in current directory
# original 5/9/16 mod 6/13/16 to add length/size to filename
outfile="masterlist_by_file.txt"
echo "Generating $outfile"
if [ -e "$outfile" ];then
rm "$outfile"
fi
find | grep ".mp3$" | sort | sed "s/^.\///" | while read f
do
artist=`soxi "$f" | grep "^Artist="`
filesize=`soxi "$f" | grep "^File Size :" | tail -c +18`
duration=`soxi "$f" | grep "^Duration :" | tail -c +18 | head -c 8`
if echo $duration | grep -q "^00:"; then
duration=`echo $duration | tail -c +4`
fi
if [ "$artist" != "" ];then
echo "File=$f ($duration,$filesize)" >> "$outfile"
echo "$artist" >> "$outfile"
fi
done
blassic makemp3indexhelper.blassic
echo "Done"
sleep 5
------- end makemp3index.sh ---------------------

------- file makemp3indexhelper.blassic ---------
rem File makemp3indexhelper.blassic, called by makemp3index.sh
rem Made by Terry Newton (WTN)
rem Original version written May 9 2016 to process a collection of MP3
rem recordings so I can tell at a glance who played when and on which file
rem Slightly modified May 30 2016 to add a line before the artist names
rem Modified June 12 2016 to separate (duration,filesize) if present
rem
rem This is blassic code (a type of BASIC), requires blassic and sort.
rem I like blassic because it's extremely fast and avoids compiling,
rem it does require using a lot of goto statements due to its lack of
rem block if/then/else but for quick and dirty stuff like this it's great.
rem If blassic isn't available can be easily converted to another BASIC
rem like FreeBasic, just remove "label " from the labels. I run this
rem under Linux but should work under Windows with some mods, mainly
rem to rewrite the makemp3index shell script in batch or use Cygwin etc.
rem Blassic and sox are available for Windows, sort should work the same.
rem To get soxi for parsing tags copy "sox.exe" and name it "soxi.exe".
rem
rem This program takes an input file in the form of...
rem File=filename.mp3
rem Artist=artist name[ and another artist name[ and ...]...]
rem ...repeated for every MP3 file then outputs a sorted list
rem of artists along with the files they are featured on.
rem Example input file...
rem -----------------------------------------------------------------
rem File=Writers_Night_151203_set1_Jamie_Wayz_Jim_Martin.mp3 (22:33,54.1M)
rem Artist=Jamie Wayz and Jim Martin
rem File=Writers_Night_151203_set2_Ariel_Petrie_David_Dale_King.mp3 (25:42,61.7M)
rem Artist=Ariel Petrie and David Dale King
rem -----------------------------------------------------------------
rem (duration,filesize) is optional
rem This produces the following in the output file...
rem -----------------------------------------------------------------
rem Ariel Petrie
rem Writers_Night_151203_set2_Ariel_Petrie_David_Dale_King.mp3 (25:42,61.7M)
rem
rem David Dale King
rem Writers_Night_151203_set2_Ariel_Petrie_David_Dale_King.mp3 (25:42,61.7M)
rem
rem Jamie Wayz
rem Writers_Night_151203_set1_Jamie_Wayz_Jim_Martin.mp3 (22:33,54.1M)
rem
rem Jim Martin
rem Writers_Night_151203_set1_Jamie_Wayz_Jim_Martin.mp3 (22:33,54.1M)
rem -----------------------------------------------------------------
rem Also produces a simple html file with the same content, but with
rem links to the files so they can be played in a browser.
rem
rem The input file is generated by the makemp3index script, essentially...
rem echo "File=$f">>$out;soxi "$f"|grep "Artist=">>$out (requires soxi)
rem ...called in a loop for each MP3 file ($f=mp3 file, $out=output file)
rem The input file must not contain any other data or extra line ends.
rem
rem To avoid separating names that happen to contain " and " this program
rem also checks to see if an and exception list exists, put any names that
rem shouldn't be separated in this file, must match exactly.
rem
inputfile$ = "masterlist_by_file.txt"
outputfile$ = "masterlist_by_artist.txt"
htmloutputfile$ = "masterlist.html"
exceptionfile$ = "andexceptions.txt"
arraylimit = 1000 : rem increase this if more than 1000 files/artists
dim artist$(arraylimit,arraylimit)
rem artist$(n,1) = artist name artist$(n,2) and above = file names
dim andexception$(arraylimit)
print "Processing ";inputfile$
numberofartists = 0
numberoffiles = 0
numberofexceptions = 0
on error goto noexceptionlist
open exceptionfile$ for input as #1
print "Reading and exceptions from ";exceptionfile$
while not eof(1)
line input #1, t$
t$ = ltrim$(rtrim$(t$))
if t$ = "" then goto skipexception
numberofexceptions = numberofexceptions + 1
andexception$(numberofexceptions) = t$
label skipexception:
wend
print "Number of exceptions = ";numberofexceptions
label noexceptionlist:
close #1
on error goto inputfilemissing
open inputfile$ for input as #1
on error goto programerror
while not eof(1)
line input #1, a$
line input #1, b$
if left$(a$,5) <> "File=" then goto fileerror
if left$(b$,7) <> "Artist=" then goto fileerror
numberoffiles = numberoffiles + 1
a$=mid$(a$,6)
b$=mid$(b$,8)
b$ = ltrim$(rtrim$(b$)):rem in case extra spaces in tag
q=instr(b$," and ")
if numberofexceptions = 0 or q = 0 then goto noexceptions1
for k = 1 to numberofexceptions
elen = len(andexception$(k))
if left$(b$,elen) = andexception$(k) then q = instr(elen,b$," and ")
next k
label noexceptions1:
if q > 0 then goto processmultiple
label addartist:
rem see if unique
if numberofartists = 0 then goto newartist
n = 0
for i = 1 to numberofartists
if artist$(i,1) = b$ then n = i: i = numberofartists
next i
if n = 0 then goto newartist
for i = 2 to arraylimit
if artist$(n,i) <> "" and i = arraylimit then goto limiterror
if artist$(n,i) = "" then artist$(n,i) = a$: i = arraylimit
next i
goto keepprocessing
label newartist:
numberofartists = numberofartists + 1
if numberofartists > arraylimit then goto limiterror
artist$(numberofartists,1) = b$
artist$(numberofartists,2) = a$
goto keepprocessing
label processmultiple:
while q<>0
t$ = left$(b$, q-1)
b$ = mid$(b$,q+5)
n = 0
for i = 1 to numberofartists
if artist$(i,1) = t$ then n = i: i = numberofartists
next i
if n = 0 then goto multiplenewartist
for i = 2 to arraylimit
if artist$(n,i) = "" then artist$(n,i) = a$: i = arraylimit
next i
goto keepprocessingmultiple
label multiplenewartist:
numberofartists = numberofartists + 1
if numberofartists > arraylimit then goto limiterror
artist$(numberofartists,1) = t$
artist$(numberofartists,2) = a$
label keepprocessingmultiple:
q = instr(b$," and ")
if numberofexceptions = 0 or q = 0 then goto noexceptions2
for k = 1 to numberofexceptions
elen = len(andexception$(k))
if left$(b$,elen) = andexception$(k) then q = instr(elen,b$," and ")
next k
label noexceptions2:
wend
goto addartist:rem loop back to add last item
label keepprocessing:
wend
close #1
if numberofartists = 0 then goto fileerror
print "Number of files = ";numberoffiles
print "Number of artists = ";numberofartists
print "Generating ";outputfile$;" and ";htmloutputfile$
open "__temp1" for output as #1
for i = 1 to numberofartists
print #1,artist$(i,1)
next i
close #1
shell "sort __temp1 > __temp2"
open "__temp2" for input as #1
open outputfile$ for output as #2
open htmloutputfile$ for output as #3
print #2,"================================"
print #2,"Total of ";numberofartists;" unique artist names"
print #2,"Total of ";numberoffiles;" MP3 files"
print #2,"================================"
print #3,"<html><h3>Index of MP3 files by artist name</h3>"
print #3,"<p>Total of ";numberofartists;" unique names in ";
print #3,numberoffiles;" files.</p>"
while not eof(1)
line input #1, t$
n = 0
for i = 1 to numberofartists
if artist$(i,1) = t$ then n = i: i = numberofartists
next i
if n = 0 then goto sorterror
print #2,""
print #2, t$
print #3, "<p>";t$
for i = 2 to arraylimit
if artist$(n,i) = "" then i = arraylimit : goto finisharrayprintloop
print #2," ";artist$(n,i)
print #3,"<br>&nbsp;&nbsp;&nbsp;<a href=";chr$(34);
c$ = artist$(n,i) : d$ = ""
if right$(c$,1) <> ")" then goto finishtag
q = instr(c$,".mp3 (") : if q=0 then goto finishtag
d$ = mid$(c$,q+4) : c$ = left$(c$,q+3)
label finishtag:
print #3,c$;chr$(34);">";c$;"</a>";d$
label finisharrayprintloop:
next i
print #3,"</p>"
wend
print #2,""
print #3,"</html>"
kill "__temp1"
kill "__temp2"
goto exitprogram
label fileerror:
print "input file not formatted correctly"
goto exitprogram
label inputfilemissing:
print "no input file"
goto exitprogram
label programerror:
print "an error occured",err,erl
goto exitprogram
label limiterror:
print "array limit exceeded, edit program to increase"
goto exitprogram
label sorterror:
print "system error with sort"
print "see __temp1 and __temp2"
label exitprogram:
close #1
close #2
close #3
system
------- end makemp3indexhelper.blassic ----------

...now I can tell quickly who played when and on what set. More spaghetti magic.. a real programmer (for some definitions of real) would freak out on goto-heavy code like that but having grown up with 8-bit BASIC on the C64 COCO Atari etc it doesn't bother me - sure I'd rather have true block if then else but blassic doesn't have that and it's not a big enough deal to resort to compilers or try to figure out how to do all that string processing in another language. One day I'll learn python well enough to pull off stuff like this (when it stops changing).. but I don't care about programming, I care about the answers.

11/20/16

The KiCad PCB package sure has advanced since the last time I messed with it, especially "nice" things like the 3D viewer. A test I made in 2011...


A PCB I recently completed using version 4.0.4...


Big difference! I didn't have to do much to get that - after placing the parts most of the 3D models were already in place, just had to add block models for the capacitors (picked from a list). Initially I drafted the PCB using ExpressPCB, which is very easy to use but it was going to cost >$300 to actually make the boards, too expensive. Need Gerbers! Thought about using Altium Designer but my install is set up mostly for surface mount stuff, really didn't feel like going through the process of creating new components and all the other stuff Altium makes me do before I can even start. Recently there's been a lot of talk about KiCad so gave it a try. To avoid dependency stuff I got the Windows version and installed it in Win7 running under VirtualBox, time required to learn how to use the software and create an initial version of the board was about a day - much easier to learn than Altium. All the parts I needed for this fairly simplistic board were in the default libraries, and it's easy to change pad and hole sizes on the PCB itself without having to make new footprints. When importing netlist changes there's an option to preserve footprints, no need to have to keep the schematic footprints in sync. One thing took a bit to figure out - to create the connection pads on the schematic I used 1 pin connectors then fixed the footprint on the PCB. One oddity - in KiCad the Y axis numbers increase from top to bottom, backwards from what I'm used to. No big deal, just resulted in making the Gerber/drill Y numbers negative, board houses don't care where the origin is so long as everything lines up. It won't replace Altium for my work stuff - for one thing it doesn't export .step files which I need so the mechanical folks can make sure the board fits the case (they use SolidWorks) - but for this project (a simple guitar pedal going in a stock case) I didn't need that, Kicad got the job done. Glad I gave it a shot because Seeed only wanted $40 to make 30 boards and half of that was shipping.

It would be nice to run KiCad natively but my old Ubuntu 12.04 won't support it - tried compiling but some of the required libraries are too far out of date... that's one area where Windows beats Linux. It doesn't have to be that way, would probably run just fine if a binary package was offered that included all dependencies, not exactly the "Linux Way" but I would much prefer a more bloated install than having to run a Windows version in a virtual machine.. works for Firefox and Google Earth and other up-to-date programs and it's not like hard drive space and update bandwidth are a precious resources these days. Would be nice if apps could be more decoupled from the GUI... but it's.. complicated.

I like 12.04, newer versions not as much mainly because they're often missing features I use or make me click more - File Edit etc menus exist for a reason but often get removed to "simplify" the interface. But it won't be long before I have to change - my 12.04 install is developing other problems. After a Nvidia driver update the mutter WM stopped working. Along with Gnome Shell (not that I ever use it). Thanks to Gnome 3's configurability I still have Compiz and Metacity so still in business but it's just a matter of time before 12.04 becomes too much to keep going. MATE is a possibility but I hesitate - not sure how to define multiple configurations in MATE, something like the window manager dying would be a total GUI failure instead of a minor issue. Also MATE renamed a lot of stuff (out of necessity) so if I tried to install it beside Gnome I'd have dups of all the core apps. Leaning towards staying with gnome-panel and doing whatever needs doing to get it running on a modern core, probably 16.04. Tempted to just image the disk (and work from the copy with the old disk put up in case it goes bad), distro upgrade to 14.04 then 16.04, then fix the broken bits.. might be easier than starting over.


Terry Newton (wtn90125@yahoo.com)