Computing links

Computing home PHP function Raspberry Pi Banner Moving to PHP Find the favicon ASP resources html resources Password

Other links

Development history Apprentice training Under test portrait pics landscape pics
-*- Website Homepage


Computing

This is the computing home page which has just been converted to php [December 2017]. Links to all posts can be accessed from the lefthand bar or just scroll down.


    php multi-link function
       December 2018       

I have just [about] finished marking up the pages from our trip to South Africa. This turned out to be quite a marathon having to sort out over 3000 pics occupying 10 gigabytes of storage it also presented a problem with multiple links..

I like to include links outside this website to sites that provide more information or add to the narrative in some way. Trouble is that the links can be obtrusive at times especially when there is more than one link associated with a particular item. This started to become a problem in referencing the bird and animal pictures. There were usually two very good and sometimes as many as four, references to further information about some items. In the past, I have formatted the text so as to give multiple references to the same item, each with a different target. The problem with this approach is that the text becomes contrived and the reader has no way of knowing that the separate links are actually to different websites.

As you know, I am rather fond of favicons so my first solution was to just include the website favicon in the external link. This worked OK but the displayed text became messy and the markup a nightmare of dense code difficult to read and de-cypher.
This output:
Common quail - Common quail

Looks something like this in my editor:
<a class="link colorexternallink" target="_blank" href="https://en.wikipedia.org/wiki/Common_quail"> <img src="imagesfavicon/wikipedia.ico" width="15ems" border="0" alt="&#127;" />Common quail </a> - <a class="link colorexternallink" target="_blank" href="http://www.warwicktarboton.co.za/birdpgs/200CoQul.html"> <img src="imagesfavicon/tarboton.png" width="15ems" border="0" alt="&#127;" />Common quail</a>

What I did was to write a php function to simplify the markup and condense the output.
This output:
m m Common quail 2 links

Looks something like this in my editor:
<?php echo multilink("wikipedia.ico", "https://en.wikipedia.org/wiki/Common_quail"); echo multilink("tarboton.png", "http://www.warwicktarboton.co.za/birdpgs/200CoQul.html","Common quail", "2 links");?>

Much simpler and much easier to faultfind.

A measure of how desperate I was getting with the multiple links was that I stopped doing the South African markup in order to write the php function to handle them. I'm writing it up now because for once in my [programming] life a new [to me] technique worked straight out of the box and behaved just as it said on the tin! [Even the clichés work for this function.] So here is the php function and for once it's actually been commented by me. {Comments in blue.}
<php
/*
function multilink($favicon, $link, $legend, $numlink )
function to combine multiple links into a single entity. links are as website's favicons links open in a new window
usage:
$favicon local link to site favicon
$link html link to site address
$legend site[s] descriptor. non-active link rendered in not link blue [color multilink]
$numlink text descriptor of number of links rendered in dark blue [color multilinknumber]

example [from sj2017a.php]

echo multilink("wikipedia.ico", "https: //en.wikipedia.org/wiki/Bainskloof_Pass");
echo multilink("mountainpass.ico", "https: //mountainpassessouthafrica.co.za/find-a-pass/western-cape/item/37-bains-kloof-pass,-wellington.html");
echo multilink("dangerroad.ico", "http: //www.dangerousroads.org/africa/south-africa/1045-bainskloof-pass-south-africa.html","Bain's Kloof Pass", "3 links");
Notes on syntax
the '
.' is the php concatenation operator
" ' quotes are only nestable to 2 levels. i have used double quotes for the .php code and single quotes for the generated html code
*/

function multilink($favicon,$link, $legend, $numlink )
{
$z = " <a class='link colorexternallink' target='_blank' href='" . $link . "' ><img src='imagesfavicon/" . $favicon . "'height='15ems' border='0' alt='m' /> </a> <a class= 'multilink' >" . $legend . " </a> <a class= 'multilinknumber' >" . $numlink. " </a>";
return $z;
}
? >

References:
mw3schools
mGuru99



    Raspberry Pi
       March 2017       

