Technology Tales

Adventures in consumer and enterprise technology

Running multiple files on Windows using just two batch commands

25th October 2007

Repairing Windows installations like I have had to do all too often in the last few weeks means that I have a load of updates that need to be performed. My preference for using Shavlik NetChk Protect means that I have a folder full of executable path files. That encapsulates the first step: creating a folder and adding the files that you want to run. The next step is to run a command like this:

dir /b * > exec.bat

The /b is the switch that gives a bare file list and that is stored in exec.bat. Running exec.bat affords a bit more automation. While it is that this might need a spot more sophistication to be truly automatic, it's still a good start.

Evaluating an ergonomic mouse

24th October 2007

Recent hectic mouse work has left my right hand feeling the worse for wear, so a recent opportunity to try out a colleague's Evoluent VerticalMouse 3 was one that I took up. I gave it a go for a day, and it left me impressed enough to go out and order one for myself. It's not a cheap item, with some selling for a smidgen less than £60 and others selling for significantly more than this. Also, it is a handed item; the latest version is available to right-handers like myself, along with an earlier one for lefties. While It will work with Windows 2000, the supplied software is for XP and later.

The idea behind the gadget is intriguing: rather than having your hand held parallel to your desk as with a conventional mouse, you have it almost perpendicular to it. The claim is that when you have your arm this way, it is less likely to get tired. The arrangement may sound as if it might not work, yet it does in practice: your thumb is the anchor for the hand and the little finger (lúidín in Irish) rests on a little ledge that stops it getting dragged along either the mouse mat or the surface of the desk. This arrangement does allow you to relax your hand on the mouse. You get the usual mouse functions plus extra buttons that you can use to go back and forward through web pages; even without installing the included software, you get these. However, I have observed drift of the mouse cursor across the screen of my home PC when the unit is not being moved around. At first, I wasn't sure what was causing this, but it now appears to be the mouse mat that I was using. I'll continue to give it a go.

Update: a mouse such as this really needs you to rest your arm on the desk for it to be at its most helpful. Though that's fine for work, my home set up had me stretching my arm and that leads to a lot of discomfort. That isn't the fault of the mouse: it is actually telling me something useful. The primary cause is a pull-out keyboard drawer that I have to use due to a lack of space on the desk itself. So, I raised my full tower computer case a little from the floor and now use that as a platform for the mouse. While I know that it's an unconventional approach, it seems to be working so far, and I can make further adjustments if needs be...

Is computer mousemat wrist support a waste of time?

23rd October 2007

It is an occupational hazard for those who use computers a lot that they feel twinges in their wrists, hands, fingers and forearms. I, for one, have to admit that I end up getting my continual warnings. Previously, this has taken the form of wrist fatigue, weakness and discomfort and mouse mats with wrist support have taken pride of place on computer desks frequented by my person. Keyboard wrist supports have been another staple when at my workplace.

More recently, I have been exposed to a new bespoke-built application at work and its testing has meant a lot of intensive mouse work, and it can be very repetitive. The can take its toll, and my fatigued fingers have been enough to make me speak to the occupational health department at work. To their credit, they recognise the issues, and I am getting some advice from a physiotherapist. The obvious resolution is of course the very one that you can never do as much as you want when you are an application developer: rest from computer-related activities. I work with someone for whom rest has not worked, and his problems have made him ambidextrous; I am right-handed and find it tricky to use a mouse with my left, but that's what he has mastered. Exercises are another necessity; vigorous hand shaking together with wrist rotations and stretches are among those that I have been told to do every thirty minutes while using a PC. I don't know how that appears to my work colleagues, but it sounds like something that could look a little odd to those not in the know. Anything has to be better than doing permanent and lasting damage...

