PC Plus HelpDesk - issue 226

This month, Paul Grosse gives you more insight into some of the topics dealt with in HelpDesk and HelpDesk Extra

From the pages of HelpDesk, we look at:

  • Robot Bandwidth; and,
  • Disposing of printed material.

From HelpDesk Extra, we look at OpenOffice.org Presentation:

  • Supported platforms;
  • License considerations;
  • Those little buttons;
  • Setting up a master;
  • Continuously transparent graphics; and,
  • Outputting your presentation to various file types.
Paul Grosse

HelpDesk

Robot Bandwidth

This is a little program I wrote earlier - the code is below. Again, I have coded it in such a was as to make it easier to understand so there are some things that could go on one line (successive checks using 'and's instead) that I have spread over several for clarity.

As always, the program starts off with ...
#!/usr/bin/perl -w

Next, so that it is easy to find what you need to to change, we have the configuration section. First of all, we create an array with the log files in it. We could have a path to the log files and just the names if we wanted and then concatenate the two strings later on as an alternative but this is just a first draught at the problem so this will do. Even though this might seem a little long-winded (it isn't really though when you consider cut and paste), if you have log files in different places, you can put the paths in with the files on a per-file basis.

#### CONFIGURATION ####
# Path and Name of log files to look in...
@logs = ("/var/log/httpd/access_log-20040809",
         "/var/log/httpd/access_log-20040930",
         "/var/log/httpd/access_log-20041115",
         "/var/log/httpd/access_log");

Next, we choose a month. In the 'monthsbw' script, we have this as an array as well so that it will look at a number of different months. Often, when writing a program, you find that you want extra functionality so you build it in once you have the core of the code functional.

# month to look at (string must be on log line)
$rmonth = "/Oct/2004";

Here, we specify the name of the robot we are searching for. We could use any string - it doesn't have to be a robot. In monthsbw, we specify this on the command line if we want to.

# name of robot to search for...
$robotname = "msnbot";

With the configuration out of the way, we can start processing the information

#### PROGRAM ####
# let the user know that something is happening
print "BandWidth Usage for $robotname robot\nduring $rmonth in...\n";

$lcount = 0; # overall total lines counted
$rcount = 0; # overall robot lines counted
$tbytes = 0; # overall total bytes counted
$rbytes = 0; # overall robot bytes counted

The following line, looks at each of the log files we have specified above. If there was only one log file, it will only go through this outer loop once.

foreach $logpath (@logs) {
  # let the user know that something is happening by
  # printing the name of the current log file
  print "$logpath\n";
  # open each log file as read only
  open LOG, $logpath;
  #start reading lines
  while (<LOG>) {
    # loop around until we get to the end of the log file
    my $line = $_;
    # check for correct month
    if ($line =~ /($rmonth)/) {
      $lcount++ ;
      # all properly formed lines have the string "HTTP".
      if ($line =~ /HTTP/) {
        # split it with spaces, the ninth segment
        # will be our number of bytes
        @sline = split /\s+/, $line;
        # look to see that it is a correctly delivered line.
        # the eighth segment contains the error code: 200=OK
        $code = $sline[8];
        # in the following line, note that we use == instead of =
        # This is because we are comparing values as opposed to
        # assigning values.
        if ($code == 200) {
          # This line is okay, look at the number of bytes...
          $num = $sline[9];
          $tbytes = $tbytes + $num;
          # check to see if the line is also for our robot
          if ($line =~ /($robotname)/) {
            $rcount++;
            $rbytes = $rbytes + $num;
          };
        };
      };
    };
  };
  # tidy up
  close LOG;
};
# finished
# print out overall stats
if ($lcount == 0) {
  print "ERROR: no lines counted - check log file name in configuration.\n";
} else {
  if ($rbytes == 0) {
    print "ERROR: no robot bytes counted - check for search string in log.\n";
  } else {
    $lineratio = int( ( $rcount / $lcount ) * 1000 ) / 10;
    printf "%12d robot lines = %2.1f per cent\n", $rcount, $lineratio;
    printf "%12d total lines.\n\n", $lcount;
    $byteratio = int( ( $rbytes / $tbytes ) * 1000 ) / 10;
    printf "%12d robot lines = %2.1f per cent\n", $rbytes, $byteratio;
    printf "%12d total bytes,\n", $tbytes;
  };
};

This is just a first draught. You can look at the code in monthsbw to see the differences. Note that in the output from monthsbw, the numbers of bytes and files are thousands separated. Look at the code and see if you can work out how this is done, how the code works. The answer is in HelpDesk Extra next month (227) where we will look at SSIs, including a page counter that splits up the output number into thousands just like this.

Below is the output for msnbot and googlebot.

April is a partial month as is December.

You can see that msnbot is far more aggressive than googlebot, clocking up nearly 13,000 hits as opposed to googlebot's 2,145 for the same period.

One thing to notice is that the totals are different at the bottom by one hit (14,145 and 14,146) and several kB (2,186,519,897 and 2,186,532,023). This is because there had been a hit on the site (for these logs) between doing the two runs.

As I said earlier, you don't have to look just at robots. Below, I have compared Firefox with Internet Explorer. You can see a definite step in the percentage usage of firefox and MSIE when the US Government and other organisations with concerns about security recommended that people stop using MSIE.

The main traffic for this site is from US education clients which will tend to use MS Windows.


Disposing of printed material

We all 'know' that we can delete files from our hard discs using programs that overwrite the data repeatedly (go to one of my lectures on computer forensics and you won't) but what about printed materials?

The ultimate way of disposing of sensitive material is clearly to burn them but sometimes this is not convenient - Do you save up enough to have a proper fire? Where do you keep it whilst you are saving it up? Should you burn it in little bits as you produce it? What if you haven't got a garden incinerator? What if you haven't got a garden? What about health and safety considerations?

So, if organising a conflagration is out of the question, what should you do? The biggest risk is from the dumpster diver - someone who searches through your rubbish for anything that could be of interest.

It makes sense to shred papers but if you then put them into a guinea pig's cage, they will quite happily sit on them, weave them into a nest, eat them and do all manner of things with them that you shouldn't think about too much if you are reading this whilst eating.

Every day, you can collect the remains and put them in your bin in the full knowledge that anybody who wants to extract information will have to sort through smelly, stained, wet, partially eaten shreddings which they will then have to sort out from food, hay, other paper (old copies of the Guardian and the local paper) and various substances that are perhaps best described as 'other stuff'.


HelpDesk Extra

OpenOffice.org Presentation

Supported platforms

The OpenOffice.org office suite is released for a number of different platforms. They are:

  • Windows;
  • Linux (x86);
  • Linux (PPC);
  • Solaris (SPARC);
  • Solaris (x86);
  • FreeBSD; and,
  • Macintosh.

This has two main effects as far as the individual user is concerned and they are that they can get a copy which will work on their computer (OpenBSD will emulate Linux and can be made to emulate FreeBSD); and, that if you have a mixed network with central storage (or shares that are available through, say, SMB/Samba), you can work on the same document on any of the machines that you have OOo installed on that have access to that share.

One point about OOo is that it has the same interface so, for example, I work on OOo on Linux and on Windows and there are no real differences (other than using '/' and '\').

One (of many) advantage is that you can still use your legacy MS presentations on this program.


License considerations

OOo is licensed in such a way that for ordinary users (those that are not going to make a contribution to the open source code that makes the program, ie, you are going to use the program as an end user), they can have as many copies as they like in as many places as they like and it doesn't cost them a penny.

This means that if you use it at work and you need to do some work at home, you can install it on your home machine without having to pay for a license, perfectly legally. This of course has the implication that there is no pressure from some software company, that they will sue you and therefore that is one thing less thing for a system administrator or any manager for that matter to worry about.


Those little buttons

Small though they might be, they are the key to using this program.

  1. Slide - This allows you to edit the slide presentation for what you and your students/co-employees will see. You can edit both the content of the slides and also the notes, depending upon the selection of the buttons 3 to 7.
  2. Master - The master sits behind every slide you will do with this presentation. Once you have an idea of what you want your presentation to look like, you can design your master. This also means that if you want to change the look of your presentation (say the company has just won an award that should be on every slide, or it has been bought out by another company, you can effect this change just by editing the master and putting a new logo on it).
  3. Drawing View - Lets you edit the slide as it will appear in the final presentation.
  4. Outline - this displays a hierarchical view so that you can plan out your slide on-screen. You don't have to use this, so, if you are more comfortable using mind-maps or other thought-organising methods, you can. This is all about flexibility.
  5. Slides - this displays the slides on one screen several at a time so that you can re-order them as you like. This is particularly useful if you have a pattern of display in your presentation (perhaps revealing small parts at a time in particular fonts or with particular images and you want to repeat this sequence at some stage) or you want to show a slide again later on - all you need to do is to duplicate the slide in question, go into this view and then drag and drop the slide where you want it. It is also useful for pruning out slides for student copies (remember to make a backup first so that you are not deleting slides from your only copy.
  6. Notes - this lets you add the notes you need. These notes will not be displayed (or exported to PDF) so you can add whatever you like and they can be printed out for you only.
  7. Handout - this displays a number of slides (just the slides as they will appear in the presentation) on a single sheet. You might find it easier to use this in your presentation than the notes (it depends how much you are dependent upon relying on notes).
  8. Presentation - this starts your presentation. Left-click the mouse and you go to the next slide - Right-click the mouse and you you can go back one. If you drag the mouse, you can draw on the screen.

In 8, dragging the mouse to draw on the screen is handy because you can see the image displayed on your laptop as well so you can make a decent job of it. However, if it is just students asking about things, you can either move the mouse (not brilliant with a pad on a laptop) or, I have found better, use a laser pointer and point it as the projected image.


Setting up a master

There are hundreds of barge-pole standard masters out there so, in order not to be grouped in with the other members of the 'I really can't be bothered' brigade, spend a little time making one of your own. On the SuperDisc, you will find the presentation used in the screenshots. It is only two pages but it should give you some idea of just how easy it is to create a basic master.

Click on button 3 and then on button 2 - this will allow you to edit the master.

For your background, you can just click on the filled rectangle on the left and then drag it from the top left to the bottom right of the image. This will effectively change the background (you can push it to the back using the arrange button). Next you can change its colour, if necessary, creating a gradient as described in the magazine.

After this, you can build an implicit frame if you want. Here, I've just used two lines and then, in the bottom right corner, implied the rest of the frame with three little squares. In all, I have used just six rectangles/squares - no clipart, just boxes.


Continuously transparent graphics

If you want to add a little more to it such as a company logo, there is no reason why you should be restricted to having a rectangular block with the logo in it as this will most likely look awful - especially if you have a gradient as your background. Logos look far better if they seem to be a part of the image as opposed to apart from it. Either you will have to obtain a copy of the image with transparency or create one of your own. The best way of doing the latter is to use a program like the GIMP (which again is free).

Take your logo (as big a copy as you can get - or at least several times as many pixels larger than you will finally want it to be) and mask off the background (possibly feathering the mask). Copy it into the clipboard then paste it into a transparent image. Next, shrink it down to roughly the size you are going to use it at so that any hard pixel boundaries are smoothed out. Next, save it as a PNG image - this will preserve the transparency so that gradient backgrounds will render okay with the logo. (You can add transparent graphics to any part of the process - it doesn't have to be only in the master.) One other advantage of PNG files is that they use lossless compression - they keep all of their detail so no need to compress the colours down to 256 colours as in GIF or put up with curious edge artefacts that you get with JPEGs regardless of how little compression you use.

On the SuperDisc, there is an example transparent graphic file that you can try out - just click on Insert> Graphics> and add the file which you will find here.

If you are viewing this with a browser that does not support gradual transparency, the image on the right will not render correctly as it is the PNG file. This does not trouble OOo though and it does render correctly in that.


Outputting your presentation to various file types

Once you have finished, you will need to produce various versions of your presentation for various people.

Presenting

You can do your presentation directly from OOo which will probably be more convenient for you. However, a word of warning about this is that if you have any special fonts, you need to make sure that the machine that you are using to give your presentation has the same ones that the machine you wrote it on has.

If you are using a Linux (or other Unix-like OS), this could be a little bit of a problem if you are not aware of what is going on. In Windows, fonts have names like Times New Roman and so on. These are just simplified versions of the real names which can be quite long and complex. In Linux, similar things have happened for some versions of some fonts so Times in Linux might not be exactly the same as Times in Windows. It is easiest - if you are going to mix OSs - to copy the fonts across to Linux. If you are only using one of the many non-MS OSs, you shouldn't find this a problem.

One way of getting around this - to such an extent that it allows you to do your presentation on OSs that are not even supported by OOo - is to export them to PDF. You can do presentations from PDF in full-screen mode although (in my experience) it is forward only.

Printing

You can print out your own notes using either 6 or 7 on the right. You will get whatever you have designed into the views. Of course, you can print out from 3 to 7. One thing to remember is that if you are getting students to print things out, you should have designed your master so that it is light on ink.

Exporting/ Saving

Students will often need a PDF version that they can look at after the lecture (jog their memory). If you have any pages that are superfluous, create a version of your presentation with those pages taken out and export to PDF from that.

PDF is not the only way to export/ save as you can export to Macromedia Flash (SWF) HTML, various image file formats and save to StarDraw, StarImpress and even to legacy MS PowerPoint (PPT) format.

Back to PC Plus Archive Index Page