When I first retired, I bought a P8048 Pic development board from Maplin. It had LEDs and micro switches interfaced to the PIC and I played with it quite a bit. Repeated some of the machine code exercises I developed when I used to teach microelectronics so flashed lights and debounced switches and then decided I was 'all dressed up with nowhere to go' and put it to one side.

Now I have treated myself to a Raspberry Pi and I'm hoping that this won't suffer the same fate.

I do have a few little projects in mind though and if they come to fruition expect to see them here. For the moment, I busy setting it up...making breadboards and fiddling about in general. I'm very impressed by all that it can do and how easy it has been to set up. I can see that direct access to its, to me, the unconventional 3v3 logic bus is going to need some thought and some hardware to keep it safe I think.

    Display random images with links
       20 October 2015       

0005staw

marsha067.JPG5

port01050435

blogal0099.JPG

5-11990523_4p.jpg

greenfordcat2







As you can see from my post of 2 June, below, I was rather missing my banner of random images with links that adorn the front page of the website, and the top of this post. For a while I made do with a random image displayer but really wanted to be able to link to the underlying content as well as display the image.

Looked on the web for an instant solution and couldn't find anything that did what i wanted that didn't involve acres or java script so decided I should sort out something for myself...it seemed such an easy thing to do,

That's exactly how it turned out, two lines of php code, and the C programmer in me knows quite well that they could be reduced to just one , But [so far] I have resisted.

Wrote a quick and dirty routine to display all the portrait oriented pics and then a quick clone to display all the landscape oriented ones. Then added a bit of rampant featuritis by counting how many pics I had and then displaying a final one chosen at random. I have linked to the files here as I think it might be useful to be able to see them all with one click.

What I wanted though was a routine to display an image with its link so a bit more fiddling was needed. I already had files of html lines that displayed linked images so all that was needed was to write a routine to randomly select one of these lines from the requisite file and then stand back and grin.

Now if I can just remember how to display html code without it running I will show how the banner is produced.

The banner is made up from a number of portrait and landscape oriented pics. The mix of orientations being chosen so that the banner covers most of the page width.

Displaying the images is done by a line of html code, selected at random, from a pair of files called 'textlandscape.txt' and 'textportrait.txt'.

A line from the textlandscape file looks like this:
<a target= "_top" href= "party09.asp" ><img src="imageshomelandscape/noddy2.jpg" width="16%" alt="noddy2"/></a>

It displays the image noddty2.jpg and links it to the party09.asp page. That line is run below and displays the linked image as shown.

noddy2

All the images have been reduced in size from the originals contained in the main text for speed of loading.
The php code to select a random line from a file and cause it to be displayed is:

<?php
$piclink=file('textlandscape.txt');
echo($piclink[array_rand($piclink,1)]);
?>

The first line:
$piclink=file('textlandscape.txt');
Declares a file pointer to an array $piclink and reads the file 'textlandscape.txt' into the array.

The second line:
echo($piclink[array_rand($piclink,1)]);
Uses the array_rand() function to choose a single element of the array pointed to by $piclink and then passes it to the echo command for execution of the html string it has chosen.7

By the way, the single line version looks like this:
<?php
echo($piclink[array_rand(file('textlandscape.txt'),1)]);
?>
and does this!
l0awolf130164.JPG



And that is quite enough rampant featuritus for now.


    Migrating to PHP
       2 June 2015       

Three years ago I set up my own webserver using Microsoft's ASP. I suppose I chose this because I had a new PC running Windows 7 and it came with it. Now I have migrated to a Unix operating system [Xubuntu] and the prospect of setting up ASP in this environment is far too daunting. So all new pages will be in PHP and older ones dealt with as they get updated, like probably never in some cases.

I have tried several options for updating, including 'instant' re-direction from the old file to the new one. Trouble with this is that it loses navigation to labels in the file and despite what it says on the tin, takes a while to actually do the re-direction. My version of PHP at any rate loads the whole file before re-directing from it.