Doing daft exercise is fine in the comfort of one's own home, though, and that brings me to another point: you cannot just concentrate on your work set up and forget about that at home. Spending hours playing computer games on a dining table and seated on a dining room chair is never going to help your cause; that's not something that I have ever done, but it's a story that I have heard. I have certainly made some adjustments so that my wrist and arm are level with one another; the latter was likely to be inclined at an angle at times, with some strain on the wrist. Nine years go, I have had an inappropriate chair adding to the discomfort of pulled back muscles, so my current home computer chair became a required acquisition, from Argos as it happened. It performs sterling service, but that has not stopped me wondering about one with armrests, but that could be down to my using a computer desk with a roll-out keyboard shelf.

Another key piece of advice is to relax my hand on the mouse and for that, you need to set up your desk properly. Many problems are caused by the habit of holding the palm of one's hand in thin air over a mouse, and my long fingers make the practice easier to do than it should be. Having a mouse with wrist support exacerbates the situation and I have come to the conclusion that I need my wrist resting directly on the desk and that allows my arm to move the mouse too and not just my wrist. That allows me to rest the palm of my hand and my fingers on the mouse. It appears to be better for me, but it leaves one question: how did wrist supports get added to mouse mats in the first place? Saying that, I am not in a position to question the use of keyboard wrist supports, but typing has never been known to cause me any real problems.

Getting rid of mistakenly added mispellings from your custom dictionary in Firefox

22nd October 2007

Mozilla Firefox includes a spell checker and, like any such function, it offers a chance to add words to a custom dictionary. Of course, you can also add misspellings too, and these definitely need to be removed. With Word, it's a matter of looking for custom.dic and deleting the nefarious item. With Firefox, it's similar, at least on Windows anyway. The file that you need to edit is persdict.dat which you'll find it in C:\Documents and Settings\[user name]\Application Data\Mozilla\Firefox\Profiles\[random name].default. My search for the relevant information took me over to Lifehacker.

Update 2012-12-11: For users of Linux, the location of the above file is as follows: /home/[user id]/.mozilla/firefox/[random name].default. Once you find persdict.dat in there, the required editing can be performed.

Repairing Windows XP

21st October 2007

I have been having an accident-prone time of it with Windows XP recently, and have had plenty of reason to be thankful for the ability to perform a repair installation. Here are the steps:

  • Pop the installation disk into your PC's DVD drive and reboot the PC.
  • If you have your PC set it up to boot from DVD's in its BIOS, then you at least will have the option to do this. You may find that this happens by default, but I needed to tell it to do the deed.
  • Select normal installation from the first menu that is presented to you by the installer.
  • Accept the licence agreement.
  • Press R at the next menu and that'll repair the installation.
  • Follow all the menus from there on; it'll be all the usual stuff from here on in, and there should be no need to reactivate Windows or reinstall all of your other software afterwards.

There is a repair option on the first screen (step 3 above) but this takes you into the dark recesses of the command line and isn't what I was needing. I do have to say that they do leave the required option late on in the installation process and that assumes on users having a risk taking streak in them, something that definitely does not apply to everyone. If your boot.ini file is not well, you may find yourself needing to do the full installation and that wipes the slate clean for you, extending the recovery process.

Onto Norton 360…

20th October 2007

TrueVector Error

ZoneAlarm cut off VMware's access to the internet, so it was time to reinstall it. However, I messed up the reinstallation and now there seems no way to reinstate things like they were without tampering with my Windows XP installation status, and I have no intention of doing that. The thing seems to think that it can start a TrueVector service that does not exist.

Since I have to have some security software on board, I made a return to the Symantec fold with my purchase of Norton 360. That does sound extreme, but I have been curious about the software for a while now. You get the usual firewall, antivirus and antispam functions with PC tuning, anti-phishing and backup features available as well. It is supposed to be unobtrusive, so we'll see how it goes from here.

Update:

PC Pro rates the software highly, while Tech.co.uk accuses it of being bloatware. Nevertheless, the only issue that I am having with it is its insistence on having Microsoft Update turned on. For now, I am sticking with Shavlik's NetChk Protect, especially seeing what Microsoft has been doing with its update service. Have a look at Windows Secrets.com to see what I mean. Other than that, it seems to working away in the background without intruding at all.

Filename autocompletion on the command line

19th October 2007

