Client Pre-emptive Iframe Crontab Curl Daily Tutorial

Client Pre-emptive Iframe Crontab Curl Daily Tutorial

Client Pre-emptive Iframe Crontab Curl Daily Tutorial

Two days ago we set the premise …

We don’t know if “Client Pre-emptive Iframe” is a concept, but even if it isn’t, we’d like to say something about it today.

To us, it’s the idea that in the web application world, at the client end of things, with Javascript, though there is no file manipulation as such, there is what we’d like to term “Client Pre-emptive Iframe”, as an idea that Javascript functionality teamed with an HTML iframe (and its onload event logic) can achieve a bit of what a serverside language like PHP or ASP.Net can achieve, in terms of using server files, by guessing about their existence as the src= parameter of an HTML iframe element, and sort of “sucking it, and seeing” whether the operation succeeds … ie. pre-emptive guessing, we guess. The point is, even if the guess is wrong, no huge harm is done, and in Javascript, it can be checked for, so why stress out, man person?

… and yesterday we used a Linux web server’s …

… to latch onto a minute by minute (“Continuous Report”) scenario of change. Today we use similar ideas for a daily report, to reinforce the methods and show those nuances of difference when a changing time doesn’t come into play.

So the report idea today, which is more like a “Once a Day Report” … hence the crontab entry …


58 23 * * * curl //www.rjmprogramming.com.au/PHP/JSON/once_a_day_report.php

… centers around the share market and the ASX lookup (via the wonderful Gomashup (and other great information of this ilk is at Yahoo YQL)) web application we wrote with PHP/Javascript/HTML Public JSON ASX Usage Tutorial. It left behind web server generated reports when a web user accesses it (via the HTML/Javascript front end client once_a_day_report.html), and today’s once_a_day_report.php “harvests” (and does a good impersonation of those ducks on the water working hard underneath to sculpt) that data into a daily report (even if there is none) and updates any monthly or yearly data, ready to present to the user with the HTML/Javascript frontend where the user can drill down on the ASX Company Categorization report findings, and zero in on the ASX website information specific to that company.

You may find it useful to see the differences in code between a daily report scenario (“Once a Day Report”) versus yesterday’s “Continuous Report” minute by minute, by examining this link.

Again, we have that “feel” regarding feeds, or shared reporting.

So try a live run to see what we are on about.


Client Pre-emptive Iframe Crontab Curl Tutorial

Client Pre-emptive Iframe Crontab Curl Tutorial

Recap to yesterday …

We don’t know if “Client Pre-emptive Iframe” is a concept, but even if it isn’t, we’d like to say something about it today.

To us, it’s the idea that in the web application world, at the client end of things, with Javascript, though there is no file manipulation as such, there is what we’d like to term “Client Pre-emptive Iframe”, as an idea that Javascript functionality teamed with an HTML iframe (and its onload event logic) can achieve a bit of what a serverside language like PHP or ASP.Net can achieve, in terms of using server files, by guessing about their existence as the src= parameter of an HTML iframe element, and sort of “sucking it, and seeing” whether the operation succeeds … ie. pre-emptive guessing, we guess. The point is, even if the guess is wrong, no huge harm is done, and in Javascript, it can be checked for, so why stress out, man person?

… as you can see, also, at Client Pre-emptive Iframe Primer Tutorial.

Today’s HTML/Javascript work of continuous_report.html teams this concept with a Linux web server’s …

… (what a duo!) … where we set up a “Continuous Report” on our web server, where an HTML report is placed via the crontab job …


*/1 * * * * curl //www.rjmprogramming.com.au/HTMLCSS/continuous_report.php

… repeated every minute using the PHP continuous_report.php (source code) to report on the number of web server processes are running at this snapshot of time at the www.rjmprogramming.com.au web server, which happens to be Linux … otherwise for a Windows web server we’d probably have used a Windows Schedular Batch File setup.

Here, we are very close to the territory of feeds, or shared reporting.

Dates and times fly around everywhere with the code for such reporting, as do timezones relevant to your web server, up at the continuous_report.html Javascript client code.

So try a live run to see what we mean.


Previous relevant Client Pre-emptive Iframe Primer Tutorial is shown below.

Client Pre-emptive Iframe Primer Tutorial

Client Pre-emptive Iframe Primer Tutorial