Granted we are still running on a damp string internet connection here but the favicon post slows everthing down as it tries to find the live websites. I have often thought that the greatest thing I could do for mankind [ohh ok webkind] would be to lend [no give] my old computers to developers so that they can test their latest offerings on a real end-user platform and not the state of the art kit they are using.

The plan for the computing pages then is that new ones will be in PHP format and will contain links to the old ones via the lefthand side bar. I'll think of something different should this get to be too full, still a few years left at the present rate of updating.

So far, things have gone quite well in bringing up PHP. The main reason I chose ASP was for the content rotate utility and then Microsoft promptly depreciated it, thanks Microsoft. I've replaced it with a cloned/hacked PHP version which is OK but doesn't link when an image is clicked. I can see how to do this, I think, but I am happy enough with it as it as for now.

Of course, the real reason for wanting server side scripting was to make website maintenance easier by loading in side bars and menus etc without having to update them in every file.

    Find the favicon
       2 December 2012       

Somehow it has taken me a long time to twig out how to do this easily. As you may have realised, I like to include site favicons with links to external websites. Now developers are meant to put their favicons in the main route of their webpages BUT of course many do not. When the favicon is not in its expected place, I spend a happy time playing the well known Christmas party game 'Find the Favicon' by trying to find where it has been hidden. For this I have been using, Chris Pederick's web developer. to have a good snoop around and to find the location of images amongst other things.

It's obvious from the Firefox page that it manages to find them and to display them at the start of it's website tab. So you would expect that this would be a good place to look for them without going on a website treasure hunt. NOT SO! But if you left click on the address bar icon you get this helpful message, AND a click box:

dialog box


So go ahead and click it!
then you get:

images/comp19


Now click on media

computing19
and there are the links!


To prove it here is the link to Chris Pederick's website, [with favicon!]

 chrispederick

AND what is more, his is in the right place.

BUT what about when it's not in the right place you ask as on the notepad++ site.
Firefox tells us about the media on this site like this:

http://notepad-plus-plus.org/assets/img/bg-vertical.gif
http://notepad-plus-plus.org/assets/images/favicon.ico
http://notepad-plus-plus.org/assets/img/bghtml.gif

look through the list and there it is lurking in /assets/images/favicon.ico
Not where it is supposed to be at all.

 Notepad++


This is the html that makes it happen:

<img src="http://chrispederick.com/favicon.ico" width="16" height="16" border="0" alt="" />
<a class="link colorexternallink" target="_blank" href="http://chrispederick.com/">chrispederick</a>

Once you know where to find the favicon that is.

To display html in an html document

Just in case you were wondering, to display html in an html document, you need to replace html reserved characters with their character entities.
For example, you can't use the html tag symbols < and > instead you have to use their entity representation which is just their decimal unicode number proceded by &# and followed by ;
< is coded as &#60; and > as &#62;

You can either use the unicode number or the entity name.
The ampersand & can be coded as &#38; or &amp;
The less than tag < and can be coded as &lt; or &#60;

Links for this post [with favicons]

 Online Unicode Character Map, does what it says on the tin.
mw3schools, where to go when you need to know.
mNotepad++, can't praise this enough, THE choice if you are looking for an editor.
mFamFamFam, where Notepad++ sourced their buttons
mchrispederick, website, source for web developer



    Active Server Pages
       April 2012       

I have been wanting to use some sort of Server Side Scripting on the website for some time now but my motley collection of old computers have conspired to prevent me. When the dog ate my computer it gave me the opportunity to upgrade and that has made it possible to build a local webserver so I can test my code before uploading it.

This post is to share asp resources I have found useful and give me a quick access point to them. Also a few observations about Windows 7 which was bundled with the new PC and a quick look at browsers used by visitors to the website.

asp resources

To learn something new about web development, my usual first recourse is to see what is to be found at mw3schools. They have a good section on asp, including how to set it up on various platforms.