The Windows 2000 command line feels an austere primitive when compared with the wonders of the UNIX/Linux equivalent. Windows XP feels a little better, and PowerShell is another animal altogether. With the latter pair, you do get file or folder autocompletion upon hitting the TAB key. What I didn't realise until recently was that continued tabbed cycled through the possibilities; I was hitting it once and retyping when I got the wrong folder or file. I stand corrected. With the shell in Linux/UNIX, you can get a listing of possibilities when you hit TAB for the second time and the first time only gives you completion as far as it can go with certainty; you'll never get to the wrong place, though you may not get anywhere at all. This works for bash, but not ksh88 as far as I can see. It's interesting how you can take two different approaches to reach the same end.

Numeric for loops in Korn shell scripting: from ksh88 to ksh93

18th October 2007

The time-honoured syntax for a for loop in a UNIX script is what you see below, and that is what works with the default shell in Sun's Solaris UNIX operating system, ksh88.

for i in 1 2 3 4 5 6 7 8 9 10
do
    if [[ -d dir$i ]]
    then
        :
    else
        mkdir dir$i
    fi
done

However, there is a much nicer syntax supported since the advent of ksh93. It follows C language conventions found in all sorts of places like Java, Perl, PHP and so on. Here is an example:

for (( i=1; i<11; i++ ))
do
    if [[ -d dir$i ]]
    then
        :
    else
        mkdir dir$i
    fi
done

Detecting file ownership in Korn shell scripts

17th October 2007

I recently was having a play with using a shell script to do some folder creation to help me set up a system for testing, and I started to hit ownership issues that caused some shell script errors. At the time, I didn't realise that there is a test that you can perform for ownership. The "-o" in the code below kicks in the test condition and avoids the error in question.

if [[ -o $dirname ]]
then
    cd test
    for i in 1 2 3 4 5 6 7 8 9 10
    do
        if [[ -d study$i ]]
        then
            :
        else
            mkdir study$i
        fi
    done
    ls
    cd ~
fi

Previously, I shared a way to test for directory (-d operator) and file (-f operator) existence that follows the above coding convention. However, there are a plethora of others and I have made a list of them here:

 Operator Condition
-e file File exists
-L file File is a symbolic link
-r file User has read access to file
-s file File is non-empty
-w file User has write access to file
-x file User has execute-access to file
-G file User's effective group ID is the same as that of the file
file1 -nt file2 File 1 is newer than file2
file1 -ot file2 File 1 is older than file2
file1 -et file2 File 1 was created at the same time as file2

It's all useful stuff when you want to rid the command line output of errors in an above board way. These are the kinds of things that often make life easier...

Negative logic in Korn shell scripts

16th October 2007

I was looking for a way to negative logic, doing something when a condition is not satisfied, that is, and found that the way to do it is to do nothing when the condition is satisfied and something when it isn't. Being used to saying do something when a condition is false, this does come as a surprise. In time, I may find another way on my UNIX shell scripting journey. Meanwhile, the code below will only create a directory when it doesn't already exist.

dirname=test
if [[ -d $dirname ]]
then
    :    # the colon operator means do nothing
else
    mkdir test
fi

  • The content, images, and materials on this website are protected by copyright law and may not be reproduced, distributed, transmitted, displayed, or published in any form without the prior written permission of the copyright holder. All trademarks, logos, and brand names mentioned on this website are the property of their respective owners. Unauthorised use or duplication of these materials may violate copyright, trademark and other applicable laws, and could result in criminal or civil penalties.

  • All comments on this website are moderated and should contribute meaningfully to the discussion. We welcome diverse viewpoints expressed respectfully, but reserve the right to remove any comments containing hate speech, profanity, personal attacks, spam, promotional content or other inappropriate material without notice. Please note that comment moderation may take up to 24 hours, and that repeatedly violating these guidelines may result in being banned from future participation.

  • By submitting a comment, you grant us the right to publish and edit it as needed, whilst retaining your ownership of the content. Your email address will never be published or shared, though it is required for moderation purposes.