PC Plus HelpDesk - issue 221
This month, Paul Grosse gives you more insight into some of the topics dealt with in HelpDesk
From the pages of HelpDesk, we look at:
- Transposed colour Infra red with Digital Cameras;
- Novelty CDR finger bowl dish; and,
- Spam-bot honey pot.
From HelpDesk Extra, we look at: Spreadsheets:
- Number Functions
- String Functions
- Conditional Expressions
- Double Entry Book
- Caesar and Horst Feistel
Transposed colour Infra red with Digital Cameras
Most people have seen the far infra red footage from police helicopters as people are chased around in the dark. Whilst this takes special lenses and sensors to see wavelengths of light that are emitted by body heat, your digital camera is actually sensitive to near infra red.
This is the camera looking at the near infra red from a garden incinerator.
Note the purple areas which are slightly cooler than the red hot parts and to our eyes, they are not hot enough to glow.
Molten glass also emits light at this wavelength and if you shine your television remote control (or infra red car fob) at the camera, it will probably show similar results.
This is the eye's approximate sensitivity to wavelengths of light. The visible range roughly goes from 400nm (blue) to 700nm (red) but it also extends below this to around 780nm. The CCD in your camera goes from around 400nm down to around 900nm.
Interestingly, our eyes are also sensitive to UV (wavelengths lower than 400nm) but this is filtered out by the front of our eyes. People who have had front of eye operations can see UV and apparently, it looks a sort of white. The part of the IR spectrum that your camera can see between 700 and 900nm is also represented as a very unsaturated purple (lower levels of response from the green layer).
If you get an IR filter, you can use the residual sensitivity of your eyes to see this. All you need to do is to hold the filter up against your eye so that you exclude all other light and allow your eye to adjust to the reduced level of light and then have a look around.
REMEMBER! THE AMOUNT OF LIGHT ENTERING YOUR EYE IS STILL HIGH EVEN THOUGH YOU CANNOT SEE IT VERY BRIGHTLY THEREFORE YOU CAN DAMAGE YOUR EYE IF YOU LOOK AT SOMETHING THAT IS TOO BRIGHT SUCH AS THE SUN. WITHOUT VISIBLE LIGHT ALLOWING YOUR EYE TO REGULATE THE AMOUNT OF LIGHT ENTERING YOUR EYE, YOU HAVE LOST ONE LEVEL OF PROTECTION SO BE CAREFUL IF YOU DO THIS.
However, you can investigate the IR sensitivity of your eyes at lower power levels and do so reasonably objectively...
Looking at IR through your filter using a diffraction grating (CD)
If you want to find out if the black filter you have transmits NIR light that your eyes are sensitive to as the 89b and 87 do, you can test it very easily. First, get a CD ROM and switch on a tungsten light (not a fluorescent one as these do not emit a continuous spectrum or in some cases, even one that extends beyond red). Next, adjusting the angle of the CD so that the tracks split the light from the bulb into the colours of the rainbow.
Next, hold the filter up to your eye so that you are now looking through the filter at the rainbow and you should see a deep red band. Adjust the angle so that this band falls half way over the edge of the CD and hold it very still. Take away the filter and you should now see that the red you were looking at appears to have gone - in fact it has been drowned out by the visible part of the rainbow which starts a little further on and which your eyes are far more sensitive to. You were looking at the IR part of the spectrum that the filter passes and you have confirmed it using a diffraction grating (the CD ROM) in the same way that a spectrophotometer would. You can also note that this is proof that your eyes are sensitive to infra red light. You can use this method if you get hold of some IR security spotlight film instead of a Wratten filter.
This is the diffracted reflection of a continuous spectrum source (a tungsten light bulb) as seen with a CD. The continuation of the red into a blue is an artefact of diffraction gratings in that this spectrum blends into the next (the primary (first) is the best one for separation).
This is a fluorescent light. Note that it is not continuous as it is an emission spectrum of mercury and another gas along with the fluorescent coating on the inside of the tube. The blue is at 404nm, turquoise at 436nm, green at 546nm, yellow at 578nm and the red is a series of peaks that stretch into the IR due to the noble gas - picked up here by the IR sensitive camera (as the purple smudge) although by eye, I can only see the shortest of the red peaks. You can see the effect of using an infra red filter just by putting it over the lens of your camera. Click on the image on the right to start it off or click on this link to go to it in the files directory. With the ability to see into the near infra red region of the spectrum and record it, we can take some interesting photographs like the one of the lodge on the right.
This is a composite of two images - effectively four layers - and we have thrown away one of them. With the Wratten filter, we have the range from 900nm up to around 750nm. With the colour image, we have three bands - nominally red (700 - 600nm), green (600 to 500nm) and blue (500 to 400nm). If we transpose the IR, R and G input bands to R, G and B output bands using image editing software, we can reproduce the Ektachrome colour transparency film.
If we break down the RGB and IR images we end up with four layers that we can play around with.
The Ektachrome film works like this but with some careful photography and a little image manipulation, you can get similar results...
A is the full spectrum of light that can be broken up into bands (1, 2 and 3 normally by the camera and 4 using an infra red filter such as the Wratten.
The bands are built up again into B to produce picture 5, the normal photograph and C, each layer's sensitivity to IR, producing the curiously coloured 6. This can vary from CCD to CCD and the RGB producing dyes in the CCD can have differing sensitivities to different bands within the IR band. If you take a picture with an IR filter and then turn up the colour saturation, you will either see colour noise or get different hues depending on what you have photographed.
Normally, you would then normalise the colours of the IR band and expand the contrast to produce a grey-scale D, giving picture 7.
Next, the layers are brought together again - discarding the blue and shifting everything else up one so that we have three colours again in picture 8.
Of course, you don't have to throw away the blue, you can mix the layers or squash the hue layer (or part of it) according to any recipe you like so, without throwing away any layer you could have...
Layer-> R G B Example 1 I+R G B 2 I R+G B 3 I R G+B 4 I R + G + B 5 I + R + G B ... and that's just keeping them in order. You can either separate the layers and treat them as individual entities or separate them into HSL and squash or shift the hue layer then introduce the IR layer - there are a number of different ways of doing it.
In Micrografx Picture Publisher, one way is to take the colour image and then shift the hue by 120 degrees (Map | Hue Shift), then go into Map | Tone Balance, select the red channel and move the 'S' flag to the far right so that the image has only all of the red information (formerly the blue layer) removed.
Next, take your IR image that has been corrected for tone balance, turned into grey scale and back into RGB and then remove the green and blue layers by going into Map | Tone Balance, selecting the green and then blue channels and with each, pulling the 's' flag to the far right.
After that, copy the now red image into the clipboard and paste it into the now cyan coloured image. Click on the white arrow and change 'Merge Mode' to 'Additive'. Go back to the transform arrow (black with the cross) and shift the red image around until it is aligned with the cyan. Then, click on Object | Combine | All Objects With Base.
In The GIMP, you can separate the three colour layers again and do it that way or you can rotate the hue of the colour image (Image | Colours | Colourmap Rotation...), click on select all for both and then grab the colour arrow on the 'To' colour map, on the inside of the circular arrow and drag it around by 120 degrees (0.66 Radians/Pi or 2.09 radians).
If you want to squash all of the visible colours into the G and B layers, you can do it here just by going from 120 to 360 degrees as your 'To'.
If you have rotated without squashing, your old blue layer is now occupying your red layer and you need to get rid of it. Right click on the image and select Image | Colours | Levels. Select the red channel and drag the white arrow to the left so that the output range is 0 to 0. This should make your image appear cyan. Click on OK.
Make sure that the red image is selected and right click on it: "Select | All" then right click again and "Edit | Copy".
In the 'Layers, channels and paths dialogue box, make sure that it is displaying the cyan image and then right click on the image.
Left click "Edit | Paste" and then in the 'Layers ...' dialogue, change the mode to 'Addition'. Back on the image, move the red layer around until it is aligned and then anchor it (click on a part that has no floating image on it or click on the anchor icon in the 'Layers ...' dialogue.
Channels (Layers in film technology)...
If you click on the image, a larger version of it (500 pixels wide) will open up in a new browser or you can right-click on it and 'save target as...' so that you can play around with it yourself.
700-600nm. The following three images are the three layers of the colour photograph.
This one is the red layer. Note that the leaves on the trees are quite dark in comparison to the IR picture above.
600-500nm. This is the green layer. Note that the leaves on the trees are brighter in this layer and also that the sky is getting progressively lighter as we go through the layers. 500-400nm. This is the blue layer. The sky is very bright and, no doubt, if we carried on with the UV, it would be brighter still. The brightness of the sky is due to dust particles that interfere with the sun's light, effectively filtering out the blue light from the direct image (why the sun looks yellowish) and adding that light (remember that it is scattered and not absorbed) to the rest of the sky. We have not got a yellow sun, we have got a white sun that looks yellow when the blue light is scattered.
Look at the colours on the tunnel mural and how they look in each layer.
700-400nm. This is the colour photograph that the camera takes, from which the last three of the above separations was taken.
You can save this image so that you can play around with it as well (it opens up to a larger version of it).
900-500nm. This is the colour shifted photograph, using the IR, R and G layers and putting them into the R, G and B layers that we can see so that we can visualise it.
Note that because healthy foliage reflects so much IR as well as green, that they get shifted to R and B which is magenta. Sick foliage does not reflect as much IR and so looks bluer and in this way, you would be able to see a camouflaged gun emplacement (the original use of the Ektachrome film) or pinpoint that ill looking apple tree in your 5,000 acre orchard before it kills of a few dozen other trees around it.
If you play around with the two images (IR and BGR) you will be able to see that some of the grass through the tunnel is a different colour - this is where it has been cut badly.
As you can see from the above composite examples that grass is a nice magenta and so are the trees. However, there are trees that do not reflect as much green such as copper beeches. In this shot, we see a number of different types of tree and the orange ones are the copper beech (deep red and IR make orange).
This is the Orangery in Markeaton Park in Derby. It is called that because the buildings used to be used to grow oranges, not because of the way its young grass (this was taken in May) shows up in IR composites.
This grass is different to the magenta rye grasses (hard-wearing, football pitch type grasses) and is more of an ornamental grass (as in 'keep off the grass' signs). This is proof that it is a different type of grass.
When I was researching this for digital cameras, I went around, taking shots of all types of things and chose this because of the different types of trees in it. However, there was an unanticipated result in this.
As you can see, the red filters on the cars have come out as yellow, as you would expect, and the colours of the cars are not the same as in visible light. The red car, facing away from us in the centre of the shot is actually a fairly desaturated blue.
However, whilst in visible light, the car looks as though it has a fairly uniform paint finish (you cannot tell any difference between parts of it) in IR, a different story is revealed.
The driver's door shows up brighter in IR and whilst the same blue as the rest of the car in visible light, it is completely different in IR. If you had a red car that needed the driver's door respraying and it came back from the paint-shop looking like this, you would send it back.
Sometimes, flaws like this can show up in sodium light which has a number of bands very close together in the yellow region (there are actually many although most spectrophotometers will show only two - if you remove the Doppler shift from the gas using a saturation/absorption method with a tunable laser, you can see the other transitions as well).
So, we have seen how shifting the colours along by one can effectively bring things that are merely very hot into the extremely hot range and also make the world around us look weird. So, what does this do to our already colourful sunsets? There's only one way to find out...
This is a normal sunset as most people would expect it to look.
This is the same sunset, taken a few seconds later using the Wratten 87 filter This is the IR-R-G > R-G-B composite. You know from your own experience that as the sun gets closer to the horizon, the overall light balance shifts towards the red.
Here, we have shifted it back again by shoving the arbitrary layers up around 100nm or so. This is more like the middle of the day than a sunset.
Novelty CDR dish
This is one thing that you can do if your burning activities go amiss - one step further on from just using them as coasters. It is based on the widely publicised activity that many children did with vinyl records in the 1960s and 70s using a flower pot and an oven - there is nothing new here, it is just brought up-to-date in the age of the CD.
First of all, if you are going to try this, make sure that you both own the oven and that you are the one that uses it for cooking - if you decide to try this, you do so entirely at your own risk.
Having made sure that the kitchen windows and door are open and that any doors into the rest of the house are closed, set the oven to gas mark 6. Put a clean, dry plant pot with a small base (2.5 to 3cm) upside down on a clean baking tray. Place the CDR on it and when the oven as got up to temperature, place the baking tray, complete with plant pot and CDR, on a shelf in the middle of the oven. Leave it there for five minutes and then check it. It should have started to droop by then and if your oven is set a little on the hot side, you might find that it is already done. If not, leave it for a few more minutes.
Once it is ready, take it out of the oven and let it cool down, noting how long it took for your oven. Once it has become rigid enough, you can put it under a cold tap if you want to. Don't put the plant pot in the water or you might crack it.
You might notice the smell of hot plastic but remember that you should have the kitchen well ventilated and that you are not even melting the plastic, let alone burning it so the smell you have is similar to the one in the pressing plant where local exhaust ventilation is all that is used (a plastic injection moulding plant that I worked on for a while didn't even have that).
With your new, novelty dish with some kitchen towel in the bottom you can put some peanuts in and it will be the talking point of the LAN party.
Spam-bot honey pot
Spammers have to get their spam out through somewhere and with known open mail relays being isolated, they have to comply with the rules for other relays. This usually involves making sure that a certain proportion of mails are not bounced and if someone is monitoring the amount of bounces, sending something that is not spam is the only way to ensure it. This is why we get mails that are either empty or have some piece of (formerly) genuine text in which the spam filters will not be able to filter out: send 20,000,000 mails of which 10,000,000 contain no spam and you automatically have a 50% non-bounce success rate with the mail relay.
Of, course, this depends upon the mail addresses all being real ones. If the list has been poisoned with false email addresses, they will all bounce, reducing the proportion regardless of the nature of the content. So, how can we poison the email lists? We know that email address list compilers use spiders to work their way around the Internet, looking for mailto: strings in web pages or even joe (at) bloggs (dot) com is not clever enough nowadays. So, all we have to do is provide them with a web page or twenty, filled with bogus email addresses.
If you have a website, but do not use that IP address for mail services, you can have a few pages of dedicated email links that are all false. You can stop genuine search engine spiders from looking at them by using the robots.txt file - something that a spam-bot might use to point it in the right direction. When the spam-bots spider your web pages, they will pick up on all of these addresses and think that they have hit gold. All you need to do is have a convincing looking set of pages that look like they are a directory of company employees or customers that the spam-bot can see.
Obtaining name lists
How do we make one of these? First of all, we need some names. There are various lists of first names and last names on the Internet that you can download - just type 'first names list' and get the results. Some of these have the frequency next to them so that instead of the same unlikely name popping up with the same frequency as common names ('John' appearing the same number of times as 'Shula'), you can use the frequencies to change their probabilities of being selected.
If you get a combined list of boy's and girl's names, you can copy the table into a spreadsheet which will put them into columns for you. You will then be able to highlight the columns you want for each list (male/female name + frequency) and paste it into a text editor, then saving it as a text file.
Using the list
Next, you need to write a program that will use these names to create email addresses.
If you have a list with the frequencies (these are usually census data with the empirical frequency next to each name), you can write a program that will first of all, load up the names into an array (this can be done with male and female names in the same array if you want equal distribution) of the form [string][longinteger], add up the frequency totals and then choose random numbers between 1 and the total (or 0 and the total-1 if you are doing it that way). Next, start at the second long integer value and add the previous long integer to it, storing the result in the second long integer array element. Thus...
Before...John 5467 Fred 4629 Chris 3761
...and after...John 5467 Fred 10096 Chris 13857
So, if the last number was 120,000, choose a number between 1 (for the first of the first name) and 120,000. If our random number is 12,642, this represents 'Chris' in our example because the end of the Freds is at 10096 and the end of the Chrises is at 13857. You can speed up a search of a thousand names by using successive approximation where you start in the middle and if it is higher, you go to the middle of the upper half and so on. As these numbers are skewed, you might find that you can get quicker results if you choose a different starting point for each iteration if the computer time is that important to you.
You just need to load up the names into an array and then choose them. If they were compiled by frequency (ie, is not an alphabetical list), you can skew the probabilities by using a function of the random number.
We now have a list of names that we can pluck proper sounding names from. Next, we need to make them into email addresses.
Email addresses come in a number of formats when used by corporations which include:
- [firstname].[lastname]@company.com - firstname.lastname@example.org
- [lastname].[firstname]@company.com - email@example.com
- [firstinitial].[lastname]@company.com - firstname.lastname@example.org
- [firstname][numberbetween1and999]@company.com - email@example.com
These can be with or without the dot in the username part of the address. As for a company name, you can register a free domain name on a permanent basis (ie not temporary) and point it at your firewall (note that at the beginning, I said that you should use an address that does not use mail services - this is because your firewall will reject the mail traffic but the domain name will turn out correct. To get around this, the spammers will have to check that a mail server exists at that address which, no doubt will be the next battle in the war.
We need to turn these into a web page.
So, in your program, configure it to...load up the name files # ie check that it is going to work write an html header # top of the page including # <head> and so on, leading into the body # with the top of the page generate a reasonable number of mailto: links write the footer # possibly with links to other # honeypot pages tidy up.
If you add a line to your robots.txt file that says that spiders shouldn't look there, then, if they use that, the will go straight there. If you want them to get there anyway, you can put an invisible link on your page (small white text on a white background) and then word it so that anybody who stumbles across there by mistake knows not to use them.
The cells are all given a letter and a number to reference them. A1 is in the top left and, depending upon the size of your program (version or memory dependent) the bottom right could be Z255, BA8191, ZZ65535 or whatever. Interestingly, spreadsheets work by storing cell contents in a database rather than storing the whole sheet as an array. This means that if you have 2 cells occupied, it should not take up a significantly different amount of memory whether they are in A1 and B2 or in A1 and ZZ21436 (or anywhere in the vicinity of ZZ9 Plural Z Alpha for that matter)
Spreadsheets need to know what type of input they are looking at so that they know how to render it and how to process it.
How programs recognise user input
(input starts with...) Examples in blue
Program Number String Function Cell
Abacus 2.3 1234567890
Lotus 1-2-3 1234567890
OOo Calc 1234567890
since Abacus on the Sinclair QL, the emphasis has changed so that users now can just type text implicitly, having to use a special character to use a function. In OOo Calc, only the beginning of the cell entry needs the '=' so if you had =IF(VLOOKUP(E3;D8:F31;3)>7;SUM(A9:A26);K15), only the first function needs it.
There are many number functions and, excluding the statistical functions, they are as listed below...
ABS, ACOS, ACOSH, ACOT, ACOTH, ASIN, ASINH, ATAN, ATAN2, ATANH, CEILING, COMBIN, COMBINA, CONVERT, COS, COSH, COT, COTH, COUNTBLANK, COUNTIF, DEGREES, EVEN, EXP, FACT, FLOOR, GCD, GCD_ADD, INT, ISEVEN, ISODD, LCM, LCM_ADD, LN, LOG, LOG10, MOD, MROUND, MULTINOMIAL, ODD, PI, POWER, PRODUCT, QUOTIENT, RADIANS, RAND, RANDBETWEEN, ROUND, ROUNDDOWN, ROUNDUP, SERIESSUM, SIGN, SIN, SINH, SQRT, SQRTPI, SUBTOTAL, SUM, SUMIF, SUMSQ, TAN, TANH, TRUNC.
Many of them are self-explanatory and for those that are not, there is the help, either on the spreadsheet itself or as the extra help files that come with the program.
The string (text) functions are pretty similar to those that you will find in any high-level programming language They are...
ARABIC, BASE, CHAR, CLEAN, CODE, CONCATENATE, DECIMAL, DOLLAR, EXACT, FIND, FIXED, LEFT, LEN, LOWER, MID, PROPER, REPLACE, REPT, RIGHT, ROMAN, SEARCH, SUBSTITUTE, T, TEXT, TRIM, UPPER, VALUE.
Conditional expressions (ie IF) allow you to use the output of an expression that can be evaluated in logical terms (whether something is equal to something else (or greater than, less than and so on) and giving the contents of that cell accordingly. These can also be nested and mixed with other functions allowing things like =IF(VLOOKUP(E3;D8:F31;3)>7;SUM(A9:A26);K15).
Double Entry Book
The double entry book spreadsheet that is in the magazine can be found for Lotus 1-2-3 97, MS Excel and OOo Calc in the files directory which you can enter by clicking here. In this version, the months have been typed in manually but if you want to try out the method described in the magazine and then change the language, you can see what happens.
Caesar and Horst Feistel
This is about ROT13 (one of the text (string) functions). ROT 13 is a Caesar cipher where each letter is displaced by an offset - in this case 13. A Feistel network shifts bits around to encrypt data. There is more about Horst Feistel on the Internet
You can find the files for this month's work in the files directory which you can enter by clicking here.
Back to PC Plus Archive Index Page