We don’t know if “Client Pre-emptive Iframe” is a concept, but even if it isn’t, we’d like to say something about it today.

To us, it’s the idea that in the web application world, at the client end of things, with Javascript, though there is no file manipulation as such, there is what we’d like to term “Client Pre-emptive Iframe”, as an idea that Javascript functionality teamed with an HTML iframe (and its onload event logic) can achieve a bit of what a serverside language like PHP or ASP.Net can achieve, in terms of using server files, by guessing about their existence as the src= parameter of an HTML iframe element, and sort of “sucking it, and seeing” whether the operation succeeds … ie. pre-emptive guessing, we guess. The point is, even if the guess is wrong, no huge harm is done, and in Javascript, it can be checked for, so why stress out, man person?

So, today, we add client-side “Client Pre-emptive Iframe” business logic functionality, to yesterday’s XML to HTML PHP Three Ways Translation Tutorial, by only adding additional Emailing functionality should an address book HTML file exist at the server. That extra functionality adds an “Email” button.

So that is conditional functionality … unconditionally we add functionality to be able to send “client” “mailto:” email messages should the XML contain id= parameters and <to> … </to> or its ilk defined via the HTML textarea populated and its associated HTML input submit button pressed.

This is a clunky equivalent to PHP’s file_exists method for Javascript client usage, and an aid to determinations of whether specific business logic comes into play.

The HTML code you can call xml_to_html.html and it changed from previously in this way, or you can try a live run, or you can try a live run without the email onload event functionailty.

The PHP code you can call xml_to_html.php and it changed from yesterday in this way, but we’d like to emphasise the client side today, and want you to see that this PHP server-side functionality is optional to the whole process, or you can try a live run, or you can try a live run without the email onload event functionality.

Below we’ll leave you with some quite specific email business logic code …


<script type='text/javascript'>
// ... Some Javascript global variables regarding Client Pre-emptive Iframe addressbook usage

var preqs=location.search.split('addressbook=')[1] ? location.search.split('addressbook=')[1].split('&')[0] : "y";
var qs="?addressbook=" + (location.search.split('noaddressbook=')[1] ? location.search.split('noaddressbook=')[1].split('&')[0].toLowerCase().replace("y","n") : preqs);

// ... more Javascript