My only problem was that even following the !instructions! I was still struggling to get it to work. So I had a bit of a rummage on the internet and found what I felt was the clearest description of what to do. This site includes the two final steps, omitted in most descriptions, of setting default documents and parent paths.

Trouble was that although it was clear that my webserver was working, it wouldn't work with any of my scripts. Then the penny dropped. asp script needs to be in an .asp file [not a .html one].

I mention this in the hope it will stop you from feeling as foolish as I did. My other little problem was that I seemed to revert to an earlier existence and kept naming them as .asm files despite not having written an assembler file in two decades.

"Now that we found .asp, what we goin' to do with it?"

When I first started learning html, I kept looking for the file handling functions. Now I've got them! I've re-cast the whole website into .asp files with .html overlays for the menu bars. Already, this has saved a lot of effort and means I can change the lot from one location. This has enabled me to split some of the bigger files without incurring increased maintenance costs.

There are lots of other things I want to do but need to continue testing the site a bit more before I start on them.

Windows 7

I'm not what you might call a Microsoft 'windows fan' but I think that version 7 is their best yet. In fact, I might have updated my laptop earlier if I could have found one without Vista as part of the package.

Having said that, the instability of windows explorer is not acceptable, it keeps on crashing. I've tried just about every remedy suggested on the web to no avail. I note Microsoft's weasel words that 'one should find which piece of third party software is causing the problem and then re-install it.' Well I only have three pieces of 'third party' software running: Norton360, Seagate Dashboard and Notepad++. I have re-installed the last two, to no avail. I know Microsoft dislikes other vendor's virus checkers so I suppose I should re-install Norton too. Windows Explorer is so bad that it is un-usable so I've replaced it with a freeware package called ExplorerXP. Of course any application that has a sailing boat  for its icon has to be OK with me. The most noticeable thing about it is how much faster it does things than the Microsoft product.

I used to use Oxford University Physics Department's on-line Unicode Character Map. Unfortunately, their website has been sanitised by the marketing department and this is no longer available. The replacement that I now use is Online Unicode Character Map.

Firefox

I like to look at which browsers have been used by visitors to my site. I was horrified to find that last month at least two of you used Internet Explorer 2, come on you two! I'm rather keen to take out some of the .css kludges I have had to put in for IE users. They make my css non-standards compliant so I don't like them. I'm beginning to think that if I do this to enable your old browser to view the site, you will never update it. So I'm thinking I might just be doing you a favour if I take it off. Please contact the complaints department if you don't like that idea.

You can get mFirefox, free from this link.

Other popular browsers used by cribbit.net visitors:
mChrome
mApple's safari
mOpera

I had thought that finally Microsoft had an Internet Explorer version that actually worked in IE v6. Now I have just found that putting an innocent comment in the first line of a .asp file causes IE6 to load my side bars wrongly. Best advice to all is to ditch IE altogether.

Some useful links

mA list apart, using alternate stylesheets.
mw3schools
mGuru99
 Online Unicode Character Map, does what it says on the tin.
mFilezilla, excellent ftp programme.
mExplorerXP, a file manager that works.
mNotepad++, can't praise this enough, THE choice if you are looking for an editor. [and are still running ms windows of some sort, poor you!]

html resources

September 2007
I've been trying to teach myself html for the past few years. What follows are details of resources I have found useful.

First, a few confessions, on the whole I like to use tools that are simple, not packed with helpful features and that enable me to see what I am doing.

My experience is that one starts off with a nice functional little program that does the job and then it gets prettified, features are added and before you know it is overblown and cumbersome. I know this because I used to write programs myself and I used to call this crime 'rampant featuritis'. Poor old Microsoft has a terminal case of this I am afraid and I'm beginning to find Firefox going the same way.

As I'm using Windows, I like programs that conform to Windows protocols, and if it conforms to Wordstar ones as well I'm well pleased.

I've written most of this website with a shareware editor
mNotepad++ which fulfills my rather modest requirements and keeps its rampant features out of sight but available.

