Twitter Updates

    follow me on Twitter

    G-AVLN in front of her home

    G-AVLN in front of her home

    Mostly Unix and Linux topics. But flying might get a mention too.

    Monday, October 15, 2007

    No access to ntp source?

    When you install Linux on a PC, you may find that the hardware clock enforced the time. Normally, you would use the ntpd (network time protocol daemon) to synchronise the system (software) time with a selection of external sources.

    However, what if you are not connected, or for some reason just don't have access to time servers (for example the ntpd port 123 is blocked)?

    Well, unless you need to maintain a precise time (in which case you still need to find access to a reliable source), you can just use the good old date command and inform the hardware clock of the change.

    # date --utc 101517052007.00

    will update the system (software) clock and set the current time and date to: Oct 15 18:05:00 BST 2007.

    The only problem is that system clock doesn't run when your machine is powered off. What does continue to run is the hardware clock. It ticks forever. External power present or not. Because on start-up the hardware clock is used, you need to flush the system date into the hardware clock, and as long as the hardware clock is accurate enough, your newly adjusted time will be persistent over reboots.

    Use the hwclock tool to achieve this:

    # hwclock --systohc

    Do remember, though: this is 'quick and dirty'. If you require consistent and accurate time keeping, you need to synchronise the system clock with an external source...

    Saturday, August 18, 2007

    How much do people pay for Windows software?

    There is a discussion brewing in our local LUG, to do with almost philosophical aspect of software theft.
    The basis for the thread lie in one of the most interesting articles on the subject I have ever read:

    http://tlug.jp/articles/Windows_Is_Free

    As many before, it explores moral aspects of using "second hand" software, but less usually, it attempts to analise the implication of cracked software on the industry itself and how, ironically, the effectively free windows software distorts the balance of marketing power between windows, mac OS and linux.

    Keyboard layout in Solaris 10

    If there is a way of setting UK keyboard during Solaris 10 installation - I don't know it! However, the /boot/solaris/bootenv.rc has a directive for that - just change US to UK.

    A reboot, unfortunately is necessary...

    Monday, July 09, 2007

    Keyboard layout in Centos

    I have been playing with Centos 5, which is the community binary for binary version of RHEL 5 (with various elements, such as text and graphics depicting or referring to Red Hat replaced with Centos, quite legally, might I add). It's an excellent alternative, as long as you don't expect a 24/7 support, or automatic updates or any of the value added stuff that a formal contract from Red Hat provides.

    Anyway, the install from the DVD onto my Vaio PCG-V505BP went without any problems. Selected "Gnome Desktop", "Server" and "Server-GUI" software, and the only other customisation was disk partitioning (I like my partitions to be done the old-fashioned UNIX style).

    So, as I said, the installation completed successfully, and to my best knowledge all hardware was recognised OK (still testing, so can't be totally sure). One little surprise, though - the keyboard layout was the US, not UK! Well, it is quite possible that I messed it up myself (when selecting the keyboard during installation). Either way, I went to correct it by hand, and thought I'd document it. It's quite straightforward, but a thing to remember is that two different configuration files need to be changed.

    For CLI (character interface screen, accessed through CTRL-ALT-F1 - F6) you need to modify the /etc/sysconfig/keyboard. Change the KEYTABLE line to read:

    KEYTABLE="uk"

    This will have immediate effect, and any new CLI session will assume the correct keyboard.

    For GUI screen terminals, you need to change the Xorg configuration file: /etc/X11/xorg.conf. In the "Section InputDevice", identify the line with XkbLayout and modify it to read:

    Option "XkbLayout" "uk"

    Unlike CLI setting, this GUI change will only take place after GUI session is restarted. I have tried the standard CTRL-ALT-Backspace, to restart Xorg server, but it didn't work! Well, not for the first time. On many systems this is disabled.

    I refuse doing a full reboots lightly, so I tend to 'recycle' GUI instead. First of all, make sure you don't have any GUI-dependent users or applications before you carry out the next step (they may not like being kicked off the system without a warning).

    To 'recycle' GUI means switching runlevels to 3 than to 5 again. To do that: open a CLI session (press CTRL-ALT-F1), log in as root, and switch runlevel to 3 with:

    # init 3

    Once the 'anaconda' message appears on the screen - you are in runlevel 3, even though you see no new prompt. Hit "Enter", and the prompt will be printed. At that point, switch back into runlevel 5 with:

    # init 5

    Your new keyboard layout is now available to all users.

    Thursday, July 05, 2007

    Default gateway in Solaris 10

    I'm spending a lot of time switching between different versions of UNIX and Linux, and the detailed syntax of the command line stuff keeps catching me out. So I will start documenting for myself (and any QA-IQ colleagues) some of the most popular things that are needed in our classrooms.

    This week it is a turn of Solaris 10 (ix86), in our Swindon office. Our infrastructure is such that the 192.168.1.254 gateway requires an argument of 1 where the 'metric' value used to be. No rocket science - just the command line syntax, but it kept me unconnected for far too long (or am I getting too indoctrinated by the Linux syntax and the power of the ip command there?).

    Anyway: to add the default gateway to the Solaris 10 :

    # route add default 192.168.1.254 1

    Then obviously adjust the browser settings to the correct proxy for your location (with port 8080 on QA-IQ sites). In the Mozilla version provided with Solaris 10 you can find the settings in Edit --> Preferences --> Advanced --> Proxies.

    Get it back together again

    Had so many changes within the company - blog went onto the back burner. Things are getting calmer and easier again, and hopefully I can get on with it properly. With any luck, the postings will start coming out again...

    Sunday, May 06, 2007

    Forcing hp2400 to print double sided

    Needed to print a set of labs for a new version of a course. Run out of time, and although the manuals are being printed, the labs documents had to be done by hand! So to save the Amazon, I managed to get my printer to print double-sided! Although this is specifically for the hp2400, the algorythm of printing sequence and which way at which stage should be useful for any printer...

    1. Ensure all documents have an even number of pages

    2. First print the even pages with the last page on top.

    Select File --> Print...

    - in "Print:" drop down menu select "Even pages" (default is "All pages in range")

    Then select "Properties" --> Basics

    - in "Page Order" mark "Back to Front"

    Then press "OK" in Properties screen, and "OK" again in Print screen

    3. Replace the paper

    Pick up the freshly printed pages. Keep them together, in the same order they were printed and the same side up (i.e. printed side up). Rotate the whole bunch 180 degrees horizontally and insert in into the paper tray. Once in the paper tray, the orientation of the paper should be such that one can read the pages correctly, with the highest even page at the top.

    4. Print the odd pages with the ultimate result having the first page on top.

    Select File --> Print...

    - in "Print:" drop down menu select "Odd pages" (default is "All pages in range")

    Then select "Properties" --> Basics

    - in "Page Order" mark "Front to Back"

    Then press "OK" in Properties screen, and "OK" again in Print screen

    Sunday, November 19, 2006

    The IFS mystery

    The IFS is involved in the parsing of the command line (word splitting) and in variable assignment during the read built-in execution.

    But there is a side effect, which I have only discovered recently, by accident. If you assign positional parameters with set:

    $ set a 'b c' d 'e f'

    than using the * parameter we can get at the values individually or as one word. To illustrate, try the following:

    $ echo $* "$*"

    a b c d e f a b c d e f


    However, if you 'nullify' the IFS variable:

    $ IFS=""

    then the behaviour of the shell when referencing the * parameter changes:

    $ echo $* "$*"

    a b c d e f ab cde f

    This only works with the * parameter (not with @) and only if IFS had a null value (if you inset IFS altogether, then the shell will use a space to separate positional parameters.

    Finally, I've checked this behaviour in ksh and bash - same (and documented in manual pages, at least in bash).

    Wednesday, November 15, 2006

    Quoting command substitution

    When we learn the inner works of a shell, we quickly realise the benefit of using double quotes with request for variable substitution.

    For example, to assign a value to a variable (and preserve leading spaces), we would use:

    $ address=" 23 Acacia Avenue "

    A correct quotation is needed to recall the value complete with the spaces:

    $ echo "<$address>"

    The less known application of the quotes is when they are around the command substitution syntax. By default, POSIX shells remove trailing new-lines during command substitution. Double quotes change this behaviour!

    Compare the output of the following commands:

    $ echo $(ls)
    log.1 log.2 log.3

    and

    $ echo "$(ls)"
    log.1
    log.2
    log.3

    Wednesday, November 08, 2006

    Graphics problems...

    For all its maturity, problems with graphics with installs out of the box are still there... This time, trying to use RHEL4 on an HP machine with Intel 82845G/GL[Brookdale-G]/GE Chipset.


    Seems fine, until you try to restart the X Window System with CTL-ALT-Backspace. The screen just goes blank, no message, no GUI - nothing. Log into a character interface, run level 5 is shown, and the startx command works well.


    Just wonder, actually... Could it be a setting somewhere stopping the CTL-ALT-Backspace restart deliberately? Will need to do a bit of 'googling'.

    Tuesday, November 07, 2006

    Adjusting the kernel for Oracle

    In the golden old days, when installing Oracle on UNIX, a laborious kernel recompilation process was often needed, to adjust required memory parameters.

    On Linux, the process is much simpler, as most of the significant parameters may be changed 'on the fly', effortlessly, and without as much as a reboot, let alone kernel compilation.

    All current kernel parameters may be found in /proc/sys/kernel location. Explore it, to see that each parameter has its own file, with either a Boolean Yes/No (or 1/0) or a string value.

    The set of parameters required for Oracle10g (only part of the list is quoted here) says:

    shmmax  = 2147483648
    shmmni = 4096
    shmall = 2097152

    shmmin = 1
    shmseg = 10

    There are different ways of implementing it: first of all, you can get the values directly into the memory constructs, for example:

    # echo 2147483648 > /proc/sys/kernel/shmmax

    This will adjust the value correctly, with the slight drawback - the value will return to whatever the default was after the next reboot.

    Alternatively, for a more permanent modification, you can place the required definitions in the kernel configuration file: /etc/sysctl.conf.

    kernel.shmmax=2147483648
    kernel.smni=4096
    kernel.shmall=2097152
    kernel.shmin=1
    kernel.shmseg=10
    and inform the kernel of the changes with:

    # sysctl -p

    command, which will read the values from the sysctl.conf file and place them in the
    appropriate files under /proc/sys/kernel.
    Any subsequent reboots will also make use of these values.
     

    Thursday, October 05, 2006

    Crashing Unix?

    What's that?

    Having now worked so much with Linux, I have developed an unhealthy approach to file system care. Initially by accident, then by design - to test, now by habit, when I shut a Linux machine, I just slam the lid - generally just pull the power on it (I'm talking laptops here - not really advisible on servers, especially of a production, live variety).


    Well, I've been waiting for some kind of corruption, longing for the fsck to be forced on me, waiting to sit there for the entire afternoon typing "yes", because I've forgotten to provide the -y option (and worrying that ^C would upset it further - which it wouldn't!).

    Nothing! A bit of a delay on subsequent boots, but no disaster of any description.

    This week we are working on porting our generic UNIX admin course onto SPARCs with Solaris 9 (I'm still not up to speed with the new Solaris 10 features, but that's a totally different story).

    We are working at the brand new offices in Birmingham (on the verge of the China Town - wonderful, but that's yet another different story). The machines were shipped from London. Once connected - power on, and... three out of four boxes booted OK, the last one would not.

    Guess what: had to do a manual fsck on the /var partition. Guess what: forgot to do the -y option. Except that I did interrupt it this time ;-)

    Fsck declared the partition healthy - boot into runlevel 3 - no joy: utmpx file missing. Back to single user: it turned out that most of the /var partition is missing! Having recreated most of it by hand, the machine came up - eventually.

    Now then - I might be totally unfair to Solaris at this point, but the corruption has no known history or explanation. The machines had been installed at the same time from a jumpstart (logs confirm it), then they were shutdown and shipped. Did the engineer pull the power? Very likely. Did the engineer remove by hand some of the /var tree - doubt it very much.

    Well, at least I had a chance to reacquaint myself with the good old fsck !

    Tuesday, September 26, 2006

    I'll be back

    My blog has been awfully neglected lately.

    The company's merger meant a new look at the portfolio, to integrate and merge the offerings. Quite exciting, as several new sites mean access to loads more kit, including some top spec Sparc machines, which will be employed very quickly for the new generation of administration courses. The breadth of the combined customer base is demanding several new courses, at either end of the spectrum. Linux for desktop at one end, and top level enterprise server stuff at the other.

    Teaching trips to all corners of the world add variety and excitement, but do nothing to relief time squeeze ;-)

    All in all rather busy times for us! But I have so much to document, that hopefully this blog might start flowing again soon...

    Sunday, August 27, 2006

    Choice is wonderful

    There has been so much arguing about pros and cons of open source, I'm not going to start now. Developers and system architects having choice in selecting programs and having the Linus-given right to modify them and adjust them to their need is all truly great.

    It may, however, give the rest of us headaches when trying to adjust our understanding of a command or program behaviour.

    Take the login program. Originated quite early in the UNIX evolution. Linux implementation (look at the bottom of man login) refers to:
    'BSD login 5.40 (5/9/89) by Michael Glad (glad@daimi.dk) for HP-UX.
    Ported to Linux 0.12: Peter Orbaek (poe@daimi.aau.dk)
    '.

    Both SuSE and Red Hat derivatives use this version of the program.
    However, if you are SuSE user, there is one more credit line you can see there:
    'Added new features: ThorstenKukuk (kukuk@suse.de)'.

    I have only realised that, when hours of trying and trying to make the /etc/securetty file work consistently failed, and I was reaching that well know to me desparation state.

    In manual pages, under SPECIAL ACCESS RESTRICTIONS, where the behaviour of the two standard access files (securetty and usertty) are described, the behaviour of the securetty file is described, but on closer inspection, in the DESCRIPTION section it's stated:
    'This login implementation does ignore /etc/nologin and /etc/securetty. You need to configure this in the PAM configuration file for login...' .

    Why? Obviously the assumption is made that PAM ought to run at all times - a very sensible advice. But why force people? The worse implication to me is that if administrator decides to leave the PAM configuration out of the equation, the simple system access configuration is then missing altogether...

    Apart of anything, it means that I cannot have an exercise in the 'generic' Linux course that can be done on both distributions.
    How annoying!

    I'm not going to throw it out, though. It will act as a reminder for all of us, not to become complacent.

    This is the beauty of UNIX and Linux - always keep you on your toes, make you test all solutions on every new platform, force you to test-run every script or program you want to port...

    Tuesday, August 01, 2006

    Which shell?

    Finding which shell you are currently using is not difficult, the ps command can tell you this easily. However, if you are using several shells, identifying the current one can be rather involving, may require ps -f, to make sure that you are looking at the last one executed. his method has one inherent problem - relies on human ability to deduce the desired result. Approach very much prone to mistakes!

    Whenever possible make the system do the hard work for you. We know that the current process ID is stored in the environmental variable $. You can therefore always check what the PID of the current shell is with:

    $ echo $$

    PID itself does not tell you which shell this is (if you have a mix of ksh, bash or any other you are still nonthewiser which one of them corresponds to the PID). Yyou can find the name of the process name ellegantly by interrogating the /proc filesystem, which stores all process information (in both UNIX and Linux, but on Linux has also all sorts of other hardware information).

    Still using a reference to the $ variable, look in the /proc for the name of the corresponding program:

    $ ls -l /proc/$$/exe

    lrwxrwxrwx . . . /proc/25541/exe -> /bin/bash


    If this is something you need to execute regularly, you can always create a little function and place it in one of the environmental files...

    Monday, July 24, 2006

    Back in action

    I've spent last few months between holidays, teaching, flying and a combination of all three above. Rather busy and exciting times, and the QA-IQ merger put another layer of travel, presentations and meetings to this all.


    Well, it looks like it's back to 'normal', whatever this may mean ;-)) - so back to Linux'ing, etc.


    I've now moved to Linux almost entirely. The HP/XP laptop is now sitting on my desk at home most of the time, and is acting as a backup machine mostly. My old faithful VAIO V550 is back in action, with SuSE10 final beta.


    I'm so impressed with it, that (backed up by the expressed needs of the public sector customers that IQ brought into the equation) I decided that for the first time Linux *IS* ready for the desktop, and consequently we need a Linux Desktop end user training. In the good QA tradition, will try to make it vendor (distributor in this case) independent, but will probably base it round Fedora 5 and Suse 10 installations.

    Monday, July 03, 2006

    Partition or not

    This entry is in fact a reply I posted earlier today on our local LUG.

    One of our guys lost a lot of data, because he accidentally done the
    rm at a wrong level of the /var branch. Any recovery work was made very difficult through the fact that his entire system was on a single partition.

    So, the discussion about best partitioning practice emerged. Here are my comments:

    My rule of thumb has always been to separate 'dynamic' from 'static' directories.

    Every branch which I regard as 'dynamic' (ie written frequently by users or applications)
    would go onto its own partition.

    Typically these would be:
    /var - log and spool files; these days also web pages - adjust the size for that
    /home
    /tmp
    /usr - (mostly because of /usr/local, but also because historically it used to be
    separate partition)
    /boot - this is to keep the kernel's disk small, away from other stuff, and as contiguous
    as possible
    /any-other-application

    Anything that you don't place on a separate partition will end up being part of the 'root disk'.
    Don't forget a swap partition, and consider any particular needs of applications you are installing.

    There seems to be a new school of thought, which suggests doing swap and root only (perhaps /boot as well).
    I have heard arguments supporting that approach, but they obviously didn't convince me, as I can't remember what they were ;-)

    Monday, June 19, 2006

    Command line and GUI operations don't mix

    When unzipping files (zipped originally under DOS) all permissions are messed up; notably the 'x' bit for shell scripts. That's nothing new really – always something to be aware of.

    We have a set of Oracle installation (Linux) scripts that are stored on a Windows server. When needed, Dave "the NumbThumb" zips them up and sends them to us to play with. We are well used to adjusting access permissions, in fact we have a little script that looks after attributes of files that arrive from the dark side.

    Today I've realised that mixing command line and GUI file manager is no good. Martin opened a GUI file manager and tried to run one of the scripts by double-clicking on the icon. Instead of running, an editor was opened. We quickly realised that the 'x' permission was missing. So I dropped into the command line, and did a quick:

    # chmod +x *.sh

    Run ls –l to confirm the change – OK. Martin tries to run the script again, but no difference: script didn't execute, but the editor opened again. Conclusion: if you have a GUI screen showing file icons, and change file attributes from the command line, don't expect GUI to take any notice.

    The whole experience proves the very old recommendation of working with UNIX : when working on any particular task it’s best to stick to either the command line or GUI, don't mix them!

    Friday, June 09, 2006

    Playing cat and mouse with the cat builtin

    Teaching Fundies. Using cat. Straightforward, hey?

    One example in the book says, that you cannot redirect file onto itself using cat.
    What should happen is:

    $ cat file5 > file5
    cat: file5: input file is output file

    Delegates try this - "Alina, it doesn't work!". What does happen is:

    $ cat file5 > file5
    $

    Several minutes of experimenting, and one of the delegates shouted with satisfaction: "Got it - cat is a built in".

    What? As surprised as I was, in the ksh-20050202-1 cat is a builtin, in addition to the standard /bin/cat.

    $ type cat
    cat is a shell builtin version of /bin/cat

    It may be a builtin implementation of /bin/cat, but there is behavioural difference. Perhaps not because of changes to what or how the two cat versions work, but due to the fact that one (the builtin) is operating in the same process as the calling shell, the other (/bin/cat) gets its own process space.

    This could have VERY serious implications for shell scripts!

    Consider the following:

    $ cat x > x
    $ echo $?
    0

    Then try the same, this time using external version:

    $ /bin/cat x > x
    /bin/cat: x: input file is output file
    $ echo $?
    1

    How many programmers use full pathnames in their scripts? If you are one of them – well done, and you will have no problems with this particular cat!

    If not, however (admit it!), any script written in the past, that uses cat's exit status will fail when ported to this version of ksh.

    OK, so why would you like to use cat for testing? I don't know – but that's not the point!

    Friday, June 02, 2006

    Amazing resource page

    When looking for an on-line IP subnet calculator during a class, we came across the site that managed to pull together a fantastic number of network and computer relating tools and resources.

    The site itself is an American ISP. If they were in the UK, I would probably be talking to them about their services. Anybody who put so much effort and intelligence into creating this site would be worth considering...

    A lesson to learn ;-)

    Thursday, May 18, 2006

    Input redirection into a while loop

    I'm teaching shell scripting in Stamford this week. Earlier today we had a discussion about data redirection to/from various programming statements like if, while, etc.

    The offered approach was:

    while read -r
    do
    command(s)
    done 0< file

    One of the students asked if you could have the redirection specified before the while, i.e:

    0< file while read -r
    do
    command(s)
    done

    My immediate thought was - yes, it should work. I didn't offer my opinion at that point, though. Instead I answered the question with another one. I asked them if the following would work (my favourite example illustrating shell scan):

    $ 1> file < /etc/passwd cat 2> /dev/null

    I was truly convinced that the original question is another exhibition of the same behaviour, which allows to specify the I/O redirection at any (sensible) point of the command line.

    Well, whereas the cat command line above will work OK, the original construct does not work! I have tried various combinations, and deduced that any alias, function or external command can have redirection specified before the command itself. However, when you are dealing with reserved words (programming keywords) or built-ins, the mechanism is not recognised, with a "command not found" error message.

    Curious... Need to investigate it further, unless Clive comes back with an answer before then ;-)

    Friday, May 05, 2006

    URL code/decode tool

    NLUG discussion on debugging htmp/php code lead to one of the participants quoting what I thought was an excellent tool for url decoding.

    There are also very useful conversion tables.

    Tuesday, May 02, 2006

    Mac addresses in VMWare

    I have recently noticed that when booting RHEL 4 in VMWare 5 (on my HPnc6120 laptop) the eth0 card would not initialise, with an error "MAC address is different than expected - failed".

    After some googling, one theme appeared to recur: hardware modules in the kernel problem. However, I was convinced this was not the issue in my case, since I also have FC 5 and SuSE, to compare the kernel config files against.
    To complicate the matter further, I went down the totally wrong way to start with, assuming that the correct value was one reported by ip neigh show from another machine on the same home network. How silly of me - that other host was looking at the 'front end' configuration, whereas my problem was sitting behind the VM...

    Eventually I managed to fix the problem, but without really understanding the reasons. What was the fix?

    Well, I noticed that the HWADDR parameter in the /etc/sysconfig/network-scripts/ifcfg-eth0 had a different value than the one reported by the ip address show command.

    I changed the HWADDR value to the one reported by the ip command, restarted the network with service network restart, and all was well. But I couldn't understand why (and how) the configuration file got changed - I could swear that I hadn't touched the parameter - ever! So I continued googling - and eventually went directly to the vmware site (another lesson learnt - should have gone there much sooner!) . The answer is well documented amongst their support pages, under "Maintaining and Changing the MAC Address of a Virtual Machine".

    In a nutshell: virtual machine also means virtual MAC. The value assigned is unique, but is liable to be changed if you move the location of your VM.

    This is exactly what happened to me. Since creating the RHEL4 VM, I have moved the "My Virtual Machines" folder (yes, XP) to a different drive - to fix XP synchronisation issues... But in turn , that messed up my RHEL installation.

    Since my fix did the trick, I haven't studied the solutions they quote on their site - apparently you can tweak configuration files of VMWare itself to fix this.

    I'm just happy that there was a 'good' reason for my problems. I hate fixing the unknown... It's just like replacing a blown fuse without knowing why it blew in the first place ;-)


    Tuesday, April 25, 2006

    Just a link... to a Microsoft blogger!

    I've come across a very interesting discussion, started by a blog entry. It comes from an MS enclosure, and is a rather adventureous and brave expression of individual's views.

    In the world where corporates often attempt to control the expression of views of their employees - usually through the fear of the unknown - this blog entry is proving that given a chance, most employees are prepared to stand by their bread provider, for better and for worse, in sickness and in health.

    So, whether you agree with the preaching, analisys and recommendations or not - it does make interesting reading.

    Thursday, April 06, 2006

    Linux in the air

    Embedded Linux from LynuxWorks has been cleared for use in display, flight management and flight control systems in American commercial fleets.

    "LynuxWorks becomes the first and only embedded operating system vendor to receive an Advisory Circular AC 20-148 acceptance letter from the FAA. "


    See more at http://www.lynuxworks.com/corporate/press/2006/rsc-acceptance.php.

    Friday, March 10, 2006

    F-Spot - open source answer to Picassa

    There is only a handful of applications which ensured that I continue using Windows. Picassa from Google (picture and video editing and management program) has definitely been one of them. Personally, I could never understand why they resist releasing a version of Picassa for Linux, but resist they do.

    However, Linux community responded, as usual, and equivalent tool emerged. It's name is F-Spot, and comes from:
    http://f-spot.org/ F-Spot can be used on a non-Linux platform as well - if you download a Mono-Live CD , which comes with all sorts of goodies, F-Spot included.

    The current version, 0.1.10, is actually quite good and stable. I haven't tested it fully yet, but it certainly
    y is usable. The only feature I'm missing is video clips management, but this is very early days for the project, and developer team is keen to hear of any "shopping lists". Versioning is good, editing less comprehensive than that of Picassa's, but on the whole the time of good by to Windows is nearer and nearer.


    Any QA person reading this - relax, I will maintain a system for course design applications, at least until we get to use some portable standard ;-)

    Tuesday, March 07, 2006

    New phase in X server evolution

    For a while Novell seemed to head for the open source community doghouse, for working on the new X standard (Xgl) behind closed doors. They have also been developing a new window and composition manager called Combiz. Well, both of these products have now been released into Xorg repositories. So all is well. Is it? There are two issues that this has raised. One is the new wave of standard in-fighting that we are seemingly face. This is because as soon as the community accepted Novell's Xgl (or Xegl - OpenGL version) as the future for X11, Red Hat put the spanner in the works by promoting an alternative: aiglx (accelerated indirect GL X. Red Hat's argument would be sound - both Xgl and Xegl are brand new solutions, which would require a lot of work on the part of driver creators, whereas aiglx is just an extension to the existing X server standard. Hmmm. Here we go again... The other issue that occurred to me is more of the philosophical nature. It refers to the reasoning Novell offered in defense of the 'keep it behind the closed door' approach to the design. The "design by committee" concept is what most companies face, and have to deal with. Novell chose to go against the politically correct community involvement in the early stages of planning, spec'ing and designing. They are being slagged for it, but should they really. For one, I fully agree with Dan Winship's reasoning...

    See: http://mail.gnome.org/archives/desktop-devel-list/2006-February/msg00115.html .

    Monday, February 20, 2006

    Boot from CD - a winner again

    Didn't expect to write anything whilst on holidays in Sydney. But couldn't resist sharing my joy of Knoppix saving me from a big row with the hotel staff.

    Hotel I'm in is using a third party company to provide telecomms and broadband services. It's awfully expensive, but convenient, so I have subscribed.

    So, to get online, you tune into channel 8 on your telly, choose the deal (9.95 for an hour, 44.95 for 3 days), then enter your room number - and bingo, a password is created for you. You connect your laptop and off you go. Except that the socket in our room was faulty. A very friendly manager allowed us to use another room (to test my laptop), using a password he provided for me. It worked (I never doubted my laptop). So, we move rooms altogether. Once moved, tried to connect and the fun started.

    Tried the password I had generated before - error message saying - cannot activate: already active. Although the manager's password has expired, I could still connect to the Internet, and use exactly the same sites I did as part of the test, but no others. Tried clearing the browser's cache, reboot, clear the cache again for good measure, same behaviour over and over.

    MAC address tied it in? Don't know, but booted from the Knoppix CD, connected the cable, punched in the password - straight in! On the same laptop, with the same hardware.

    So, if not a browser's cache, not an interface number, what was it that tied my laptop to the servers information? Am I missing something? Or is the comms provider being naughty and captures more information that I would comfortably want to surrender? I left the question with the manager. Somehow, I don't expect to get any answers before we leave in three days time...

    Moral of the story - Knoppix came up trupms again!

    Thursday, February 02, 2006

    Allowing remote X sessions

    A couple of posts before, I have described how to use gdmsetup to enable (in conjunction with xhost + command) remote X applications on your machine.

    I've been working with our engineers (OK, here goes the mention - Dave Williams, who is fast becoming a Linux expert, and Martin Pain - who, similarly is becoming Oracle and SQL ex if not expert), to update our various course setup documents. The fix for gdmsetup needed to be scripted. A simple trick allowed me to identify the configuration line that needed to be changed:

    First save the current setting in a different file:

    # cp /etc/X11/gdm/gdm.conf /tmp/x.$$

    Then change the setting; run:

    # gdmsetup

    Select Security tab, and modify the setting for the "Always disallow TCP connections...".

    Once done, just compare the two files:

    # diff /etc/X11/gdm/gdm.conf /tmp/x.$$
    191c191
    < disallowtcp="true
    ---
    > DisallowTCP=false

    Bobs your uncle. A single line (or two):

    sed '/DisallowTCP/s/false/true/' /etc/X11/gdm/gdm.conf > /tmp/x$$
    mv /tmp/x$$ /etc/X11/gdm/gdm.conf

    placed in an appropriate script, and X applications will now be accepted.

    RPM package verification

    This post doesn't solve any problems, but is more of a record of the investigation to solve one.

    I'm having problems with Fedora Core 4 GUI. Rather unpredictible X behaviour, with not being able to restart it, inability to start just some of the applications, such as xterm or firefox...

    Handling X has always been my achilles heal. I resisted windows, of any description ;-), for as long as I could, initially regarding it first as pure waste, then unnecessary nicety. It's only relatively recently that I kind of resigned to the fact that resources are now robust enough to cope, and there exist applications that could not live without GUI.

    Anyway, still don't really know what the problem is, but done some googling, and can see that I'm not the only one struggling with this strange GUI behaviour. Somebody suggested verifying X server packages - good idea. Run the rpm --verify on all packages to do with xorg, and got some result:

    # rpm -V $(rpm -qa | grep xorg)
    . . ? . . . . . c /etc/security/console.apps/xserver
    S . 5 . . . . T /usr/X11R6/lib/modules/libvgahw.a

    So why post this? Well, mostly to document the result, and to make a record of the file attribute characters.

    The eight characters mean differences in:
    S - size
    M - file type or permissions (mode)
    5 - MD5 checksum
    D - major/minor device number
    L - access path (read-link)
    U - user (owner)
    G - group
    T - mtime stamp (modification time)

    Between attribute characters and the file name, the file's type (as in "purpose") may be listed. In my output I got 'c' - a configuration file.


    All I know now, that the checksum on the xserver file cannot be verified and that the module archive file has a different size, mtime and checksum (considering what type of file it is - hardly surprising).

    So, have I learned anything - not really, but it gave me a chance to experiment with verifying packages ;-)


    Monday, January 16, 2006

    Working with UNIX 'epoch'

    An administrator friend was trying to find out on which date the last change of a password occured. He knew that this information was stored in the /etc/shadow file.

    Well, the third field of the shadow file contains a number, which is equivalent to number of days from the epoch, which for UNIX was agreed to be January 1, 1970, at midnight, UTC.

    So, let's see how we can convert this information into a meaningful date. For example, on my test machine I have:

    $ grep root /etc/shadow
    root:$1$.LbW0Bv2$keqd6WlAumjwvqRl2tu6U1:13117:0:120:7:::

    The conversion is simpler that you may think - no complicated calculations, just yet another useful option of the date command:

    $ date -d "1970-01-01 utc + 13117 days"
    Wed Nov 30 00:00:00 GMT 2005

    The above command means: show the date based on the given "string". The string used here says: use the epoch as the base date, and add to it the value of the 3rd field (for the user of interest) from the /etc/shadow file .

    The unit at the end of the string is important! For example, consider the following:

    $ date +%s
    1137404710
    $ date -d "1970/01/01 utc + 1137404710 sec"
    Mon Jan 16 09:46:11 GMT 2006

    In the above example we first convert the current date into the 'epoch' value, but expressed in seconds (notice that the +%s formatting is only available on the GNU-enhanced versions of date). We then used the date command to convert this number back into a proper date format.

    You could use the output of the date command as part of the string used in the calculations. The following is for illustration purposes only, really. It's a long-winded way of finding the 'now' date.

    $ date -d "1970-01-01 utc + $(date +%s) sec"
    Mon Jan 16 10:02:54 GMT 2006
    Finally, the same -d option can be used for creating any date stamp, for example:
    $ date
    Mon Jan 16 10:26:21 GMT 2006
    $ date -d "+ 30 min"
    Mon Jan 16 10:56:42 GMT 2006
    $ date -d "+ 2 days"
    Mon Jan 18 10:58:03 GMT 2006

    Thursday, December 15, 2005

    xhost in RHEL4

    I needed to illustrate how an operator could send an X application from a server to a workstation in his office (I'm talking here RHEL4 boxes).

    Simple, done it loads of times - on the workstation do:

    # xhost +server-name

    On the server run the application from the command line and direct the output to the display on the workstation:

    # xapplication -display workstation-name:0.0

    WRONG! It's not that simple on RHEL4! Here, you need to enable TCP first, which is done as part of gdm (graghical desktop manager) configuration.

    Run:

    # gdmsetup

    Select Security tab and notice that the following setting is "checked":

    "Always disallow TCP connections to X server (disables all remote connections)"

    Take the 'tick' off, restart the GUI (CTRL-ALT-Backspace), and all is well - the method shown above will now work.

    I'm still about...

    Anybody looking at this blog would be forgiven for thinking that I've given up...
    No such luck. I'm still here, except that the project I've been involved in took me into a customer's environment where access to Internet is not easy.

    How ironic is that! Internet has clearly become a victim of its own success. I still find it incomprehesible that one might be expected to work without access to e-mail and the web, yet most of large organisations don't seem to provide these facilities to visitor even or even contractors.

    Time for 3G or similar?

    Thursday, November 03, 2005

    Polish your Ingres in Polish

    Been looking for a book on Ingres, hoping to find something on r3.
    Funily enough, couldn't (and din't) find anything on amazon, etc. There are some excellent HOWTOs, notably at www.tldp.org, but nothing recent - most of the documents are several years old. Something more contemporary could prove quite useful. Now, there is a thought ;-)

    However, found a book in a Polish on-line technical bookshop!
    http://www.ksiegarnia-techniczna.com.pl/modules.php?name=Sklep&plik=lista&nazwa=opis&kod=837101144X

    OK, it isn't exactly up-to-date, as was published in 1994, but I still found it amusing that one exists! And at all of 6.50 zl (about £1.00), I decided to order it!

    Friday, October 28, 2005

    Ingres 3 - part 2

    Well, now that the software appears fully installed and configured, the daemons all hovering in the background waiting to spring to life, time to put some data in, and see if one can ever see it again ;-)

    Logged in as user ingres, and off we go:

    [ingres@fedora4 ~]$ createdb newone
    Creating database 'newone' . . .
    Creating DBMS System Catalogs . . .
    Modifying DBMS System Catalogs . . .
    Creating Standard Catalog Interface . . .
    Creating Front-end System Catalogs . . .
    Creation of database 'newone' completed successfully.
    So far so good, now have a go at creating then selecting some data:

    [ingres@fedora4 ~]$ sql newone
    INGRES TERMINAL MONITOR Copyright 2005 Computer Associates Intl, Inc.
    Ingres Linux Version II 3.0.2 (int.lnx/105) login
    Fri Oct 21 09:49:07 2005

    continue
    * create table t1 (col1 char(20));
    * insert into t1 values ('hello world');
    * select * from t1
    * \g
    Executing . . .
    (1 row)

    ┌────────────────────┐
    │col1 │
    ├────────────────────┤
    │hello world │
    └────────────────────┘
    (1 row)
    continue
    * \q
    Your SQL statement(s) have been committed.
    Ingres Version II 3.0.2 (int.lnx/105) logout
    Fri Oct 21 09:52:46 2005

    So, what's the conclusion? Well, I'm very impressed.

    I suppose I will encounter some problems with the very installation I have just completed, as there are specific environmental settings, as well as kernel parameters that I did not investigate and adjust.

    Another important issue a chose to totally ignore is that of user identity when performing the download and installation. This should also have been identified and used correctly. However, what the above exercise proved, is that Ingres for Linux is fine, and can be used 'out of box'.

    Basic installation and configuration is simple - if the defaults are fine for you, that is!

    Friday, October 21, 2005

    Ingres 3 - part 1

    A customer of ours is planning an upgrade to Ingres3, whilst changing from Dynix to Linux at the same time. So I thought that I'd refresh my acquaintance with Ingres, since I haven't seen this version yet. I have had some experience of looking after a Linux system running Ingres, but this is the first time I'll be installing r3 myself.

    At this stage I'm not even sure that what I'm doing will work. This is going to be what I call a dry run - I'm going to play it by ear, following the installation steps intuitively, rather than following any particular set of instructions - so, the following steps should be taken more as a log of events, rather than a tutorial. I had a look at www.tldp.net , which does have an ingres HOWTO, but it is a really old one, and although most of the document might be OK, I decided not to risk it ;-). At least this way I will have to use some brain cells.

    You've been warned! To emphasize the point, here is a quote from the "Ingres r3 Getting Started" document (part of the downloaded documentation package):

    "Note: Make sure you thoroughly understand the issues regarding system resources, storage locations, and other configuration parameters before installing Ingres. If you are not sure, have someone more knowledgeable in these areas perform the following tasks."

    I have not even checked or tested that system requirements are good enough - here is the briefest of specs:
    I'm using Compaq nc6120, with 2G RAM, inside a VMWare virtual machine with Fedora Core 4.

    So, to the installation.

    Step 1 ================================================================
    Download the following files from CA site: http://opensource.ca.com/projects/ingres/

    ingres-3.0.2-105-pc-linux-i386.tgz
    ingresr3documentation.tar.gz

    You will need to register with CA first.

    Step 2 ================================================================
    Prepare for the installation: create 'infrastructure' and unpack the tarballs.

    # mkdir -p ingres/documentation

    Unpack the documentation. I chose to separate the documentation (PDF files) from the installation software.
    # cp ./ingresr3documentation.tar.gz ingres/documentation
    # (cd ingres/documentation; tar xzvf ingresr3documentation.tar.gz)

    Unpack the Ingres 3 software
    # cd ingres;
    # tar xzvf ingres-3.0.2-105-pc-linux-i386.tgz
    # cd ingres-3.0.2-105-pc-linux-i386

    Step 3 ================================================================
    Perform the installation

    Need to run the Licence scripts first, to accept the conditions. The main database installation script won't work until you do this one first. Trust me, I know this from experience ;-)

    # ./ingres-CATOSL

    Can now run the main Ingres 3 installation script.

    # ./*install
    INSTALL OUTPUT: Invoking RPM...
    INSTALL OUTPUT: Preparing... ################################ [100%]
    INSTALL OUTPUT: System user ingres has been created but no password has been set.
    INSTALL OUTPUT: Please set the password to enable login for this user.
    INSTALL OUTPUT: 1:ca-ingres ################################ [ 6%]
    INSTALL OUTPUT: II_INSTALLATION configured as II.
    INSTALL OUTPUT: 2:ca-ingres-dbms ################################ [ 12%]
    INSTALL OUTPUT: Setting up Ingres Intelligent DBMS, this may take some time...
    INSTALL OUTPUT: See /opt/CA/IngresII/ingres/files/install.log for more info.
    INSTALL OUTPUT: 3:ca-ingres-net ################################ [ 18%]
    INSTALL OUTPUT: Building the password validation program 'ingvalidpw'.
    INSTALL OUTPUT: Could not compile ingvalidpw: Using executable from the distribution instead.
    INSTALL OUTPUT: Executable successfully installed.
    INSTALL OUTPUT: 4:ca-ingres-qr_run ################################ [ 24%]
    INSTALL OUTPUT: 5:ca-ingres-abf ################################ [ 29%]
    INSTALL OUTPUT: 6:ca-ingres-c2audit ################################ [ 35%]
    INSTALL OUTPUT: 7:ca-ingres-das ################################ [ 41%]
    INSTALL OUTPUT: 8:ca-ingres-esql ################################ [ 47%]
    INSTALL OUTPUT: 9:ca-ingres-ice ################################ [ 53%]
    INSTALL OUTPUT: Setting up Ingres Web Deployment Option, this may take some time..
    INSTALL OUTPUT: See /opt/CA/IngresII/ingres/files/install.log for more info
    INSTALL OUTPUT: ngres release 3 has installed successfully.
    INSTALL OUTPUT: The instance will now be started...
    INSTALL OUTPUT:
    INSTALL OUTPUT: Starting Ingres, instance

    So, the following Ingres packages have been installed:

    # rpm -qa | grep ingres
    ca-ingres-net-3.0.2-105
    ca-ingres-das-3.0.2-105
    ca-ingres-odbc-3.0.2-105
    ca-ingres-tuxedo-3.0.2-105
    ca-ingres-CATOSL-3.0.2-105
    ca-ingres-dbms-3.0.2-105
    ca-ingres-qr_run-3.0.2-105
    ca-ingres-c2audit-3.0.2-105
    ca-ingres-esql-3.0.2-105
    ca-ingres-jdbc-3.0.2-105
    ca-ingres-ome-3.0.2-105
    ca-ingres-star-3.0.2-105
    ca-ingres-vision-3.0.2-105
    ca-ingres-3.0.2-105
    ca-ingres-abf-3.0.2-105
    ca-ingres-ice-3.0.2-105
    ca-ingres-rep-3.0.2-105
    ca-ingres-documentation-3.0.2-105


    Service 'rc' file has been installed:

    # ls -l /etc/init.d/ingres*
    -rwxr-xr-x 1 root root 7187 Oct 20 19:27 /etc/init.d/ingresII

    Indeed: the service list in the runlevel 5 lists the following:

    Ingres II name server (iigcn) - running
    Ingres II recovery server (dmfrcp) - running
    Ingres II DBMS server (iidbms) - 1 running
    Ingres II Star server (iistar) - 1 running
    Ingres II Net server (iigcc) - 1 running
    Ingres II Data Access server (iigcd) - 1 running
    Ingres II JDBC server (iijdbc) - not active
    Ingres II RMCMD process (rmcmd) - running
    Ingres II archiver process (dmfacp) - running

    And, sure enough, loads of Ingres processes are running:

    # ps -ef | grep ingres
    ingres 25691 1 0 19:34 pts/1 00:00:00 /opt/CA/IngresII/ingres/bin/iigcn II
    ingres 25805 1 0 19:34 pts/1 00:00:02 /opt/CA/IngresII/ingres/bin/iidbms recovery (dmfrcp) II
    ingres 25925 1 0 19:34 pts/1 00:00:01 /opt/CA/IngresII/ingres/bin/dmfacp II
    ingres 25935 1 0 19:34 pts/1 00:00:19 /opt/CA/IngresII/ingres/bin/iidbms dbms (default) II
    ingres 26079 1 0 19:34 pts/1 00:00:00 /opt/CA/IngresII/ingres/bin/iigcc II gcc
    ingres 26135 1 0 19:34 pts/1 00:00:00 /opt/CA/IngresII/ingres/bin/iigcd II gcd
    ingres 26189 1 0 19:34 pts/1 00:00:02 /opt/CA/IngresII/ingres/bin/iistar star (default) II
    ingres 26270 1 0 19:34 pts/1 00:00:02 /opt/CA/IngresII/ingres/bin/rmcmd II

    That's all for this posting - next time, I'll see if my common sense approach worked. Chances are that many settings, variables, locations (possibly even additional libraries, etc) will have to be tweaked, adjusted, added...

    Why am I so pessimistic? Well, it's just that it's been going too well so far! ;-)

    Commenting out a block of lines in a script

    Everybody knows of the '#' character as the character allowing to comment out lines that are not meant to be interpreted by the shell in a shell script.

    Well, how cumbersome and untidy it ends up sometimes! Imagine you have a block of code, perhaps a big for-do-done loop, or a complex if-elif-else-fi statement and you need to, temporarily, take it out of the script for some reason. Inserting hash in front of each line, and then removing it again when done with whatever test you wanted to conduct is just plain messy.

    Ok, you could argue that this can be done nicely in vi :

    First, identify line numbers with:

    :set nu

    Then:

    :10,30s/^/# /

    will insert the hash at the begining of line, on lines 10 through 30, but even this is long-winded, and if you are using another editor, then the method may not be available at all.

    The alternative is to use a combination of the 'do nothing' command: the colon command, and the 'here document'. Imagine the following construct:

    : <<>
    ....
    ....
    ....
    BLOCK-OF-LINES-COMMENTED-OUT

    You can easily move the two lines up and down the script, and isolate the blok of line you don't want to 'participate' at run time.

    How does it work? The colon command means 'do nothing', but generate exit status 0, success. The way we are using it here is: 'do nothing, and whilst doing this ;-) use stream of data provided as 'here document'. This embedded data is not not interpreted by the shell at run time, so it hides our code!

    Monday, October 17, 2005

    The case in date

    Tha date command, one of the eldest tools in Unix has got one quirk that escaped me all those years. As usual with these things, it was a delegate who pointed this out to me, with a wry smile.

    A bit of background first. If you need to extract hour and minutes from the date command, you'd probably use:

    $ date +%H:%M
    14:48

    The little 'inverted polish logic' (is that why they keep telling me these things? ;-) ) is if you try to use the AM/PM indicator, achieved with the 'p' options.

    Try the following:

    $ date +%H:%M\ %p
    14:49 PM

    Then try:

    $ date +%H:%M\ %P
    14:49 pm

    Don't know the background to this, but it does appear a deliberate tease ;-)

    Saturday, October 15, 2005

    Pleasures of a tight-fit hangar

    A Pup (150) embracing a Robin (400) Posted by Picasa

    Sunday, October 09, 2005

    Still the best kept secret?

    I'm amazed how many people are still not aware of what Linux is! And I don't mean any Fred (sorry to all Freds out there!) off the street. I mean IT professionals, who come and join our UNIX classes. OK, so it was a Unix Fundamentals I'm referring to in particular; but even then, I would expect a bit more appreciation of the players in the industry.

    We give away a Knoppix disk on our UNIX/Linux courses. Frequently people ask - "what's that?". In itself, this is not an unexpected question, after all Knoppix is not a distribution talked about in board rooms. But when I answer: "it's a distribution of Linux, which...." and I still get a follow up "what's that?", then I do despair!

    Thursday, September 29, 2005

    Playing with pdksh redirection

    We often test the understanding of the command line scan by asking if the following will work:

    $ > /tmp/file1 2> /tmp/file2 (*)

    This week, been faced with questions exploring this further. For example, notice that:

    $ >log ( ps; who; df )

    will work, so will

    $ > log10 < /etc/hosts (while read -r line; do print $line; done )



    (*) It will (as long as file exists). The shell opens all three files during the scan, and cat will be the only word remaining on the command line. In simple terms. the shell will look after the 'connectivity' between cat's I/O streams and the files.

    Wednesday, September 21, 2005

    SCO is fighing back ?

    I hear that SCO are teaming up with MySQL! Must check it out - should we await MySQL license requirement soon ? ;-))

    Daily Hintlet
    The ps command is one of the most underused tools! Experiment with -o, which allows you to format the output. For example, try the following:

    $ ps -C ksirtet -o pid=

    Obviously, if you are not currently playing tetris, substitute ksirtet for another active process ;-)

    Friday, September 16, 2005

    Terminal capabilities

    I remember going back years and years, having to use an application which was meant to be displayed on a Prestel terminal. Prestel is a simple screen protocol, of 40 columns x 24 rows, still used in some places (mostly in Europe). It's got some interesting features, such as fixed colours for certain facilities. Can't remember much of the detail anymore, but I'm sure that, for example, the background colour is like choosing an old Ford - any colour you want, as long as it is black. Quite peculiar.

    This was the project, however, that tought me a lot about terminfo database and tools associated with creating and manipulating the terminal capability files. The terminfo database is in fact a collection of hundreds of individual files, each containing a description of one terminal type. These are data files, you can't 'touch' them with cat or more, but feel free (as root) to convert it into text with:

    # infocmp /usr/share/terminfo/v/vt100 > /tmp/vt100.txt

    If you needed to create a new terminal file, you'd pick up the most suitable (similar) existing one, modify it (using data from the hardware manual provided with your new terminal) and submit it into the terminfo system with the tic command (terminfo compiler).

    These days one gets 'drivers' for every screen one can think of (and few more), but understanding of the terminfo still helps - as you can then implement scripts, menus, etc, using some of the more advanced screen control techniques.

    For example, many people know of the tput command, that allows to manipulate the screen on an ad hoc bases. This command uses the capabilities file indicated by your TERM variable. To check, type:

    $ echo $TERM

    If you are looged into Linux, that is very likely xterm, and the file used is /usr/share/terminfo/x/xterm.

    If you've never seen tput in action, log onto any Unix or Linux box, open any terminal session and type:

    $ tput bold; echo hello world; tput rev; echo and again; tput rsg0

    The fun starts when you begin to utilise some of the more obscure features, such a colour or placement control. Try the following:

    $ red=$(tput setf 4)
    $ echo "${red}$(tput cup 10 20)hello world"

    The setf argument allows to control the character colour, whereas cup x y will send the cursor to column x row y of your screen.

    DailyHintlet
    To find out more about the screen capabiliites and arguments to tput look at the manual pages for terminfo, as well as tput. There is a lot more useful stuff there, for example there is an explanation of why setf 4 might mean red on one ocassion but green on another!

    Thursday, September 15, 2005

    DailyHintlets

    I found that doing a decent write-up on any particular thought or a 'discovery', etc takes time, and for that reason I often delay posting, to the point that the thought is gone, and opportunity for recording it missed.
    So, from now on, in addition to sometimes longer ellaborations, I will now have a snappy entry, called "DailyHintlet". They will usually be one-liner solutions, examples, thoughts, etc. Often they will be bits of information I've learned from the delegates!
    Despite the name, I don't really expect them to be posted daily, just liked the title ;-)

    DailyHintlet
    In GRUB configuration, the scope of the password directive changes, depending on where it is applied. If applied in the general definitions section, it controls ability to edit the configuration file. If applied within a stanza paragraph, it controls the access to (ability to boot) that kernel.
    (Ghanny from CompuCentre - thank you for correcting my lab solutions)

    Tuesday, September 06, 2005

    grep with -E option

    One of the most confusing things newbies face when learning Unix is having to grasp regular expressions. Having gone through the pains of learning the globbing (wildcards) and other shell specials, only a couple of days later we throw them all into air (characters, that is - not the delegates) and try to catch them again!

    It's interesting to watch the delegates try to rationalise it all... What usually finishes them off, is the use of the counting mechanism, whereby one can specify how many instances of a character or a pattern is expected.

    For example: to locate lines (in datafile) with at least 4 characters using grep could be done simply with (remember, in regular expressions dot means any one character):

    $ grep '....' datafile

    But if you want to locate lines containing exactly four characters, grep is taking on a bit more complex detail. The counting mechanism used needs to be 'switched on' with the use of the backslash.

    $ grep '^.\{4\}$' datafile

    The delegates are by this stage happy (ish) with the 'anchoring' characters (^ and $) and know that this means tying the pattern to the beginning and end of line, respectively. What freaks them out is that \{ \} notation.

    I like using it, because it allows me to complete the explanation of the backslash usage in Unix - you use it to toggle a special-meaning of a character. We normally use it to turn the special meaning of a character off. In the counting notation of grep, we use it for the exactly opposite purpose. Here, it means turn the special meaning of the curly brackets on (and make it count the character specified in front of it).

    But, I will have to find a different example to illustrate the use of the backslash; I just can't justify for much longer keeping quiet about the -E option one can use with grep. This allows the use of the set of extended regular expressions, in which counting is part of the default, and the { } notation is taken to mean counting without any additional measures...

    Therefore, the last example could be re-written with:

    $ grep -E '^.{4}' datafile

    Much simpler, and less confusing...

    Why sudden change of heart? Had an e-mail from a delegate along the lines of: "Alina, did you know that..."

    Thursday, September 01, 2005

    Memory stick Duo and HP 6120...

    ...do not work together!

    HP 6120 comes with a fancy digital card reader port. It takes every card. Apparently. What was not documented very well, is that the new format memory sticks, such as the Magic Gate ones, do not (and will not) work. Indeed, some of the sites on the web warn you against using them, as you can corrupt the card.

    So, I thought I'd get a PCMCIA card, with the memory stick adapter. Guess what! I have found a way of predicatably generating a blue screen of death on XP!

    And that's after being convinced by many that this is now in the past. It actually is blue, even if it doesn't last long, not even long enough for me to read the info (not that I would really want to).

    So, off to Jessops again, to get a USB external reader. More bits to carry.

    Lack of standards is getting at me.

    Blog Archive