// A business logic idea ... messages/note XML with defined id= are user interactively emailable
function checkforemail() {
var ee, eo, preiu, iu, predivs,divs=[],cdivs;
var ecnt=0;
var oto='', ofrom='', osubject='', obody='';
predivs=document.body.innerHTML.toLowerCase().split(' id=');
for (preiu=1; preiu<predivs.length; preiu++) {
cdivs=predivs[preiu].substring(1).split(predivs[preiu].substring(0,1));
iu=0;
divs[iu]=document.getElementById(cdivs[0]);
try {
oto='';
ofrom='';
oheading='';
obody='';
try {
oto=divs[iu].getAttribute('data-to');
if (oto == null) oto='';
} catch (ee) {
oto='';
}
try {
ofrom=divs[iu].getAttribute('data-from');
if (ofrom == null) ofrom='';
} catch (ee) {
ofrom='';
}
try {
obody=divs[iu].getAttribute('data-body');
if (obody == null) obody='';
} catch (ee) {
obody='';
}
try {
osubject=divs[iu].getAttribute('data-heading');
if (osubject == null) {
osubject='';
osubject=divs[iu].getAttribute('data-subject');
if (osubject == null) osubject='';
}
} catch (ee) {
osubject='';
try {
osubject=divs[iu].getAttribute('data-subject');
if (osubject == null) osubject='';
} catch (ee) {
osubject='';
}
}
} catch (ee) {
}
if (oto != '' || obody != '' || osubject != '') {
if (document.getElementById('elinksplace').innerHTML.replace(/&amp;/g,"&").indexOf(('mailto:' + oto + '?subject=' + encodeURIComponent(osubject) + '&body=' + encodeURIComponent(obody)).replace(/&amp;/g,"&")) == -1) {
document.getElementById('elinksplace').innerHTML+='<a href="mailto:' + oto + '?subject=' + encodeURIComponent(osubject) + '&body=' + encodeURIComponent(obody) + '" id="email' + ecnt + '" style="display:none;">From ' + ofrom + "</a>";
ecnt++;
}
}
}
if (ecnt > 0) {
for (var iuc=0; iuc<ecnt; iuc++) {
eo=document.getElementById('email' + iuc);
eo.click();
}
}
}
// A business logic idea ... client pre-emptive iframe ... address book
function getaddressbook(iois) {
var qbits, ie, je, edelim='"', bdone=false;
var idx=['&lt;to&gt;','<to>','<TO>','<To>','data-to="','&lt;from&gt;','<from>','<FROM>','<From>','data-from="','&lt;cc&gt;','<cc>','<CC>','<Cc>','data-cc="','&lt;bcc&gt;','<bcc>','<BCC>','<Bcc>','data-bcc="'];
if (iois != null) {
var aconto = (iois.contentWindow || iois.contentDocument);
if (aconto != null) {
if (aconto.document) { aconto = aconto.document; }
if (aconto.body != null) {
addresscont=aconto.body.innerHTML.replace(/\n/g, ',');
var emailinfo=addresscont.split(',');
for (ie=1; ie<eval(-1 + emailinfo.length); ie+=2) {
if (emailinfo[eval(ie - 1)] != "" && emailinfo[ie].indexOf('@') != -1) {
for (je=0; je<idx.length; je++) {
edelim='&lt;';
if (idx[je].indexOf(edelim) == -1) edelim='"';
if (idx[je].indexOf(edelim) == -1) edelim='<';
if (document.body.innerHTML.toLowerCase().indexOf(idx[je] + emailinfo[eval(ie - 1)].toLowerCase() + edelim) != -1) {
if (document.body.innerHTML.indexOf(idx[je] + emailinfo[eval(ie - 1)] + edelim) != -1) {
if (je < 4 && bdone == false) {
bdone=true;
document.getElementById('bemail').style.display='block';
}
while (document.body.innerHTML.indexOf(idx[je] + emailinfo[eval(ie - 1)] + edelim) != -1) {
document.body.innerHTML=document.body.innerHTML.replace(idx[je] + emailinfo[eval(ie - 1)] + edelim,idx[je] + emailinfo[eval(ie - 1)] + " [" + emailinfo[ie] + "]" + edelim);
}
}
if (document.body.innerHTML.indexOf(idx[je] + emailinfo[eval(ie - 1)].toLowerCase() + edelim) != -1) {
if (je < 4 && bdone == false) {
bdone=true;
document.getElementById('bemail').style.display='block';
}
while (document.body.innerHTML.indexOf(idx[je] + emailinfo[eval(ie - 1)].toLowerCase() + edelim) != -1) {
document.body.innerHTML=document.body.innerHTML.replace(idx[je] + emailinfo[eval(ie - 1)].toLowerCase() + edelim,idx[je] + emailinfo[eval(ie - 1)].toLowerCase() + " [" + emailinfo[ie] + "]" + edelim);
}
}
if (document.body.innerHTML.indexOf(idx[je] + emailinfo[eval(ie - 1)].toUpperCase() + edelim) != -1) {
if (je < 4 && bdone == false) {
bdone=true;
document.getElementById('bemail').style.display='block';
}
while (document.body.innerHTML.indexOf(idx[je] + emailinfo[eval(ie - 1)].toUpperCase() + edelim) != -1) {
document.body.innerHTML=document.body.innerHTML.replace(idx[je] + emailinfo[eval(ie - 1)].toUpperCase() + edelim,idx[je] + emailinfo[eval(ie - 1)] + " [" + emailinfo[ie].toUpperCase() + "]" + edelim);
}
}
}
}
}
}
}
}
}
}
// A business logic idea ... email via XML instructions
function emailit() {
var fs=document.getElementsByTagName('form');
var tas=document.getElementsByTagName('textarea');
if (tas.length >= 3) {
tas[2].innerHTML=tas[0].innerHTML;
fs[0].submit();
}
}

</script>
</head>
<body onload="translate(inxml); if (inxml != preinxml) { checkforemail(); } " style='background-color:orange;'>
<h1 align='center'>XML to HTML - HTML Homegrown - RJM Programming - September, 2015</h1>
<div id='elinksplace'><iframe src="addressbook.html" id="eabook" onload=" if (qs.indexOf('=n') == -1) { getaddressbook(this); } " style="display:none;"></iframe><input onclick=" emailit();" type="button" value="Email" style="display:none;position:absolute;top:280px;left:30px;z-index:7;" id="bemail"></input></div>
</body>
</html>