I know I am old fashioned, but I do like a book, I find them portable, they soon become familiar and they know to open at the section where you are having trouble.

My first book was:

mTML Dog The Best Practice Guide to XHTML and CSS, published by New Riders. This has lots of examples and an easy going style.

and my second:

mTCSS the missing manual by David Sawyer, published by O'Reilly. Clear and helpful descriptions and examples on using CSS.

Of course I have used internet resources, I find these particularly useful when I can articulate what I want to know and then I just mGoogle it up. I was mad keen on electronics when I was a boy and I made a rule then which still holds good to-day. That was not to use any 'potted' solution until I was sure I understood how it worked. This was especially useful later when I was learning C. C programmers are notorious for showing off their condensation skills when something a bit longer would be easier to understand. As far as I could see, the compiler produced the same .obj code whatever the layout of the source, so why not make it legible?.

A site that I keep coming back to is mw3schools, this site has excellent tutorials on a wide range of topics, html, CSS, javascript, .ASP etc. There are loads of examples and a great little on-line 'try-it' editor where you can see what happens when you alter bits of code.

It also has a mcolor picker utility which I think is marvellous! So much so that we now have rampant colouritis as well as rampant featuritis on this site. Also useful is mThe World Wide Web Consortium (W3C) tutorial and the original specifications.

The thing I found most difficult when I started doing html was not knowing whether what I had written was correct or not. It was all very well throwing my efforts at the browser to see if it worked but the browser was on to idiots like me and was very tolerant of dodgy code. This was good of it but this wasn't to my benefit when it came to writing robust code. In other words, I was missing the compiler. Then I discovered the m mThe W3C Markup Validation Service. All my files have been validated and I try to keep the validation current, though sometimes forget. This has helped me enormously in developing the website and in understanding how to write the code.

They also do a mcss validator too but I can't claim compliance as I am using the zoom: 1; hack to enable IE to view my site better.

Before I discovered the validator, I used mtidy.exe. This also was helpful in finding faults but I'm afraid I dislike the indented code it produces PLUS its propensity to fold markup to upper case so I don't use this anymore.

Now a list of websites I have found useful, there are so many to choose from but these are some I have used.

mThe W3C Markup Validation Service
mcss validator
mw3schools, like NY, NY so good you have to say it twice!
mDave Raggett's, the originator of tidy.exe, this is his html tutorial.
mwriting scrips
mcss validator
JavaScript tutorial from The Computer Technology Documentation Project.
 CSS information and tutorial.
mMozilla's developers center.
mchrispederick, a useful web developer toolbar that checks out the validity of .css files and much more, this is how I found the favicons of the websites on this page which don't conform to the default location.
mInternet Explorer tester, has a go at checking compatabilty with different versions of IE.
mMeyerweb.com useful stuff, especially about .css.
mA list apart, using alternate stylesheets.
mDevX.com Lots of tips, this one is about passing arguments to JavaScript functions.
mJavaScript about writing cookies.
mGuru99 Range of tutorials. 
Setting up an XP server with IIS.
mDynamic Drive, handy on-line image to favicon converter.
mWebhost-4-life This is where this website is hosted. I pay for this service as the freebies are full of annoying advertising.
mCribbit.net Just checking mine is in the right place!

 OC's PC Problem Pages.  Network2computers.
Two of my friend Harry Chester's websites. I remember Harry returning from a National Computer show wearing a freebie baseball cap with the legend 'bullshit deflector' emblazoned on its extended cap peak. He still wears it as you can tell from his sites, straight-forward, without hype and full of good information.

I'm always pleased to get suggestions for other useful sites, so please e-mail me if you have found something I have missed and should know about. I'll add it here.
You can e-mail me at:
cleadbeater@netscape.net





Mysterious poems for a mysterious purpose

At one time I used to teach electronics and computer technology. One of my courses was popular with the computer hackers as it delved a little too deeply into the operating system and how to do things without the supervision of Microsoft. I had also written a student registration and attendance monitoring programme which was a popular target for them on which to practice their new craft. I went to some trouble to make this secure and to cause dismay and confusion, the poems below were used to generate the staff passwords.

