Tag Archives: hash

Javascript Map Array Aggregates Tutorial

The SQL emphasis, recently, regarding our current Arrays and Map web application talked about in yesterday’s Javascript Map Array Delimiter Tutorial had us thinking about if we could incorporate those … count(*) sum(*) min(*) max(*) avg(*) … SQL aggregate function concepts in some way shape or form. Given we’ve gone down the “delimiters logic” road so far, we decided on a pre-emptive approach, where we calculate all the “aggregate” concept values we could think of, ahead of the user even wondering about them, and display them as they are seeing the other data be displayed. Sounds good? We hope so. Well, see this in action, along with Median and Mode and Standard deviation calculations, as well, in the changed map_test.html Array and Map Tester web application you can also try below. Previous relevant Javascript Map Array Delimiter Tutorial is shown below. Regular readers will have tweaked to the “largely delimiter based” logic surrounding the workings of the Array and Map web application of yesterday’s Javascript Map Array SQL Tutorial. To explain our changes, it’s back to a modified blurb … xenterall=prompt(‘Optionally enter a # (hashtag) delimited composite field scenario to apply for next input data (perhaps CSV) file application, such as in examples below where +-*^%/ (maths) and !<>= (conditions) and ~` (for ascending descending order) and | (for OR rather than AND conditions). ‘ + String.fromCharCode(10) + ‘Examples …’ + String.fromCharCode(10) + ‘#1,3&2&4’ + String.fromCharCode(10) + ‘#4,2*3’ + String.fromCharCode(10) + ‘#1&4,3+2’ + String.fromCharCode(10) + ‘#1&4,3&2,2>100|2<-100,`2‘, ”); … giving a “one role per interesting delimiter” paradigm we’d like to keep, if possible (though behind the scenes we have incorporated backward compatibility). Can such a delimiter approach handle everything SQL can do? Not a chance, but by the same token, we are not reinventing any wheels with all this, but rather opening up ideas you might want to pick up and run with yourself … or not. In the changed map_test.html Array and Map Tester web application you can also try below, you may notice other nuances, with logic now supporting … logic change … OR … WHERE clause parts logic (using that | delimiter mentioned above) … in addition to pre-existing … AND … WHERE clause default logic changes allowing for yellow cell report toggling between default two column data format and, perhaps, a more extensive report, via a newly introduced ondblclick (on double click) Javascript event function … the … Continue reading →

Posted in Ajax, eLearning, Event-Driven Programming, Tutorials | Tagged , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , | Leave a comment

Javascript Map Array Delimiter Tutorial

Regular readers will have tweaked to the “largely delimiter based” logic surrounding the workings of the Array and Map web application of yesterday’s Javascript Map Array SQL Tutorial. To explain our changes, it’s back to a modified blurb … xenterall=prompt(‘Optionally enter a # (hashtag) delimited composite field scenario to apply for next input data (perhaps CSV) file application, such as in examples below where +-*^%/ (maths) and !<>= (conditions) and ~` (for ascending descending order) and | (for OR rather than AND conditions). ‘ + String.fromCharCode(10) + ‘Examples …’ + String.fromCharCode(10) + ‘#1,3&2&4’ + String.fromCharCode(10) + ‘#4,2*3’ + String.fromCharCode(10) + ‘#1&4,3+2’ + String.fromCharCode(10) + ‘#1&4,3&2,2>100|2<-100,`2‘, ”); … giving a “one role per interesting delimiter” paradigm we’d like to keep, if possible (though behind the scenes we have incorporated backward compatibility). Can such a delimiter approach handle everything SQL can do? Not a chance, but by the same token, we are not reinventing any wheels with all this, but rather opening up ideas you might want to pick up and run with yourself … or not. In the changed map_test.html Array and Map Tester web application you can also try below, you may notice other nuances, with logic now supporting … logic change … OR … WHERE clause parts logic (using that | delimiter mentioned above) … in addition to pre-existing … AND … WHERE clause default logic changes allowing for yellow cell report toggling between default two column data format and, perhaps, a more extensive report, via a newly introduced ondblclick (on double click) Javascript event function … the changing of which flows through to … appropriately catering logic to pass this through to email and SMS functionality (and the clicking of links within these) … nuances pretty critical for many real data set scenarios, we figure. Previous relevant Javascript Map Array SQL Tutorial is shown below. Finishing off the SQL work start that yesterday’s Javascript Map Array Conditions Tutorial represents, today a user can follow the advice … xenterall=prompt(‘Optionally enter a # (hashtag) delimited composite field scenario to apply for next input data (perhaps CSV) file application, such as in examples below where +-*^%/ (maths) and !<>= (conditions) and ~| (for ascending descending order). ‘ + String.fromCharCode(10) + ‘Examples …’ + String.fromCharCode(10) + ‘#1,3&2&4’ + String.fromCharCode(10) + ‘#4,2*3’ + String.fromCharCode(10) + ‘#1&4,3+2’ + String.fromCharCode(10) + ‘#1&4,3&2,2>100,|2‘, ”); … to facilitate WHERE and ORDER BY processing foreshadowed yesterday. The ORDER … Continue reading →

Posted in Ajax, eLearning, Event-Driven Programming, Tutorials | Tagged , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , | Leave a comment

Javascript Map Array SQL Tutorial

Finishing off the SQL work start that yesterday’s Javascript Map Array Conditions Tutorial represents, today a user can follow the advice … xenterall=prompt(‘Optionally enter a # (hashtag) delimited composite field scenario to apply for next input data (perhaps CSV) file application, such as in examples below where +-*^%/ (maths) and !<>= (conditions) and ~| (for ascending descending order). ‘ + String.fromCharCode(10) + ‘Examples …’ + String.fromCharCode(10) + ‘#1,3&2&4’ + String.fromCharCode(10) + ‘#4,2*3’ + String.fromCharCode(10) + ‘#1&4,3+2’ + String.fromCharCode(10) + ‘#1&4,3&2,2>100,|2‘, ”); … to facilitate WHERE and ORDER BY processing foreshadowed yesterday. The ORDER BY solution featured tailored Javascript sort functionality nuances … function maybesort(rh) { var recsare=[], newc=”, ijk=0, exa=”, zero=0, ipo=0; headrec=”; if (eval(” + orderbys.length) > 0) { recsare=rh.split(String.fromCharCode(10)); if (recsare[0].indexOf(‘0’) == -1 && recsare[0].indexOf(‘1’) == -1 && recsare[0].indexOf(‘2’) == -1 && recsare[0].indexOf(‘3’) == -1 && recsare[0].indexOf(‘4’) == -1 && recsare[0].indexOf(‘5’) == -1 && recsare[0].indexOf(‘6’) == -1 && recsare[0].indexOf(‘7’) == -1 && recsare[0].indexOf(‘8’) == -1 && recsare[0].indexOf(‘9’) == -1) { headrec=recsare[0]; zero=1; efields=headrec.replace(/\”/g,”).split(‘,’); for (var ke=0; ke<efields.length; ke++) { eval(‘mappings.unshift({ from: “‘ + eval(ke + 1) + ‘”, to: “‘ + efields[ke] + ‘”})’); } document.getElementById(‘topic’).innerHTML=headrec.replace(/^\”/g,”).substring(0).split(‘”‘)[0].split(‘,’)[1].substring(0,1).toUpperCase() + headrec.replace(/^\”/g,”).substring(0).split(‘”‘)[0].split(‘,’)[1].substring(1); document.getElementById(‘thname’).innerHTML=maybenotdefn(headrec.replace(/^\”/g,”).substring(0).split(‘”‘)[0].split(‘,’)[1].substring(0,1).toUpperCase() + headrec.replace(/^\”/g,”).substring(0).split(‘”‘)[0].split(‘,’)[1].substring(1)); document.getElementById(‘thquantity’).innerHTML=maybenotdefq(headrec.replace(/^\”/g,”).substring(0).split(‘”‘)[0].split(‘,’)[0].substring(0,1).toUpperCase() + headrec.replace(/^\”/g,”).substring(0).split(‘”‘)[0].split(‘,’)[0].substring(1)); analwheres(); } for (ipo=0; ipo<orderbys.length; ipo++) { if (orderbys[ipo].indexOf(‘~1 ‘) != -1) { recsare.sort(); } else if (orderbys[ipo].indexOf(‘|1 ‘) != -1) { recsare.sort(function(x, y) { if (y < x) { return -1; } if (y > x) { return 1; } return 0; }); } else if (orderbys[ipo].indexOf(‘|’) != -1) { icol=eval(-1 + eval(” + orderbys[ipo].split(‘|’)[1].split(‘ ‘)[0])); //alert(‘icol=’ + icol); exa=” + rh.split(String.fromCharCode(10))[zero].split(‘,’)[icol]; //alert(‘exa=’ + exa); if (exa != ” && exa.replace(/0/g,”).replace(/2/g,”).replace(/3/g,”).replace(/3/g,”).replace(/4/g,”).replace(/5/g,”).replace(/6/g,”).replace(/7/g,”).replace(/8/g,”).replace(/9/g,”).replace(/\-/g,”).replace(/\./g,”).trim() == ”) { //alert(‘is a number’); recsare.sort(function(x, y) { if (x != headrec && y == headrec) { return 1; } if (x == headrec && y != headrec) { return -1; } if (x == headrec && y == headrec) { return 0; } if (eval(” + y.split(‘,’)[icol]) < eval(” + x.split(‘,’)[icol])) { return -1; } if (eval(” + y.split(‘,’)[icol]) > eval(” + x.split(‘,’)[icol])) { return 1; } return 0; }); } else { recsare.sort(function(x, y) { if (y.split(‘,’)[icol] < x.split(‘,’)[icol]) { return -1; } if (y.split(‘,’)[icol] > x.split(‘,’)[icol]) { return 1; } return 0; }); } } else if (orderbys[ipo].indexOf(‘~’) != -1) { icol=eval(-1 + eval(” + orderbys[ipo].split(‘~’)[1].split(‘ ‘)[0])); exa=” + rh.split(String.fromCharCode(10))[zero].split(‘,’)[icol]; if (exa != ” && exa.replace(/0/g,”).replace(/2/g,”).replace(/3/g,”).replace(/3/g,”).replace(/4/g,”).replace(/5/g,”).replace(/6/g,”).replace(/7/g,”).replace(/8/g,”).replace(/9/g,”).replace(/\-/g,”).replace(/\./g,”).trim() == ”) { recsare.sort(function(x, y) { if (x != headrec && y … Continue reading →

Posted in Ajax, eLearning, Event-Driven Programming, Tutorials | Tagged , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , | Leave a comment

Javascript Map Array Conditions Tutorial

Onto yesterday’s Javascript Map Array Field Tutorial we wanted to extend functionality by starting on a “more than one day” project of thinking … SQL … with it’s … SELECT … statements involving … FROM … clause … representing the input (perhaps) CSV data source … filtered via … WHERE … clauses, for sure … and pretty sure we can manage … ORDER BY … record sorting … people familiar with working with relative databases will understand. So far we’re just doing the work to construct the scenario’s SQL “pseudo SELECT statement”. In doing this, we used a new mapping array that could end up looking like … {from: ‘2’, to: ‘(Longitude+Latitude) as field2’} {from: ‘4’, to: ‘name’} {from: ‘3’, to: ‘longitude’} {from: ‘2’, to: ‘latitude’} {from: ‘1’, to: ‘country’} {from: ‘1’, to: ‘Name’} {from: ‘2’, to: ‘Quantity’} … where we found building it up via the usual mapping.push() we would use to append data was some of the story, but it’s opposite number mapping.unshift() was really useful to prioritize a changing better to member data item into the mix, as the program flow progesses in the changed map_test.html Array and Map Tester web application you can also try below. Previous relevant Javascript Map Array Field Tutorial is shown below. The way the inhouse Javascript Map Array web application worked as of the day before yesterday’s Javascript Map Array Hashtag Tutorial involved … a whole of file (or your entered string) processing of CSV data where the first two fields (comma separated) of records became the name,quantity data basis … but as all Spreadsheet afficianados will tell you, it can be very useful “to drill down” into fields (or “columns”, in Spreadsheet parlance) … so … as of today’s work … well, we’ll let our “blurb”, coming off an H1 tag double click event, to try to explain it … var compositename=”; var compositequantity=”; var enterall=”; function anal() { enterall=prompt(‘Optionally enter a # (hashtag) delimited composite field scenario to apply for next input data (perhaps CSV) file application, such as in examples below. ‘ + String.fromCharCode(10) + String.fromCharCode(10) + ‘Examples …’ + String.fromCharCode(10) + ‘#1,3&2&4’ + String.fromCharCode(10) + ‘#4,2*3’ + String.fromCharCode(10) + ‘#1&4,3+2’, ”); if (enterall.split(‘#’)[0].indexOf(‘,’) == -1 && enterall.trim() != ” && enterall.indexOf(‘~`~’) == -1) { compositename=”; compositequantity=”; if (enterall.indexOf(‘#’) != -1) { var compstuff=enterall.split(‘#’)[1]; enterall=enterall.split(‘#’)[0]; var csfs=compstuff.split(‘,’); compositename=csfs[0]; if (compositename != ”) { if (eval((” + compositename).split(‘&’)[0].split(‘+’)[0].split(‘/’)[0].split(‘*’)[0].split(‘-‘)[0].split(‘%’)[0].split(‘^’)[0]) > … Continue reading →

Posted in Ajax, eLearning, Event-Driven Programming, Tutorials | Tagged , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , | Leave a comment

Javascript Map Array Field Tutorial

The way the inhouse Javascript Map Array web application worked as of the day before yesterday’s Javascript Map Array Hashtag Tutorial involved … a whole of file (or your entered string) processing of CSV data where the first two fields (comma separated) of records became the name,quantity data basis … but as all Spreadsheet afficianados will tell you, it can be very useful “to drill down” into fields (or “columns”, in Spreadsheet parlance) … so … as of today’s work … well, we’ll let our “blurb”, coming off an H1 tag double click event, to try to explain it … var compositename=”; var compositequantity=”; var enterall=”; function anal() { enterall=prompt(‘Optionally enter a # (hashtag) delimited composite field scenario to apply for next input data (perhaps CSV) file application, such as in examples below. ‘ + String.fromCharCode(10) + String.fromCharCode(10) + ‘Examples …’ + String.fromCharCode(10) + ‘#1,3&2&4’ + String.fromCharCode(10) + ‘#4,2*3’ + String.fromCharCode(10) + ‘#1&4,3+2’, ”); if (enterall.split(‘#’)[0].indexOf(‘,’) == -1 && enterall.trim() != ” && enterall.indexOf(‘~`~’) == -1) { compositename=”; compositequantity=”; if (enterall.indexOf(‘#’) != -1) { var compstuff=enterall.split(‘#’)[1]; enterall=enterall.split(‘#’)[0]; var csfs=compstuff.split(‘,’); compositename=csfs[0]; if (compositename != ”) { if (eval((” + compositename).split(‘&’)[0].split(‘+’)[0].split(‘/’)[0].split(‘*’)[0].split(‘-‘)[0].split(‘%’)[0].split(‘^’)[0]) > 1 && eval(” + csfs.length) <= 1) { compositequantity=’1′; } else if (eval(” + csfs.length) > 1) { compositequantity=csfs[1]; } } } enterall=”; } enterall=”; } … to allow for some simple mathematical operations (ie. + / – * % ^) of the right hand quantity data item, or concatenation (ie. &) on either left or right (delimited by , comma), as possibilities via user defined field (or “column”) numbering system (starting from 1) means. Applied to our testing with country.csv here, we started getting scenarios where the Google Chart Geo Chart should turn into “markers mode”, and the statistical Google Chart Area/Bar/Column/Line Charts would have multiple Y axis items for the “name” data item X axis relationship. More flexibility, we figure, in the extensively changed map_test.html Array and Map Tester web application you can also try below. Previous relevant Javascript Map Array Hashtag Tutorial is shown below. Regular readers will know of our ever increasing fondness, out of webpage navigational ideas … form method=GET ? and & delimited argument style URL navigation (suitable for both client and server recipient webpages but apt to cause error 414 due to data size restrictions) … or … form method=POST URL navigation (suitable for server recipient webpages only, but able to handle much … Continue reading →

Posted in Ajax, eLearning, Event-Driven Programming, Tutorials | Tagged , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , | Leave a comment

Javascript Map Array Hashtag Tutorial

Regular readers will know of our ever increasing fondness, out of webpage navigational ideas … form method=GET ? and & delimited argument style URL navigation (suitable for both client and server recipient webpages but apt to cause error 414 due to data size restrictions) … or … form method=POST URL navigation (suitable for server recipient webpages only, but able to handle much more data) … or … hybrid arrangement that is essentially form method=GET ? and & delimited argument style URL navigation (suitable for both client and server recipient webpages) with error 414 avoided by most data forming the location.hash (client understood) hashtagged data … for the last hashtagging arrangement when the data size precludes the first arrangement, and we see benefits regarding “a” “mailto:” and/or “sms:” sharing links becoming involved (rather than relying on any PHP server mail function calling). Our Google Chart interfacing is no exception here, and yes, once we’ve completed our sweep of Google Chart inhouse functionality interfacers, on top of today’s … Area Chart interfacing area_chart.php is the changed PHP programming source code as per changes Bar Chart interfacing bar_chart.php is the changed PHP programming source code as per changes Column Chart interfacing column_chart.php is the changed PHP programming source code as per changes Geo Chart interfacing geo_chart.php is the changed PHP programming source code as per changes Histogram Chart interfacing histogram_chart.php is the changed PHP programming source code as per changes Line Chart interfacing line_chart.php is the changed PHP programming source code as per changes Pie Chart interfacing pie_chart.php is the changed PHP programming source code as per changes … list we got keen to attend to today, with a most (when needed) strategy … First “data” label value is method=GET Rest of “data” value items are hashtagged … (having the benefit that the intervention point is consistent and reliable) on top of yesterday’s Javascript Map Array Chart Tutorial, in this regard, as helper outerers for our changed map_test.html Array and Map Tester web application you can also try below, we’ll be able to further genericize Sharing and Collaboration Google Chart interfacing functionality when the amounts of data involved exceed server based (error 414) limits. Along the way, testing on iOS mobile platforms, we were gobsmacked by the possibility of location.hash (ie. # hashtagging) not being recognized, always, at the recipient, and so a failsafe we introduced was to also store hashtagged data in … Continue reading →

Posted in Ajax, eLearning, Event-Driven Programming, Tutorials | Tagged , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , | Leave a comment

Javascript Map Array Chart Tutorial

Does the data behind yesterday’s Javascript Map Array Import Tutorial remind you of anything? Relative database data? Spreadsheets? That last one has lots of synergy, we reckon. And lots of us know, in spreadsheet software products like Microsoft Excel, once a … spreadsheet is involved … charts are often offered as a graphical stand in display (to the tabular looking spreadsheet, that is) And in this respect, looking back on our interfacing work to Google Charts when you have a label name to numerical quantity relationship two Google Chart types (we know of) are useful … Pie Chart … and … Histogram Chart … and we’d like to offer some optional interfacing to these (to improve functionality, that is) … the Javascript for this leaning on the new … function datait(oselv) { var outv=oselv, kk=0, firstdelim=”; //alert(outv); if (outv != ”) { if (oselv.indexOf(‘PHP/Pie’) != -1) { document.getElementById(‘title’).value=document.getElementById(‘topic’).innerHTML + ‘ ‘ + document.getElementById(‘spanok’).innerHTML + ‘ versus ‘ + document.getElementById(‘spanlow’).innerHTML + ‘ Report’; document.getElementById(‘popularity’).value=document.getElementById(‘thquantity’).innerHTML; document.getElementById(‘task’).value=document.getElementById(‘thquantity’).innerHTML; document.getElementById(‘country’).value=document.getElementById(‘thname’).innerHTML; document.getElementById(‘desc’).value=document.getElementById(‘thname’).innerHTML; outv=outv.replace(‘title=Title’, ‘title=’ + encodeURIComponent(document.getElementById(‘topic’).innerHTML + ‘ ‘ + document.getElementById(‘spanok’).innerHTML + ‘ versus ‘ + document.getElementById(‘spanlow’).innerHTML + ‘ Report’)); outv=outv.replace(‘popularity=Popularity’, ‘popularity=’ + encodeURIComponent(document.getElementById(‘thquantity’).innerHTML)); outv=outv.replace(‘country=Country’, ‘country=’ + encodeURIComponent(document.getElementById(‘thname’).innerHTML)); outv=outv.replace(‘task=Popularity’, ‘task=’ + encodeURIComponent(document.getElementById(‘thquantity’).innerHTML)); outv=outv.replace(‘desc=Country’, ‘desc=’ + encodeURIComponent(document.getElementById(‘thname’).innerHTML)); for (kk=0; kk<fruits.length; kk++) { if ((‘~,’ + fruits[kk].quantity + ‘]’).replace(/\~\,\]/g,’~,0]’).indexOf(‘-‘) == -1) { outv+=’,[~’ + encodeURIComponent(fruits[kk].name) + (‘~,’ + fruits[kk].quantity + ‘]’).replace(/\~\,\]/g,’~,0]’); } } } else if (oselv.indexOf(‘PHP/Histogram’) != -1) { document.getElementById(‘title’).value=document.getElementById(‘topic’).innerHTML + ‘ ‘ + document.getElementById(‘spanok’).innerHTML + ‘ versus ‘ + document.getElementById(‘spanlow’).innerHTML + ‘ Report’; document.getElementById(‘popularity’).value=document.getElementById(‘thquantity’).innerHTML; document.getElementById(‘task’).value=document.getElementById(‘thquantity’).innerHTML; document.getElementById(‘country’).value=document.getElementById(‘thname’).innerHTML; document.getElementById(‘desc’).value=document.getElementById(‘thname’).innerHTML; outv=outv.replace(‘title=Title’, ‘title=’ + encodeURIComponent(document.getElementById(‘topic’).innerHTML + ‘ ‘ + document.getElementById(‘spanok’).innerHTML + ‘ versus ‘ + document.getElementById(‘spanlow’).innerHTML + ‘ Report’)); outv=outv.replace(‘popularity=Popularity’, ‘popularity=’ + encodeURIComponent(document.getElementById(‘thquantity’).innerHTML)); outv=outv.replace(‘country=Country’, ‘country=’ + encodeURIComponent(document.getElementById(‘thname’).innerHTML)); outv=outv.replace(‘task=Popularity’, ‘task=’ + encodeURIComponent(document.getElementById(‘thquantity’).innerHTML)); outv=outv.replace(‘desc=Country’, ‘desc=’ + encodeURIComponent(document.getElementById(‘thname’).innerHTML)); for (kk=0; kk<fruits.length; kk++) { outv+=’,[~’ + encodeURIComponent(fruits[kk].name) + (‘~,’ + fruits[kk].quantity + ‘]’).replace(/\~\,\]/g,’~,0]’); } //alert(outv); } else if (oselv.indexOf(‘PHP/Geo’) != -1) { document.getElementById(‘title’).value=document.getElementById(‘topic’).innerHTML + ‘ ‘ + document.getElementById(‘spanok’).innerHTML + ‘ versus ‘ + document.getElementById(‘spanlow’).innerHTML + ‘ Report’; document.getElementById(‘popularity’).value=document.getElementById(‘thquantity’).innerHTML; document.getElementById(‘task’).value=document.getElementById(‘thquantity’).innerHTML; document.getElementById(‘country’).value=document.getElementById(‘thname’).innerHTML; document.getElementById(‘desc’).value=document.getElementById(‘thname’).innerHTML; outv=outv.replace(‘title=Title’, ‘title=’ + encodeURIComponent(document.getElementById(‘topic’).innerHTML + ‘ ‘ + document.getElementById(‘spanok’).innerHTML + ‘ versus ‘ + document.getElementById(‘spanlow’).innerHTML + ‘ Report’)); outv=outv.replace(‘popularity=Popularity’, ‘popularity=’ + encodeURIComponent(document.getElementById(‘thquantity’).innerHTML)); outv=outv.replace(‘country=Country’, ‘country=’ + encodeURIComponent(document.getElementById(‘thname’).innerHTML)); outv=outv.replace(‘task=Popularity’, ‘task=’ + encodeURIComponent(document.getElementById(‘thquantity’).innerHTML)); outv=outv.replace(‘desc=Country’, ‘desc=’ + encodeURIComponent(document.getElementById(‘thname’).innerHTML)); for (kk=0; kk<fruits.length; kk++) { outv+=firstdelim + ‘%20[~’ + encodeURIComponent(fruits[kk].name) + (‘~,’ + fruits[kk].quantity + ‘]’).replace(/\~\,\]/g,’~,0]’) + ‘%20′; firstdelim=’,’; } if ((” + outv).length > 600) { return toolong(outv.replace(‘&data=%20’, ‘&data=%20#’)); } } } if ((” + outv).length > 600) … Continue reading →

Posted in eLearning, Event-Driven Programming, Tutorials | Tagged , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , | Leave a comment

Javascript Map Array Import Tutorial

Is it … the extension of import capabilities … or … the sharing capabilities … of most interest in today’s work, extending that of yesterday’s Javascript Map Array Genericization Tutorial? Well … the extension of import capabilities … function askall(preenterall) { var isfirst=true; var delall=false; var enterall=(” + preenterall).replace(/^undefined$/g,”); if (enterall == ”) { enterall=prompt(‘Optionally copy all your CSV (comma separated values) data to apply here (where ; or | can be record delimiters). Optionally prefix this CSV data with your topic followed by ~`~’ + String.fromCharCode(10) + String.fromCharCode(10) + ‘Example …’ + String.fromCharCode(10) + ‘Fish~`~taylor,300;barramundi,400;perch,100;mullet,234’, ”); } //else { //alert(enterall); //} if (enterall == null) { enterall=”; } if (enterall.indexOf(‘~`~’) != -1) { document.getElementById(‘topic’).innerHTML=enterall.split(‘~`~’)[0]; enterall=enterall.replace(enterall.split(‘~`~’)[0] + ‘~`~’, ”); } if (enterall.indexOf(‘,’) != -1) { var elines=[]; if (enterall.indexOf(String.fromCharCode(10)) != -1) { elines=enterall.split(String.fromCharCode(10)); } else if (enterall.indexOf(‘;’) != -1) { elines=enterall.split(‘;’); } else if (enterall.indexOf(‘|’) != -1) { elines=enterall.split(‘|’); } for (var ie=0; ie<elines.length; ie++) { if (elines[ie].indexOf(‘”,”‘) != -1 && elines[ie].indexOf(‘”,”‘) < elines[ie].indexOf(‘,’)) { if (!delall) { delall=true; fruits=[]; m = new Map(); } if (elines[ie].substring(1).replace(‘-‘,”).substring(0,1) >= ‘0’ && elines[ie].substring(1).replace(‘-‘,”).substring(0,1) <= ‘9’) { //alert(1); addone(elines[ie].split(‘”,”‘)[1].split(‘”‘)[0], elines[ie].substring(1).split(‘”‘)[0]); } else { //alert(2); addone(elines[ie].substring(1).split(‘”‘)[0], elines[ie].split(‘”,”‘)[1].split(‘”‘)[0]); } } else if (elines[ie].indexOf(‘”,’) != -1 && elines[ie].indexOf(‘”,’) < elines[ie].indexOf(‘,’)) { if (!delall) { delall=true; fruits=[]; m = new Map(); } if (elines[ie].substring(1).replace(‘-‘,”).substring(0,1) >= ‘0’ && elines[ie].substring(1).replace(‘-‘,”).substring(0,1) <= ‘9’) { //alert(3); addone(elines[ie].split(‘”,’)[1].split(‘,’)[0], elines[ie].substring(1).split(‘”‘)[0]); } else { //alert(4); addone(elines[ie].substring(1).split(‘”‘)[0], elines[ie].split(‘”,’)[1].split(‘,’)[0]); } } else if (elines[ie].indexOf(‘,”‘) != -1 && elines[ie].indexOf(‘,”‘) == elines[ie].indexOf(‘,’)) { if (!delall) { delall=true; fruits=[]; m = new Map(); } if (elines[ie].substring(0).replace(‘-‘,”).substring(0,1) >= ‘0’ && elines[ie].substring(0).replace(‘-‘,”).substring(0,1) <= ‘9’) { //alert(5); addone(elines[ie].split(‘,”‘)[1].split(‘”‘)[0], elines[ie].substring(0).split(‘,’)[0]); } else { //alert(6); addone(elines[ie].substring(0).split(‘,’)[0], elines[ie].split(‘,”‘)[1].split(‘”‘)[0]); } } else if (elines[ie].indexOf(‘,’) != -1) { if (!delall) { delall=true; fruits=[]; m = new Map(); } if (elines[ie].substring(0).replace(‘-‘,”).substring(0,1) >= ‘0’ && elines[ie].substring(0).replace(‘-‘,”).substring(0,1) <= ‘9’) { //alert(7); addone(elines[ie].substring(0).split(‘,’)[1], elines[ie].substring(0).split(‘,’)[0]); } else { //alert(8); if (isfirst && ((elines[ie].substring(0).split(‘,’)[1] + ‘ ‘).replace(‘-‘,”).substring(0,1) < ‘0’ || (elines[ie].substring(0).split(‘,’)[1] + ‘ ‘).replace(‘-‘,”).substring(0,1) > ‘9’)) { document.getElementById(‘topic’).innerHTML=elines[ie].substring(0).split(‘,’)[0].substring(0,1).toUpperCase() + elines[ie].substring(0).split(‘,’)[0].substring(1); document.getElementById(‘thname’).innerHTML=elines[ie].substring(0).split(‘,’)[0].substring(0,1).toUpperCase() + elines[ie].substring(0).split(‘,’)[0].substring(1); document.getElementById(‘thquantity’).innerHTML=elines[ie].substring(0).split(‘,’)[1].substring(0,1).toUpperCase() + elines[ie].substring(0).split(‘,’)[1].substring(1); } else { addone(elines[ie].substring(0).split(‘,’)[0], elines[ie].substring(0).split(‘,’)[1]); } } } isfirst=false; } beadjustable(); } } function yesthreethree(restis) { if (restis.indexOf(‘;base64,’) != -1) { var icontent=window.atob(restis.split(‘;base64,’)[1]); if (((” + icontent).trim() + ‘ ‘).replace(/^\[caption/g,'<‘).substring(0,1) == ‘<‘) { askall(extractContent(icontent,true)); } else { askall(icontent); } } else { askall(restis); } } …asked for tweaks to our changed client_browsing.htm client side HTML and Javascript inhouse file browsing interfacer showing a “first time” scenario, for … Continue reading →

Posted in eLearning, Event-Driven Programming, Tutorials | Tagged , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , | Leave a comment