If this was interesting you may be interested in this too.


If this was interesting you may be interested in this too.


If this was interesting you may be interested in this too.

This entry was posted in eLearning, Event-Driven Programming, Operating System, Tutorials and tagged , , , , , , , , , , , , , , , . Bookmark the permalink.

18 Responses to Client Pre-emptive Iframe Crontab Curl Daily Tutorial

  1. I’ve recently started a site, the info you provide on this site has helped me tremendously. Thanks for all of your time & work. “The word ‘genius’ isn’t applicable in football. A genius is a guy like Norman Einstein.” by Joe Theismann.

  2. of course like your web site however you have to check the spelling on quite a few of your posts. Many of them are rife with spelling issues and I find it very bothersome to tell the reality then again I will definitely come again again.

  3. guarantee says:

    Hi my family member! I want to say that this post is awesome, great written and include almost all significant infos. I would like to look more posts like this .

  4. Isabel says:

    CzeΕ›Δ‡, interesujΔ…cy artykuΕ‚. OkreΕ›lony czas nie sΕ‚uchaΕ‚em tak interesujΔ…cego tekstu

  5. keezmovies says:

    You might have observed quite intriguing details ! ps decent web site.

  6. Eventually, the author make an update for a weblog. I used to be waiting anxiously for your own next update. I’m hoping you may consider updating often so your readers might follow along. I do not have significantly joy in life today but your blog is one of them. I recognize life is busy but I genuinely hope you will take the time to keep us modified on any progress.

  7. tell says:

    You can definitely see your expertise within the paintings you write. The arena hopes for more passionate writers like you who are not afraid to mention how they believe. At all times go after your heart.

  8. micro-star says:

    I’m truly enjoying the style and layout of your weblog. It’s a very quick on the eyes which tends to make it considerably additional pleasant for me to come here and check out additional normally. Did you hire out a developer to make your theme? Excellent work!

  9. You’ve got some actual insight. Why not hold some kind of contest for the readers?

  10. Isabel says:

    Hello, interesujΔ…cy tekst. Dawno nie widziaΕ‚em tak ciekawego dzieΕ‚a

  11. I would like to thnkx for the efforts you’ve put in writing this blog. I’m hoping the same high-grade blog post from you in the upcoming as well. In fact your creative writing abilities has encouraged me to get my own web site now. Really the blogging is spreading its wings rapidly. Your write up is a good example of it.

  12. You made some nice points there. I did a search on the subject matter and found most people will agree with your website.

  13. Green Living says:

    I wanted to post you a very small note just to give many thanks yet again for these nice secrets you have shown on this website. It is really incredibly open-handed of people like you to grant unhampered exactly what many individuals would’ve sold for an ebook in order to make some cash for themselves, and in particular since you could possibly have tried it if you considered necessary. These tactics in addition worked like a great way to be aware that some people have a similar zeal like my very own to learn good deal more with respect to this problem. I am sure there are millions of more pleasurable instances ahead for folks who scan your site.

  14. You produced some decent points there. I looked on the internet for the problem and located most individuals will go along with along with your web site.

  15. I am often to blogging and i genuinely appreciate your articles. The write-up has absolutely peaks my interest. I’m going to bookmark your internet site and maintain checking for brand spanking new data.

  16. Hiya very cool site!! Guy .. Beautiful .. Wonderful .. I will bookmark your web site and take the feeds additionallyΒ‘KI am glad to find numerous helpful info here in the submit, we’d like work out extra techniques in this regard, thanks for sharing. . . . . .

  17. at Yahoo says:

    I’ve been browsing online greater than three hours lately, yet I never found any fascinating article like yours. It’s beautiful price enough for me. Personally, if all webmasters and bloggers made excellent content as you did, the web will probably be much more helpful than ever before. “No one has the right to destroy another person’s belief by demanding empirical evidence.” by Ann Landers.

  18. Guys, I just downloaded some amazing freebies from http://scarab13.com. There are some beautiful creative resources, all done exclusivelly by one of the Elite Envato Authors for greater good.

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>