I first came across the poem about St. Eulalia at the Huddersfield Contemporary Music Festival and I've always rather liked it. The gory details of her story can be found at this website. Catholic Forum

It is not the gruesome details of the Saint's demise that I like, although it does remind me of the episode in Bergman's Seventh Seal of the girl burned at the stake, but the lines:

"Here, where clear, bright marble illuminates the gracious halls, are both visitors and natives."

Now I have lived in Colwyn Bay, Stratford-upon-Avon, London and now Oxford. When you walk the streets of these places you do indeed encounter both visitors and natives and the contrast is always interesting. In Stratford you would see the natives scurrying around on their Zimmer frames or with their shopping trolleys, completely oblivious to the Japanese tourists with their complicated cameras and pre-occupation with the ersatz manifestations of the bard. I doubt that there is such a thing as a native in London.

David Munroe was a presenter on Radio 3 who died young, I used to enjoy his programme for young people, 'Pied Piper'.

I'm not going to divulge the method by which the passwords are generated by this definition block but the text was chosen to remind those who would wish to hack my program that there is a fate awaiting them which is DEATH!!! One could also say that perhaps choosing a variable name like "password" may or may not be a red herring.

char title[]={
"The tomb of St. Eulalia by Peter Racine Fricker"
"Translation of the final section of the latin"
"Hymnus in Honorem Passionis Eulaliae Beatissimae Martyris"
			};

char password[]={
"No place more deserves this tomb than the famous town of"       //55
"Vettonia, whose beautiful walls are greedily washed by the"    //113
"green, swirling waters of the remarkable river Ana. Here,"      //170
"where clear, bright marble illuminates the gracious halls, are" //232
"both visitors and natives. The relics and ashes are preserved"  //293
"in the bosom of this holy ground. "                             //327
				};

char ev2[]={
"The bright roof above glows red with gilded ceilings and"        //55
"precious stones, as if a rosy meadow was alive with red"
"flowers.   Pick purple violets and red crocuses.   The kindly"
"winter does not lack these.   The thawing ice releases the "
"fields so that we may heap baskets of flowers."
				};
				
char ev3[]={
"Offer your gifts from this leafy foliage, maidens and youths!"
"I will carry woven garlands in the middle of the dance;   my"
"dancing feet poor, withered, yet none-the-less fruitful.  It is"
"our delight thus to reverence the bones and the alter placed"
"over them.   Seated at God's right-hand and propitiated with"
"those who sing, she cherishes her people"
			};
			

char death[]={
"Keep your nasty little hacking fingers out of this program"
				};
char munro[]={
"Death has deprived me of my dearest friend"
"My dearest friend is dead and laid in grave,"
"In grave he rests until the world shall end, "
"The world shall end, as end must must all things have."
"All things must  have an end that nature wrought,"
"That nature wrought, must unto dust be brought"
"Death has deprived me of my dearest friend"				};

Apprentice training

There was a time when I used to be somewhat involved in apprentice training. This included direct delivery at Newham College and through collaborative working with other training providers. Working with collaborative partners can be difficult unless strong monitoring and control procedures are in place. I wrote some html scripts to help pull together the various strands needed to manage and monitor collaborative provision.

That was several years ago, but I notice from my site statistics, that people are still accessing these pages. This is a bit of a worry as many of the regulations that the system was developed to conform to will have changed by now. The overall systems probably remain sound but users need to be aware of the dangers of using out of date data.

This note is to give a simple route to the collaborative provision website from here. To warn users of its danger and suggest that if they would like it updating or changing they should contact me to see if this is worth doing.


Website links

Topics

With the famous application -MotionX, Swiss traditional smartwatch can communicate bi-directionally with iPhone and omega replica watches Android applications, and can provide personalized life record application to rolex replica watches record the body's messages. Watch battery more replica watches uk without charge, you can meet the application of swiss replica watches various functions.