WordPress Is Mentioned By Less Recently Modified Tutorial
Supposing you came in here paying scant attention to the Blog Posting Title and its Animated GIF Tutorial picture I’d like to set you the challenge to look at the build up to organizing the use of the theme for today’s tutorial, and you try to anticipate what that may be? Up to the challenge? We hope so, because, with respect to the recent WordPress Is Mentioned By Recently Modified Tutorial‘s …
MySql SQL …
<?php
$res = mysql_query("SELECT " . $tname . ".post_title, " . $tname . ".guid, " . $tname . ".post_content, LOCATE('" . $ourtitle . "'," . $tname . ".post_content) as tfind, LOCATE('" . $ourother . "'," . $tname . ".post_title) as tother, " . $tname . ".post_date as post_date FROM " . $tname . "
WHERE " . $tname . ".post_status = 'publish' " . "
AND (1 = 1 OR LOWER(" . $tname . ".post_title) != LOWER('" . $ourtitle . "')) " . "
AND (" . $tname . ".post_content like CONCAT(CONCAT('%?p='," . $tname . ".guid), '%') " . "
OR " . $tname . ".post_content like '%" . str_replace('youllneverfindthis','%',permalinkit($ourtitle)) . "%' " . "
OR " . $tname . ".post_content like '%" . str_replace('youllneverfindthis','%',$ourother) . "%' " . "
OR " . $tname . ".post_content like '%" . str_replace('youllneverfindthis','%',$ourtitle) . "%') " . " UNION SELECT " . $tname . ".post_title, " . $tname . ".post_content as guid, ' ' as post_content, -1 as tfind, -1 as tother, " . $tname . ".post_modified as post_date FROM " . $tname . " WHERE " . $tname . ".post_status = 'publish' AND " . $tname . ".post_modified > NOW() - INTERVAL 1 WEEK " . " UNION SELECT 'Code Download Table' as post_title, " . $tname . ".post_content as guid, '' as post_content, 1 as tfind, 0 as tother, CURTIME() as post_date FROM " . $tname . "
WHERE " . $tname . ".post_status = 'publish' " . "
AND LOWER(" . $tname . ".post_title) = LOWER('" . $ourtitle . "') " . "
AND " . $tname . ".post_content like '%GETME%' ORDER BY post_date ");
?>
… we changed it to be …
<?php
$res = mysql_query("SELECT " . $tname . ".post_title, " . $tname . ".guid, " . $tname . ".post_content, LOCATE('" . $ourtitle . "'," . $tname . ".post_content) as tfind, LOCATE('" . $ourother . "'," . $tname . ".post_title) as tother, " . $tname . ".post_date as post_date FROM " . $tname . "
WHERE " . $tname . ".post_status = 'publish' " . "
AND (1 = 1 OR LOWER(" . $tname . ".post_title) != LOWER('" . $ourtitle . "')) " . "
AND (" . $tname . ".post_content like CONCAT(CONCAT('%?p='," . $tname . ".guid), '%') " . "
OR " . $tname . ".post_content like '%" . str_replace('youllneverfindthis','%',permalinkit($ourtitle)) . "%' " . "
OR " . $tname . ".post_content like '%" . str_replace('youllneverfindthis','%',$ourother) . "%' " . "
OR " . $tname . ".post_content like '%" . str_replace('youllneverfindthis','%',$ourtitle) . "%') " . " UNION SELECT " . $tname . ".post_title, " . $tname . ".post_content as guid, ' ' as post_content, -1 as tfind, (-480 + TIMESTAMPDIFF(MINUTE,NOW()," . $tname . ".post_modified)) as tother, " . $tname . ".post_modified as post_date FROM " . $tname . " WHERE " . $tname . ".post_status = 'publish' AND " . $tname . ".post_modified > NOW() - INTERVAL 1 MONTH " . " UNION SELECT 'Code Download Table' as post_title, " . $tname . ".post_content as guid, '' as post_content, 1 as tfind, 0 as tother, CURTIME() as post_date FROM " . $tname . "
WHERE " . $tname . ".post_status = 'publish' " . "
AND LOWER(" . $tname . ".post_title) = LOWER('" . $ourtitle . "') " . "
AND " . $tname . ".post_content like '%GETME%' ORDER BY post_date ");
?>
… to fit in with …
we changed the modifiedis_mentioned_by.php‘s SQL result set logic “if logic framework” … from …
<?php
while (($r_array = mysql_fetch_row($res))) {
if ($r_array[3] == "-1" && strtolower($r_array[3]) == strtolower($r_array[4])) {
// this is a member of the modified list (via middle UNION SELECT) of the MySQL SQL query result set
} else if (strtolower($r_array[0]) == strtolower($ourtitle)) {
// matches current post logic goes here
} else {
// does not match current post logic goes here
}
}
?>
… to …
<?php
while (($r_array = mysql_fetch_row($res))) {
if ($r_array[3] == "-1" && strpos(("" . $r_array[4]), "-") !== false) {
// this is a member of the modified (and less recently modified) list (via middle UNION SELECT) of the MySQL SQL query result set
} else if (strtolower($r_array[0]) == strtolower($ourtitle)) {
// matches current post logic goes here
} else {
// does not match current post logic goes here
}
}
?>
… turning a “binary” piece of logic into a “ternary” (and above) one … as well as, for good ol’ header.php we add some global Javascript variables …
var coption='option';
var cdisabled='disabled';
var chidden='hidden';
var cblank='_blank';
Is it apparent to you now what we are using to achieve some new “Less Recently Modified Tutorial” list data onto the “Recently Modified Tutorial” list data of below? But how do we go about doing that, that has been an enthusiasm around here, of recent times? What if we could say …
we changed the modifiedis_mentioned_by.php‘s SQL result set logic “within that top if logic” … from …
<?php
if ($secresult == "") {
$secresult=" <span id=xdrpl><select style=\"background-color:orange;display:inline-block;width:80px;\" id=mr" . permalinkit($ourtitle) . " onchange=window.open(this.value,\"_blank\"); title=\"Modified recently (over last week)\"><option value=\"\">Modified</option></select></span> ";
}
$secresult=str_replace('>Modified</option>','>Modified</option><option value=https://www.rjmprogramming.com.au/ITblog/' . permalinkit($r_array[0]) . '>' . $r_array[0] . '</option>', $secresult);
We’ve also long been interested in HTML select (dropdown) element option (subelement) disabling and/or hiding (statically or dynamically (as with today’s Javascript work)), and today, for the first time for us, we put this into action
… and we’ve found a new (probably you’d say, “more apt”) use of this idea. We differentiate the …
new less potent (you could argue) “older than one week and up to one month” of modified postings list that can be made “singly selectable” by the user (but don’t start that way, because they initially have “hidden” and “disabled” option element attributes set) … and …
in order to save space and honour those platforms that really render the “hidden” option tags we add “older than one week and up to one month” blog posting titles onto the “selectable day age” ones (all causing a select (dropdown) element value property of blank (if trimmed … ie. their length matches (40 – number of days age)) so that that new Javascript onchange logic can just look for a select element value existing in an option (list) member outerHTML property in order to decide whether to remove the “disabled” and “hidden” properties initially populated into those option “older than one week and up to one month” elements
Now can we recommend turning off the “scant attention” and having a look at today’s animated GIF tutorial picture showing a bit of how this new functionality works in practice here at the WordPress TwentyTen themed blog you are reading up with the ☞ emoji button (you click) above.
For biassed moi, just another reason to keep on admiring and using the ever useful HTML select (dropdown) element in our web applications.
WordPress Is Mentioned By Recently Modified Tutorial
Administering this blog there are two major criteria that would cause a blog posting’s modified date to change, that being …
at this blog we schedule one new blog post per day … and …
as we see things, on an ad hoc basis, we’ll make changes
… but that “Recent Posts” widget you see at this blog only reflects blog post criteria 1 above. Supposing you are following a thread of blog posts or an old blog post, try out the code and see that there is something amiss. How could this possibly be so! Yes, humanity rainsreigns, and we are scouring the postings you might visit to see what you might see, as a basis for revisits to code of the past.
And pretty naturally, if we find an issue, and can do something about it, with that category 2 blog posting type above, we may change one or other or both of …
the underlying code of said category 2 blog posting … and/or, as applicable …
the blog posting content of said category 2 blog posting
… the latter of which will cause that blog posting’s modified date to change, and as of today, adding onto yesterday’s WordPress Is Mentioned By Posting Order Tutorial, your clicking of “Is Mentioned By” ☞ “emoji button” above to change the “Recent Posts” widget title to “Recent Posts”, that (select element) dropdown populated in chronological order by a week’s worth of modified date changes at this blog. Using this, you may get an update to something you cannot figure, else drop us a line.
<?php
$res = mysql_query("SELECT " . $tname . ".post_title, " . $tname . ".guid, " . $tname . ".post_content, LOCATE('" . $ourtitle . "'," . $tname . ".post_content) as tfind, LOCATE('" . $ourother . "'," . $tname . ".post_title) as tother, " . $tname . ".post_date as post_date FROM " . $tname . "
WHERE " . $tname . ".post_status = 'publish' " . "
AND (1 = 1 OR LOWER(" . $tname . ".post_title) != LOWER('" . $ourtitle . "')) " . "
AND (" . $tname . ".post_content like CONCAT(CONCAT('%?p='," . $tname . ".guid), '%') " . "
OR " . $tname . ".post_content like '%" . str_replace('youllneverfindthis','%',permalinkit($ourtitle)) . "%' " . "
OR " . $tname . ".post_content like '%" . str_replace('youllneverfindthis','%',$ourother) . "%' " . "
OR " . $tname . ".post_content like '%" . str_replace('youllneverfindthis','%',$ourtitle) . "%') " . " UNION SELECT " . $tname . ".post_title, " . $tname . ".post_content as guid, ' ' as post_content, -1 as tfind, -1 as tother, " . $tname . ".post_modified as post_date FROM " . $tname . " WHERE " . $tname . ".post_status = 'publish' AND " . $tname . ".post_modified > NOW() - INTERVAL 1 WEEK " . " UNION SELECT 'Code Download Table' as post_title, " . $tname . ".post_content as guid, '' as post_content, 1 as tfind, 0 as tother, CURTIME() as post_date FROM " . $tname . "
WHERE " . $tname . ".post_status = 'publish' " . "
AND LOWER(" . $tname . ".post_title) = LOWER('" . $ourtitle . "') " . "
AND " . $tname . ".post_content like '%GETME%' ORDER BY post_date ");
?>
… that -1 as tfind, -1 as tother an intentional ploy to fit in with a new “if” clause in the PHP (that loops through database record reads of the MySql SQL query above) as per …
<?php
$secresult="";
if ($res == 0) {
if (1 == 2) echo("<b>Error " . mysql_errno() . ": " . mysql_error() . "</b>");
} else if (mysql_num_rows($res) == 0) {
if (1 == 2) echo("<b>Query executed successfully</b>");
$retval=$delim;
$retval = str_replace(" }", " parent.document.getElementById('d" . permalinkit($ourtitle) . "').innerHTML='<select style=background-color:yellow; id=" . permalinkit($ourtitle) . " onchange=window.open(this.value,\"_blank\"); title=\"Is mentioned by\"><option value=\"\">Sadly, this tutorial is not mentioned by any others, yet</option></select>'; }", $retval);
} else {
while (($r_array = mysql_fetch_row($res))) {
if ($r_array[3] == "-1" && strtolower($r_array[3]) == strtolower($r_array[4])) {
if ($secresult == "") {
$secresult=" <span id=xdrpl><select style=\"background-color:orange;display:inline-block;width:80px;\" id=mr" . permalinkit($ourtitle) . " onchange=window.open(this.value,\"_blank\"); title=\"Modified recently (over last week)\"><option value=\"\">Modified</option></select></span> ";
}
$secresult=str_replace('>Modified</option>','>Modified</option><option value=https://www.rjmprogramming.com.au/ITblog/' . permalinkit($r_array[0]) . '>' . $r_array[0] . '</option>', $secresult);
} else if (strtolower($r_array[0]) == strtolower($ourtitle)) {
$isize++;
$retval = str_replace(" }", " isize++; theseopts=theseopts.replace(' size=' + eval(-1 + isize) + ' ', ' size=' + isize + ' ').replace('>','><option value=https://www.rjmprogramming.com.au/ITblog/" . permalinkit($r_array[0]) . " selected>" . $r_array[0] . pluckfirstreal($r_array[2]) . "</option>'); }", $retval);
} else {
$pdate = $r_array[1];
if ($retval == "") {
$retval=$delim;
$retval = str_replace(" }", " var theseoptions='<select style=background-color:yellow; id=" . permalinkit($ourtitle) . " onchange=window.open(this.value,\"_blank\"); title=\"Is mentioned by\"><option value=\"\">This tutorial is mentioned by ...</option></select>'; }", $retval);
$retval = str_replace(" }", " var theseopts='<select si' + 'ze=0 style=width:100%;background-color:#f0f0f0; class=select_ms id=z" . permalinkit($ourtitle) . " onchange=changed(this.value,ocb); title=\"Is part of a blog posting thread ... and you can select multiple tutorials to show\"></selec' + 't>'; }", $retval);
}
if ($r_array[3] != "0") $retval = str_replace(" }", " theseoptions=theseoptions.replace('</select>','<option value=https://www.rjmprogramming.com.au/ITblog/" . permalinkit($r_array[0]) . ">" . $r_array[0] . "</option></select>'); }", $retval);
if ($criteria != "") {
if (str_replace($criteria, "", $r_array[0]) != $r_array[0] && $r_array[4] != "0") {
$found = true;
$isize++;
$retval = str_replace(" }", " isize++; theseopts=theseopts.replace(' size=' + eval(-1 + isize) + ' ', ' size=' + isize + ' ').replace('>','><option value=https://www.rjmprogramming.com.au/ITblog/" . permalinkit($r_array[0]) . ">" . $r_array[0] . pluckfirstreal($r_array[2]) . "</option>'); }", $retval);
}
}
}
}
if ($retval != "") {
if (!$found) {
$retval = str_replace(" }", " theseopts=''; }", $retval);
} else {
$retval = str_replace(" }", " theseoptions+=(' ' + theseopts); }", $retval);
}
$retval = str_replace(" }", " parent.document.getElementById('d" . permalinkit($ourtitle) . "').innerHTML=theseoptions; parent.checkclass(\"\"); }", $retval);
}
}
mysql_close($link); // close the MySql database connection
if ($retval != "") {
if ($secresult != "") {
$retval=str_replace("></selec' + 't>';", "></selec' + 't>' + '" . $secresult . "'; ", $retval);
}
echo $retval; // this get communicated back to TwentyTen theme's header.php changes as explained below ...
}
?>
… teaming up with this blog’s TwentyTen theme’s (good ol’) header.php changes (to suit above) that go …
<?php
var rppspana=null;
function rpcheck() {
if (rppspana == null) {
var h3sare=document.getElementsByTagName('h3');
for (var ih3sare=0; ih3sare<h3sare.length; ih3sare++) {
if (('' + h3sare[ih3sare].innerHTML).indexOf('cent Post') != -1) { rppspana=h3sare[ih3sare]; }
}
}
if (rppspana != null && document.getElementById('xdrpl')) {
if (rppspana.innerHTML.indexOf('cent Post') != -1 && document.getElementById('xdrpl').innerHTML != '') {
var dx=document.getElementById('xdrpl').innerHTML;
document.getElementById('xdrpl').innerHTML='';
rppspana.innerHTML=rppspana.innerHTML.replace('cent Post', 'cent ' + dx + ' Post');
} else {
setTimeout(rpcheck, 4000);
}
} else if (document.getElementById('xdrpl')) {
setTimeout(rpcheck, 4000);
} else if (rppspana != null) {
setTimeout(rpcheck, 4000);
}
}
function preresize_font(aois) {
setTimeout(rpcheck, 3000);
zzzspare=aois.id.replace('t','d');
resize_font();
}
… to move this newly created “Modified” (select element) dropdown from the Blog Posting content area over to the title of the Recent Posts widget to become that “Recent Posts” dropdown populated with a week’s worth of modified date changed blog posting titles that if selected navigate the user onto that blog posting.
the order of blog postings that could end up on dropdowns as a result of this PHP code was not always chronological … and …
the … “glimpse into” wording on the dropdown options told us (the users) nothing … and …
the navigation off a user selected dropdown option was flaky and sporadic
… so let’s talk about these in more depth below …
the order of blog postings that could end up on dropdowns as a result of this PHP code was not always chronological … so … we changedis_mentioned_by.php‘s central bit of SELECT (DML) SQL as per …
<?php
$res = mysql_query("SELECT " . $tname . ".post_title, " . $tname . ".guid, " . $tname . ".post_content, LOCATE('" . $ourtitle . "'," . $tname . ".post_content) as tfind, LOCATE('" . $ourother . "'," . $tname . ".post_title) as tother, " . $tname . ".post_date as post_date FROM " . $tname . "
WHERE " . $tname . ".post_status = 'publish' " . "
AND (1 = 1 OR LOWER(" . $tname . ".post_title) != LOWER('" . $ourtitle . "')) " . "
AND (" . $tname . ".post_content like CONCAT(CONCAT('%?p='," . $tname . ".guid), '%') " . "
OR " . $tname . ".post_content like '%" . str_replace('youllneverfindthis','%',permalinkit($ourtitle)) . "%' " . "
OR " . $tname . ".post_content like '%" . str_replace('youllneverfindthis','%',$ourother) . "%' " . "
OR " . $tname . ".post_content like '%" . str_replace('youllneverfindthis','%',$ourtitle) . "%') UNION SELECT 'Code Download Table' as post_title, " . $tname . ".post_content as guid, '' as post_content, 1 as tfind, 0 as tother, CURTIME() as post_date FROM " . $tname . "
WHERE " . $tname . ".post_status = 'publish' " . "
AND LOWER(" . $tname . ".post_title) = LOWER('" . $ourtitle . "') " . "
AND " . $tname . ".post_content like '%GETME%' ORDER BY post_date ");
?>
… noting that ORDER BY clause fields should appear in the (SELECT) column list, and we chose to put it at the end (of that list) to avoid any array indexing code changes
the … “glimpse into” wording on the dropdown options told us (the users) nothing … so … we changedis_mentioned_by.php‘s “function pluckfirstreal” as per …
<?php
function pluckfirstreal($pcont) {
$xpcont=$pcont;
if (strpos($xpcont, "[/caption]</p>") !== false) {
$xpcont=explode("[/caption]</p>", $pcont)[1];
} else if (strpos($xpcont, "[/caption]") !== false) {
$xpcont=explode("[/caption]", $pcont)[1];
}
$paras = explode("</p", str_replace("<p", "</p", $xpcont));
if (sizeof($paras) > 2) {
$oth = explode("<", $paras[1]);
$retval = " ... ";
for ($i=0; $i<sizeof($oth); $i++) {
$huh = explode(">", $oth[$i]);
$retval .= str_replace("'", "`", str_replace("}", " ", str_replace("{", " ", $huh[-1 + sizeof($huh)])));
}
return substr($retval,0,200);
}
return "";
}
?>
the navigation off a user selected dropdown option was flaky and sporadic … so … in (good ol’) header.php of the WordPress Blog TwentyTen theme folder we changed …
<?php
function changed(inval,intxt) {
if (1 == 1 || navigator.userAgent.match(/Android|BlackBerry|iPhone|iPad|iPod|Opera Mini|IEMobile/i)) {
if (callwhat.length == 0) {
parentwino(inval,intxt.toLowerCase(),'');
}
}
if (callwhat.length > 1) {
if (prevxcmd != "") {
eval(prevxcmd);
} else if (prevcmd != "") {
eval(prevcmd.replace("''","'top=50,left=50,width=600,height=600'"));
}
prevxcmd="parentwino('" + inval + "','" + intxt.toLowerCase() + "','top=50,left=50,width=600,height=600')";
prevcmd="";
} else if (callwhat.length == 1) {
if (sitlist.indexOf(',') != -1) {
prevcmd="";
prevxcmd="";
var invala=sitlist.split(',');
for (var ip=0; ip<invala.length; ip++) {
if (prevxcmd != "") {
eval(prevxcmd);
} else if (prevcmd != "") {
eval(prevcmd.replace("''","'top=50,left=50,width=600,height=600'"));
}
prevxcmd="parentwino('" + invala[ip] + "','" + intxt.toLowerCase() + "','top=50,left=50,width=600,height=600')";
prevcmd="";
}
} else if (1 == 1) {
parentwino(inval,intxt.toLowerCase(),'');
} else {
if (prevcmd != "") {
eval(prevcmd);
} else if (prevxcmd != "") {
eval(prevxcmd.replace("'top=50,left=50,width=600,height=600'", "''"));
}
prevcmd="parentwino('" + inval + "','" + intxt.toLowerCase() + "','')";
prevxcmd="";
}
}
}
function antiaway() {
if (document.getElementById('hfloater') && document.getElementById('aaway')) {
document.getElementById('hfloater').innerHTML=document.getElementById('hfloater').innerHTML.replace(' ' + document.getElementById('aaway').outerHTML, '');
}
}
function parentwino(a, b, c) {
var woisp=null, eqas=null;
if (c == "") {
try {
if (woisp == null && document.getElementById('hfloater')) { // && !navigator.userAgent.match(/Android|BlackBerry|iPhone|iPad|iPod|Opera Mini|IEMobile/i)) {
document.getElementById('hfloater').innerHTML+=' <a id="aaway" target="_blank" href="' + a + '" style="display:none;">WOpen</a>';
document.getElementById('aaway').click();
setTimeout(antiaway, 4300);
} else {
woisp=window.open(a,b);
}
} catch(eqas) {
woisp=null;
}
return woisp; //window.open(a,b);
At this blog we are keen for users to learn one off ideas and on occasions linked “threaded” (or blog postings of a theme) ones.
The last WordPress Blog (TwentyTen theme) “Is Mentioned by” functionality is good for certain scenarios, but what if you arrive at a blog posting that is part of a “threaded” series of blog postings? We normally show you older ones and that’s fine. But I’m not so much talking about the avid reader here who follows it “hot off the press” but more the users finding things off search engines, coming to this blog, and the posting they get to may not be the last in the “thread”. Below the blog posting they log in at, the reader can read all the information of the past to do with the thread, but what of getting it into context, relative to the entire “thread” up to that point, or out more recently “beyond” it? Well, that is the purpose of today’s extension of functionality to the WordPress Blog “Is Mentioned by” functionality we last finished up discussing with WordPress Is Mentioned By Code Download Progress Tutorial as shown below.
Surprisingly the WordPress Blog TwentyTen theme’s header.php does not need to change to make this happen. The PHP that queries the WordPress MySql database can handle all the change today, and ended up looking like is_mentioned_by.php changing this way.
The method is to …
query the MySql database with a more complex query that results in data for …
“is mentioned by” and “is part of a blog posting thread” are represented by two separate dropdowns … and …
in order to show you the context of the current blog posting in a blog posting “thread” we have an HTML select size property set to the number of dropdown records … alas, mobile platforms do not honour the size property regarding their display of dropdowns … display and set the selected property to the current blog posting’s entry, with this entry consisting of …
a blog posting title and the first paragraph of content are put into the “is part of a blog posting thread” dropdown option text to enhance the context for the user, shown this list with the most recent posting first down in reverse chronological order to the older blog posting of the “thread” down the bottom
Below in bold is how the MySql query got more complex …
$res = mysql_query("SELECT " . $tname . ".post_title, " . $tname . ".guid, " . $tname . ".post_content, LOCATE('" . $ourtitle . "'," . $tname . ".post_content) as tfind, LOCATE('" . $ourother . "'," . $tname . ".post_title) as tother FROM " . $tname . "
WHERE " . $tname . ".post_status = 'publish' " . "
AND (1 = 1 OR LOWER(" . $tname . ".post_title) != LOWER('" . $ourtitle . "')) " . "
AND (" . $tname . ".post_content like CONCAT(CONCAT('%?p='," . $tname . ".guid), '%') " . "
OR " . $tname . ".post_content like '%" . str_replace('youllneverfindthis','%',permalinkit($ourtitle)) . "%' " . " OR " . $tname . ".post_content like '%" . str_replace('youllneverfindthis','%',$ourother) . "%' " . "
OR " . $tname . ".post_content like '%" . str_replace('youllneverfindthis','%',$ourtitle) . "%') UNION SELECT 'Code Download Table' as post_title, " . $tname . ".post_content as guid, '' as post_content, 1 as tfind, 0 as tother FROM " . $tname . "
WHERE " . $tname . ".post_status = 'publish' " . "
AND LOWER(" . $tname . ".post_title) = LOWER('" . $ourtitle . "') " . "
AND " . $tname . ".post_content like '%GETME%'");
where the (new) variable $ourother is set to being the first few words of the blog posting title.
In order to “pluck out” one paragraph from the content (of variable $pcont) we use …
WordPress Is Mentioned By Code Download Progress Tutorial
There are various approaches with user experience (UX) considerations regarding putting a web application user at their ease as they wait for a response. I’m talking about where the response is coming from a separate serverside script doing something that may take a while, such as querying a database for instance, and that responder will do the work back at its parent to say it has finished its job. Given all this, you may be asking “What is there left to worry about, with the user, if the responder is doing this?”. Well, there is that amount of time between …
clicking the action item of HTML at the parent … all the way through to …
the responder “child”, often serverside code (for us, PHP), finishing its work and fixing the parent webpage to indicate that it has finished its work
Now, we all hope this time period is short, and, hopefully, most of the time, it is short, and perhaps it is “overkill” to worry about doing anything here. However there are some things to consider …
if you are writing commercial software code there could well be an UX expectation that you would code for this, to keep the user informed at all times … and …
it could be the case that the database crashes at that very “clicking” moment, and though your responder may not get back to the parent with information, at least if you’ve coded for the scenario back at the client, at least the user will know something is being attempted, even if it doesn’t appear to be succeeding, which is less frustrating than getting no information at all, which could be mistaken for software code “hanging” … definitely not a great UX feel, or look
Now there are a variety of client code approaches for showing “progress”, such as …
something you just clicked, changing appearance cyclically over time
That last one appeals to us for a recent bit of functionality we added to this WordPress Blog you are reading, as well as for the fact that what we show “progress” on is difficult to numerically quantify as far as completion time is concerned, and so the first two above are not as suitable. We actually change the HTML div element font size to make an emoji “button” pressed “throb” while the user waits for the PHP and MySql query to respond back. Do you remember our thread of blog posting that used to end with WordPress Is Mentioned By Code Download CSS Tutorial? That’s the functionality we’re talking about today, as we do at WordPress 4.1.1’s WordPress Is Mentioned By Code Download Progress Tutorial.
Now reading that previous link’s content below, you may see that we have considered the scenario of the child responder not finding any mentions and responding with …
Sadly, this tutorial is not mentioned by any others, yet
… which is good, but it may either take a long time for the responder to work this out, or, as we’ve indicated above, the responder’s mechanism for finding out may fail, and we’re dealing with that, from the perspective of the user looking at the client webpage, and waiting for information after clicking that emoji link we introduced when we did that work in that tutorial.
We decided to prove our method with a “proof of concept” local MAMP web server HTML and Javascript and CSS parent taking …
one blog posting bit of HTML body HTML …
the is_mentioned_by function renamed to was_is_mentioned_by and a new is_mentioned_by worked until it works, tested via the Safari web browser’s Develop menu’s Web Inspector (similar to the Firefox Firebug web inspector we tend to go on and on and on and on and on and on about at this blog)
… that took the form of this imb_poc.html … supervising the reworked PHP serverside code is_mentioned_by.php on MAMP that is, deliberately, made to …
wreck the connection to MySql … and then intervene to …
change the die message to instead sleep(18) before showing “Sadly, this tutorial is not mentioned by any others, yet” … at which time our changes should look good UX wise for the user
We must stress this about “proof of concept”. Don’t waste time on “proof of concept” with too much fine grain simulation of the original scenario, if it is not involved in what you are proving, that is different, and is what is being tested here. See how it can even be that it suits the purposes of some “proof of concept” scenarios, like today’s, that you wreck the MySql connection in a progress “proof of concept” scenario, for example?
We made these WordPress Blog changes in good ol’ TwentyTen themed header.php, as we so often do, and show changed code bold below …
<script> var ourfs=21, zzzspare='';
// ...
// lots of other Javascript code
// ...
// down to ...
function preresize_font(aois) {
zzzspare=aois.id.replace('t','d');
resize_font();
}
function resize_font() {
ourfs=eval((ourfs + 5) % 45);
if (document.getElementById(zzzspare).innerHTML.indexOf('<select ') != -1) {
ourfs=21;
} else {
setTimeout(resize_font, 500);
}
document.getElementById(zzzspare).style.fontSize='' + ourfs + 'px';
}
… where is_mentioned_by function is called by the document.body onload event, to trigger all this. You can see some of all this with today’s tutorial picture, and by trying to click some of the right pointing emoji ☞ “is mentioned by” functionality “buttons” you see next to Blog Posting Titles around you here at this WordPress TwentyTen themed blog, but here’s hoping you don’t see too many throbbing emojis … heaven forbid?!
change the PHP that creates the HTML for displaying the Code Download Table, and that is accessed by our web server at RJM Programming using the Crontab/Curl “dynamic duo” (we often look at) … that uses …
CSS Complex Selector functionality (we’ve last talked about with WordPress Blog Complex Selectors Tutorial), but via the use of jQuery methods like parent() and siblings() methods … and only being called, as for yesterday’s scenario, where …
… to make what we are doing stand out more for the user, who may “swim” in a large table devoid of any styling to focus their attention.
We’ll leave you with modified PHP, that writes out the HTML Code Download Table manipulator, you could call getmelist.php and which changed in this way to make the Code Download Table be more usercentric with its presentation of hashtagged calls linking a WordPress Blog Posting at this blog with a particular piece of software code of interest in our Code Download Table.
A blog posting being referred to … back, optionally, as a link, to …
A blog posting that mentioned that blog posting currently being viewed
… and looking at this premise, it stands to reason that as helpful as this concept looks on paper, if a regular reader expects a recent posting be referred to by others “hot off the press” they’d be expecting quite a lot, and though what they get in this scenario …
Sadly, this tutorial is not mentioned by any others, yet
… probably does a good job tweaking them to the dilemma of “hot off the press” being “too recent to be referred to” it still remains a disappointment, perhaps. So, thinking a tad laterally on this, what is going to help out here will be to particularize the scenario for what we do around here … and am sorry if this annoys, but we are showing a line of thinking here … and allow for Blog Posts that contain the word “GETME” … our favourite code download mechanism around here … to add a “Code Download Table” dropdown option, that if selected will lob the user directly onto the RJM Programming Code Download Table entry for the first “GETME” file link found in that blog posting. This additional scouring of the MySql database, that utilizes the SQL UNION operator (the “adding an extra clause or paragraph” SQL operator, we like to think of it as) with its query, will not be relevant to all unmentioned blog postings, but it will help those that talk about software coding, which is quite a few.
That functionality had us looking back at how the Code Download Table was constructed in terms of its hashtagging when we discussed PHP Blog Summary Follow Up Tutorial. In this way, we had a first try at …
… using the hashtagging for a date … as you see with these changes to is_mentioned_by.php at the left hand column of the Code Download Table … did a couple of unit tests seeing the first one work, the second one work if you take it a day back, and the third one not work at all, at which point it tweaked with us that the date in the Code Download Table is a date reflected by the software code file’s modified date, not the WordPress Blog Posting publication date, that we can derive off our amended query … so that being less friendly than we envisaged we end up …
… using the very interesting hashtagging that particularizes the filename, where the read file extension (minus all the “GETME” and “-“‘s and “_”‘s that is) is taken out of the prefix to the hashtag, and made into a suffix … like “analogue_clock.-GETMEhtml” for Analogue Clock Timezone Tutorial that is exemplified in today’s tutorial picture and as you can see the changes for at this is_mentioned_by.php link
So it panned out to make this happen the original Code Download Table code did not need any tweaking, not good ol’ WordPress TwentyTen theme header.php … just is_mentioned_by.php … but we hope you try out clicking some “White Right Pointing Index” emoji …
What gives with the &tsp=[someBigNumber]GET parameter … like is yellow highlighted in today’s tutorial picture … in the “Code Download Table” lookup URLs? This is so that we end up with different URLs each time a user accesses this functionality. This is because web browsers often try to help you out with speeding up your browsing, and use the web browser cache to “regurgitate” a previously visited URL should that have happened since the last clearing of any web browser cache, to “slap” the cache version quickly on the screen. But we don’t want any “slapping” to go on around our functionality today, and a way to force the web browser to reconsider the real lookup, and go back to the real web server again for data, is to make your URL be unique. A curiosity here you can try is to use something like a local MAMP (for Mac or EasyPHP for Windows) local web server to, for an image file called image.jpg that is put into the Apache web server’s Document Root …
see the image in your favoured web browser with the URL http://localhost:8888/image.jpg … then …
change that image somehow with an image editor … and …
refresh, or revisit the image with the URL http://localhost:8888/image.jpg … and you’ll probably see the cached web server version … unless you haven’t got web browser caching going … so amend this to …
revisit the image with the URL http://localhost:8888/image.jpg?random=7456536 … and this time we think you’ll see the amended image that happened with your image editing … and yes, you can add GET parameters to your URLs even for image URLs (often, most helpfully with image URLs, actually)
WordPress Is Mentioned By Navigation Primer Tutorial
We’ve written some new WordPress navigation logic today, for blog posting relationships between …
A blog posting being referred to … back, optionally, as a link, to …
A blog posting that mentioned that blog posting currently being viewed
… done, because we see that it is not only the “vertical” type linking of blog postings into a “thread” that helps understanding … we hope … but also to jump around among commonalities between concepts (like “horizontal” “degrees of separation”), perhaps. This functionality involves MySql database queries, and is best suited to a user clicks something (rather than pre-emptive content loading) to reach the functionality so that our database query has a post title to work with, and also so that every blog post does not overload the web server with a query ahead of time whose work may not be accessed anyway. The something that is clicked is an HTML a tag whose “look” is an Emoji.
We also wrote a proof of concept, before applying that proof of concept live. To us, a “proof of concept” is not much use if it is as involved as what it is trying to prove, and in today’s scenario we did a proof of concept for two scenarios, that being …
a blog posting that was referred to by others … and …
a blog posting that wasn’t … doh! … but if you don’t change something about the “look of things” you’ll confuse the user as to whether the web application just took notice of their click (via the onclick event) … so this is of mild importance, but we grant you that it is not as important as the first scenario’s workings
We quite often adopt a proof of concept scenario which tests the workings of a child (often in an HTML iframe element), in this case, PHP server side, piece of code, by introducing a simplified and pared down parent, in this case HTML piece of code. At the end of successful testing you are left with a good, and close to totally suitable child piece of code, to slot into the functionality of the real and live parent code.
That proof of concept was definitely a good “unit testing” thing to do, but nevertheless, don’t feel overconfident as you go live … living with other real “goings on” on the live website are things to consider, and test … it took us half an hour to iron out these types of issues.
The other good thing to have on your side is a Web Inspector like on Safari, similar to the Firefox Firebug web inspector we tend to go on and on and on and on and on and on about at this blog. We’re giving you a Safari rest on that today, and we want to show you an “early days” view …
… in the proof of concept help that the Safari Web Inspector gave us, delving in under the called (by HTML parent) PHP’s actions. This type of information makes server side programming, like you do with PHP, that much easier … much easier than ideas where you write out web server files, with information, for your own benefit, or the other one we often like, during testing, is to write information out to top.document.title or perhaps to an alert box or to use console.log (on the debugging window, down the bottom).
You’ll never guess where we made this change to our WordPress TwentyTen themed blog? Give up … yes, good ol’ header.php changed in the bold Javascript new function way below …
Team that with some new PHP source code you could call is_mentioned_by.php and you have today’s new WordPress blog TwentyTen theme “Is Mentioned By” functionality.
Today we return to the WordPress (TwentyTen themed) blog you are reading now, as with WordPress Blog Standard Makeover Tutorial, and it’s header.php (PHP writes) Javascript (inhouse) function …
function img_alt
… in good ol’ header.php file, where we check for a lot of the tweaks we apply to the default TwentyTen theme look and feel. Why? Well, we noticed, finally, a bit of a “hanging sentence” there … being charitable, that is. It’s that (ol’) …
Ending a sentence with a preposition
… proposition, again?! After “by” (now a dropdown) should be the blog posting author, and so added into function img_alt is …
<?php echo ”
var alis = document.getElementsByTagName(\"a\");
for (ialis=0; ialis<alis.length; ialis++) {
if (alis[ialis].innerHTML == '') {
if (alis[ialis].outerHTML.indexOf(' content=\"') != -1 && alis[ialis].outerHTML.indexOf(' content=\"\"') == -1) {
alis[ialis].innerHTML=alis[ialis].outerHTML.split(' content=\"')[1].split('\"')[0];
alis[ialis].href+=encodeURIComponent(alis[ialis].outerHTML.split(' content=\"')[1].split('\"')[0]);
alis[ialis].style.fontSize='6px';
}
}
}
Can a Schnauzer change it’s mind … in the sense that the writer is currently on all fours on the ground looking up at some food?
Well, it appears they have phases in life … so … yes.
Well, it appears we’ve grown out of The “Teenager” Phase, apparently, and are changing our tack regarding mobile smaller device WordPress blog “repositioning” tactics that the Miniiature Schnauzer “within us” must have been so into when we presented WordPress Blog Mini Makeover Tutorial.
But it’s standard practice to review ideas every now and then, and when “mini” was the go, this WordPress Blog had less traffic, but in today’s scenarios you could get, on an iPhone, for instance, circumstances where …
a WordPress Blog webpage could flash up for perhaps a second and then …
blank content could take over, for a good while … before …
repositioned webpage content could eventually show
We accept, sometimes, there will be too much traffic to service every reader, but to see a “flash of it” and “then it disappears” is, to put it bluntly, disappointing.
And so, if you have been put out that way …
we apologize …
our research has indicated it is the efforts in trying to have “repositioned webpage content” that is the biggest drag here … and so …
Standard schnauzer … still on all fours … is pulling the plug … though …
Have you ever tried to get into a bath on all fours?
… and, if so (and you claim you did?!) …
Have you ever tried to pull a plug out just with your teeth?
… and no animals were harmed in the making of this blog posting so that is today’s work, stopping that mobile iPhone sized device repositioning that involves either …
location.href=’#[someElementId]’;
window.scrollBy(deltax, deltay);
Good ol’ TwentyTen theme’s header.php, in it’s relevant bit, now shows code that goes …
function windowscrollBy(inxis, inyis) {
if (navigator.userAgent.match(/Android|BlackBerry|iPhone|iPad|iPod|Opera Mini|IEMobile/i)) {
return null;
}
return window.scrollBy(inxis, inyis)
}
Further to yesterday’s Autumn Leaves One Image Webpage Tutorial another discovery in the category of “generic issue” (and so moves up priority lists around here) was the discovery that …
the optional audio playing functionality of One Image Webpage ideas around here worked on non-mobile via HTML webpages (calling an *.mp3 iframe URL) or a *.mp3 URL as the destination href attribute of an “a” link encompassing the image img elements … but …
these same programmatical approaches do not “cut the mustard” on mobile platforms, where, to play media, the user needs to tap (with a real non-programmatical gesture) the media element
… and so we needed a “generic makeover”. Luckily we had an external Javascript called onrightclick.js called on every One Image Webpage we could call upon as a good place to affect all the behaviour of all these webpages, as per …
function audiolook() {
var ifsare=document.getElementsByTagName('a');
if (eval('' + ifsare.length) > 0) {
// alert(ifsare[eval(-1 + ifsare.length)].href);
if (ifsare[eval(-1 + ifsare.length)].href.slice(-4) == '.mp3') {
//document.title='' + ifsare[eval(-1 + ifsare.length)].href;
var parisis=null, parisisx=null;
if (window.opener) {
parisis=window.opener;
if (parisis.document.getElementById('xxsource')) {
parisisx=parisis.document.getElementById('xxsource');
}
}
if (parisisx) {
if (parisisx.src != ifsare[eval(-1 + ifsare.length)].href) {
if (6 == 8) { parisisx.src=ifsare[eval(-1 + ifsare.length)].href; }
}
var ifzsare=parisis.document.getElementsByTagName('a');
if (eval('' + ifzsare.length) > 0) {
if (ifzsare[eval(-1 + ifzsare.length)].href.slice(-4) == '.mp3') {
if (ifzsare[eval(-1 + ifzsare.length)].href != ifsare[eval(-1 + ifsare.length)].href) {
if (6 == 8) { ifzsare[eval(-1 + ifzsare.length)].href=ifsare[eval(-1 + ifsare.length)].href; }
}
}
}
} else if (document.getElementById('xxsource')) {
if (document.getElementById('xxsource').src != ifsare[eval(-1 + ifsare.length)].href) {
if (6 == 8) { document.getElementById('xxsource').src=ifsare[eval(-1 + ifsare.length)].href; }
}
} else if (!document.getElementById('xxsource')) {
var firsta=ifsare[eval(-1 + ifsare.length)].href.split('/')[eval(-1 + ifsare[eval(-1 + ifsare.length)].href.split('/').length)].split('.')[0];
document.body.innerHTML+='<audio id=xxaudio onclick="this.style.left=0; this.style.opacity=0.5; this.autoplay=true; ; if (document.getElementById(' + "'thedivlink'" + ')) { document.getElementById(' + "'thedivlink'" + ').style.marginLeft=' + "'120px'" + '; } " controls style="opacity:1.0;z-index:8976;position:fixed;left:' + eval(-120 + eval('' + window.innerWidth)) + 'px;top:-20px;height:60px;\" loop><source id=xxsource type=audio/mp3 src="' + ifsare[eval(-1 + ifsare.length)].href.replace(firsta,'all') + '"></source></audio>';
}
}
}
}
setTimeout(doacheck, 100);
if (navigator.userAgent.match(/Android|BlackBerry|iPhone|iPad|iPod|Opera Mini|IEMobile/i)) {
setTimeout(function(){
document.ontouchend=function(e){
if (document.URL.replace('/wordpress','/ITblog').indexOf('/ITblog') != -1) {
lastsp=eval(e.touches.length);
}
if (eval('' + e.touches.length) >l= 1) {
if (document.URL.replace('/wordpress','/ITblog').indexOf('/ITblog') == -1) {
onrightclickask();
} else if (e.touches[0].target.outerHTML.split('>')[0].indexOf('<img ') == 0 && e.touches[0].target.outerHTML.split('>')[0].indexOf(' tabindex=') != -1) {
onrightclickask(); //document.title=':' + e.touches[0].target.outerHTML.split('>')[0].substring(1);
}
}
};
}, 4000);
setTimeout(function(){
var ifsare=document.getElementsByTagName('a');
if (eval('' + ifsare.length) > 0) {
// alert(ifsare[eval(-1 + ifsare.length)].href);
if (ifsare[eval(-1 + ifsare.length)].href.slice(-4) == '.mp3') {
//document.title='' + ifsare[eval(-1 + ifsare.length)].href;
var parisis=null, parisisx=null;
if (window.opener) {
parisis=window.opener;
if (parisis.document.getElementById('xxsource')) {
parisisx=parisis.document.getElementById('xxsource');
}
}
if (parisisx) {
if (parisisx.src != ifsare[eval(-1 + ifsare.length)].href) {
if (6 == 8) { parisisx.src=ifsare[eval(-1 + ifsare.length)].href; }
}
var ifzsare=parisis.document.getElementsByTagName('a');
if (eval('' + ifzsare.length) > 0) {
if (ifzsare[eval(-1 + ifzsare.length)].href.slice(-4) == '.mp3') {
if (ifzsare[eval(-1 + ifzsare.length)].href != ifsare[eval(-1 + ifsare.length)].href) {
if (6 == 8) { ifzsare[eval(-1 + ifzsare.length)].href=ifsare[eval(-1 + ifsare.length)].href; }
}
}
}
} else if (document.getElementById('xxsource')) {
if (document.getElementById('xxsource').src != ifsare[eval(-1 + ifsare.length)].href) {
if (6 == 8) { document.getElementById('xxsource').src=ifsare[eval(-1 + ifsare.length)].href; }
}
} else if (!document.getElementById('xxsource')) {
var firsta=ifsare[eval(-1 + ifsare.length)].href.split('/')[eval(-1 + ifsare[eval(-1 + ifsare.length)].href.split('/').length)].split('.')[0];
document.body.innerHTML+='<audio id=xxaudio onclick="this.style.left=0; this.style.opacity=0.5; this.autoplay=true; if (document.getElementById(' + "'thedivlink'" + ')) { document.getElementById(' + "'thedivlink'" + ').style.marginLeft=' + "'120px'" + '; } " controls style="opacity:1.0;z-index:8976;position:fixed;left:' + eval(-120 + eval('' + window.innerWidth)) + 'px;top:-20px;height:60px;" loop><source id=xxsource type=audio/mp3 src="' + ifsare[eval(-1 + ifsare.length)].href.replace(firsta,'all') + '"></source></audio>';
setInterval(audiolook, 10000);
}
}
}
}, 1500);
}
… because, that is very much the go around here in the Blue Mountains in those coniferous and associated maple deciduous tree type areas. The colours are very vibrant!
What have we noticed changing? Well, the iPhone outputs IMG_[0-9]*.HEIC images these days for full sized images, rather than DSC_[0-9]*.JPEG, like the way it used to be for the same full sized images back when we last tried to create a One Image Webpage website. We decided to convert HEIC to JPEG and found both Ffmpeg or ImageMagick, on a Windows command line, could attempt it, but Ffmpeg had an issue, and so, the Windows (ImageMagick) command …
for %i in (*.HEIC) do magick "%i" "%~ni.jpg"
… ended up suiting our purposes.
And what was the transferring from iPhone to macOS MacBook Air (for this part of the work) methodology?
iPhone Camera app takes photo …
each stored in iPhone Photos app …
use iPhone Photos app Sharing link … to …
tap AirDrop option (which, in Apple woooorrrrllllddd is the best go for these “too large for Mail attachments” amounts of data) …
tap MacBook Air as the recipient (which, even out and about, and only lassooing MacBook Air to iPhone’s Hot Spot as a connection, worked (and was very fast)) … which …
copies images (as is in *.HEIC format) from iPhone to MacBook Air
… retiring the iPhone, optionally, from any further involvement creating Autumn Leaves One Image Webpage website.
If this was interesting you may be interested in this too.
If this was interesting you may be interested in this too.
… because, that is very much the go around here in the Blue Mountains in those coniferous and associated maple deciduous tree type areas. The colours are very vibrant!
What have we noticed changing? Well, the iPhone outputs IMG_[0-9]*.HEIC images these days for full sized images, rather than DSC_[0-9]*.JPEG, like the way it used to be for the same full sized images back when we last tried to create a One Image Webpage website. We decided to convert HEIC to JPEG and found both Ffmpeg or ImageMagick, on a Windows command line, could attempt it, but Ffmpeg had an issue, and so, the Windows (ImageMagick) command …
for %i in (*.HEIC) do magick "%i" "%~ni.jpg"
… ended up suiting our purposes.
And what was the transferring from iPhone to macOS MacBook Air (for this part of the work) methodology?
iPhone Camera app takes photo …
each stored in iPhone Photos app …
use iPhone Photos app Sharing link … to …
tap AirDrop option (which, in Apple woooorrrrllllddd is the best go for these “too large for Mail attachments” amounts of data) …
tap MacBook Air as the recipient (which, even out and about, and only lassooing MacBook Air to iPhone’s Hot Spot as a connection, worked (and was very fast)) … which …
copies images (as is in *.HEIC format) from iPhone to MacBook Air
… retiring the iPhone, optionally, from any further involvement creating Autumn Leaves One Image Webpage website.
If this was interesting you may be interested in this too.
… can be used to manage Windows firewall settings Microsoft Defender will be defending, especially the Windows desktop applications you allow through the firewall that would, as a default, refuse. We had this happening on our Windows laptop involving the FileZilla sftp manager of file transferring to and from a public website … the one you are reading from.
A firewall is a security device, or network security system, designed to protect a secure internal network from other networks, by the means to control the incoming and outgoing network traffic, via a rule set (in a similar way to how some email systems allow the user to write their own rules, to control the flow of emails into their email client mailboxes).
Today, with our slideshow example, we imagine, on a Windows 7 laptop, that you want to block (or ban) the network traffic from a nominated IP address (or range of IP addresses).
This kind of control can perhaps protect the computer network “behind” the firewall from some sort of scamming operation.
This would be of pretty obvious interest to system administrators and network administrators charged with protecting the integrity of their network arrangements.
The way to access the firewall functionality in Windows has been pretty fluid over the various versions of the Windows operating system, but the one we gravitate towards, as a generic piece of advice, is to …
get to a Windows Command Line prompt … and … type …
firewall.cpl
The firewall in Windows 7, at least, also appears in Control Panel as “Windows Firewall” … mainly because it would be pretty obtuse to say “Fenestra Firewall” (though it sounds like a good movie).
Sometimes the firewall duties for a Windows laptop, for instance, are taken on by the Virus Protection software you have installed, perhaps. For instance, the Norton by Symantec software called Internet Security offers up its own Windows Firewall as an option for use, that will supercede any Windows Firewall arrangements that come with an install of the Windows operating system.
So please take a look at our slideshow showing you the blocking of our mythical 48.xx.xxx.xx IP address using Windows Firewall.
If this was interesting you may be interested in this too.
If this was interesting you may be interested in this too.
The personal computer world has been fed the line for years that Apple Mac OS X (or macOS) is more secure than Microsoft Windows, but is this true? Have a read of this interesting article for more in this regard.
Whether the sentiment is true or not, must say the simple Avast Security virus protection arrangement I have for this MacBook Pro does not fill me with the anxiety the virus protection on Windows, so front and centre does. But maybe that is just delusion on my part. Anyhow, with Windows, though all this remains very front and centre stil lwith Windows 10, it is far less disorganized feeling, where years ago third party software was the only place to go. You can still …
use third party software to manage virus control (as we show with the previous Windows Virus Protection Primer Tutorial) … but Microsoft’s Microsoft Defender application will tell you so and work with that … whereas you can …
use Microsoft’s Microsoft Defender application on its own to manage virus protection
… meaning that there is a “one stop shop” for finding out about the security controls in place for a Windows 10 personal computer or laptop. Much less “wild west” feeling.
As such, today, we take a stream of consciousness tour of Microsoft Defender to show you today, screenshotted on a Windows 10 personal computer.
Hope you can see that “all in one place” can have its benefits.
Windows users will almost always have considered the issue of Virus protection. The term “Virus Protection” encompasses, for many of us, so much more these days. Terminology that springs to mind with regards to that general concept of “protecting your computer from harmful software” could be …
when using the Animated GIF creator on a local web server (eg. MAMP) we just prefix the slide textbox Dropped full file specification by …
file://
… and … voila … it works … whereas …
when using the Animated GIF creator on a public web server and this incarnation can find a deployed local web server (eg. MAMP) Animated GIF creator ( in that equivalent Document Root subfolder PHP and then subsubfolder animegif ) we just prefix the slide textbox Dropped full file specification by …
file://
… and allow the user to decide whether, on completion of their slide definitions, call that local web server incarnation before they click their relevant form submit button …
<?php echo ”
var uplat='' + navigator.platform;
var allowlocalanswered=false, allowlocal=false;
function maybemore(tval, tid, tis) {
var oldtval=tval;
if (('' + tval.length) != '0') {
//alert(tval);
if (tval.indexOf(preftotest) == 0) {
tval=tval.replace(preftotest, suftotest).replace(/\\\\/g,'/');
setTimeout(latermaybemore, 3000);
} else if (tval.indexOf('file:') != 0 && tval.replace(/^[A-Z][a-z]\:/g,'').indexOf('//') == -1 && (tval.replace(/^[A-Z][a-z]\:/g,'') + '%%').substring(1).substring(0,1) != (tval.replace(/^[A-Z][a-z]\:/g,'') + '%%').substring(0,1) && (tval.replace(/^[A-Z][a-z]\:/g,'') + '%%').substring(0,1).replace(String.fromCharCode(92),String.fromCharCode(47)) == '/' && document.URL.indexOf('/localhost') != -1) {
tval='file://' + tval;
setTimeout(latermaybemore, 3000);
} else if (document.URL.indexOf('/localhost') == -1 && (tval.indexOf('file:') == 0 || tval.indexOf('file:') != 0 && tval.replace(/^[A-Z][a-z]\:/g,'').indexOf('//') == -1 && (tval.replace(/^[A-Z][a-z]\:/g,'') + '%%').substring(1).substring(0,1) != (tval.replace(/^[A-Z][a-z]\:/g,'') + '%%').substring(0,1) && (tval.replace(/^[A-Z][a-z]\:/g,'') + '%%').substring(0,1).replace(String.fromCharCode(92),String.fromCharCode(47)) == '/')) {
if (tval.indexOf('file:') != 0) {
tval='file://' + tval;
}
if (!allowlocalanswered) {
allowlocalanswered=true;
allowlocal=confirm('We can only make this work if when submitting we redirect the processing to a tutorial_to_animated_gif.php similarly set up on a local web server ( ie. in a folder off Document Root called PHP and off that a folder called animegif ), like MAMP. If all this is fine, and there are going to be no data URIs as slide contents, answer OK. You may need to click that local web server web application similar submit button to start creating your animated GIF.');
if (allowlocal) {
uplaturl=(uplaturl + '&').replace('delay=' + (uplaturl + '&').split('delay=')[1].split('&')[0] + '&','delay=' + encodeURIComponent(document.getElementById('delay').value) + '&').replace('&&','&').replace(/\&$/g,'');
//document.getElementById('myform').target='_blank';
//document.getElementById('myform').method='GET';
//document.getElementById('myform').action=uplaturl.split('?')[0];
}
}
if (allowlocal) {
if (tid.replace(/^slideshow0$/g,'slideshow').replace(/^slideshow1$/g,'slideshow') == 'slideshow') {
uplaturl=(uplaturl + '&').replace('slideshow=' + (uplaturl + '&').split('slideshow=')[1].split('&')[0] + '&','slideshow=' + encodeURIComponent('file://' + tval.replace(/^file\:\/\//g,'') + '&')).replace('&&','&').replace(/\&$/g,'');
} else {
uplaturl+='&slideshow' + tid.replace('slideshow','') + '=' + encodeURIComponent('file://' + tval.replace(/^file\:\/\//g,''));
//alert(uplaturl);
if (confirm('Was this the last animated GIF slide?')) {
window.open(uplaturl + '&title=' + encodeURIComponent(document.getElementById('stitle').value),'_blank','top=100,left=30,width=' + eval(-60 + screen.width) + ',height=800');
}
}
}
setTimeout(latermaybemore, 3000);
}
// more Javascript code follows
}
“; ?>”
… and voila … that can work too!
Again, there could be tweaking, but, feel free to try it out, if you like with …
paste it in as text (at an animated GIF slide textbox, that is) … or, as of today …
paste it in as graphical content via the inhouse Client Browsing (and now “Pasting”) web application’s iframe element hosted span contenteditable=true onpaste and onblur event savvy new inclusion into the mix
function dragstart(ev) { // thanks to https://developer.mozilla.org/en-US/docs/Web/API/HTML_Drag_and_Drop_API/File_drag_and_drop
lastelem=ev.target;
if (('' + ev.target.outerHTML).indexOf('<span ') == 0) { // thanks to https://developer.mozilla.org/en-US/docs/Web/API/DataTransfer/setData
// Change the source element's background color
// to show that drag has started
ev.currentTarget.classList.add("dragging");
// Clear the drag data cache (for all formats/types)
ev.dataTransfer.clearData();
// Set the drag's format and data.
// Use the event target's id for the data
ev.dataTransfer.setData("text/uri-list", ev.target.id); //"image/png", ev.target.innerHTML);
//ev.dataTransfer.setData(
// "text/uri-list",
// ev.target.ownerDocument.location.href
//);
} else {
ev.dataTransfer.setData("text/plain", '');
}
}
… that being the inhouse Animated GIF Creator and its interfacings, in turn, to the inhouse Client Browsing (and now “Pasting”) web application, so that as far as slideshow image defining goes you can …
type it in …
browse it in …
paste it in as text (at an animated GIF slide textbox, that is) … or, as of today …
paste it in as graphical content via the inhouse Client Browsing (and now “Pasting”) web application’s iframe element hosted span contenteditable=true onpaste and onblur event savvy new inclusion into the mix
We reserve the right to tweak, but, feel free to try it out, if you like with …
yesterday’s “standalone” incarnation of our now potentially dual purpose “browsing and pasting” inhouse client browsing web application … to, today …
“called upon” incarnation of our inhouse client browsing web application
… and, as we suspected, today’s first look was pretty salutary in proving “no one paradigm size fits all” with the number of scenarios a “called upon” incarnation of our inhouse client browsing web application can throw up.
Where we think the inhouse client browsing web application for this new “paste” functionality can flourish can be via what we like to call “client pre-emptive iframe” Javascript logic back at the caller, where we extend the code for that HTML iframe’s onload event …
var twaconto=null, twacontoiurl=null, twacontojurl=null;
today, our inhouse client browsing web application, in standalone mode … and then …
tomorrow and on, our inhouse client browsing web application, being called upon
… so that, as far as Image data goes, this inhouse client browsing web application is dual purpose, the user able to …
click a button to go file browsing for that (Image) file … or, for example …
mobile device
take a photograph via mobile device Camera app … and it being iOS iPhone …
via Photos app hover over relevant image and tap Copy option … and it being iOS iPhone with a MacBook Air of the same network nearby …
be in a web browser starting up our inhouse client browsing (and, now, image copy pasting) web application … with one new HTML span contenteditable=true onpaste and onblur savvy …
<span title=""Image copy paste here." onclick="csclick=0; setTimeout(csc,20000); event.stopPropagation();" onblur="youruplit(this,1);" onpaste="youruplit(this,0);" contenteditable="true" id="imgcopycheck" style="border:2px dotted red;width:50px;height:25px;display:inline-block;">⬆️ 🖼️</span>
… element …
click on that new span element …
Edit->Paste (or command-V) … accesses the great Apple Universal Clipboard functionality …
var yehbutisob=false, xcelem=null, xccontext=null, xcimg=null, within=false, mydivo=null, origh=-1, origw=-1, altdu='', dlm='"', copyspans='', gij=0;
var zcontent=[], zfilename='', zoptions=null, csclick=-1;
function iftoolarge(zimg,zw,zh) {
var zcanvas = document.createElement('canvas');
zcanvas.width = zw;
zcanvas.height = zh;
var zctx = zcanvas.getContext('2d');
zctx.drawImage(zimg, 0, 0);
// Get JPG as Data URL (quality 0.9)
altdu=zcanvas.toDataURL("image/jpeg", 0.1);
take a photograph via mobile device Camera app … and it being iOS iPhone …
via Photos app hover over relevant image and tap Copy option … and it being iOS iPhone with a MacBook Air of the same network nearby …
be in a web browser starting up our inhouse canvas annotation helper web application … with two new HTML span contenteditable=true onpaste and onblur savvy …
<span title="Image copy Paste here to populate canvas fitting in." onclick="event.stopPropagation();" onblur="myuplit(this,1);" onpaste="myuplit(this,0);" contenteditable="true" id="imgcopycheck" style="border:2px dotted red;width:50px;height:25px;display:inline-block;">⬆️ 🖼️</span> <span title="Image copy Paste here to populate canvas resizing." onclick="event.stopPropagation();" onblur="myuplit(this,1);" onpaste="myuplit(this,0);" contenteditable="true" id="imgcopychecken" style="border:2px dotted red;width:50px;height:25px;display:inline-block;">⬆️ 📈</span>
… elements …
click on the one of interest regarding image sizing …
Edit->Paste (or command-V) … accesses the great Apple Universal Clipboard functionality …
var yehbutisob=false, xcelem=null, xccontext=null, xcimg=null, within=false, mydivo=null, origh=-1, origw=-1, altdu='';
function iftoolarge(zimg,zw,zh) {
var zcanvas = document.createElement('canvas');
zcanvas.width = zw;
zcanvas.height = zh;
var zctx = zcanvas.getContext('2d');
zctx.drawImage(zimg, 0, 0);
// Get JPG as Data URL (quality 0.9)
altdu=zcanvas.toDataURL("image/jpeg", 0.1);
Yes, if an iPhone is connected to a MacBook Air—or even just nearby—the copy buffer (clipboard) of the iPhone can be transferred to the copy buffer of the MacBook Air. Apple calls this feature Universal Clipboard.
It allows you to copy text, images, photos, and videos on your iPhone and instantly paste them onto your Mac (or vice versa).
Cute, huh?! If on the same network, and close, the iPhone and MacBook Air do not even need an Apple White Lead connection, necessarily, though we noticed it sped up the process!
Given the “smarts” at this end, today, we turned to …
… as a solution to massive image png copy buffers coming off the camera being fed into an HTML5 canvas and out as a reduced size jpeg image to allow PHP $_POST methodologies used for the uploading process not be overwhelmed, as per the adjusted Ajax code …
One Image Website Onpaste Uploading Hashtagging Tutorial
You guessed it! Yesterday’s One Image Website Onpaste Uploading Tutorial‘s work was working just within the realms of those “first webpages” occurring within the “One Image Website” project paradigm, but that we needed to pass onto subsequent webpages this “new image uploaded” list as ….
hashtagged data … but also …
argumented data (ie. ? and & arguments) for those “first webpages” occurring within the “One Image Website” project paradigm …
… the reason being that document.referrer cannot be used to glean hashtagged data. Luckily in this project that second requirement above, which asks for a true document reload, is not the end of the woooorrrrllllddd, as we know it, and means we can get help from the external Javascript we use in these projects, as per …
… is sensitive here, and for the most part, is moved to above the “inline Javascript” loading within the head webpage element, to help make all this idea function, all the way back from changes to inline Javascript parts to the initialization code of (our Guinea Pig) “first webpage” occurring within the “One Image Website” project paradigm …
var image_index = 0;
var number_of_image = 0;
var myxhr=null, formis=null;
var ipuvalid=true, ipis='', lhend='', lhdata='';
var fetchcmd="./index.php?diris=images&prefixis=DSC_0&startsuffix=279&endsuffix=364";
// Thanks to https://stackoverflow.com/questions/74997800/how-to-code-a-synchronous-wrapper-for-jquery-ajax-functions
(async () => {
setTimeout(function(){
image_list[image_index++] = new imageItem('images/DSC_0279.jpg');
image_list[image_index++] = new imageItem('images/DSC_0280.jpg');
image_list[image_index++] = new imageItem('images/DSC_0281.jpg');
image_list[image_index++] = new imageItem('images/DSC_0282.jpg');
image_list[image_index++] = new imageItem('images/DSC_0283.jpg');
image_list[image_index++] = new imageItem('images/DSC_0284.jpg');
image_list[image_index++] = new imageItem('images/DSC_0285.jpg');
image_list[image_index++] = new imageItem('images/DSC_0286.jpg');
image_list[image_index++] = new imageItem('images/DSC_0287.jpg');
image_list[image_index++] = new imageItem('images/DSC_0288.jpg');
image_list[image_index++] = new imageItem('images/DSC_0289.jpg');
image_list[image_index++] = new imageItem('images/DSC_0290.jpg');
image_list[image_index++] = new imageItem('images/DSC_0291.jpg');
image_list[image_index++] = new imageItem('images/DSC_0292.jpg');
image_list[image_index++] = new imageItem('images/DSC_0293.jpg');
image_list[image_index++] = new imageItem('images/DSC_0294.jpg');
image_list[image_index++] = new imageItem('images/DSC_0295.jpg');
image_list[image_index++] = new imageItem('images/DSC_0296.jpg');
image_list[image_index++] = new imageItem('images/DSC_0297.jpg');
image_list[image_index++] = new imageItem('images/DSC_0298.jpg');
image_list[image_index++] = new imageItem('images/DSC_0299.jpg');
image_list[image_index++] = new imageItem('images/DSC_0300.jpg');
image_list[image_index++] = new imageItem('images/DSC_0301.jpg');
image_list[image_index++] = new imageItem('images/DSC_0302.jpg');
image_list[image_index++] = new imageItem('images/DSC_0303.jpg');
image_list[image_index++] = new imageItem('images/DSC_0304.jpg');
image_list[image_index++] = new imageItem('images/DSC_0305.jpg');
image_list[image_index++] = new imageItem('images/DSC_0306.jpg');
image_list[image_index++] = new imageItem('images/DSC_0307.jpg');
image_list[image_index++] = new imageItem('images/DSC_0308.jpg');
image_list[image_index++] = new imageItem('images/DSC_0309.jpg');
image_list[image_index++] = new imageItem('images/DSC_0310.jpg');
image_list[image_index++] = new imageItem('images/DSC_0311.jpg');
image_list[image_index++] = new imageItem('images/DSC_0312.jpg');
image_list[image_index++] = new imageItem('images/DSC_0313.jpg');
image_list[image_index++] = new imageItem('images/DSC_0314.jpg');
image_list[image_index++] = new imageItem('images/DSC_0315.jpg');
image_list[image_index++] = new imageItem('images/DSC_0316.jpg');
image_list[image_index++] = new imageItem('images/DSC_0317.jpg');
image_list[image_index++] = new imageItem('images/DSC_0318.jpg');
image_list[image_index++] = new imageItem('images/DSC_0319.jpg');
image_list[image_index++] = new imageItem('images/DSC_0320.jpg');
image_list[image_index++] = new imageItem('images/DSC_0321.jpg');
image_list[image_index++] = new imageItem('images/DSC_0322.jpg');
image_list[image_index++] = new imageItem('images/DSC_0323.jpg');
image_list[image_index++] = new imageItem('images/DSC_0324.jpg');
image_list[image_index++] = new imageItem('images/DSC_0325.jpg');
image_list[image_index++] = new imageItem('images/DSC_0326.jpg');
image_list[image_index++] = new imageItem('images/DSC_0327.jpg');
image_list[image_index++] = new imageItem('images/DSC_0328.jpg');
image_list[image_index++] = new imageItem('images/DSC_0329.jpg');
image_list[image_index++] = new imageItem('images/DSC_0330.jpg');
image_list[image_index++] = new imageItem('images/DSC_0331.jpg');
image_list[image_index++] = new imageItem('images/DSC_0332.jpg');
image_list[image_index++] = new imageItem('images/DSC_0333.jpg');
image_list[image_index++] = new imageItem('images/DSC_0334.jpg');
image_list[image_index++] = new imageItem('images/DSC_0335.jpg');
image_list[image_index++] = new imageItem('images/DSC_0336.jpg');
image_list[image_index++] = new imageItem('images/DSC_0337.jpg');
image_list[image_index++] = new imageItem('images/DSC_0338.jpg');
image_list[image_index++] = new imageItem('images/DSC_0339.jpg');
image_list[image_index++] = new imageItem('images/DSC_0340.jpg');
image_list[image_index++] = new imageItem('images/DSC_0341.jpg');
image_list[image_index++] = new imageItem('images/DSC_0342.jpg');
image_list[image_index++] = new imageItem('images/DSC_0343.jpg');
image_list[image_index++] = new imageItem('images/DSC_0344.jpg');
image_list[image_index++] = new imageItem('images/DSC_0345.jpg');
image_list[image_index++] = new imageItem('images/DSC_0346.jpg');
image_list[image_index++] = new imageItem('images/DSC_0347.jpg');
image_list[image_index++] = new imageItem('images/DSC_0348.jpg');
image_list[image_index++] = new imageItem('images/DSC_0349.jpg');
image_list[image_index++] = new imageItem('images/DSC_0350.jpg');
image_list[image_index++] = new imageItem('images/DSC_0351.jpg');
image_list[image_index++] = new imageItem('images/DSC_0352.jpg');
image_list[image_index++] = new imageItem('images/DSC_0353.jpg');
image_list[image_index++] = new imageItem('images/DSC_0354.jpg');
image_list[image_index++] = new imageItem('images/DSC_0355.jpg');
image_list[image_index++] = new imageItem('images/DSC_0356.jpg');
image_list[image_index++] = new imageItem('images/DSC_0357.jpg');
image_list[image_index++] = new imageItem('images/DSC_0358.jpg');
image_list[image_index++] = new imageItem('images/DSC_0359.jpg');
image_list[image_index++] = new imageItem('images/DSC_0360.jpg');
image_list[image_index++] = new imageItem('images/DSC_0361.jpg');
image_list[image_index++] = new imageItem('images/DSC_0362.jpg');
image_list[image_index++] = new imageItem('images/DSC_0363.jpg');
image_list[image_index++] = new imageItem('images/DSC_0364.jpg');
The onpaste event referencing work of the recent Using Document Writeln Onpaste Tutorial set us to thinking about the unwieldy nature of our “One Image Website” series of photographic projects ability to, on the fly, these days …
take a new relevant photograph (on an iPhone, for instance) … and then easily …
get some functionality on the “One Image Websites” (our Guinea Pig, here, being our Street Art project) to accept either …
graphical image Copy into buffer via some Edit->Select All, Edit->Copy (eg. within an Image Editor desktop application) (combination) option Edit->Pasted into a new HTML span contenteditable=true onpaste and onblur savvy events “uploading” helper … or …
right click at first webpage (of one of these “One Image Website” projects) to get to a prompt window that can accept a data URI the likes of which Google Image Search (say, of “clipart”)->right click->Copy Image Address could glean for you as a representation of an image
Where’s the security and moderation here? Any upload operation needs to worry about that, huh?! Well, we limit it via IP address at this stage, in our Guinea Pig start to proceedings, and will monitor over time.
Let’s start, codewise with the pretty well self contained PHP block of code that is new for this work …
<?php
$oklist=['0::1', '1.156.90.221'];
function server_remote_addr() {
global $ris;
$rma = $_SERVER['REMOTE_ADDR'];
if ($rma != "") {
$qris = $rma;
} else if ($rma == "") {
$rma = $qris;
}
$ua = strtolower($_SERVER['HTTP_USER_AGENT']);
// you can add different browsers with the same way ..
if(preg_match('/(chromium)[ \/]([\w.]+)/', $ua))
$rma = '000000'.$rma;
elseif(preg_match('/(chrome)[ \/]([\w.]+)/', $ua))
$rma = '00000'.$rma;
elseif(preg_match('/(safari)[ \/]([\w.]+)/', $ua))
$rma = '0000'.$rma;
elseif(preg_match('/(opera)[ \/]([\w.]+)/', $ua))
$rma = '000'.$rma;
elseif(preg_match('/(msie)[ \/]([\w.]+)/', $ua))
$rma = '00'.$rma;
elseif(preg_match('/(mozilla)[ \/]([\w.]+)/', $ua))
$rma = '0'.$rma;
//echo "<p>".$ua.$rma."</p>";
return $rma;
}
Why involve either/both textarea and div (contenteditable=true) elements as “containers” of content?
Well, with yesterday’s starting onblur (just) event gambit, it’s a very pertinent question, but, today, we introduce onpaste event work, and involving this event with the div element can have it distinguishing itself, able to accept graphical (eg. image) content. For example, the user can have their cursor placed into the div element and have been in an image editor having Edit->Select Alled and Edit->Copyed graphical content, then that can be Edit->Pasted into the div as graphical content.
As you might imagine, this opens a Pandora’s Box of possibilities regarding image sizing, but we apply inline CSS styling …
… to the img data URIed element within the div element that happens when graphical content is pasted into it, so that the graphical data is unlikely to spill too far outside the div bounds, assuming only one image is pasted, that is.
Can you believe it was more than 30 years ago, in 1994, that the US politician Al Gore coined the phrase …
Information Superhighway
? And then, in 2001, the great Wikipedia was launched, and quickly all those encyclopaedias in book form looked a bit wan.
As we have surmised often, where we see this “superhighway” excelling is on questions related to the “where” of life, and the quality and quantity of online maps is awe inspiring (as well as yours truly being a sucker for any interesting map).
Then, reading today in the Sydney Morning Herald online newspaper, an article called The Rajs bought into the Australian dream. It came with a nightmare (by Anthony Segaert) and scrolling down to see a map titled “The new growth centres in Sydney’s west” it was not only where these growth centres were located that caught our attention … it was also …
Huh?! We travel the M4 a lot, and never noticed creeks between the Nepean River and Eastern Creek (but will definitely be looking more the next time). We were intrigued, and so what started as geography interests (related to that greatlittleSouth Creek or Wianamatta (and it’s 15 or so tributaries?!)), went in various directions, as the online world is so good at getting us information.
That’s what is great, all those years into the “superhighway” age, but what we need more diligence with is “where” (again) your information comes from … it’s “providence”. Personally, we find comfort in the Wikipedias of this world that are Not For Profit in their thinking, and there is no apparent agenda. Of course, on any interest topic, you are likely to go to many websites that are not anything like Wikipedia, and we are not in any way saying “stay away”, it’s just that sometimes you should take an interest in whether your information source has a vested interest in pushing the information you read.
This read helped crystallize for me why at lunchtimes when working in Dunsheved near St Marys and going down the road for a breather those emus …
… probably had a ready water source!
Stop Press 09/05/2026
My mistake! Near the Mamre Road turn off …
South Creek
… sign!
If this was interesting you may be interested in this too.